prevent trying to login twice on startup

open idiot-friendly dialog when application is not configured
bump version
This commit is contained in:
Andrew Dolgov 2012-07-10 21:51:18 +04:00
parent 9341df4c21
commit e68c90cbce
3 changed files with 25 additions and 8 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="85"
android:versionName="0.6.9" >
android:versionCode="86"
android:versionName="0.6.10" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="11" />

View File

@ -121,4 +121,6 @@
<string name="article_set_note">Publish with note</string>
<string name="close_feed">Close feed</string>
<string name="close_article">Close article</string>
<string name="dialog_open_preferences">Open preferences</string>
<string name="dialog_need_configure_prompt">Please fill in your tt-rss server information such as URL, login, and password.</string>
</resources>

View File

@ -709,7 +709,7 @@ public class MainActivity extends CommonActivity implements OnlineServices {
if (m_sessionId != null) {
loginSuccess();
} else {
login();
//login(); -- handled in onResume()
}
}
}
@ -1957,11 +1957,26 @@ public class MainActivity extends CommonActivity implements OnlineServices {
setLoadingStatus(R.string.login_need_configure, false);
// launch preferences
Intent intent = new Intent(MainActivity.this,
PreferencesActivity.class);
startActivityForResult(intent, 0);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.dialog_need_configure_prompt)
.setCancelable(false)
.setPositiveButton(R.string.dialog_open_preferences, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// launch preferences
Intent intent = new Intent(MainActivity.this,
PreferencesActivity.class);
startActivityForResult(intent, 0);
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
LoginRequest ar = new LoginRequest(getApplicationContext());