1 /*
2  * Copyright (C) 2019 The Android Open Source Project
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *       http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package com.example.android.bubbles
17 
18 import android.os.Bundle
19 import android.widget.ImageView
20 import android.widget.TextView
21 import androidx.appcompat.app.AppCompatActivity
22 import com.bumptech.glide.Glide
23 import com.bumptech.glide.request.RequestOptions
24 
25 /**
26  * A dummy voice call screen. It only shows the icon and the name.
27  */
28 class VoiceCallActivity : AppCompatActivity() {
29 
30     companion object {
31         const val EXTRA_NAME = "name"
32         const val EXTRA_ICON = "icon"
33     }
34 
onCreatenull35     override fun onCreate(savedInstanceState: Bundle?) {
36         super.onCreate(savedInstanceState)
37         setContentView(R.layout.voice_call_activity)
38         val name = intent.getStringExtra(EXTRA_NAME)
39         val icon = intent.getIntExtra(EXTRA_ICON, 0)
40         if (name == null || icon == 0) {
41             finish()
42             return
43         }
44         val textName: TextView = findViewById(R.id.name)
45         textName.text = name
46         val imageIcon: ImageView = findViewById(R.id.icon)
47         Glide.with(imageIcon).load(icon).apply(RequestOptions.circleCropTransform()).into(imageIcon)
48     }
49 }
50