mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-27 20:36:51 +01:00
add development option to set a miband device address so it appears in our list.
This is only meant for future development, there is no MI Band support yet!
This commit is contained in:
parent
2c50f95a92
commit
13d734b0f1
@ -415,7 +415,7 @@ public class BluetoothCommunicationService extends Service {
|
||||
private boolean mQuit = false;
|
||||
private boolean mmIsConnected = false;
|
||||
private int mmConnectionAttempts = 0;
|
||||
|
||||
|
||||
public PebbleIoThread(String btDeviceAddress) {
|
||||
super(btDeviceAddress);
|
||||
}
|
||||
|
@ -181,6 +181,13 @@ public class ControlCenter extends Activity {
|
||||
}
|
||||
deviceList.add(new GBDevice(device.getAddress(), device.getName(), deviceType));
|
||||
}
|
||||
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
String miAddr = sharedPrefs.getString("development_miaddr", null);
|
||||
if (miAddr != null && !miAddr.equals("")) {
|
||||
deviceList.add(new GBDevice(miAddr, "MI", GBDevice.Type.MIBAND));
|
||||
}
|
||||
|
||||
if (!deviceList.isEmpty()) {
|
||||
hintTextView.setText("tap a device to connect");
|
||||
}
|
||||
|
@ -43,10 +43,16 @@ public class SettingsActivity extends PreferenceActivity {
|
||||
}
|
||||
});
|
||||
|
||||
// Add 'development' preferences, and a corresponding header.
|
||||
PreferenceCategory fakeHeaderDev = new PreferenceCategory(this);
|
||||
fakeHeaderDev.setTitle(R.string.pref_header_development);
|
||||
getPreferenceScreen().addPreference(fakeHeaderDev);
|
||||
addPreferencesFromResource(R.xml.pref_development);
|
||||
|
||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
|
||||
// their values. When their values change, their summaries are updated
|
||||
// to reflect the new value, per the Android Design guidelines.
|
||||
//bindPreferenceSummaryToValue(findPreference("notifications_sms"));
|
||||
bindPreferenceSummaryToValue(findPreference("development_miaddr"));
|
||||
//bindPreferenceSummaryToValue(findPreference("notifications_sms_whenscreenon"));
|
||||
}
|
||||
|
||||
|
@ -31,4 +31,7 @@
|
||||
<string name="pref_title_notifications_k9mail">Notification for K9-Mail</string>
|
||||
<string name="pref_title_notifications_generic">Generic notification support</string>
|
||||
<string name="pref_title_whenscreenon">… also when screen is on</string>
|
||||
|
||||
<string name="pref_header_development">Developer Options</string>
|
||||
<string name="pref_title_development_miaddr">Miband address</string>
|
||||
</resources>
|
||||
|
8
app/src/main/res/xml/pref_development.xml
Normal file
8
app/src/main/res/xml/pref_development.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<EditTextPreference
|
||||
android:key="development_miaddr"
|
||||
android:title="@string/pref_title_development_miaddr"
|
||||
android:digits="0123456789abcdef:"
|
||||
android:maxLength="17" />
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user