1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Refactor code to start Accounts activity to import settings

This commit is contained in:
cketti 2013-03-06 06:26:04 +01:00
parent dc8cb3ba17
commit 7ff0da0b52
2 changed files with 10 additions and 4 deletions

View File

@ -326,7 +326,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
private static String SELECTED_CONTEXT_ACCOUNT = "selectedContextAccount";
public static final String EXTRA_STARTUP = "startup";
public static final String EXTRA_IMPORTFIRST = "importfirst";
public static final String ACTION_IMPORT_SETTINGS = "importSettings";
public static void listAccounts(Context context) {
@ -337,6 +338,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
context.startActivity(intent);
}
public static void importSettings(Context context) {
Intent intent = new Intent(context, Accounts.class);
intent.setAction(ACTION_IMPORT_SETTINGS);
context.startActivity(intent);
}
@Override
public void onNewIntent(Intent intent) {
Uri uri = intent.getData();
@ -366,7 +373,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
//onNewIntent(intent);
// see if we should show the welcome message
if (intent.getBooleanExtra(EXTRA_IMPORTFIRST, false)) {
if (ACTION_IMPORT_SETTINGS.equals(intent.getAction())) {
onImport();
} else if (accounts.length < 1) {
WelcomeMessage.showWelcomeMessage(this);

View File

@ -46,8 +46,7 @@ public class WelcomeMessage extends K9Activity implements OnClickListener{
break;
}
case R.id.import_settings: {
startActivity(new Intent(getApplicationContext(), Accounts.class)
.putExtra(Accounts.EXTRA_IMPORTFIRST, true));
Accounts.importSettings(this);
finish();
break;
}