mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
Split preferences, add chart settings activity, add button
This commit is contained in:
parent
194f5b04ae
commit
132e92041e
@ -60,6 +60,10 @@
|
|||||||
android:name=".activities.SettingsActivity"
|
android:name=".activities.SettingsActivity"
|
||||||
android:label="@string/title_activity_settings"
|
android:label="@string/title_activity_settings"
|
||||||
android:parentActivityName=".activities.ControlCenterv2" />
|
android:parentActivityName=".activities.ControlCenterv2" />
|
||||||
|
<activity
|
||||||
|
android:name=".activities.charts.ChartsPreferencesActivity"
|
||||||
|
android:label="@string/activity_prefs_charts"
|
||||||
|
android:parentActivityName=".activities.charts.ChartsPreferencesActivity" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".devices.miband.MiBandPreferencesActivity"
|
android:name=".devices.miband.MiBandPreferencesActivity"
|
||||||
android:label="@string/preferences_miband_settings"
|
android:label="@string/preferences_miband_settings"
|
||||||
|
@ -56,6 +56,7 @@ import nodomain.freeyourgadget.gadgetbridge.database.PeriodicExporter;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
|
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandPreferencesActivity;
|
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandPreferencesActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimePreferenceActivity;
|
import nodomain.freeyourgadget.gadgetbridge.devices.zetime.ZeTimePreferenceActivity;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsPreferencesActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||||
@ -96,6 +97,16 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
pref = findPreference("pref_charts");
|
||||||
|
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
Intent enableIntent = new Intent(SettingsActivity.this, ChartsPreferencesActivity.class);
|
||||||
|
startActivity(enableIntent);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
pref = findPreference("pref_key_miband");
|
pref = findPreference("pref_key_miband");
|
||||||
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
|
@ -261,6 +261,10 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts
|
|||||||
case R.id.charts_fetch_activity_data:
|
case R.id.charts_fetch_activity_data:
|
||||||
fetchActivityData();
|
fetchActivityData();
|
||||||
return true;
|
return true;
|
||||||
|
case R.id.prefs_charts_menu:
|
||||||
|
Intent settingsIntent = new Intent(this, ChartsPreferencesActivity.class);
|
||||||
|
startActivity(settingsIntent);
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
/* Copyright (C) 2015-2019 Andreas Shimokawa, Carsten Pfeiffer, Christian
|
||||||
|
Fischer, Daniele Gobbetti, José Rebelo, Szymon Tomasz Stefanek
|
||||||
|
|
||||||
|
This file is part of Gadgetbridge.
|
||||||
|
|
||||||
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Gadgetbridge is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
package nodomain.freeyourgadget.gadgetbridge.activities.charts;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.AbstractSettingsActivity;
|
||||||
|
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||||
|
|
||||||
|
|
||||||
|
public class ChartsPreferencesActivity extends AbstractSettingsActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
addPreferencesFromResource(R.xml.charts_preferences);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -7,5 +7,9 @@
|
|||||||
app:showAsAction="ifRoom"
|
app:showAsAction="ifRoom"
|
||||||
android:icon="@android:drawable/stat_notify_sync_noanim"
|
android:icon="@android:drawable/stat_notify_sync_noanim"
|
||||||
android:title="@string/controlcenter_fetch_activity_data"/>
|
android:title="@string/controlcenter_fetch_activity_data"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/prefs_charts_menu"
|
||||||
|
android:icon="@drawable/ic_settings"
|
||||||
|
android:title="@string/pref_header_charts"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
</menu>
|
</menu>
|
||||||
|
39
app/src/main/res/xml/charts_preferences.xml
Normal file
39
app/src/main/res/xml/charts_preferences.xml
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="pref_charts"
|
||||||
|
android:title="@string/activity_prefs_charts">
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="chart_max_heart_rate"
|
||||||
|
android:maxLength="3"
|
||||||
|
android:defaultValue="250"
|
||||||
|
android:title="@string/activity_prefs_chart_max_heart_rate" />
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="chart_min_heart_rate"
|
||||||
|
android:maxLength="3"
|
||||||
|
android:defaultValue="10"
|
||||||
|
android:title="@string/activity_prefs_chart_min_heart_rate" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:layout="@layout/preference_checkbox"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="charts_allow_swipe"
|
||||||
|
android:title="@string/pref_title_charts_swipe" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:layout="@layout/preference_checkbox"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="charts_show_average"
|
||||||
|
android:title="@string/pref_title_charts_average" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:layout="@layout/preference_checkbox"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="charts_range"
|
||||||
|
android:summaryOff="@string/pref_charts_range_off"
|
||||||
|
android:summaryOn="@string/pref_charts_range_on"
|
||||||
|
android:title="@string/pref_title_charts_range" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
</PreferenceScreen>
|
@ -158,42 +158,9 @@
|
|||||||
android:title="@string/activity_prefs_activetime_minutes" />
|
android:title="@string/activity_prefs_activetime_minutes" />
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceScreen
|
<Preference
|
||||||
android:key="pref_charts"
|
android:key="pref_charts"
|
||||||
android:title="@string/activity_prefs_charts">
|
android:title="@string/activity_prefs_charts"/>
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
android:inputType="number"
|
|
||||||
android:key="chart_max_heart_rate"
|
|
||||||
android:maxLength="3"
|
|
||||||
android:defaultValue="250"
|
|
||||||
android:title="@string/activity_prefs_chart_max_heart_rate" />
|
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
android:inputType="number"
|
|
||||||
android:key="chart_min_heart_rate"
|
|
||||||
android:maxLength="3"
|
|
||||||
android:defaultValue="10"
|
|
||||||
android:title="@string/activity_prefs_chart_min_heart_rate" />
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:layout="@layout/preference_checkbox"
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="charts_allow_swipe"
|
|
||||||
android:title="@string/pref_title_charts_swipe" />
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:layout="@layout/preference_checkbox"
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:key="charts_show_average"
|
|
||||||
android:title="@string/pref_title_charts_average" />
|
|
||||||
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:layout="@layout/preference_checkbox"
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="charts_range"
|
|
||||||
android:summaryOff="@string/pref_charts_range_off"
|
|
||||||
android:summaryOn="@string/pref_charts_range_on"
|
|
||||||
android:title="@string/pref_title_charts_range" />
|
|
||||||
</PreferenceScreen>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_key_datetime"
|
android:key="pref_key_datetime"
|
||||||
|
Loading…
Reference in New Issue
Block a user