Show week number, when torn on in watchface setting menu.

This commit is contained in:
rICTx-T1D 2020-10-08 22:25:18 +02:00 committed by mh
parent 6bd7bf65a8
commit 92570ae098
5 changed files with 63 additions and 2 deletions

View file

@ -14,6 +14,10 @@ import androidx.core.content.ContextCompat;
import com.ustwo.clockwise.common.WatchFaceTime;
import com.ustwo.clockwise.common.WatchMode;
import java.text.SimpleDateFormat;
import java.util.Date;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interaction.menus.MainMenuActivity;
@ -149,8 +153,21 @@ public class RICTxWF01 extends BaseWatchFace {
mMinute.setTextSize(26);
mHour.setLetterSpacing((float) 0);
mMinute.setLetterSpacing((float) 0);
/* display week number */
Boolean isShowWeekNumber = sharedPrefs.getBoolean("show_weeknumber", false);
Log.i("---------------------------------","weeknumber refresh ");
TextView mWeekNumber= layoutView.findViewById(R.id.weeknumber);
if (isShowWeekNumber) {
mWeekNumber.setVisibility(View.VISIBLE);
mWeekNumber.setText("(" + (new SimpleDateFormat("ww")).format(new Date()) + ")");
} else {
mWeekNumber.setVisibility(View.GONE);
mWeekNumber.setText("");
}
}
/* @ToDo optimize font-size --> when direction and time-ago is off, increase font-size of sgv */
}

View file

@ -308,14 +308,32 @@
<TextView
android:id="@+id/dayname"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:fontFamily="@font/roboto_condensed_regular"
android:text="DDD"
android:textAllCaps="true"
android:textColor="@color/white"
android:textFontWeight="400"
android:textSize="18sp" />
<TextView
android:id="@+id/weeknumber"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:fontFamily="@font/roboto_condensed_light"
android:text="ww"
android:textAllCaps="true"
android:textColor="@color/light_grey"
android:textFontWeight="400"
android:textSize="18sp"
android:letterSpacing="-0.1"
android:visibility="gone"/>
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" />
</LinearLayout>
<!-- day number + month (short)-->

View file

@ -308,14 +308,32 @@
<TextView
android:id="@+id/dayname"
android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:fontFamily="@font/roboto_condensed_regular"
android:text="DDD"
android:textAllCaps="true"
android:textColor="@color/white"
android:textFontWeight="400"
android:textSize="18sp" />
<TextView
android:id="@+id/weeknumber"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:fontFamily="@font/roboto_condensed_light"
android:text="ww"
android:textAllCaps="true"
android:textColor="@color/light_grey"
android:textFontWeight="400"
android:textSize="18sp"
android:letterSpacing="-0.1"
android:visibility="gone"/>
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" />
</LinearLayout>
<!-- day number + month (short)-->

View file

@ -152,5 +152,6 @@
<string name="pref_choose_your_color">Choose your color</string>
<string name="pref_choose_your_color_saturation">Choose your color saturation</string>
<string name="pref_vibrate_hourly">vibrate hourly</string>
<string name="pref_show_weeknumber">Show Week number</string>
</resources>

View file

@ -30,6 +30,13 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:key="show_weeknumber"
android:title="@string/pref_show_weeknumber"
android:defaultValue="false"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on" />
<CheckBoxPreference
android:key="rictxwf01_vibrateHourly"
android:title="@string/pref_vibrate_hourly"