mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-01 14:32:54 +01:00
Move user name to about user preferences
- Remove from Mi Band prefs - Remove fitness goal from mi band prefs - it's also un the about user section - During pairing, direct user to the about user if there is invalid data
This commit is contained in:
parent
69ae4ed1c4
commit
61a78c0ad8
@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.AboutUserPreferencesActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.AbstractGBActivity;
|
import nodomain.freeyourgadget.gadgetbridge.activities.AbstractGBActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.ControlCenterv2;
|
import nodomain.freeyourgadget.gadgetbridge.activities.ControlCenterv2;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.DiscoveryActivity;
|
import nodomain.freeyourgadget.gadgetbridge.activities.DiscoveryActivity;
|
||||||
@ -96,7 +97,7 @@ public class MiBandPairingActivity extends AbstractGBActivity implements Bonding
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!MiBandCoordinator.hasValidUserInfo()) {
|
if (!MiBandCoordinator.hasValidUserInfo()) {
|
||||||
Intent userSettingsIntent = new Intent(this, MiBandPreferencesActivity.class);
|
Intent userSettingsIntent = new Intent(this, AboutUserPreferencesActivity.class);
|
||||||
startActivityForResult(userSettingsIntent, REQ_CODE_USER_SETTINGS, null);
|
startActivityForResult(userSettingsIntent, REQ_CODE_USER_SETTINGS, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -53,22 +53,6 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity {
|
|||||||
addPreferencesFromResource(R.xml.miband_preferences);
|
addPreferencesFromResource(R.xml.miband_preferences);
|
||||||
|
|
||||||
addTryListeners();
|
addTryListeners();
|
||||||
|
|
||||||
Prefs prefs = GBApplication.getPrefs();
|
|
||||||
|
|
||||||
final Preference fitnessGoal = findPreference(ActivityUser.PREF_USER_STEPS_GOAL);
|
|
||||||
fitnessGoal.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object newVal) {
|
|
||||||
invokeLater(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
GBApplication.deviceService().onSendConfiguration(ActivityUser.PREF_USER_STEPS_GOAL);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,10 +105,7 @@ public class MiBandPreferencesActivity extends AbstractSettingsActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected String[] getPreferenceKeysWithSummary() {
|
protected String[] getPreferenceKeysWithSummary() {
|
||||||
Set<String> prefKeys = new HashSet<>();
|
Set<String> prefKeys = new HashSet<>();
|
||||||
prefKeys.add(PREF_USER_NAME);
|
|
||||||
prefKeys.add(PREF_MIBAND_ADDRESS);
|
prefKeys.add(PREF_MIBAND_ADDRESS);
|
||||||
prefKeys.add(ActivityUser.PREF_USER_STEPS_GOAL);
|
|
||||||
prefKeys.add(PREF_INACTIVITY_THRESHOLD);
|
|
||||||
prefKeys.add(getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_ALARM_CLOCK));
|
prefKeys.add(getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_ALARM_CLOCK));
|
||||||
prefKeys.add(getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_INCOMING_CALL));
|
prefKeys.add(getNotificationPrefKey(VIBRATION_COUNT, ORIGIN_INCOMING_CALL));
|
||||||
|
|
||||||
|
@ -6,6 +6,13 @@
|
|||||||
android:key="pref_category_activity_personal"
|
android:key="pref_category_activity_personal"
|
||||||
android:title="@string/activity_prefs_about_you">
|
android:title="@string/activity_prefs_about_you">
|
||||||
|
|
||||||
|
<EditTextPreference
|
||||||
|
android:key="mi_user_alias"
|
||||||
|
android:maxLength="17"
|
||||||
|
android:title="@string/miband_prefs_alias"
|
||||||
|
app:iconSpaceReserved="false"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
app:iconSpaceReserved="false"
|
app:iconSpaceReserved="false"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
|
@ -1,23 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<!--TODO: this is actually "about your miband" and possibly refers to a single device (if the owner has multiple mibands, it may be that they are worn on different arms -->
|
|
||||||
<PreferenceCategory
|
|
||||||
android:key="pref_category_miband_personal"
|
|
||||||
android:title="@string/activity_prefs_about_you">
|
|
||||||
<EditTextPreference
|
|
||||||
android:key="mi_user_alias"
|
|
||||||
android:maxLength="17"
|
|
||||||
android:title="@string/miband_prefs_alias" />
|
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
android:defaultValue="10000"
|
|
||||||
android:inputType="number"
|
|
||||||
android:key="fitness_goal"
|
|
||||||
android:maxLength="5"
|
|
||||||
android:title="@string/miband_prefs_fitness_goal" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="pref_category_miband_notification"
|
android:key="pref_category_miband_notification"
|
||||||
android:title="@string/pref_header_vibration_settings">
|
android:title="@string/pref_header_vibration_settings">
|
||||||
|
Loading…
Reference in New Issue
Block a user