Show custom watchface only if Wear Watch connected
This commit is contained in:
parent
b309109090
commit
9bf6545f5d
|
@ -19,6 +19,7 @@ import info.nightscout.rx.logging.AAPSLogger
|
||||||
import info.nightscout.rx.weardata.CustomWatchfaceDrawableDataKey
|
import info.nightscout.rx.weardata.CustomWatchfaceDrawableDataKey
|
||||||
import info.nightscout.rx.weardata.CustomWatchfaceMetadataKey
|
import info.nightscout.rx.weardata.CustomWatchfaceMetadataKey
|
||||||
import info.nightscout.rx.weardata.EventData
|
import info.nightscout.rx.weardata.EventData
|
||||||
|
import info.nightscout.shared.extensions.toVisibility
|
||||||
import info.nightscout.shared.interfaces.ResourceHelper
|
import info.nightscout.shared.interfaces.ResourceHelper
|
||||||
import info.nightscout.shared.sharedPreferences.SP
|
import info.nightscout.shared.sharedPreferences.SP
|
||||||
import info.nightscout.shared.utils.DateUtil
|
import info.nightscout.shared.utils.DateUtil
|
||||||
|
@ -109,6 +110,7 @@ class WearFragment : DaggerFragment() {
|
||||||
binding.coverChart.setImageDrawable(null)
|
binding.coverChart.setImageDrawable(null)
|
||||||
}
|
}
|
||||||
binding.connectedDevice.text = wearPlugin.connectedDevice
|
binding.connectedDevice.text = wearPlugin.connectedDevice
|
||||||
|
binding.customWatchfaceLayout.visibility = (wearPlugin.connectedDevice != rh.gs(R.string.no_watch_connected)).toVisibility()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadCustom(cwf: EventData.ActionSetCustomWatchface) {
|
private fun loadCustom(cwf: EventData.ActionSetCustomWatchface) {
|
||||||
|
|
|
@ -55,7 +55,6 @@ class WearPlugin @Inject constructor(
|
||||||
private val disposable = CompositeDisposable()
|
private val disposable = CompositeDisposable()
|
||||||
|
|
||||||
var connectedDevice = "---"
|
var connectedDevice = "---"
|
||||||
var customWatchfaceSerialized = ""
|
|
||||||
var savedCustomWatchface: CustomWatchfaceData? = null
|
var savedCustomWatchface: CustomWatchfaceData? = null
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
|
|
@ -73,9 +73,13 @@
|
||||||
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/custom_watchface_Layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
android:id="@+id/custom_watchface"
|
|
||||||
style="@style/Widget.MaterialComponents.CardView"
|
style="@style/Widget.MaterialComponents.CardView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -89,11 +93,6 @@
|
||||||
android:layout_gravity="center">
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/main_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/custom_name"
|
android:id="@+id/custom_name"
|
||||||
|
@ -175,15 +174,12 @@
|
||||||
|
|
||||||
</androidx.gridlayout.widget.GridLayout>
|
</androidx.gridlayout.widget.GridLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/custom_layout"
|
android:id="@+id/custom_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
|
||||||
android:padding="20dp"
|
android:padding="20dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
@ -199,3 +195,5 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
Loading…
Reference in a new issue