Merge pull request #2695 from Philoul/wear/new_custom_watchface

Wear CWF infos button
This commit is contained in:
Milos Kozak 2023-08-24 09:16:10 +02:00 committed by GitHub
commit 1111ae2ed7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 491 additions and 48 deletions

View file

@ -103,20 +103,21 @@ enum class CwfMetadataKey(val key: String, @StringRes val label: Int, val isPref
CWF_AUTHOR_VERSION("author_version", R.string.metadata_label_watchface_name_version, false),
CWF_COMMENT("comment", R.string.metadata_label_watchface_comment, false), // label not planed to be used for CWF_COMMENT
CWF_AUTHORIZATION("cwf_authorization", R.string.metadata_label_watchface_authorization, false),
CWF_PREF_WATCH_SHOW_DETAILED_IOB("key_show_detailed_iob", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_DETAILED_DELTA("key_show_detailed_delta", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_BGI("key_show_bgi", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_IOB("key_show_iob", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_COB("key_show_cob", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_DELTA("key_show_delta", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_AVG_DELTA("key_show_avg_delta", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_UPLOADER_BATTERY("key_show_uploader_battery", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_RIG_BATTERY("key_show_rig_battery", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_TEMP_BASAL("key_show_temp_basal", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_DIRECTION("key_show_direction", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_AGO("key_show_ago", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_BG("key_show_bg", R.string.metadata_label_watchface_pref, true),
CWF_PREF_WATCH_SHOW_LOOP_STATUS("key_show_loop_status", R.string.metadata_label_watchface_pref, true);
CWF_PREF_WATCH_SHOW_DETAILED_IOB("key_show_detailed_iob", R.string.pref_show_detailed_iob, true),
CWF_PREF_WATCH_SHOW_DETAILED_DELTA("key_show_detailed_delta", R.string.pref_show_detailed_delta, true),
CWF_PREF_WATCH_SHOW_BGI("key_show_bgi", R.string.pref_show_bgi, true),
CWF_PREF_WATCH_SHOW_IOB("key_show_iob", R.string.pref_show_iob, true),
CWF_PREF_WATCH_SHOW_COB("key_show_cob", R.string.pref_show_cob, true),
CWF_PREF_WATCH_SHOW_DELTA("key_show_delta", R.string.pref_show_delta, true),
CWF_PREF_WATCH_SHOW_AVG_DELTA("key_show_avg_delta", R.string.pref_show_avgdelta, true),
CWF_PREF_WATCH_SHOW_UPLOADER_BATTERY("key_show_uploader_battery", R.string.pref_show_phone_battery, true),
CWF_PREF_WATCH_SHOW_RIG_BATTERY("key_show_rig_battery", R.string.pref_show_rig_battery, true),
CWF_PREF_WATCH_SHOW_TEMP_BASAL("key_show_temp_basal", R.string.pref_show_basal_rate, true),
CWF_PREF_WATCH_SHOW_DIRECTION("key_show_direction", R.string.pref_show_direction_arrow, true),
CWF_PREF_WATCH_SHOW_AGO("key_show_ago", R.string.pref_show_ago, true),
CWF_PREF_WATCH_SHOW_BG("key_show_bg", R.string.pref_show_bg, true),
CWF_PREF_WATCH_SHOW_LOOP_STATUS("key_show_loop_status", R.string.pref_show_loop_status, true),
CWF_PREF_WATCH_SHOW_DATE("key_show_date", R.string.pref_show_date, true);
companion object {

View file

@ -46,9 +46,23 @@
<string name="metadata_wear_import_filename">File name: %1$s</string>
<string name="metadata_label_plugin_version">Plugin version: %1$s</string>
<string name="metadata_label_watchface_name_version">Name: %1$s (%2$s)</string>
<string name="metadata_label_watchface_comment" translatable="false">%1$s</string>
<string name="metadata_label_watchface_comment" translatable="false">Comment: %1$s</string>
<string name="metadata_label_watchface_authorization" translatable="false">%1$s</string>
<string name="metadata_label_watchface_pref" translatable="false">%1$s</string>
<string name="pref_show_date">Show Date</string>
<string name="pref_show_iob">Show IOB</string>
<string name="pref_show_detailed_iob">Show detailed IOB</string>
<string name="pref_show_cob">Show COB</string>
<string name="pref_show_delta">Show Delta</string>
<string name="pref_show_detailed_delta">Show detailed Delta</string>
<string name="pref_show_avgdelta">Show AvgDelta</string>
<string name="pref_show_phone_battery">Show Phone Battery</string>
<string name="pref_show_rig_battery">Show Rig Battery</string>
<string name="pref_show_basal_rate">Show Basal Rate</string>
<string name="pref_show_loop_status">Show Loop Status</string>
<string name="pref_show_bg">Show BG</string>
<string name="pref_show_bgi">Show BGI</string>
<string name="pref_show_direction_arrow">Show Direction Arrow</string>
<string name="pref_show_ago">Show Ago</string>
<string name="default_custom_watchface_comment">Default watchface, you can click on EXPORT WATCHFACE button to generate a template</string>
<string name="wear_default_watchface">Default Watchface</string>

View file

@ -55,9 +55,9 @@ class CustomWatchfaceImportListActivity: TranslatedDaggerAppCompatActivity() {
binding.recyclerview.adapter = RecyclerViewAdapter(prefFileListProvider.listCustomWatchfaceFiles())
}
inner class RecyclerViewAdapter internal constructor(private var customWatchfaceFileList: List<CwfData>) : RecyclerView.Adapter<RecyclerViewAdapter.PrefFileViewHolder>() {
inner class RecyclerViewAdapter internal constructor(private var customWatchfaceFileList: List<CwfData>) : RecyclerView.Adapter<RecyclerViewAdapter.CwfFileViewHolder>() {
inner class PrefFileViewHolder(val customWatchfaceImportListItemBinding: CustomWatchfaceImportListItemBinding) : RecyclerView.ViewHolder(customWatchfaceImportListItemBinding.root) {
inner class CwfFileViewHolder(val customWatchfaceImportListItemBinding: CustomWatchfaceImportListItemBinding) : RecyclerView.ViewHolder(customWatchfaceImportListItemBinding.root) {
init {
with(customWatchfaceImportListItemBinding) {
@ -74,16 +74,16 @@ class CustomWatchfaceImportListActivity: TranslatedDaggerAppCompatActivity() {
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PrefFileViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CwfFileViewHolder {
val binding = CustomWatchfaceImportListItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return PrefFileViewHolder(binding)
return CwfFileViewHolder(binding)
}
override fun getItemCount(): Int {
return customWatchfaceFileList.size
}
override fun onBindViewHolder(holder: PrefFileViewHolder, position: Int) {
override fun onBindViewHolder(holder: CwfFileViewHolder, position: Int) {
val customWatchfaceFile = customWatchfaceFileList[position]
val metadata = customWatchfaceFile.metadata
val drawable = customWatchfaceFile.drawableDatas[CwfDrawableFileMap

View file

@ -23,6 +23,11 @@
</intent-filter>
</activity>
<activity
android:name=".general.wear.activities.CwfInfosActivity"
android:exported="false"
android:theme="@style/AppTheme" />
<service android:name="info.nightscout.plugins.general.persistentNotification.DummyService" />
<service

View file

@ -2,6 +2,7 @@ package info.nightscout.plugins.di
import dagger.Module
import dagger.android.ContributesAndroidInjector
import info.nightscout.plugins.general.wear.activities.CwfInfosActivity
import info.nightscout.plugins.general.wear.wearintegration.DataLayerListenerServiceMobile
@Module
@ -9,4 +10,5 @@ import info.nightscout.plugins.general.wear.wearintegration.DataLayerListenerSer
abstract class WearModule {
@ContributesAndroidInjector abstract fun contributesWatchUpdaterService(): DataLayerListenerServiceMobile
@ContributesAndroidInjector abstract fun contributesCustomWatchfaceInfosActivity(): CwfInfosActivity
}

View file

@ -1,5 +1,6 @@
package info.nightscout.plugins.general.wear
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
@ -10,6 +11,7 @@ import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.maintenance.ImportExportPrefs
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.WearFragmentBinding
import info.nightscout.plugins.general.wear.activities.CwfInfosActivity
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventMobileToWear
@ -69,6 +71,9 @@ class WearFragment : DaggerFragment() {
binding.exportCustom.setOnClickListener {
rxBus.send(EventMobileToWear(EventData.ActionrequestCustomWatchface(true)))
}
binding.infosCustom.setOnClickListener {
startActivity(Intent(activity, CwfInfosActivity::class.java))
}
}
override fun onResume() {
@ -107,9 +112,11 @@ class WearFragment : DaggerFragment() {
wearPlugin.checkCustomWatchfacePreferences()
binding.customName.text = rh.gs(R.string.wear_custom_watchface, it.metadata[CwfMetadataKey.CWF_NAME])
binding.coverChart.setImageDrawable(it.drawableDatas[CwfDrawableFileMap.CUSTOM_WATCHFACE]?.toDrawable(resources))
binding.infosCustom.visibility = View.VISIBLE
} ?:apply {
binding.customName.text = rh.gs(R.string.wear_custom_watchface, rh.gs(info.nightscout.shared.R.string.wear_default_watchface))
binding.coverChart.setImageDrawable(null)
binding.infosCustom.visibility = View.GONE
}
binding.connectedDevice.text = wearPlugin.connectedDevice
binding.customWatchfaceLayout.visibility = (wearPlugin.connectedDevice != rh.gs(R.string.no_watch_connected)).toVisibility()

View file

@ -0,0 +1,142 @@
package info.nightscout.plugins.general.wear.activities
import android.os.Bundle
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.core.view.MenuProvider
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import info.nightscout.core.ui.activities.TranslatedDaggerAppCompatActivity
import info.nightscout.interfaces.versionChecker.VersionCheckerUtils
import info.nightscout.plugins.R
import info.nightscout.plugins.databinding.CwfInfosActivityBinding
import info.nightscout.plugins.databinding.CwfInfosActivityPrefItemBinding
import info.nightscout.plugins.general.wear.WearPlugin
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger
import info.nightscout.rx.weardata.CUSTOM_VERSION
import info.nightscout.rx.weardata.CwfDrawableFileMap
import info.nightscout.rx.weardata.CwfMetadataKey
import info.nightscout.rx.weardata.CwfMetadataMap
import info.nightscout.shared.interfaces.ResourceHelper
import info.nightscout.shared.sharedPreferences.SP
import javax.inject.Inject
class CwfInfosActivity : TranslatedDaggerAppCompatActivity() {
@Inject lateinit var rh: ResourceHelper
@Inject lateinit var sp: SP
@Inject lateinit var rxBus: RxBus
@Inject lateinit var aapsLogger: AAPSLogger
@Inject lateinit var wearPlugin: WearPlugin
@Inject lateinit var versionCheckerUtils: VersionCheckerUtils
private lateinit var binding: CwfInfosActivityBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = CwfInfosActivityBinding.inflate(layoutInflater)
val view = binding.root
setContentView(view)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)
supportActionBar?.setDisplayShowTitleEnabled(true)
updateGui()
// 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
}
})
}
private fun updateGui() {
wearPlugin.savedCustomWatchface?.let {
val cwf_authorization = sp.getBoolean(info.nightscout.core.utils.R.string.key_wear_custom_watchface_autorization, false)
val metadata = it.metadata
val drawable = it.drawableDatas[CwfDrawableFileMap.CUSTOM_WATCHFACE]?.toDrawable(resources)
binding.customWatchface.setImageDrawable(drawable)
title = rh.gs(CwfMetadataKey.CWF_NAME.label, metadata[CwfMetadataKey.CWF_NAME])
metadata[CwfMetadataKey.CWF_AUTHOR_VERSION]?.let { author_version ->
title = "${metadata[CwfMetadataKey.CWF_NAME]} ($author_version)"
}
binding.filelistName.text = rh.gs(CwfMetadataKey.CWF_FILENAME.label, metadata[CwfMetadataKey.CWF_FILENAME] ?: "")
binding.author.text = rh.gs(CwfMetadataKey.CWF_AUTHOR.label, metadata[CwfMetadataKey.CWF_AUTHOR] ?: "")
binding.createdAt.text = rh.gs(CwfMetadataKey.CWF_CREATED_AT.label, metadata[CwfMetadataKey.CWF_CREATED_AT] ?: "")
binding.cwfVersion.text = rh.gs(CwfMetadataKey.CWF_VERSION.label, metadata[CwfMetadataKey.CWF_VERSION] ?: "")
val colorAttr = if (checkCustomVersion(metadata)) info.nightscout.core.ui.R.attr.metadataTextOkColor else info.nightscout.core.ui.R.attr.metadataTextWarningColor
binding.cwfVersion.setTextColor(rh.gac(binding.cwfVersion.context, colorAttr))
binding.cwfComment.text = rh.gs(CwfMetadataKey.CWF_COMMENT.label, metadata[CwfMetadataKey.CWF_COMMENT] ?: "")
if (metadata.count { it.key.isPref } > 0) {
binding.prefLayout.visibility = View.VISIBLE
binding.prefTitle.text = rh.gs(if (cwf_authorization) R.string.cwf_infos_pref_locked else R.string.cwf_infos_pref_requested)
binding.prefRecyclerview.layoutManager = LinearLayoutManager(this)
binding.prefRecyclerview.adapter = PrefRecyclerViewAdapter(
metadata.filter { it.key.isPref && (it.value.lowercase() == "true" || it.value.lowercase() == "false") }.toList()
)
} else
binding.prefLayout.visibility = View.GONE
}
}
inner class PrefRecyclerViewAdapter internal constructor(private var prefList: List<Pair<CwfMetadataKey, String>>) : RecyclerView.Adapter<PrefRecyclerViewAdapter.CwfFileViewHolder>() {
inner class CwfFileViewHolder(val cwfInfosActivityPrefItemBinding: CwfInfosActivityPrefItemBinding) : RecyclerView.ViewHolder(cwfInfosActivityPrefItemBinding.root) {
init {
with(cwfInfosActivityPrefItemBinding) {
root.isClickable = false
}
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CwfFileViewHolder {
val binding = CwfInfosActivityPrefItemBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return CwfFileViewHolder(binding)
}
override fun getItemCount(): Int {
return prefList.size
}
override fun onBindViewHolder(holder: CwfFileViewHolder, position: Int) {
val pref = prefList[position]
val key = pref.first
val value = pref.second.lowercase().toBooleanStrictOrNull() // should never be null here, just safety to avoid exception
with(holder.cwfInfosActivityPrefItemBinding) {
prefLabel.text = rh.gs(key.label)
value?.let { prefValue.setImageResource(if (it) R.drawable.settings_on else R.drawable.settings_off) }// should never be null here, just safety to avoid exception
}
}
}
private fun checkCustomVersion(metadata: CwfMetadataMap): Boolean {
metadata[CwfMetadataKey.CWF_VERSION]?.let { version ->
val currentAppVer = versionCheckerUtils.versionDigits(CUSTOM_VERSION)
val metadataVer = versionCheckerUtils.versionDigits(version)
//Only check that Loaded Watchface version is lower or equal to Wear CustomWatchface version
return ((currentAppVer.size >= 2) && (metadataVer.size >= 2) && (currentAppVer[0] >= metadataVer[0]))
}
return false
}
}

View file

@ -5,13 +5,13 @@
android:viewportHeight="24">
<path
android:pathData="M1.885,11.953c0,2.578 2.09,4.668 4.668,4.668s4.668,-2.09 4.668,-4.668c0,-2.578 -2.09,-4.668 -4.668,-4.668S1.885,9.375 1.885,11.953zM3.093,11.953c0,-1.911 1.549,-3.46 3.46,-3.46s3.46,1.549 3.46,3.46c0,1.911 -1.549,3.46 -3.46,3.46S3.093,13.864 3.093,11.953z"
android:fillColor="#AAAAAA"/>
android:fillColor="?attr/colorControlNormal"/>
<path
android:pathData="M4.273,4.976l4.56,0l0.597,3.338l-5.754,0z"
android:fillColor="#AAAAAA"/>
android:fillColor="?attr/colorControlNormal"/>
<path
android:pathData="M4.273,19.024l4.56,0l0.597,-3.338l-5.754,0z"
android:fillColor="#AAAAAA"/>
android:fillColor="?attr/colorControlNormal"/>
<path
android:pathData="M12.915,6.067h9.405v11.865h-9.405z"
android:strokeLineJoin="round"

View file

@ -0,0 +1,9 @@
<vector android:height="48dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="?attr/colorControlNormal" android:pathData="M1.885,11.953c0,2.578 2.09,4.668 4.668,4.668s4.668,-2.09 4.668,-4.668c0,-2.578 -2.09,-4.668 -4.668,-4.668S1.885,9.375 1.885,11.953zM3.093,11.953c0,-1.911 1.549,-3.46 3.46,-3.46s3.46,1.549 3.46,3.46c0,1.911 -1.549,3.46 -3.46,3.46S3.093,13.864 3.093,11.953z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M4.273,4.976l4.56,0l0.597,3.338l-5.754,0z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M4.273,19.024l4.56,0l0.597,-3.338l-5.754,0z"/>
<path android:fillColor="#FFFFFF" android:pathData="M17.25,3.197c0.27,0.001 0.48,0.215 0.477,0.487c-0.003,0.263 -0.217,0.472 -0.481,0.472c-0.267,0 -0.482,-0.22 -0.478,-0.488C16.771,3.408 16.988,3.196 17.25,3.197z"/>
<path android:fillColor="#FFFFFF" android:pathData="M17.68,7.224c-0.07,-0.04 -0.124,0.004 -0.166,0.057c-0.068,0.085 -0.128,0.177 -0.199,0.259c-0.121,0.14 -0.238,0.286 -0.412,0.366c-0.059,0.027 -0.129,0.049 -0.183,0.004c-0.049,-0.04 -0.025,-0.105 -0.015,-0.16c0.049,-0.264 0.163,-0.506 0.263,-0.752c0.214,-0.527 0.414,-1.058 0.558,-1.609c0.101,-0.387 -0.028,-0.69 -0.343,-0.817c-0.149,-0.06 -0.306,-0.088 -0.462,-0.053c-0.407,0.089 -0.763,0.276 -1.043,0.592c-0.175,0.174 -0.329,0.364 -0.447,0.58c-0.02,0.037 -0.047,0.083 -0.001,0.12c0.043,0.035 0.093,0.026 0.136,-0.002c0.03,-0.019 0.057,-0.045 0.079,-0.074C15.61,5.51 15.811,5.32 16.024,5.14c0,0 0,0 0,0c0.076,-0.026 0.153,-0.103 0.233,-0.024c0.079,0.079 0.077,0.181 0.044,0.283c-0.005,0.015 -0.012,0.03 -0.018,0.045c-0.281,0.712 -0.562,1.424 -0.843,2.137c-0.085,0.216 -0.142,0.438 -0.128,0.672c0.016,0.263 0.155,0.414 0.416,0.454c0.185,0.028 0.361,-0.013 0.535,-0.068c0.513,-0.162 0.888,-0.512 1.228,-0.907c0.087,-0.1 0.162,-0.212 0.212,-0.336C17.727,7.336 17.755,7.267 17.68,7.224z"/>
<path android:fillColor="#FFFFFF" android:pathData="M16.762,1.857c-2.4,0 -4.346,1.946 -4.346,4.346s1.946,4.346 4.346,4.346s4.346,-1.946 4.346,-4.346S19.162,1.857 16.762,1.857zM16.762,10.149c-2.179,0 -3.946,-1.767 -3.946,-3.946s1.767,-3.946 3.946,-3.946s3.946,1.767 3.946,3.946S18.941,10.149 16.762,10.149z"/>
</vector>

View file

@ -1,8 +1,8 @@
<vector android:height="48dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#AAAAAA" android:pathData="M17.653,7.286c-2.578,0 -4.668,2.09 -4.668,4.668c0,2.578 2.09,4.668 4.668,4.668s4.668,-2.09 4.668,-4.668C22.321,9.375 20.231,7.286 17.653,7.286zM17.653,15.414c-1.911,0 -3.46,-1.549 -3.46,-3.46c0,-1.911 1.549,-3.46 3.46,-3.46s3.46,1.549 3.46,3.46C21.113,13.864 19.564,15.414 17.653,15.414z"/>
<path android:fillColor="#AAAAAA" android:pathData="M19.932,4.976l-4.559,0l-0.597,3.338l5.754,0z"/>
<path android:fillColor="#AAAAAA" android:pathData="M19.932,19.024l-4.559,0l-0.597,-3.338l5.754,0z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M17.653,7.286c-2.578,0 -4.668,2.09 -4.668,4.668c0,2.578 2.09,4.668 4.668,4.668s4.668,-2.09 4.668,-4.668C22.321,9.375 20.231,7.286 17.653,7.286zM17.653,15.414c-1.911,0 -3.46,-1.549 -3.46,-3.46c0,-1.911 1.549,-3.46 3.46,-3.46s3.46,1.549 3.46,3.46C21.113,13.864 19.564,15.414 17.653,15.414z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M19.932,4.976l-4.559,0l-0.597,3.338l5.754,0z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M19.932,19.024l-4.559,0l-0.597,-3.338l5.754,0z"/>
<path android:fillColor="#00000000"
android:pathData="M1.885,6.067h9.405v11.865h-9.405z"
android:strokeColor="#FFFFFF" android:strokeLineJoin="round" android:strokeWidth="0.4819"/>

View file

@ -1,7 +1,7 @@
<vector android:height="48dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#AAAAAA" android:pathData="M16.168,7.286c-2.578,0 -4.668,2.09 -4.668,4.668c0,2.578 2.09,4.668 4.668,4.668s4.668,-2.09 4.668,-4.668C20.836,9.375 18.746,7.286 16.168,7.286zM16.168,15.414c-1.911,0 -3.46,-1.549 -3.46,-3.46c0,-1.911 1.549,-3.46 3.46,-3.46s3.46,1.549 3.46,3.46C19.628,13.864 18.079,15.414 16.168,15.414z"/>
<path android:fillColor="#AAAAAA" android:pathData="M18.448,4.976l-4.56,0l-0.597,3.338l5.754,0z"/>
<path android:fillColor="#AAAAAA" android:pathData="M18.448,19.024l-4.56,0l-0.597,-3.338l5.754,0z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M16.168,7.286c-2.578,0 -4.668,2.09 -4.668,4.668c0,2.578 2.09,4.668 4.668,4.668s4.668,-2.09 4.668,-4.668C20.836,9.375 18.746,7.286 16.168,7.286zM16.168,15.414c-1.911,0 -3.46,-1.549 -3.46,-3.46c0,-1.911 1.549,-3.46 3.46,-3.46s3.46,1.549 3.46,3.46C19.628,13.864 18.079,15.414 16.168,15.414z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M18.448,4.976l-4.56,0l-0.597,3.338l5.754,0z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M18.448,19.024l-4.56,0l-0.597,-3.338l5.754,0z"/>
<path android:fillColor="#6AE86D" android:pathData="M16.241,11.953l-4.975,-2.13l0,1.255l-7.896,0l0,1.75l7.896,0l0,1.256z"/>
</vector>

View file

@ -1,7 +1,7 @@
<vector android:height="48dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="48dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#AAAAAA" android:pathData="M12.103,7.286c-2.578,0 -4.668,2.09 -4.668,4.668c0,2.578 2.09,4.668 4.668,4.668s4.668,-2.09 4.668,-4.668C16.771,9.375 14.681,7.286 12.103,7.286zM12.103,15.414c-1.911,0 -3.46,-1.549 -3.46,-3.46c0,-1.911 1.549,-3.46 3.46,-3.46s3.46,1.549 3.46,3.46C15.563,13.864 14.014,15.414 12.103,15.414z"/>
<path android:fillColor="#AAAAAA" android:pathData="M14.383,4.976l-4.56,0l-0.597,3.338l5.754,0z"/>
<path android:fillColor="#AAAAAA" android:pathData="M14.383,19.024l-4.56,0l-0.597,-3.338l5.754,0z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M12.103,7.286c-2.578,0 -4.668,2.09 -4.668,4.668c0,2.578 2.09,4.668 4.668,4.668s4.668,-2.09 4.668,-4.668C16.771,9.375 14.681,7.286 12.103,7.286zM12.103,15.414c-1.911,0 -3.46,-1.549 -3.46,-3.46c0,-1.911 1.549,-3.46 3.46,-3.46s3.46,1.549 3.46,3.46C15.563,13.864 14.014,15.414 12.103,15.414z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M14.383,4.976l-4.56,0l-0.597,3.338l5.754,0z"/>
<path android:fillColor="?attr/colorControlNormal" android:pathData="M14.383,19.024l-4.56,0l-0.597,-3.338l5.754,0z"/>
<path android:fillColor="#FF1313" android:pathData="M13.768,11.999l1.886,-1.886c0.081,-0.081 0.081,-0.213 0,-0.294l-1.372,-1.372c-0.078,-0.078 -0.216,-0.078 -0.294,0l-1.886,1.886l-1.886,-1.886c-0.078,-0.078 -0.216,-0.078 -0.294,0L8.552,9.819C8.513,9.858 8.491,9.911 8.491,9.966c0,0.055 0.022,0.108 0.061,0.147l1.886,1.886l-1.886,1.886c-0.039,0.039 -0.061,0.092 -0.061,0.147c0,0.055 0.022,0.108 0.061,0.147l1.372,1.372c0.041,0.04 0.094,0.061 0.147,0.061c0.053,0 0.106,-0.02 0.147,-0.061l1.886,-1.886l1.886,1.886c0.04,0.04 0.093,0.061 0.147,0.061c0.053,0 0.106,-0.02 0.147,-0.061l1.371,-1.371c0.081,-0.081 0.081,-0.213 0,-0.294L13.768,11.999z"/>
</vector>

View file

@ -0,0 +1,10 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path android:fillColor="#00000000"
android:pathData="M12,4.802l2.338,4.739l5.23,0.76l-3.784,3.688l0.893,5.209l-4.677,-2.459l-4.678,2.459l0.894,-5.209l-3.785,-3.688l5.23,-0.76z"
android:strokeColor="#CCCCCC" android:strokeWidth="1.9843"/>
</vector>

View file

@ -0,0 +1,10 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:width="48dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path android:fillColor="#CCCCCC"
android:pathData="M12,4.802l2.338,4.739l5.23,0.76l-3.784,3.688l0.893,5.209l-4.677,-2.459l-4.678,2.459l0.894,-5.209l-3.785,-3.688l5.23,-0.76z"
android:strokeColor="#CCCCCC" android:strokeWidth="1.9843"/>
</vector>

View file

@ -0,0 +1,175 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical"
android:paddingTop="2dp"
tools:context="info.nightscout.plugins.general.wear.activities.CwfInfosActivity">
<androidx.core.widget.NestedScrollView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/custom_watchface"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_marginStart="5dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="6dp"
android:layout_marginBottom="1dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/watchface_custom"
android:contentDescription="@string/a11y_file" />
<TextView
android:id="@+id/filelist_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:ellipsize="none"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:scrollHorizontally="false"
android:text="Filename: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/importListFileNameColor"
android:textSize="18sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/author"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="0dp"
android:ellipsize="none"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:scrollHorizontally="false"
android:text="Author: Name"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/importListFileNameColor"
android:textSize="18sp" />
<TextView
android:id="@+id/created_at"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="0dp"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:text="created at: "
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/importListFileNameColor"
android:textSize="18sp" />
<TextView
android:id="@+id/cwf_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:text="Custom plugin version:"
android:textAlignment="viewStart"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/importListFileNameColor"
android:textSize="18sp" />
<TextView
android:id="@+id/cwf_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="5dp"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:text="Comment"
android:textAlignment="viewStart"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/importListFileNameColor"
android:textSize="18sp" />
<LinearLayout
android:id="@+id/pref_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/pref_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="15dp"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:text="@string/cwf_infos_pref_requested"
android:textAlignment="viewStart"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/importListFileNameColor"
android:textSize="18sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/pref_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadeScrollbars="true"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
<LinearLayout
android:id="@+id/view_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="15dp"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:text="@string/cwf_infos_view_title"
android:textAlignment="viewStart"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?attr/importListFileNameColor"
android:textSize="15sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/view_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadeScrollbars="true"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="vertical">
</androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/careportal_cardview"
style="@style/Widget.MaterialComponents.CardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginEnd="4dp"
android:layout_marginTop="4dp"
app:cardCornerRadius="4dp"
app:contentPadding="2dp"
app:cardElevation="2dp"
app:cardUseCompatPadding="false"
android:layout_gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:gravity="center"
android:layout_marginBottom="3dp"
android:orientation="horizontal">
<TextView
android:id="@+id/pref_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:layout_weight="1"
android:ellipsize="none"
android:maxLines="2"
android:paddingStart="0dp"
android:paddingEnd="10dp"
android:scrollHorizontally="false"
android:text="Default Custom Watchface"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?attr/importListFileNameColor"
tools:ignore="HardcodedText" />
<ImageView
android:id="@+id/pref_value"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="5dp"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:foreground="@drawable/settings_off"
android:gravity="center"/>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

View file

@ -119,27 +119,29 @@
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:text="@string/wear_load_watchface"
android:textSize="11sp"
android:textSize="12sp"
android:textColor="?attr/treatmentButton"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="0"
app:layout_column="0" />
<!--
<info.nightscout.core.ui.elements.SingleClickButton
android:id="@+id/send_custom"
android:id="@+id/infos_custom"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/send_custom"
android:drawableTop="@drawable/ic_cwf_infos"
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:text="@string/wear_send_watchface"
android:textSize="11sp"
app:layout_column="1"
android:text="@string/wear_infos_watchface"
android:textSize="12sp"
android:textColor="?attr/treatmentButton"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_column="1"
app:layout_row="0" />
-->
<info.nightscout.core.ui.elements.SingleClickButton
android:id="@+id/export_custom"
style="@style/GrayButton"
@ -149,12 +151,13 @@
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:text="@string/wear_export_watchface"
android:textSize="11sp"
android:textSize="12sp"
android:textColor="?attr/treatmentButton"
android:visibility="visible"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="0"
app:layout_column="1" />
app:layout_row="1"
app:layout_column="0" />
<info.nightscout.core.ui.elements.SingleClickButton
android:id="@+id/default_custom"
@ -165,12 +168,13 @@
android:paddingStart="0dp"
android:paddingEnd="0dp"
android:text="@string/wear_default_watchface"
android:textSize="11sp"
android:textSize="12sp"
android:textColor="?attr/treatmentButton"
android:visibility="visible"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="1"
app:layout_column="0" />
app:layout_column="1" />
</androidx.gridlayout.widget.GridLayout>

View file

@ -360,11 +360,14 @@
<string name="wear_custom_watchface_authorization_summary">Authorize loaded custom watchface to change and lock some watch display settings to suit watchface design</string>
<string name="wear_custom_watchface">Custom Watchface: %1$s</string>
<string name="wear_load_watchface">Load Watchface</string>
<string name="wear_send_watchface">Send Watchface</string>
<string name="wear_infos_watchface">Infos Watchface</string>
<string name="wear_export_watchface">Export template</string>
<string name="wear_new_custom_watchface_exported">Custom watchface template exported</string>
<string name="resend_all_data">Resend All Data</string>
<string name="open_settings_on_wear">Open Settings on Wear</string>
<string name="cwf_infos_pref_locked">List of prefs locked by the Watchface</string>
<string name="cwf_infos_pref_requested">List of prefs requested by the Watchface</string>
<string name="cwf_infos_view_title">List of fields included into the Watchface</string>
<!-- PersistentNotification-->
<string name="ongoingnotificaction" translatable="false">Ongoing Notification</string>

View file

@ -496,7 +496,8 @@ class CustomWatchface : BaseWatchFace() {
SHOW_AGO(CwfMetadataKey.CWF_PREF_WATCH_SHOW_AGO.key, R.string.key_show_ago),
SHOW_BG(CwfMetadataKey.CWF_PREF_WATCH_SHOW_BG.key, R.string.key_show_bg),
SHOW_BGI(CwfMetadataKey.CWF_PREF_WATCH_SHOW_BGI.key, R.string.key_show_bgi),
SHOW_LOOP_STATUS(CwfMetadataKey.CWF_PREF_WATCH_SHOW_LOOP_STATUS.key, R.string.key_show_external_status)
SHOW_LOOP_STATUS(CwfMetadataKey.CWF_PREF_WATCH_SHOW_LOOP_STATUS.key, R.string.key_show_external_status),
SHOW_DATE(CwfMetadataKey.CWF_PREF_WATCH_SHOW_DATE.key, R.string.key_show_date)
}
}