mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-19 07:07:46 +01:00
Pebble: fix crash when navigating back from configuration activity
This commit is contained in:
parent
860ded1022
commit
fa924ff9d8
@ -53,6 +53,7 @@
|
||||
android:label="@string/preferences_miband_settings"
|
||||
android:parentActivityName=".activities.SettingsActivity" />
|
||||
<activity
|
||||
android:launchMode="singleTop"
|
||||
android:name=".activities.AppManagerActivity"
|
||||
android:label="@string/title_activity_appmanager"
|
||||
android:parentActivityName=".activities.ControlCenter" />
|
||||
|
@ -3,8 +3,10 @@ package nodomain.freeyourgadget.gadgetbridge.activities;
|
||||
import android.app.Activity;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.MenuItem;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
@ -31,7 +33,6 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ExternalPebbleJSActivity.class);
|
||||
|
||||
private Uri uri;
|
||||
private UUID appUuid;
|
||||
private GBDevice mGBDevice = null;
|
||||
|
||||
@ -47,7 +48,7 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||
}
|
||||
|
||||
String queryString = "";
|
||||
uri = getIntent().getData();
|
||||
Uri uri = getIntent().getData();
|
||||
if (uri != null) {
|
||||
//getting back with configuration data
|
||||
appUuid = UUID.fromString(uri.getHost());
|
||||
@ -81,9 +82,7 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||
JSONObject json = new JSONObject(jsonstring);
|
||||
return json.getJSONObject("appKeys");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
@ -113,7 +112,8 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||
int pebbleAppIndex = knownKeys.optInt(cur_key);
|
||||
if (pebbleAppIndex != 0) {
|
||||
//TODO: cast to integer (int32) / String? Is it needed?
|
||||
pairs.add(new Pair<>(pebbleAppIndex, (Object) in.get(cur_key)));
|
||||
pairs.add(new Pair<>(pebbleAppIndex, in.get(cur_key)));
|
||||
LOG.info(in.get(cur_key).getClass().toString());
|
||||
} else {
|
||||
GB.toast("Discarded key " + cur_key + ", not found in the local configuration.", Toast.LENGTH_SHORT, GB.WARN);
|
||||
}
|
||||
@ -156,4 +156,15 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
NavUtils.navigateUpFromSameTask(this);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user