Make question marks optional

Fixes #96
pull/699/head
Alinson S. Xavier 5 years ago
parent 2228dbf0f4
commit aa288ac406

@ -114,7 +114,10 @@ class CheckmarkButtonView(
val id = when (value) {
SKIP -> R.string.fa_skipped
NO -> R.string.fa_times
UNKNOWN -> R.string.fa_question
UNKNOWN -> {
if(preferences.areQuestionMarksEnabled()) R.string.fa_question
else R.string.fa_times
}
else -> R.string.fa_check
}
val label = resources.getString(id)

@ -31,6 +31,7 @@ import org.isoron.uhabits.*;
import org.isoron.uhabits.activities.habits.list.views.*;
import org.isoron.uhabits.core.models.*;
import org.isoron.uhabits.activities.common.views.*;
import org.isoron.uhabits.core.preferences.*;
import org.isoron.uhabits.utils.*;
import static org.isoron.androidbase.utils.InterfaceUtils.getDimension;
@ -53,6 +54,8 @@ public class CheckmarkWidgetView extends HabitWidgetView {
protected boolean isNumerical;
private Preferences preferences;
public CheckmarkWidgetView(Context context)
{
super(context);
@ -121,7 +124,12 @@ public class CheckmarkWidgetView extends HabitWidgetView {
case Checkmark.SKIP:
return getResources().getString(R.string.fa_skipped);
case Checkmark.UNKNOWN:
{
if (preferences.areQuestionMarksEnabled())
return getResources().getString(R.string.fa_question);
else
getResources().getString(R.string.fa_times);
}
case Checkmark.NO:
default:
return getResources().getString(R.string.fa_times);
@ -196,6 +204,10 @@ public class CheckmarkWidgetView extends HabitWidgetView {
private void init()
{
HabitsApplicationComponent appComponent;
appComponent = (HabitsApplicationComponent) getContext().getApplicationContext();
preferences = appComponent.getPreferences();
ring = (RingView) findViewById(R.id.scoreRing);
label = (TextView) findViewById(R.id.label);

@ -203,4 +203,6 @@
<string name="decrement">Decrement</string>
<string name="pref_skip_title">Enable skip days</string>
<string name="pref_skip_description">Toggle twice to add a skip instead of a checkmark. Skips keep your score unchanged and don\'t break your streak.</string>
<string name="pref_unknown_title">Show question marks for missing data</string>
<string name="pref_unknown_description">Differentiate days without data from actual lapses. To enter a lapse, toggle twice.</string>
</resources>

@ -38,6 +38,13 @@
android:title="@string/pref_skip_title"
app:iconSpaceReserved="false" />
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_unknown_enabled"
android:summary="@string/pref_unknown_description"
android:title="@string/pref_unknown_title"
app:iconSpaceReserved="false" />
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_checkmark_reverse_order"

@ -367,6 +367,10 @@ public class Preferences
storage.putBoolean("pref_skip_enabled", value);
}
public boolean areQuestionMarksEnabled()
{
return storage.getBoolean("pref_unknown_enabled", false);
}
/**
* @return An integer representing the first day of the week. Sunday

Loading…
Cancel
Save