mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-12 22:28:10 -05:00
Separate the welcome message in it's own activity. Cleaner solution and it prevents it from having the same actionbar as the Accounts activity.
This commit is contained in:
parent
e172e398ce
commit
29b6d046d3
@ -91,6 +91,12 @@
|
|||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
>
|
>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name="com.fsck.k9.activity.setup.WelcomeMessage"
|
||||||
|
android:label="@string/welcome_message_title"
|
||||||
|
android:configChanges="locale"
|
||||||
|
>
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name="com.fsck.k9.activity.setup.FontSizeSettings"
|
android:name="com.fsck.k9.activity.setup.FontSizeSettings"
|
||||||
android:label="@string/font_size_settings_title"
|
android:label="@string/font_size_settings_title"
|
||||||
|
@ -8,34 +8,4 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
/>
|
/>
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/empty"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent">
|
|
||||||
<ScrollView
|
|
||||||
android:layout_marginBottom="54dip"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:fadingEdge="none"
|
|
||||||
>
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<TextView
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:text="@string/accounts_welcome"
|
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
|
||||||
android:padding="8dip"/>
|
|
||||||
<View
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="0dip"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
||||||
<include layout="@layout/wizard_next" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
35
res/layout/welcome_message.xml
Normal file
35
res/layout/welcome_message.xml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_marginBottom="54dip"
|
||||||
|
android:fadingEdge="none" >
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:padding="8dip"
|
||||||
|
android:text="@string/accounts_welcome"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="0dip"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<include layout="@layout/wizard_next" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -78,6 +78,7 @@ http://k9mail.googlecode.com/
|
|||||||
|
|
||||||
<string name="about_title_fmt">About <xliff:g id="app_name">%s</xliff:g></string>
|
<string name="about_title_fmt">About <xliff:g id="app_name">%s</xliff:g></string>
|
||||||
<string name="accounts_title">Accounts</string>
|
<string name="accounts_title">Accounts</string>
|
||||||
|
<string name="welcome_message_title">Welcome to K-9 Mail!</string>
|
||||||
<string name="folders_title">Folders</string>
|
<string name="folders_title">Folders</string>
|
||||||
<string name="advanced">Advanced</string>
|
<string name="advanced">Advanced</string>
|
||||||
<string name="folder_list_title"><xliff:g id="account">%s</xliff:g> </string>
|
<string name="folder_list_title"><xliff:g id="account">%s</xliff:g> </string>
|
||||||
|
@ -67,6 +67,7 @@ import com.fsck.k9.activity.misc.NonConfigurationInstance;
|
|||||||
import com.fsck.k9.activity.setup.AccountSettings;
|
import com.fsck.k9.activity.setup.AccountSettings;
|
||||||
import com.fsck.k9.activity.setup.AccountSetupBasics;
|
import com.fsck.k9.activity.setup.AccountSetupBasics;
|
||||||
import com.fsck.k9.activity.setup.Prefs;
|
import com.fsck.k9.activity.setup.Prefs;
|
||||||
|
import com.fsck.k9.activity.setup.WelcomeMessage;
|
||||||
import com.fsck.k9.controller.MessagingController;
|
import com.fsck.k9.controller.MessagingController;
|
||||||
import com.fsck.k9.controller.MessagingListener;
|
import com.fsck.k9.controller.MessagingListener;
|
||||||
import com.fsck.k9.helper.SizeFormatter;
|
import com.fsck.k9.helper.SizeFormatter;
|
||||||
@ -87,7 +88,7 @@ import com.fsck.k9.preferences.SettingsImporter.ImportContents;
|
|||||||
import com.fsck.k9.preferences.SettingsImporter.ImportResults;
|
import com.fsck.k9.preferences.SettingsImporter.ImportResults;
|
||||||
|
|
||||||
|
|
||||||
public class Accounts extends K9ListActivity implements OnItemClickListener, OnClickListener {
|
public class Accounts extends K9ListActivity implements OnItemClickListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immutable empty {@link BaseAccount} array
|
* Immutable empty {@link BaseAccount} array
|
||||||
@ -355,6 +356,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
//onNewIntent(intent);
|
//onNewIntent(intent);
|
||||||
|
|
||||||
|
// see if we should show the welcome message
|
||||||
|
if (accounts.length < 1) {
|
||||||
|
WelcomeMessage.showWelcomeMessage(this);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
boolean startup = intent.getBooleanExtra(EXTRA_STARTUP, true);
|
boolean startup = intent.getBooleanExtra(EXTRA_STARTUP, true);
|
||||||
if (startup && K9.startIntegratedInbox() && !K9.isHideSpecialAccounts()) {
|
if (startup && K9.startIntegratedInbox() && !K9.isHideSpecialAccounts()) {
|
||||||
onOpenAccount(integratedInboxAccount);
|
onOpenAccount(integratedInboxAccount);
|
||||||
@ -371,9 +378,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
ListView listView = getListView();
|
ListView listView = getListView();
|
||||||
listView.setOnItemClickListener(this);
|
listView.setOnItemClickListener(this);
|
||||||
listView.setItemsCanFocus(false);
|
listView.setItemsCanFocus(false);
|
||||||
listView.setEmptyView(findViewById(R.id.empty));
|
|
||||||
listView.setScrollingCacheEnabled(false);
|
listView.setScrollingCacheEnabled(false);
|
||||||
findViewById(R.id.next).setOnClickListener(this);
|
|
||||||
registerForContextMenu(listView);
|
registerForContextMenu(listView);
|
||||||
|
|
||||||
if (icicle != null && icicle.containsKey(SELECTED_CONTEXT_ACCOUNT)) {
|
if (icicle != null && icicle.containsKey(SELECTED_CONTEXT_ACCOUNT)) {
|
||||||
@ -481,6 +486,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
private void refresh() {
|
private void refresh() {
|
||||||
accounts = Preferences.getPreferences(this).getAccounts();
|
accounts = Preferences.getPreferences(this).getAccounts();
|
||||||
|
|
||||||
|
// see if we should show the welcome message
|
||||||
|
if (accounts.length < 1) {
|
||||||
|
WelcomeMessage.showWelcomeMessage(this);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
List<BaseAccount> newAccounts;
|
List<BaseAccount> newAccounts;
|
||||||
if (!K9.isHideSpecialAccounts() && accounts.length > 0) {
|
if (!K9.isHideSpecialAccounts() && accounts.length > 0) {
|
||||||
if (integratedInboxAccount == null || unreadAccount == null) {
|
if (integratedInboxAccount == null || unreadAccount == null) {
|
||||||
@ -916,12 +927,6 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View view) {
|
|
||||||
if (view.getId() == R.id.next) {
|
|
||||||
onAddNewAccount();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onDeleteAccount(Account account) {
|
private void onDeleteAccount(Account account) {
|
||||||
mSelectedContextAccount = account;
|
mSelectedContextAccount = account;
|
||||||
showDialog(DIALOG_REMOVE_ACCOUNT);
|
showDialog(DIALOG_REMOVE_ACCOUNT);
|
||||||
|
@ -13,6 +13,7 @@ import android.view.View.OnClickListener;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import com.fsck.k9.*;
|
import com.fsck.k9.*;
|
||||||
|
import com.fsck.k9.activity.Accounts;
|
||||||
import com.fsck.k9.activity.K9Activity;
|
import com.fsck.k9.activity.K9Activity;
|
||||||
import com.fsck.k9.helper.Utility;
|
import com.fsck.k9.helper.Utility;
|
||||||
|
|
||||||
@ -85,6 +86,7 @@ public class AccountSetupNames extends K9Activity implements OnClickListener {
|
|||||||
}
|
}
|
||||||
mAccount.setName(mName.getText().toString());
|
mAccount.setName(mName.getText().toString());
|
||||||
mAccount.save(Preferences.getPreferences(this));
|
mAccount.save(Preferences.getPreferences(this));
|
||||||
|
Accounts.listAccountsClearTop(this);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
src/com/fsck/k9/activity/setup/WelcomeMessage.java
Normal file
33
src/com/fsck/k9/activity/setup/WelcomeMessage.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package com.fsck.k9.activity.setup;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
|
import com.fsck.k9.R;
|
||||||
|
import com.fsck.k9.activity.K9Activity;
|
||||||
|
|
||||||
|
public class WelcomeMessage extends K9Activity implements OnClickListener{
|
||||||
|
|
||||||
|
public static void showWelcomeMessage(Context context) {
|
||||||
|
Intent intent = new Intent(context, WelcomeMessage.class);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle icicle) {
|
||||||
|
super.onCreate(icicle);
|
||||||
|
setContentView(R.layout.welcome_message);
|
||||||
|
((Button) findViewById(R.id.next)).setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (view.getId() == R.id.next) {
|
||||||
|
AccountSetupBasics.actionNewAccount(this);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user