Wear: remove tile debug log
This commit is contained in:
parent
ee27b07377
commit
ad95626619
3 changed files with 3 additions and 21 deletions
|
@ -558,15 +558,4 @@
|
||||||
<item quantity="other">%1$d minutes</item>
|
<item quantity="other">%1$d minutes</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
|
|
||||||
<!-- WEAR OS-->
|
|
||||||
<string name="wear_action_tempt_preset_error">Temptarget unknown preset: %1$s</string>
|
|
||||||
<string name="wear_action_tempt_cancel_message">Cancelling running Temp-Targets?</string>
|
|
||||||
<string name="wear_action_tempt_unit_error">Different units used on watch and phone!</string>
|
|
||||||
<string name="wear_action_tempt_zero_message">Zero-Temp-Target - cancelling running Temp-Targets?</string>
|
|
||||||
<string name="wear_action_tempt_min_bg_error">Min-BG out of range!</string>
|
|
||||||
<string name="wear_action_tempt_max_bg_error">Max-BG out of range!</string>
|
|
||||||
<string name="wear_action_tempt_manual_range_message">Temptarget:\nMin: %1$s\nMax: %2$s\nDuration: %3$s</string>
|
|
||||||
<string name="wear_action_tempt_manual_message">Temptarget:\nTarget: %1$s\nDuration: %2$s</string>
|
|
||||||
<string name="wear_action_tempt_preset_message">Temptarget:\Reason: %1$s\nTarget: %2$s\nDuration: %3$s</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -4,7 +4,6 @@ import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.wearable.view.GridPagerAdapter;
|
import android.support.wearable.view.GridPagerAdapter;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -48,7 +47,6 @@ public class TempTargetActivity extends ViewSelectorActivity {
|
||||||
String actionString = extras.getString("actionString", "");
|
String actionString = extras.getString("actionString", "");
|
||||||
boolean inBackground = extras.getBoolean("inBackground", false);
|
boolean inBackground = extras.getBoolean("inBackground", false);
|
||||||
if (inBackground) {
|
if (inBackground) {
|
||||||
Log.i("ASTAG", "TempTargetActivity.onCreate: " + actionString);
|
|
||||||
ListenerService.initiateAction(this, actionString);
|
ListenerService.initiateAction(this, actionString);
|
||||||
confirmAction(this, R.string.action_tempt_confirmation);
|
confirmAction(this, R.string.action_tempt_confirmation);
|
||||||
finishAffinity();
|
finishAffinity();
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package info.nightscout.androidaps.tile
|
package info.nightscout.androidaps.tile
|
||||||
|
|
||||||
import android.util.Log
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
|
@ -80,7 +79,6 @@ abstract class TileBase : TileService() {
|
||||||
override fun onTileRequest(
|
override fun onTileRequest(
|
||||||
requestParams: RequestBuilders.TileRequest
|
requestParams: RequestBuilders.TileRequest
|
||||||
): ListenableFuture<Tile> = serviceScope.future {
|
): ListenableFuture<Tile> = serviceScope.future {
|
||||||
Log.i(TAG, "onTileRequest: ")
|
|
||||||
val actionsSelected = getSelectedActions()
|
val actionsSelected = getSelectedActions()
|
||||||
val wearControl = getWearControl()
|
val wearControl = getWearControl()
|
||||||
|
|
||||||
|
@ -99,7 +97,6 @@ abstract class TileBase : TileService() {
|
||||||
override fun onResourcesRequest(
|
override fun onResourcesRequest(
|
||||||
requestParams: ResourcesRequest
|
requestParams: ResourcesRequest
|
||||||
): ListenableFuture<Resources> = serviceScope.future {
|
): ListenableFuture<Resources> = serviceScope.future {
|
||||||
Log.i(TAG, "onResourcesRequest: ")
|
|
||||||
Resources.Builder()
|
Resources.Builder()
|
||||||
.setVersion(resourceVersion)
|
.setVersion(resourceVersion)
|
||||||
.apply {
|
.apply {
|
||||||
|
@ -232,7 +229,9 @@ abstract class TileBase : TileService() {
|
||||||
|
|
||||||
private fun getWearControl(): WearControl {
|
private fun getWearControl(): WearControl {
|
||||||
val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this)
|
val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this)
|
||||||
if (!sharedPrefs.contains("wearcontrol")) return WearControl.NO_DATA;
|
if (!sharedPrefs.contains("wearcontrol")) {
|
||||||
|
return WearControl.NO_DATA
|
||||||
|
}
|
||||||
val wearControlPref = sharedPrefs.getBoolean("wearcontrol", false)
|
val wearControlPref = sharedPrefs.getBoolean("wearcontrol", false)
|
||||||
if (wearControlPref) {
|
if (wearControlPref) {
|
||||||
return WearControl.ENABLED
|
return WearControl.ENABLED
|
||||||
|
@ -251,9 +250,7 @@ abstract class TileBase : TileService() {
|
||||||
actionList.add(action)
|
actionList.add(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.i(TAG, this::class.java.name + ".getSelectedActions: " + actionList.size + " " + actionList.toString())
|
|
||||||
if (actionList.isEmpty()) {
|
if (actionList.isEmpty()) {
|
||||||
Log.i(TAG, "getSelectedActions: default")
|
|
||||||
return source.getActions().take(4)
|
return source.getActions().take(4)
|
||||||
}
|
}
|
||||||
return actionList
|
return actionList
|
||||||
|
@ -268,10 +265,8 @@ abstract class TileBase : TileService() {
|
||||||
val defaults = source.getDefaultConfig()
|
val defaults = source.getDefaultConfig()
|
||||||
val firstKey = defaults.firstNotNullOf { settings -> settings.key }
|
val firstKey = defaults.firstNotNullOf { settings -> settings.key }
|
||||||
if (!sharedPrefs.contains(firstKey)) {
|
if (!sharedPrefs.contains(firstKey)) {
|
||||||
Log.i(TAG, "setDefaultSettings: set defaults")
|
|
||||||
val editor = sharedPrefs.edit()
|
val editor = sharedPrefs.edit()
|
||||||
for ((key, value) in defaults) {
|
for ((key, value) in defaults) {
|
||||||
// println("$key = $value")
|
|
||||||
editor.putString(key, value)
|
editor.putString(key, value)
|
||||||
}
|
}
|
||||||
editor.apply()
|
editor.apply()
|
||||||
|
|
Loading…
Reference in a new issue