parent
7dedff3ce1
commit
58bbcb0035
|
@ -97,6 +97,7 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
||||||
final ListPreference audioPlayer = (ListPreference) findPreference("audio_player");
|
final ListPreference audioPlayer = (ListPreference) findPreference("audio_player");
|
||||||
audioPlayer.setEntries(newEntries);
|
audioPlayer.setEntries(newEntries);
|
||||||
audioPlayer.setEntryValues(newValues);
|
audioPlayer.setEntryValues(newValues);
|
||||||
|
audioPlayer.setDefaultValue(newValues[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -107,6 +108,7 @@ public class SettingsActivity extends AbstractSettingsActivity {
|
||||||
"notification_mode_k9mail",
|
"notification_mode_k9mail",
|
||||||
"pebble_emu_addr",
|
"pebble_emu_addr",
|
||||||
"pebble_emu_port",
|
"pebble_emu_port",
|
||||||
|
"pebble_reconnect_attempts",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@ public class PebbleIoThread extends GBDeviceIoThread {
|
||||||
public static final String PEBBLEKIT_ACTION_APP_START = "com.getpebble.action.app.START";
|
public static final String PEBBLEKIT_ACTION_APP_START = "com.getpebble.action.app.START";
|
||||||
public static final String PEBBLEKIT_ACTION_APP_STOP = "com.getpebble.action.app.STOP";
|
public static final String PEBBLEKIT_ACTION_APP_STOP = "com.getpebble.action.app.STOP";
|
||||||
|
|
||||||
|
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
|
|
||||||
private final PebbleProtocol mPebbleProtocol;
|
private final PebbleProtocol mPebbleProtocol;
|
||||||
private final PebbleSupport mPebbleSupport;
|
private final PebbleSupport mPebbleSupport;
|
||||||
private boolean mIsTCP = false;
|
private boolean mIsTCP = false;
|
||||||
|
@ -67,7 +69,6 @@ public class PebbleIoThread extends GBDeviceIoThread {
|
||||||
private boolean mQuit = false;
|
private boolean mQuit = false;
|
||||||
private boolean mIsConnected = false;
|
private boolean mIsConnected = false;
|
||||||
private boolean mIsInstalling = false;
|
private boolean mIsInstalling = false;
|
||||||
private int mConnectionAttempts = 0;
|
|
||||||
|
|
||||||
private PBWReader mPBWReader = null;
|
private PBWReader mPBWReader = null;
|
||||||
private int mAppInstallToken = -1;
|
private int mAppInstallToken = -1;
|
||||||
|
@ -148,7 +149,6 @@ public class PebbleIoThread extends GBDeviceIoThread {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
||||||
mPebbleProtocol.setForceProtocol(sharedPrefs.getBoolean("pebble_force_protocol", false));
|
mPebbleProtocol.setForceProtocol(sharedPrefs.getBoolean("pebble_force_protocol", false));
|
||||||
gbDevice.setState(GBDevice.State.CONNECTED);
|
gbDevice.setState(GBDevice.State.CONNECTED);
|
||||||
gbDevice.sendDeviceUpdateIntent(getContext());
|
gbDevice.sendDeviceUpdateIntent(getContext());
|
||||||
|
@ -311,13 +311,13 @@ public class PebbleIoThread extends GBDeviceIoThread {
|
||||||
gbDevice.setState(GBDevice.State.CONNECTING);
|
gbDevice.setState(GBDevice.State.CONNECTING);
|
||||||
gbDevice.sendDeviceUpdateIntent(getContext());
|
gbDevice.sendDeviceUpdateIntent(getContext());
|
||||||
|
|
||||||
while (mConnectionAttempts++ < 10 && !mQuit) {
|
int reconnectAttempts = Integer.valueOf(sharedPrefs.getString("pebble_reconnect_attempts", "10"));
|
||||||
LOG.info("Trying to reconnect (attempt " + mConnectionAttempts + ")");
|
while (reconnectAttempts-- > 0 && !mQuit) {
|
||||||
|
LOG.info("Trying to reconnect (attempts left " + reconnectAttempts + ")");
|
||||||
mIsConnected = connect(gbDevice.getAddress());
|
mIsConnected = connect(gbDevice.getAddress());
|
||||||
if (mIsConnected)
|
if (mIsConnected)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mConnectionAttempts = 0;
|
|
||||||
if (!mIsConnected) {
|
if (!mIsConnected) {
|
||||||
mBtSocket = null;
|
mBtSocket = null;
|
||||||
LOG.info("Bluetooth socket closed, will quit IO Thread");
|
LOG.info("Bluetooth socket closed, will quit IO Thread");
|
||||||
|
@ -341,7 +341,6 @@ public class PebbleIoThread extends GBDeviceIoThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enablePebbleKitReceiver(boolean enable) {
|
private void enablePebbleKitReceiver(boolean enable) {
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
||||||
boolean force_untested = sharedPrefs.getBoolean("pebble_force_untested", false);
|
boolean force_untested = sharedPrefs.getBoolean("pebble_force_untested", false);
|
||||||
|
|
||||||
if (enable && force_untested) {
|
if (enable && force_untested) {
|
||||||
|
@ -403,7 +402,6 @@ public class PebbleIoThread extends GBDeviceIoThread {
|
||||||
private boolean evaluateGBDeviceEventPebble(GBDeviceEvent deviceEvent) {
|
private boolean evaluateGBDeviceEventPebble(GBDeviceEvent deviceEvent) {
|
||||||
|
|
||||||
if (deviceEvent instanceof GBDeviceEventVersionInfo) {
|
if (deviceEvent instanceof GBDeviceEventVersionInfo) {
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
|
||||||
if (sharedPrefs.getBoolean("datetime_synconconnect", true)) {
|
if (sharedPrefs.getBoolean("datetime_synconconnect", true)) {
|
||||||
LOG.info("syncing time");
|
LOG.info("syncing time");
|
||||||
write(mPebbleProtocol.encodeSetTime());
|
write(mPebbleProtocol.encodeSetTime());
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<string name="pref_header_general">General Settings</string>
|
<string name="pref_header_general">General Settings</string>
|
||||||
<string name="pref_title_general_autoconnectonbluetooth">Connect to device when Bluetooth turned on</string>
|
<string name="pref_title_general_autoconnectonbluetooth">Connect to device when Bluetooth turned on</string>
|
||||||
<string name="pref_title_audo_player">Preferred audio player</string>
|
<string name="pref_title_audo_player">Preferred audio player</string>
|
||||||
<string name="pref_default">default</string>
|
<string name="pref_default">Default</string>
|
||||||
<string name="pref_header_datetime">Date and Time</string>
|
<string name="pref_header_datetime">Date and Time</string>
|
||||||
<string name="pref_title_datetime_syctimeonconnect">Sync time</string>
|
<string name="pref_title_datetime_syctimeonconnect">Sync time</string>
|
||||||
<string name="pref_summary_datetime_syctimeonconnect">Sync time to device when connecting and when time or timezone changes on Android</string>
|
<string name="pref_summary_datetime_syctimeonconnect">Sync time to device when connecting and when time or timezone changes on Android</string>
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
<string name="pref_summary_pebble_forceprotocol">This option forces using the latest notification protocol depending on the firmware version. ENABLE ONLY IF YOU KNOW WHAT YOU ARE DOING!</string>
|
<string name="pref_summary_pebble_forceprotocol">This option forces using the latest notification protocol depending on the firmware version. ENABLE ONLY IF YOU KNOW WHAT YOU ARE DOING!</string>
|
||||||
<string name="pref_title_pebble_forceuntested">Enable untested features</string>
|
<string name="pref_title_pebble_forceuntested">Enable untested features</string>
|
||||||
<string name="pref_summary_pebble_forceuntested">Enable features that are untested. ENABLE ONLY IF YOU KNOW WHAT YOU ARE DOING!</string>
|
<string name="pref_summary_pebble_forceuntested">Enable features that are untested. ENABLE ONLY IF YOU KNOW WHAT YOU ARE DOING!</string>
|
||||||
|
<string name="pref_title_pebble_reconnect_attempts">Reconnect attempts</string>
|
||||||
<string name="not_connected">not connected</string>
|
<string name="not_connected">not connected</string>
|
||||||
<string name="connecting">connecting</string>
|
<string name="connecting">connecting</string>
|
||||||
<string name="connected">connected</string>
|
<string name="connected">connected</string>
|
||||||
|
|
|
@ -84,6 +84,12 @@
|
||||||
android:key="pebble_force_untested"
|
android:key="pebble_force_untested"
|
||||||
android:summary="@string/pref_summary_pebble_forceuntested"
|
android:summary="@string/pref_summary_pebble_forceuntested"
|
||||||
android:title="@string/pref_title_pebble_forceuntested" />
|
android:title="@string/pref_title_pebble_forceuntested" />
|
||||||
|
<EditTextPreference
|
||||||
|
android:inputType="number"
|
||||||
|
android:key="pebble_reconnect_attempts"
|
||||||
|
android:defaultValue="12"
|
||||||
|
android:maxLength="4"
|
||||||
|
android:title="@string/pref_title_pebble_reconnect_attempts" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
android:digits="0123456789."
|
android:digits="0123456789."
|
||||||
android:key="pebble_emu_addr"
|
android:key="pebble_emu_addr"
|
||||||
|
|
Loading…
Reference in New Issue