- replace speaker icon with vector asset
This commit is contained in:
@ -12,10 +12,8 @@ import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Color
|
||||
import android.os.CountDownTimer
|
||||
import android.support.v4.content.LocalBroadcastManager
|
||||
import android.support.v7.view.menu.ActionMenuItemView
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.text.InputType
|
||||
import android.text.TextWatcher
|
||||
@ -51,6 +49,7 @@ class MainActivity : AppCompatActivity() {
|
||||
internal lateinit var serviceEventReceiver: BroadcastReceiver
|
||||
internal lateinit var quitTimer: CountDownTimer
|
||||
internal lateinit var stopState: String
|
||||
internal lateinit var speakerIcon: MenuItem
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
@ -631,9 +630,7 @@ class MainActivity : AppCompatActivity() {
|
||||
if (ua.account.missedCalls)
|
||||
callsButton.setImageResource(R.drawable.calls_missed)
|
||||
}
|
||||
val speakerIcon = findViewById(R.id.speakerIcon) as ActionMenuItemView
|
||||
speakerIcon.setBackgroundColor(ContextCompat.getColor(applicationContext,
|
||||
R.color.colorPrimary))
|
||||
speakerIcon.setIcon(R.drawable.speaker_off)
|
||||
if (BaresipService.speakerPhone) {
|
||||
baresipService.setAction("ToggleSpeaker")
|
||||
startService(baresipService)
|
||||
@ -838,6 +835,7 @@ class MainActivity : AppCompatActivity() {
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.main_menu, menu)
|
||||
menuInflater.inflate(R.menu.speaker_icon, menu)
|
||||
speakerIcon = menu.findItem(R.id.speakerIcon)
|
||||
return true
|
||||
}
|
||||
|
||||
@ -845,12 +843,10 @@ class MainActivity : AppCompatActivity() {
|
||||
val i: Intent
|
||||
when (item.itemId) {
|
||||
R.id.speakerIcon -> {
|
||||
val speakerIcon = findViewById(R.id.speakerIcon) as ActionMenuItemView
|
||||
if (BaresipService.speakerPhone)
|
||||
speakerIcon.setBackgroundColor(ContextCompat.getColor(applicationContext,
|
||||
R.color.colorPrimary))
|
||||
item.setIcon(R.drawable.speaker_off)
|
||||
else
|
||||
speakerIcon.setBackgroundColor(Color.rgb(0x04, 0xb4, 0x04))
|
||||
item.setIcon(R.drawable.speaker_on)
|
||||
baresipService.setAction("ToggleSpeaker")
|
||||
startService(baresipService)
|
||||
return true
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 752 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB |
@ -1,4 +1,4 @@
|
||||
<vector android:height="36dp" android:tint="@color/colorPrimary"
|
||||
<vector android:height="36dp" android:tint="@color/colorAccent"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
|
||||
|
||||
5
app/src/main/res/drawable/speaker_off.xml
Normal file
5
app/src/main/res/drawable/speaker_off.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="48dp" android:tint="@color/colorGrayLight"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M7,7.07L8.43,8.5c0.91,-0.91 2.18,-1.48 3.57,-1.48s2.66,0.57 3.57,1.48L17,7.07C15.72,5.79 13.95,5 12,5s-3.72,0.79 -5,2.07zM12,1C8.98,1 6.24,2.23 4.25,4.21l1.41,1.41C7.28,4 9.53,3 12,3s4.72,1 6.34,2.62l1.41,-1.41C17.76,2.23 15.02,1 12,1zM14.86,10.01L9.14,10C8.51,10 8,10.51 8,11.14v9.71c0,0.63 0.51,1.14 1.14,1.14h5.71c0.63,0 1.14,-0.51 1.14,-1.14v-9.71c0.01,-0.63 -0.5,-1.13 -1.13,-1.13zM15,20L9,20v-8h6v8z"/>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/speaker_on.xml
Normal file
5
app/src/main/res/drawable/speaker_on.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="48dp" android:tint="@color/colorAccent"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M7,7.07L8.43,8.5c0.91,-0.91 2.18,-1.48 3.57,-1.48s2.66,0.57 3.57,1.48L17,7.07C15.72,5.79 13.95,5 12,5s-3.72,0.79 -5,2.07zM12,1C8.98,1 6.24,2.23 4.25,4.21l1.41,1.41C7.28,4 9.53,3 12,3s4.72,1 6.34,2.62l1.41,-1.41C17.76,2.23 15.02,1 12,1zM14.86,10.01L9.14,10C8.51,10 8,10.51 8,11.14v9.71c0,0.63 0.51,1.14 1.14,1.14h5.71c0.63,0 1.14,-0.51 1.14,-1.14v-9.71c0.01,-0.63 -0.5,-1.13 -1.13,-1.13zM15,20L9,20v-8h6v8z"/>
|
||||
</vector>
|
||||
@ -6,7 +6,7 @@
|
||||
android:id="@+id/speakerIcon"
|
||||
android:title=""
|
||||
app:showAsAction="always"
|
||||
android:icon="@drawable/ic_action_speaker"
|
||||
android:icon="@drawable/speaker_off"
|
||||
/>
|
||||
|
||||
</menu>
|
||||
|
||||
@ -6,5 +6,7 @@
|
||||
<color name="colorSecondary">#26a69a</color>
|
||||
<color name="colorSecondaryDark">#1c9588</color>
|
||||
<color name="colorSecondaryLight">#93d3cd</color>
|
||||
<color name="colorAccent">#B00020</color>
|
||||
<color name="colorGray">#9e9e9e</color>
|
||||
<color name="colorGrayLight">#eeeeee</color>
|
||||
<color name="colorAccent">#b00020</color>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user