diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java index 20272e4eba..e134fcdf2e 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java @@ -100,6 +100,9 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer }; @Override protected void onPostExecute(Exception result) { + if(dlg.isShowing()) { + dlg.dismiss(); + } if (result != null) { result.printStackTrace(); app.showToastMessage(app.getString(R.string.osmo_io_error) + result.getMessage()); @@ -110,10 +113,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer @Override protected Exception doInBackground(Void... params) { - if(dlg.isShowing()) { - dlg.dismiss(); - } - return OsmandPlugin.getEnabledPlugin(OsMoPlugin.class).registerOsmoDeviceKey(); + return registerOsmoDeviceKey(); } }; } diff --git a/OsmAnd/src/net/osmand/plus/osmo/SettingsOsMoActivity.java b/OsmAnd/src/net/osmand/plus/osmo/SettingsOsMoActivity.java index 14a4f1f905..df82665b69 100644 --- a/OsmAnd/src/net/osmand/plus/osmo/SettingsOsMoActivity.java +++ b/OsmAnd/src/net/osmand/plus/osmo/SettingsOsMoActivity.java @@ -27,6 +27,7 @@ public class SettingsOsMoActivity extends SettingsBaseActivity { uuid = new Preference(this); uuid.setTitle(R.string.osmo_settings_uuid); uuid.setSummary(getMyApplication().getSettings().OSMO_DEVICE_KEY.get().toUpperCase()); + uuid.setOnPreferenceClickListener(this); grp.addPreference(uuid); @@ -39,9 +40,11 @@ public class SettingsOsMoActivity extends SettingsBaseActivity { OsMoPlugin.getEnabledPlugin(OsMoPlugin.class).getRegisterDeviceTask(this, new Runnable() { @Override public void run() { - updateAllSettings(); + updateAllSettings(); + uuid.setSummary(getMyApplication().getSettings().OSMO_DEVICE_KEY.get().toUpperCase()); } }).execute(); + return true; } return super.onPreferenceClick(preference); }