1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +01:00

Make number of not scrollable Sleep sessions lines configurable. Finalmente risolto.

This commit is contained in:
vanous 2022-10-13 21:25:12 +02:00
parent 6f01dd6514
commit c59249f8d1
6 changed files with 12 additions and 4 deletions

View File

@ -60,6 +60,7 @@ public class ChartsPreferencesActivity extends AbstractSettingsActivity {
"chart_list_min_steps_per_minute_for_run",
GBPrefs.CHART_MAX_HEART_RATE,
GBPrefs.CHART_MIN_HEART_RATE,
"chart_sleep_lines_limit",
};
}

View File

@ -50,7 +50,6 @@ import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@ -90,7 +89,8 @@ public class SleepChartFragment extends AbstractChartFragment {
private int mSmartAlarmGoneOff = -1;
Prefs prefs = GBApplication.getPrefs();
private boolean CHARTS_SLEEP_RANGE_24H = prefs.getBoolean("chart_sleep_range_24h", false);
private boolean SHOW_CHARTS_AVERAGE = GBApplication.getPrefs().getBoolean("charts_show_average", true);
private boolean SHOW_CHARTS_AVERAGE = prefs.getBoolean("charts_show_average", true);
private int sleepLinesLimit = prefs.getInt("chart_sleep_lines_limit", 6);
@Override
@ -334,6 +334,7 @@ public class SleepChartFragment extends AbstractChartFragment {
ConstraintLayout intensityTotalWidgetLayout = rootView.findViewById(R.id.intensity_widget_layout);
ConstraintLayout heartRateWidgetLayout = rootView.findViewById(R.id.heartrate_widget_layout);
mSleepchartInfo.setMaxLines(sleepLinesLimit);
View.OnClickListener listener = new View.OnClickListener() {
@Override

View File

@ -15,7 +15,6 @@
android:id="@+id/sleepchart_info"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:maxLines="3"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarFadeDuration="0"
android:layout_weight="90" />

View File

@ -15,7 +15,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:maxLines="3"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarFadeDuration="0"
android:scrollbars="vertical" />

View File

@ -873,6 +873,7 @@
<string name="activity_prefs_chart_max_heart_rate">Max heart rate</string>
<string name="activity_prefs_chart_min_heart_rate">Min heart rate</string>
<string name="pref_title_charts_range">Charts Range</string>
<string name="pref_chart_sleep_lines_limit">How many sleep session lines to show before scrolling them</string>
<string name="pref_charts_range_on">Charts range is set to a Month</string>
<string name="pref_charts_range_off">Charts range is set to a Week</string>
<string name="pref_chart_heartrate_color_red">Red</string>

View File

@ -54,6 +54,13 @@
android:key="charts_show_ongoing_activity"
android:title="@string/show_ongoing_activity" />
<EditTextPreference
android:defaultValue="6"
android:inputType="number"
android:key="chart_sleep_lines_limit"
android:maxLength="2"
android:title="@string/pref_chart_sleep_lines_limit" />
</PreferenceCategory>
<PreferenceCategory