Fix authorization osmo

This commit is contained in:
vshcherb 2014-05-16 02:11:01 +03:00
parent 3c7a418707
commit 04a2acf5a1
2 changed files with 8 additions and 5 deletions

View file

@ -100,6 +100,9 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
}; };
@Override @Override
protected void onPostExecute(Exception result) { protected void onPostExecute(Exception result) {
if(dlg.isShowing()) {
dlg.dismiss();
}
if (result != null) { if (result != null) {
result.printStackTrace(); result.printStackTrace();
app.showToastMessage(app.getString(R.string.osmo_io_error) + result.getMessage()); app.showToastMessage(app.getString(R.string.osmo_io_error) + result.getMessage());
@ -110,10 +113,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
@Override @Override
protected Exception doInBackground(Void... params) { protected Exception doInBackground(Void... params) {
if(dlg.isShowing()) { return registerOsmoDeviceKey();
dlg.dismiss();
}
return OsmandPlugin.getEnabledPlugin(OsMoPlugin.class).registerOsmoDeviceKey();
} }
}; };
} }

View file

@ -27,6 +27,7 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
uuid = new Preference(this); uuid = new Preference(this);
uuid.setTitle(R.string.osmo_settings_uuid); uuid.setTitle(R.string.osmo_settings_uuid);
uuid.setSummary(getMyApplication().getSettings().OSMO_DEVICE_KEY.get().toUpperCase()); uuid.setSummary(getMyApplication().getSettings().OSMO_DEVICE_KEY.get().toUpperCase());
uuid.setOnPreferenceClickListener(this);
grp.addPreference(uuid); grp.addPreference(uuid);
@ -39,9 +40,11 @@ public class SettingsOsMoActivity extends SettingsBaseActivity {
OsMoPlugin.getEnabledPlugin(OsMoPlugin.class).getRegisterDeviceTask(this, new Runnable() { OsMoPlugin.getEnabledPlugin(OsMoPlugin.class).getRegisterDeviceTask(this, new Runnable() {
@Override @Override
public void run() { public void run() {
updateAllSettings(); updateAllSettings();
uuid.setSummary(getMyApplication().getSettings().OSMO_DEVICE_KEY.get().toUpperCase());
} }
}).execute(); }).execute();
return true;
} }
return super.onPreferenceClick(preference); return super.onPreferenceClick(preference);
} }