1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-19 00:19:25 +01:00

Add preference for hiding Today and Goals charts legends

This commit is contained in:
Arjan Schrijver 2024-02-22 15:35:39 +01:00
parent db8e1cb866
commit b50c83c278
3 changed files with 19 additions and 0 deletions

View File

@ -34,8 +34,10 @@ import android.widget.TextView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.DashboardFragment;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
/**
* A simple {@link AbstractDashboardWidget} subclass.
@ -84,6 +86,9 @@ public class DashboardGoalsWidget extends AbstractDashboardWidget {
SpannableStringBuilder legendBuilder = new SpannableStringBuilder();
legend.setText(legendBuilder.append(l_steps).append(" ").append(l_distance).append("\n").append(l_active_time).append(" ").append(l_sleep));
Prefs prefs = GBApplication.getPrefs();
legend.setVisibility(prefs.getBoolean("dashboard_widget_goals_legend", true) ? View.VISIBLE : View.GONE);
fillData();
return goalsView;

View File

@ -113,6 +113,8 @@ public class DashboardTodayWidget extends AbstractDashboardWidget {
SpannableStringBuilder legendBuilder = new SpannableStringBuilder();
legend.setText(legendBuilder.append(l_not_worn).append(" ").append(l_worn).append(" ").append(l_activity).append("\n").append(l_light_sleep).append(" ").append(l_deep_sleep));
legend.setVisibility(prefs.getBoolean("dashboard_widget_today_legend", true) ? View.VISIBLE : View.GONE);
fillData();
return todayView;

View File

@ -109,6 +109,12 @@
android:layout="@layout/preference_checkbox"
android:title="Double size"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="dashboard_widget_today_legend"
android:layout="@layout/preference_checkbox"
android:title="Show legend"
app:iconSpaceReserved="false" />
</PreferenceScreen>
<PreferenceScreen
android:key="pref_key_dashboard_goals"
@ -126,6 +132,12 @@
android:layout="@layout/preference_checkbox"
android:title="Double size"
app:iconSpaceReserved="false" />
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="dashboard_widget_goals_legend"
android:layout="@layout/preference_checkbox"
android:title="Show legend"
app:iconSpaceReserved="false" />
</PreferenceScreen>
<SwitchPreferenceCompat
android:defaultValue="true"