1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 00:58:50 -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:
Sander Bogaert 2012-08-24 10:29:17 -04:00 committed by Andrew Chen
parent e172e398ce
commit 29b6d046d3
7 changed files with 91 additions and 39 deletions

View File

@ -91,6 +91,12 @@
android:excludeFromRecents="true"
>
</activity>
<activity
android:name="com.fsck.k9.activity.setup.WelcomeMessage"
android:label="@string/welcome_message_title"
android:configChanges="locale"
>
</activity>
<activity
android:name="com.fsck.k9.activity.setup.FontSizeSettings"
android:label="@string/font_size_settings_title"

View File

@ -8,34 +8,4 @@
android:layout_width="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>

View 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>

View File

@ -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="accounts_title">Accounts</string>
<string name="welcome_message_title">Welcome to K-9 Mail!</string>
<string name="folders_title">Folders</string>
<string name="advanced">Advanced</string>
<string name="folder_list_title"><xliff:g id="account">%s</xliff:g> </string>

View File

@ -67,6 +67,7 @@ import com.fsck.k9.activity.misc.NonConfigurationInstance;
import com.fsck.k9.activity.setup.AccountSettings;
import com.fsck.k9.activity.setup.AccountSetupBasics;
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.MessagingListener;
import com.fsck.k9.helper.SizeFormatter;
@ -87,7 +88,7 @@ import com.fsck.k9.preferences.SettingsImporter.ImportContents;
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
@ -355,6 +356,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
Intent intent = getIntent();
//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);
if (startup && K9.startIntegratedInbox() && !K9.isHideSpecialAccounts()) {
onOpenAccount(integratedInboxAccount);
@ -371,9 +378,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
ListView listView = getListView();
listView.setOnItemClickListener(this);
listView.setItemsCanFocus(false);
listView.setEmptyView(findViewById(R.id.empty));
listView.setScrollingCacheEnabled(false);
findViewById(R.id.next).setOnClickListener(this);
registerForContextMenu(listView);
if (icicle != null && icicle.containsKey(SELECTED_CONTEXT_ACCOUNT)) {
@ -481,6 +486,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
private void refresh() {
accounts = Preferences.getPreferences(this).getAccounts();
// see if we should show the welcome message
if (accounts.length < 1) {
WelcomeMessage.showWelcomeMessage(this);
finish();
}
List<BaseAccount> newAccounts;
if (!K9.isHideSpecialAccounts() && accounts.length > 0) {
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) {
mSelectedContextAccount = account;
showDialog(DIALOG_REMOVE_ACCOUNT);

View File

@ -13,6 +13,7 @@ import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import com.fsck.k9.*;
import com.fsck.k9.activity.Accounts;
import com.fsck.k9.activity.K9Activity;
import com.fsck.k9.helper.Utility;
@ -85,6 +86,7 @@ public class AccountSetupNames extends K9Activity implements OnClickListener {
}
mAccount.setName(mName.getText().toString());
mAccount.save(Preferences.getPreferences(this));
Accounts.listAccountsClearTop(this);
finish();
}

View 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();
}
}
}