DiaconnG8BLEScanActivity: toolbar
This commit is contained in:
parent
e342df2a2b
commit
ca9cbefaa7
3 changed files with 24 additions and 28 deletions
|
@ -18,7 +18,7 @@
|
||||||
<activity
|
<activity
|
||||||
android:name=".activities.DiaconnG8BLEScanActivity"
|
android:name=".activities.DiaconnG8BLEScanActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
android:theme="@style/AppTheme">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="info.nightscout.androidaps.plugins.PumpDiaconnG8.activities.DiaconnG8BLEScanActivity" />
|
<action android:name="info.nightscout.androidaps.plugins.PumpDiaconnG8.activities.DiaconnG8BLEScanActivity" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
|
@ -18,11 +18,15 @@ import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.os.ParcelUuid
|
import android.os.ParcelUuid
|
||||||
|
import android.view.Menu
|
||||||
|
import android.view.MenuInflater
|
||||||
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.BaseAdapter
|
import android.widget.BaseAdapter
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
|
import androidx.core.view.MenuProvider
|
||||||
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
|
||||||
import info.nightscout.core.ui.toast.ToastUtils
|
import info.nightscout.core.ui.toast.ToastUtils
|
||||||
import info.nightscout.core.utils.extensions.safeEnable
|
import info.nightscout.core.utils.extensions.safeEnable
|
||||||
|
@ -57,12 +61,31 @@ class DiaconnG8BLEScanActivity : TranslatedDaggerAppCompatActivity() {
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|
||||||
|
|
||||||
|
title = getString(R.string.diaconn_pairing)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
supportActionBar?.setDisplayShowHomeEnabled(true)
|
||||||
|
|
||||||
blePreCheck.prerequisitesCheck(this)
|
blePreCheck.prerequisitesCheck(this)
|
||||||
|
|
||||||
listAdapter = ListAdapter()
|
listAdapter = ListAdapter()
|
||||||
binding.bleScannerListview.emptyView = binding.bleScannerNoDevice
|
binding.bleScannerListview.emptyView = binding.bleScannerNoDevice
|
||||||
binding.bleScannerListview.adapter = listAdapter
|
binding.bleScannerListview.adapter = listAdapter
|
||||||
listAdapter?.notifyDataSetChanged()
|
listAdapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
|
// Add menu items without overriding methods in the Activity
|
||||||
|
addMenuProvider(object : MenuProvider {
|
||||||
|
override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {}
|
||||||
|
|
||||||
|
override fun onMenuItemSelected(menuItem: MenuItem): Boolean =
|
||||||
|
when (menuItem.itemId) {
|
||||||
|
android.R.id.home -> {
|
||||||
|
onBackPressedDispatcher.onBackPressed()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
|
@ -7,33 +7,6 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".activities.DiaconnG8BLEScanActivity">
|
tools:context=".activities.DiaconnG8BLEScanActivity">
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:background="?attr/activity_title_backgroundColor"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="5dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:importantForAccessibility="no"
|
|
||||||
app:srcCompat="@drawable/ic_bluetooth_white_48dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginStart="10dp"
|
|
||||||
android:layout_marginEnd="10dp"
|
|
||||||
android:text="@string/diaconn_pairing"
|
|
||||||
android:textAlignment="center"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/ble_scanner_listview"
|
android:id="@+id/ble_scanner_listview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue