Merge pull request #1082 from Andries-Smit/wear-charge-mode

Wear: add feature: simplified watch face during charging
This commit is contained in:
Milos Kozak 2021-12-30 18:59:54 +01:00 committed by GitHub
commit a3b8c12c27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 351 additions and 55 deletions

View file

@ -79,6 +79,9 @@
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter> </intent-filter>
</service> </service>
@ -100,6 +103,9 @@
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter> </intent-filter>
</service> </service>
@ -121,6 +127,9 @@
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter> </intent-filter>
</service> </service>
@ -142,6 +151,9 @@
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter> </intent-filter>
</service> </service>
@ -163,6 +175,9 @@
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter> </intent-filter>
</service> </service>
<service <service
@ -204,6 +219,9 @@
<intent-filter> <intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" /> <action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter> </intent-filter>
</service> </service>
@ -544,6 +562,7 @@
<action android:name="watch_face_configuration_largehome" /> <action android:name="watch_face_configuration_largehome" />
<action android:name="watch_face_configuration_nochart" /> <action android:name="watch_face_configuration_nochart" />
<action android:name="watch_face_configuration_steampunk" /> <action android:name="watch_face_configuration_steampunk" />
<category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" /> <category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>

View file

@ -34,7 +34,7 @@ public class SgvComplication extends BaseComplicationProviderService {
switch (dataType) { switch (dataType) {
case ComplicationData.TYPE_SHORT_TEXT: case ComplicationData.TYPE_SHORT_TEXT:
final ComplicationData.Builder builder = new ComplicationData.Builder(ComplicationData.TYPE_SHORT_TEXT) final ComplicationData.Builder builder = new ComplicationData.Builder(ComplicationData.TYPE_SHORT_TEXT)
.setShortText(ComplicationText.plainText(raw.sSgv + raw.sDirection)) .setShortText(ComplicationText.plainText(raw.sSgv + raw.sDirection + "\uFE0E"))
.setShortTitle(ComplicationText.plainText(displayFormat.shortTrend(raw))) .setShortTitle(ComplicationText.plainText(displayFormat.shortTrend(raw)))
.setTapAction(complicationPendingIntent); .setTapAction(complicationPendingIntent);

View file

@ -10,6 +10,7 @@ import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.BatteryManager;
import android.os.PowerManager; import android.os.PowerManager;
import android.os.Vibrator; import android.os.Vibrator;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
@ -25,6 +26,7 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.android.gms.wearable.DataMap; import com.google.android.gms.wearable.DataMap;
@ -40,7 +42,6 @@ import javax.inject.Inject;
import dagger.android.AndroidInjection; import dagger.android.AndroidInjection;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.complications.BaseComplicationProviderService;
import info.nightscout.androidaps.data.ListenerService; import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.data.RawDisplayData; import info.nightscout.androidaps.data.RawDisplayData;
import info.nightscout.androidaps.interaction.utils.Persistence; import info.nightscout.androidaps.interaction.utils.Persistence;
@ -59,7 +60,6 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
@Inject Persistence persistence; @Inject Persistence persistence;
public final static IntentFilter INTENT_FILTER; public final static IntentFilter INTENT_FILTER;
public static final long[] vibratePattern = {0, 400, 300, 400, 300, 400};
static { static {
INTENT_FILTER = new IntentFilter(); INTENT_FILTER = new IntentFilter();
@ -70,7 +70,9 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
public final Point displaySize = new Point(); public final Point displaySize = new Point();
public TextView mTime, mHour, mMinute, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mDayName, mMonth, isAAPSv2, mHighLight, mLowLight; public TextView mTime, mHour, mMinute, mSgv, mDirection, mTimestamp, mUploaderBattery, mRigBattery, mDelta, mAvgDelta, mStatus, mBasalRate, mIOB1, mIOB2, mCOB1, mCOB2, mBgi, mLoop, mDay, mDayName, mMonth, isAAPSv2, mHighLight, mLowLight;
public TextView mSimpleSvg, mSimpleDirection, mSimpleTime;
public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand; public ImageView mGlucoseDial, mDeltaGauge, mHourHand, mMinuteHand;
public View mSimpleUi;
public RelativeLayout mRelativeLayout; public RelativeLayout mRelativeLayout;
public LinearLayout mLinearLayout, mLinearLayout2, mDate, mChartTap, mMainMenuTap; public LinearLayout mLinearLayout, mLinearLayout2, mDate, mChartTap, mMainMenuTap;
public int ageLevel = 1; public int ageLevel = 1;
@ -100,6 +102,8 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
protected SharedPreferences sharedPrefs; protected SharedPreferences sharedPrefs;
private LocalBroadcastManager localBroadcastManager; private LocalBroadcastManager localBroadcastManager;
private MessageReceiver messageReceiver; private MessageReceiver messageReceiver;
private BroadcastReceiver batteryReceiver;
protected boolean isCharging = false;
@Override @Override
public void onCreate() { public void onCreate() {
@ -121,6 +125,26 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
sharedPrefs.registerOnSharedPreferenceChangeListener(this); sharedPrefs.registerOnSharedPreferenceChangeListener(this);
persistence.turnOff(); persistence.turnOff();
setupBatteryReceiver();
}
private void setupBatteryReceiver() {
if (sharedPrefs.getBoolean("simplify_ui_charging", false)) {
IntentFilter intentBatteryFilter = new IntentFilter();
intentBatteryFilter.addAction(BatteryManager.ACTION_CHARGING);
intentBatteryFilter.addAction(BatteryManager.ACTION_DISCHARGING);
isCharging = checkIsCharging();
batteryReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
isCharging = checkIsCharging();
setDataFields();
invalidate();
}
};
registerReceiver(batteryReceiver, intentBatteryFilter);
}
} }
@Override @Override
@ -176,8 +200,11 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
mChartTap = stub.findViewById(R.id.chart_zoom_tap); mChartTap = stub.findViewById(R.id.chart_zoom_tap);
mMainMenuTap = stub.findViewById(R.id.main_menu_tap); mMainMenuTap = stub.findViewById(R.id.main_menu_tap);
chart = stub.findViewById(R.id.chart); chart = stub.findViewById(R.id.chart);
mSimpleUi = stub.findViewById(R.id.simple_ui);
mSimpleSvg = stub.findViewById(R.id.simple_sgv);
mSimpleDirection = stub.findViewById(R.id.simple_direction);
mSimpleTime = stub.findViewById(R.id.simple_watch_time);
layoutSet = true; layoutSet = true;
setDataFields(); setDataFields();
setColor(); setColor();
} }
@ -217,6 +244,9 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
if (sharedPrefs != null) { if (sharedPrefs != null) {
sharedPrefs.unregisterOnSharedPreferenceChangeListener(this); sharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
} }
if (batteryReceiver != null) {
unregisterReceiver(batteryReceiver);
}
super.onDestroy(); super.onDestroy();
} }
@ -256,8 +286,16 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
} }
} }
private boolean checkIsCharging() {
IntentFilter iFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatus = this.registerReceiver(null, iFilter);
int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
return status == BatteryManager.BATTERY_STATUS_CHARGING ||
status == BatteryManager.BATTERY_STATUS_FULL;
}
private void checkVibrateHourly(WatchFaceTime oldTime, WatchFaceTime newTime) { private void checkVibrateHourly(WatchFaceTime oldTime, WatchFaceTime newTime) {
Boolean hourlyVibratePref = sharedPrefs.getBoolean("vibrate_Hourly", false); boolean hourlyVibratePref = sharedPrefs.getBoolean("vibrate_Hourly", false);
if (hourlyVibratePref && layoutSet && newTime.hasHourChanged(oldTime)) { if (hourlyVibratePref && layoutSet && newTime.hasHourChanged(oldTime)) {
Log.i("hourlyVibratePref", "true --> " + newTime.toString()); Log.i("hourlyVibratePref", "true --> " + newTime.toString());
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
@ -285,7 +323,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
if (mDirection != null) { if (mDirection != null) {
if (sharedPrefs.getBoolean("show_direction", true)) { if (sharedPrefs.getBoolean("show_direction", true)) {
mDirection.setText(rawData.sDirection); mDirection.setText(rawData.sDirection+"\uFE0E");
mDirection.setVisibility(View.VISIBLE); mDirection.setVisibility(View.VISIBLE);
} else { } else {
mDirection.setVisibility(View.GONE); mDirection.setVisibility(View.GONE);
@ -448,6 +486,37 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
mLoop.setVisibility(View.GONE); mLoop.setVisibility(View.GONE);
} }
} }
setDataFieldsSimpleUi();
}
void setDataFieldsSimpleUi() {
if (sharedPrefs.getBoolean("simplify_ui_charging", false) && isCharging) {
mSimpleUi.setVisibility(View.VISIBLE);
mSimpleSvg.setText(rawData.sSgv);
if (ageLevel() <= 0) {
mSimpleSvg.setPaintFlags(mSimpleSvg.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
} else {
mSimpleSvg.setPaintFlags(mSimpleSvg.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
}
if (rawData.sgvLevel == 1) {
mSimpleSvg.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
mSimpleDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor));
} else if (rawData.sgvLevel == 0) {
mSimpleSvg.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mSimpleDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
} else if (rawData.sgvLevel == -1) {
mSimpleSvg.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
mSimpleDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_lowColor));
}
mSimpleDirection.setText(rawData.sDirection+"\uFE0E");
final java.text.DateFormat timeFormat = DateFormat.getTimeFormat(BaseWatchFace.this);
mSimpleTime.setText(timeFormat.format(System.currentTimeMillis()));
} else {
mSimpleUi.setVisibility(View.GONE);
}
} }
public void setDateAndTime() { public void setDateAndTime() {
@ -526,7 +595,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
@Override @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
setupBatteryReceiver();
if ("delta_granularity".equals(key)) { if ("delta_granularity".equals(key)) {
ListenerService.requestData(this); ListenerService.requestData(this);
} }

View file

@ -2,8 +2,10 @@ package info.nightscout.androidaps.watchfaces;
import android.content.Intent; import android.content.Intent;
import android.graphics.Color; import android.graphics.Color;
import androidx.annotation.ColorInt; import androidx.annotation.ColorInt;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import android.support.wearable.watchface.WatchFaceStyle; import android.support.wearable.watchface.WatchFaceStyle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -22,29 +24,30 @@ public class Home2 extends BaseWatchFace {
super.onCreate(); super.onCreate();
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE); LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
layoutView = inflater.inflate(R.layout.activity_home_2, null); layoutView = inflater.inflate(R.layout.activity_home_2, null);
performViewSetup(); performViewSetup();
} }
@Override @Override
protected void onTapCommand(int tapType, int x, int y, long eventTime) { protected void onTapCommand(int tapType, int x, int y, long eventTime) {
int extra = mSgv!=null?(mSgv.getRight() - mSgv.getLeft())/2:0; int extra = mSgv != null ? (mSgv.getRight() - mSgv.getLeft()) / 2 : 0;
if (tapType == TAP_TYPE_TAP&& if (tapType == TAP_TYPE_TAP &&
x >=chart.getLeft() && x >= chart.getLeft() &&
x <= chart.getRight()&& x <= chart.getRight() &&
y >= chart.getTop() && y >= chart.getTop() &&
y <= chart.getBottom()){ y <= chart.getBottom()) {
if (eventTime - chartTapTime < 800){ if (eventTime - chartTapTime < 800) {
changeChartTimeframe(); changeChartTimeframe();
} }
chartTapTime = eventTime; chartTapTime = eventTime;
} else if (tapType == TAP_TYPE_TAP&& } else if (tapType == TAP_TYPE_TAP &&
x + extra >=mSgv.getLeft() && x + extra >= mSgv.getLeft() &&
x - extra <= mSgv.getRight()&& x - extra <= mSgv.getRight() &&
y >= mSgv.getTop() && y >= mSgv.getTop() &&
y <= mSgv.getBottom()){ y <= mSgv.getBottom()) {
if (eventTime - sgvTapTime < 800){ if (eventTime - sgvTapTime < 800) {
Intent intent = new Intent(this, MainMenuActivity.class); Intent intent = new Intent(this, MainMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent); startActivity(intent);
@ -55,12 +58,12 @@ public class Home2 extends BaseWatchFace {
private void changeChartTimeframe() { private void changeChartTimeframe() {
int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3")); int timeframe = Integer.parseInt(sharedPrefs.getString("chart_timeframe", "3"));
timeframe = (timeframe%5) + 1; timeframe = (timeframe % 5) + 1;
sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).apply(); sharedPrefs.edit().putString("chart_timeframe", "" + timeframe).apply();
} }
@Override @Override
protected WatchFaceStyle getWatchFaceStyle(){ protected WatchFaceStyle getWatchFaceStyle() {
return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build(); return new WatchFaceStyle.Builder(this).setAcceptsTapEvents(true).build();
} }
@ -257,4 +260,5 @@ public class Home2 extends BaseWatchFace {
} }
} }
} }
} }

View file

@ -317,19 +317,21 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textFontWeight="400" android:textFontWeight="400"
android:textSize="18sp" /> android:textSize="18sp" />
<TextView <TextView
android:id="@+id/weeknumber" android:id="@+id/weeknumber"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="4" android:layout_weight="4"
android:fontFamily="@font/roboto_condensed_light" android:fontFamily="@font/roboto_condensed_light"
android:letterSpacing="-0.1"
android:text="ww" android:text="ww"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="@color/light_grey" android:textColor="@color/light_grey"
android:textFontWeight="400" android:textFontWeight="400"
android:textSize="18sp" android:textSize="18sp"
android:letterSpacing="-0.1" android:visibility="gone" />
android:visibility="gone"/>
<Space <Space
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -529,6 +531,7 @@
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal|top" /> android:gravity="center_horizontal|top" />
</LinearLayout> </LinearLayout>
<!-- right side bottom - spacer 2/10 --> <!-- right side bottom - spacer 2/10 -->
@ -540,6 +543,10 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
<!-- FLAGs --> <!-- FLAGs -->

View file

@ -154,4 +154,9 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent" tools:context=".watchfaces.Home2" tools:deviceIds="wear_square" android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black" android:background="@color/black"
android:id="@+id/main_layout"> tools:context=".watchfaces.Home2"
tools:deviceIds="wear_square">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -13,6 +16,7 @@
android:weightSum="1"> android:weightSum="1">
<LinearLayout <LinearLayout
android:id="@+id/primary_layout"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="0px" android:layout_height="0px"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
@ -42,8 +46,8 @@
android:layout_marginBottom="-2dp" android:layout_marginBottom="-2dp"
android:gravity="bottom|right" android:gravity="bottom|right"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="-2dp" android:paddingTop="-2dp"
android:paddingRight="5dp"
android:text="---" android:text="---"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="38sp" /> android:textSize="38sp" />
@ -101,8 +105,8 @@
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingEnd="2dp"
android:paddingStart="2dp" android:paddingStart="2dp"
android:paddingEnd="2dp"
android:textAlignment="center"> android:textAlignment="center">
<TextView <TextView
@ -271,7 +275,7 @@
android:text="12:00" android:text="12:00"
android:textAlignment="center" android:textAlignment="center"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="26sp" /> android:textSize="30sp" />
<LinearLayout <LinearLayout
android:id="@+id/date_time" android:id="@+id/date_time"
@ -366,4 +370,9 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -136,4 +136,9 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -488,4 +488,9 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -378,4 +378,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"/> android:visibility="gone"/>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -121,6 +121,7 @@
<!-- 1st line with direction and timestamp--> <!-- 1st line with direction and timestamp-->
<LinearLayout <LinearLayout
android:id="@+id/directionLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
@ -317,19 +318,21 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textFontWeight="400" android:textFontWeight="400"
android:textSize="18sp" /> android:textSize="18sp" />
<TextView <TextView
android:id="@+id/weeknumber" android:id="@+id/weeknumber"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="4" android:layout_weight="4"
android:fontFamily="@font/roboto_condensed_light" android:fontFamily="@font/roboto_condensed_light"
android:letterSpacing="-0.1"
android:text="ww" android:text="ww"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="@color/light_grey" android:textColor="@color/light_grey"
android:textFontWeight="400" android:textFontWeight="400"
android:textSize="18sp" android:textSize="18sp"
android:letterSpacing="-0.1" android:visibility="gone" />
android:visibility="gone"/>
<Space <Space
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -426,12 +429,12 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_weight="1" android:layout_weight="1"
android:baselineAligned="false" android:baselineAligned="false"
android:gravity="left|top" android:gravity="left|top"
android:orientation="vertical" android:orientation="vertical"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:weightSum="10"> android:weightSum="10">
<!-- right side bottom - statusbar 2/10 --> <!-- right side bottom - statusbar 2/10 -->
@ -529,6 +532,7 @@
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center_horizontal|top" /> android:gravity="center_horizontal|top" />
</LinearLayout> </LinearLayout>
<!-- right side bottom - spacer 2/10 --> <!-- right side bottom - spacer 2/10 -->
@ -541,7 +545,10 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
<!-- FLAGs --> <!-- FLAGs -->
<TextView <TextView

View file

@ -152,4 +152,9 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -1,9 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent" tools:context=".watchfaces.Home2" tools:deviceIds="wear_round" android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black" android:background="@color/black"
android:id="@+id/main_layout"> tools:context=".watchfaces.Home2"
tools:deviceIds="wear_round">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -15,11 +18,11 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0px" android:layout_height="0px"
android:orientation="vertical" android:layout_weight="0.05"
android:layout_weight="0.05"> android:orientation="vertical" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/primary_layout"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="0px" android:layout_height="0px"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
@ -49,8 +52,8 @@
android:layout_marginBottom="-2dp" android:layout_marginBottom="-2dp"
android:gravity="bottom|right" android:gravity="bottom|right"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="-2dp" android:paddingTop="-2dp"
android:paddingRight="5dp"
android:text="---" android:text="---"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="38sp" /> android:textSize="38sp" />
@ -109,8 +112,8 @@
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingEnd="5dp"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingEnd="5dp"
android:textAlignment="center"> android:textAlignment="center">
<TextView <TextView
@ -375,10 +378,14 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0px" android:layout_height="0px"
android:orientation="vertical" android:layout_weight="0.05"
android:layout_weight="0.05"> android:orientation="vertical" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -135,4 +135,9 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -488,4 +488,9 @@
</LinearLayout> </LinearLayout>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -378,4 +378,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone"/> android:visibility="gone"/>
<include
android:id="@+id/simple_ui"
layout="@layout/simple_ui"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black"
android:orientation="vertical"
android:weightSum="100">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="50"
android:gravity="center_horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="5dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:textAlignment="center">
<TextView
android:id="@+id/simple_sgv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="-2dp"
android:gravity="bottom|end"
android:text="---"
android:textColor="@color/white"
android:textSize="50sp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_horizontal"
android:baselineAligned="false"
android:gravity="center_horizontal"
android:orientation="vertical"
android:textAlignment="center"
android:weightSum="1">
<TextView
android:id="@+id/simple_direction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginTop="-2dp"
android:layout_marginBottom="-5dp"
android:gravity="center_horizontal|bottom"
android:text="--"
android:textColor="@color/white"
android:textSize="35sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="50"
android:gravity="center_horizontal">
<TextView
android:id="@+id/simple_watch_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:layout_marginTop="5dp"
android:text="12:00"
android:textColor="#FFFFFF"
android:textSize="35sp" />
</LinearLayout>
</LinearLayout>

