mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-24 10:22:15 -05:00
Refactor code to start Accounts activity to import settings
This commit is contained in:
parent
dc8cb3ba17
commit
7ff0da0b52
@ -326,7 +326,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
private static String SELECTED_CONTEXT_ACCOUNT = "selectedContextAccount";
|
private static String SELECTED_CONTEXT_ACCOUNT = "selectedContextAccount";
|
||||||
|
|
||||||
public static final String EXTRA_STARTUP = "startup";
|
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) {
|
public static void listAccounts(Context context) {
|
||||||
@ -337,6 +338,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
context.startActivity(intent);
|
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
|
@Override
|
||||||
public void onNewIntent(Intent intent) {
|
public void onNewIntent(Intent intent) {
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
@ -366,7 +373,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
|||||||
//onNewIntent(intent);
|
//onNewIntent(intent);
|
||||||
|
|
||||||
// see if we should show the welcome message
|
// see if we should show the welcome message
|
||||||
if (intent.getBooleanExtra(EXTRA_IMPORTFIRST, false)) {
|
if (ACTION_IMPORT_SETTINGS.equals(intent.getAction())) {
|
||||||
onImport();
|
onImport();
|
||||||
} else if (accounts.length < 1) {
|
} else if (accounts.length < 1) {
|
||||||
WelcomeMessage.showWelcomeMessage(this);
|
WelcomeMessage.showWelcomeMessage(this);
|
||||||
|
@ -46,8 +46,7 @@ public class WelcomeMessage extends K9Activity implements OnClickListener{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case R.id.import_settings: {
|
case R.id.import_settings: {
|
||||||
startActivity(new Intent(getApplicationContext(), Accounts.class)
|
Accounts.importSettings(this);
|
||||||
.putExtra(Accounts.EXTRA_IMPORTFIRST, true));
|
|
||||||
finish();
|
finish();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user