Add power button next to app title (v1.0.4)
- Tap: disconnect from server, stop service and close app
This commit is contained in:
@@ -112,6 +112,13 @@ class MainActivity : Activity(), SvxService.Listener {
|
||||
startActivity(Intent(this, SettingsActivity::class.java))
|
||||
}
|
||||
|
||||
findViewById<ImageButton>(R.id.btn_power).setOnClickListener {
|
||||
svc?.disconnect()
|
||||
stopService(Intent(this, SvxService::class.java))
|
||||
SplashActivity.mainAlive = false
|
||||
finishAffinity()
|
||||
}
|
||||
|
||||
lblTg.setOnClickListener { showGroupsDialog() }
|
||||
|
||||
lblCallsign.setOnClickListener { showNodesDialog() }
|
||||
|
||||
10
app/src/main/res/drawable/ic_power.xml
Normal file
10
app/src/main/res/drawable/ic_power.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#8B949E"
|
||||
android:pathData="M13,3h-2v10h2L13,3zM17.83,5.17l-1.42,1.42C17.99,7.86 19,9.81 19,12c0,3.87 -3.13,7 -7,7s-7,-3.13 -7,-7c0,-2.19 1.01,-4.14 2.58,-5.41L6.17,5.17C4.23,6.82 3,9.26 3,12c0,4.97 4.03,9 9,9s9,-4.03 9,-9C21,9.26 19.77,6.82 17.83,5.17z" />
|
||||
</vector>
|
||||
@@ -19,6 +19,15 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/btn_power"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:src="@drawable/ic_power"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/btn_power"
|
||||
android:scaleType="centerInside" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
<string name="status_disconnected">Отключено</string>
|
||||
<string name="app_title">SVXHomyak</string>
|
||||
<string name="btn_power">Выключить: отключиться и закрыть</string>
|
||||
<string name="status_big_disconnected">DISCONNECTED</string>
|
||||
<string name="status_big_connected">CONNECTED</string>
|
||||
<string name="status_big_talking">ПЕРЕДАЧА</string>
|
||||
|
||||
Reference in New Issue
Block a user