View file

@ -136,6 +136,8 @@
<string name="color_name_white">white</string> <string name="color_name_white">white</string>
<string name="color_name_black">black</string> <string name="color_name_black">black</string>
<string name="color_name_multicolor">multicolor</string> <string name="color_name_multicolor">multicolor</string>
<string name="pref_simplify_ui_charging">Simplify Charging UI</string>
<string name="pref_simplify_ui_charging_sum">Only show time and BG when charging</string>
<string name="pref_vibrate_hourly">Vibrate hourly</string> <string name="pref_vibrate_hourly">Vibrate hourly</string>

View file

@ -2,13 +2,19 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<CheckBoxPreference <CheckBoxPreference
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false" android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="simplify_ui_charging"
android:summary="@string/pref_simplify_ui_charging_sum"
android:title="@string/pref_simplify_ui_charging"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -50,4 +50,13 @@
android:defaultValue="false" android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="simplify_ui_charging"
android:summary="@string/pref_simplify_ui_charging_sum"
android:title="@string/pref_simplify_ui_charging"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -24,4 +24,13 @@
android:defaultValue="false" android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="simplify_ui_charging"
android:summary="@string/pref_simplify_ui_charging_sum"
android:title="@string/pref_simplify_ui_charging"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -8,7 +8,7 @@
android:summary="Dark theme" android:summary="Dark theme"
android:title="@string/pref_dark" android:title="@string/pref_dark"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
@ -16,7 +16,7 @@
android:summary="Status bar divider background matches watchface background" android:summary="Status bar divider background matches watchface background"
android:title="@string/pref_matching_divider" android:title="@string/pref_matching_divider"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
@ -26,9 +26,18 @@
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false"
android:key="vibrate_Hourly" android:key="vibrate_Hourly"
android:title="@string/pref_vibrate_hourly" android:title="@string/pref_vibrate_hourly"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="simplify_ui_charging"
android:summary="@string/pref_simplify_ui_charging_sum"
android:title="@string/pref_simplify_ui_charging"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -24,4 +24,13 @@
android:defaultValue="false" android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="simplify_ui_charging"
android:summary="@string/pref_simplify_ui_charging_sum"
android:title="@string/pref_simplify_ui_charging"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -16,4 +16,13 @@
android:defaultValue="false" android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off" app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" /> app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:defaultValue="false"
android:key="simplify_ui_charging"
android:summary="@string/pref_simplify_ui_charging_sum"
android:title="@string/pref_simplify_ui_charging"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
</PreferenceScreen> </PreferenceScreen>