diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2011-10-05 11:24:18 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2011-10-05 11:43:37 +0200 |
commit | 9a9aa1e0c86a6a8ae224dfe0a50ad927136bf79d (patch) | |
tree | fa83edc61af2c33a2a39248abea20a9288033f6c /main/src/cgeo/geocaching/cgeo.java | |
parent | 9bd05f7ffc6cf51d7f5c648eb205e2e0fcf01546 (diff) | |
download | cgeo-9a9aa1e0c86a6a8ae224dfe0a50ad927136bf79d.zip cgeo-9a9aa1e0c86a6a8ae224dfe0a50ad927136bf79d.tar.gz cgeo-9a9aa1e0c86a6a8ae224dfe0a50ad927136bf79d.tar.bz2 |
Use symbolic errors instead of hardcoded integers
Diffstat (limited to 'main/src/cgeo/geocaching/cgeo.java')
-rw-r--r-- | main/src/cgeo/geocaching/cgeo.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/cgeo.java b/main/src/cgeo/geocaching/cgeo.java index d68d07a..5c8c9f1 100644 --- a/main/src/cgeo/geocaching/cgeo.java +++ b/main/src/cgeo/geocaching/cgeo.java @@ -2,6 +2,7 @@ package cgeo.geocaching; import cgeo.geocaching.activity.AbstractActivity; import cgeo.geocaching.activity.ActivityMixin; +import cgeo.geocaching.enumerations.StatusCode; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.utils.CollectionUtils; @@ -129,9 +130,9 @@ public class cgeo extends AbstractActivity { @Override public void handleMessage(Message msg) { try { - int reason = msg.what; + final StatusCode reason = (StatusCode) msg.obj; - if (reason < 0) { //LoginFailed + if (reason != null && reason != StatusCode.NO_ERROR) { //LoginFailed showToast(res.getString(R.string.err_login_failed_toast)); } } catch (Exception e) { @@ -730,19 +731,19 @@ public class cgeo extends AbstractActivity { return; } - final int status = cgBase.login(); + final StatusCode status = cgBase.login(); - if (status == 1) { + if (status == StatusCode.NO_ERROR) { app.firstRun = false; cgBase.detectGcCustomDate(); } if (app.showLoginToast) { - firstLoginHandler.sendEmptyMessage(status); + firstLoginHandler.sendMessage(firstLoginHandler.obtainMessage(0, status)); app.showLoginToast = false; // invoke settings activity to insert login details - if (status == -3) { + if (status == StatusCode.NO_LOGIN_INFO_STORED) { final Context context = cgeo.this; final Intent initIntent = new Intent(context, cgeoinit.class); context.startActivity(initIntent); |