mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-12 09:16:34 +02:00
Add preference for hiding Today and Goals charts legends
This commit is contained in:
parent
db8e1cb866
commit
b50c83c278
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user