add preference

pull/646/head
asdoi 5 years ago
parent a676bc052c
commit a59321e03e

@ -110,6 +110,8 @@ class HabitCardView(
private var scoreText: TextView
private var streakText: TextView
private val showScoreText = true //Use value from Preferences.getScoreAsText()
init {
scoreRing = RingView(context).apply {
val thickness = dp(3f)
@ -172,9 +174,11 @@ class HabitCardView(
layoutParams = LinearLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT)
if (SDK_INT >= LOLLIPOP) elevation = dp(1f)
addView(scoreRing)
addView(scoreText)
addView(streakText)
if (showScoreText) {
addView(scoreText)
addView(streakText)
} else
addView(scoreRing)
addView(label)
addView(checkmarkPanel)
addView(numberPanel)

@ -129,6 +129,8 @@
<string name="interface_preferences">Interface</string>
<string name="reverse_days">Reverse order of days</string>
<string name="reverse_days_description">Show days in reverse order on the main screen.</string>
<string name="score_text">Show score as text</string>
<string name="score_text_description">Show the score as text instead of a circle. Furthermore the current streak is displayed next to the score.</string>
<string name="day">Day</string>
<string name="week">Week</string>
<string name="month">Month</string>

@ -38,6 +38,12 @@
android:title="@string/reverse_days"
app:iconSpaceReserved="false" />
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_show_text_instead_of_circle"
android:summary="@string/score_text_description"
android:title="@string/score_text"
app:iconSpaceReserved="false" />
<CheckBoxPreference
android:defaultValue="false"

@ -338,6 +338,11 @@ public class Preferences
storage.putString("pref_widget_opacity", Integer.toString(value));
}
public boolean getScoreAsText()
{
return storage.getBoolean("pref_show_text_instead_of_circle", false);
}
/**
* @return An integer representing the first day of the week. Sunday

Loading…
Cancel
Save