Convert setup to actionbars, and holo theme
* All setup activities given UI makeover: * Remove legacy themes from manifest - exposes default holo theme * Remove bottom row button(s) * Replace with action bar button(s) * No change to workflow or activity/fragment organization Change-Id: I07ce11a0a2b4b767b5ac111d466e68400fe0f30b
This commit is contained in:
parent
27c6547968
commit
8bcb572ccf
AndroidManifest.xml
res
layout
account_setup_basics.xmlaccount_setup_exchange.xmlaccount_setup_incoming.xmlaccount_setup_names.xmlaccount_setup_options.xmlaccount_setup_outgoing.xml
menu
src/com/android/email/activity/setup
@ -80,26 +80,22 @@
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupBasics"
|
||||
android:label="@string/account_setup_basics_title"
|
||||
android:theme="@android:style/Theme"
|
||||
android:exported="true"
|
||||
>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupAccountType"
|
||||
android:label="@string/account_setup_account_type_title"
|
||||
android:theme="@android:style/Theme"
|
||||
>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupIncoming"
|
||||
android:label="@string/account_setup_incoming_title"
|
||||
android:theme="@android:style/Theme"
|
||||
>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupOutgoing"
|
||||
android:label="@string/account_setup_outgoing_title"
|
||||
android:theme="@android:style/Theme"
|
||||
>
|
||||
</activity>
|
||||
<!--EXCHANGE-REMOVE-SECTION-START-->
|
||||
@ -108,7 +104,6 @@
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupExchange"
|
||||
android:label="@string/account_setup_exchange_title"
|
||||
android:theme="@android:style/Theme"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
>
|
||||
</activity>
|
||||
@ -116,13 +111,11 @@
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupOptions"
|
||||
android:label="@string/account_setup_options_title"
|
||||
android:theme="@android:style/Theme"
|
||||
>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupNames"
|
||||
android:label="@string/account_setup_names_title"
|
||||
android:theme="@android:style/Theme"
|
||||
>
|
||||
</activity>
|
||||
<!-- XXX Note: this activity is hacked to ignore config changes,
|
||||
@ -130,7 +123,6 @@
|
||||
<activity
|
||||
android:name=".activity.setup.AccountSetupCheckSettings"
|
||||
android:label="@string/account_setup_check_settings_title"
|
||||
android:theme="@android:style/Theme"
|
||||
android:configChanges="keyboardHidden|orientation"
|
||||
>
|
||||
</activity>
|
||||
|
@ -19,40 +19,11 @@
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
<fragment
|
||||
android:id="@+id/setup_basics_fragment"
|
||||
class="com.android.email.activity.setup.AccountSetupBasicsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<fragment
|
||||
android:id="@+id/setup_basics_fragment"
|
||||
class="com.android.email.activity.setup.AccountSetupBasicsFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dip"
|
||||
android:background="@android:drawable/bottom_bar" >
|
||||
<Button
|
||||
android:id="@+id/manual_setup"
|
||||
android:text="@string/account_setup_basics_manual_setup_action"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="@dimen/button_minWidth"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true" />
|
||||
<Button
|
||||
android:id="@+id/next"
|
||||
android:text="@string/next_action"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="@dimen/button_minWidth"
|
||||
android:drawableRight="@drawable/button_indicator_next"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
</ScrollView>
|
||||
|
@ -26,7 +26,7 @@
|
||||
android:orientation="vertical" >
|
||||
|
||||
<fragment
|
||||
android:id="@+id/setup_exchange_fragment"
|
||||
android:id="@+id/setup_fragment"
|
||||
class="com.android.email.activity.setup.AccountSetupExchangeFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -20,32 +20,11 @@
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true" >
|
||||
|
||||
<LinearLayout
|
||||
<fragment
|
||||
android:id="@+id/setup_fragment"
|
||||
class="com.android.email.activity.setup.AccountSetupIncomingFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<fragment
|
||||
android:id="@+id/setup_incoming_fragment"
|
||||
class="com.android.email.activity.setup.AccountSetupIncomingFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dip"
|
||||
android:background="@android:drawable/bottom_bar">
|
||||
<Button
|
||||
android:id="@+id/next"
|
||||
android:text="@string/next_action"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="@dimen/button_minWidth"
|
||||
android:drawableRight="@drawable/button_indicator_next"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
</ScrollView>
|
||||
|
@ -22,57 +22,38 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:text="@string/account_setup_names_instructions"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:text="@string/account_setup_names_instructions"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<TextView
|
||||
android:text="@string/account_setup_names_account_name_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<EditText
|
||||
android:id="@+id/account_description"
|
||||
android:inputType="textCapWords"
|
||||
android:imeOptions="actionDone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<TextView
|
||||
android:id="@+id/account_name_label"
|
||||
android:text="@string/account_setup_names_user_name_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<EditText
|
||||
android:id="@+id/account_name"
|
||||
android:inputType="textPersonName"
|
||||
android:imeOptions="actionDone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
</LinearLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dip"
|
||||
android:background="@android:drawable/bottom_bar">
|
||||
<Button
|
||||
android:id="@+id/done"
|
||||
android:text="@string/done_action"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="@dimen/button_minWidth"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<TextView
|
||||
android:text="@string/account_setup_names_account_name_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<EditText
|
||||
android:id="@+id/account_description"
|
||||
android:inputType="textCapWords"
|
||||
android:imeOptions="actionDone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<TextView
|
||||
android:id="@+id/account_name_label"
|
||||
android:text="@string/account_setup_names_user_name_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<EditText
|
||||
android:id="@+id/account_name"
|
||||
android:inputType="textPersonName"
|
||||
android:imeOptions="actionDone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
@ -23,78 +23,57 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
<TextView
|
||||
android:text="@string/account_setup_options_mail_check_frequency_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical" >
|
||||
<TextView
|
||||
android:text="@string/account_setup_options_mail_check_frequency_label"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<Spinner
|
||||
android:id="@+id/account_check_frequency"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<TextView
|
||||
android:id="@+id/account_sync_window_label"
|
||||
android:text="@string/account_setup_options_mail_window_label"
|
||||
android:visibility="gone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<Spinner
|
||||
android:id="@+id/account_sync_window"
|
||||
android:visibility="gone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_default"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_default_label" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_notify"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_notify_label" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_sync_contacts"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_sync_contacts_label"
|
||||
android:visibility="gone" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_sync_calendar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_sync_calendar_label"
|
||||
android:visibility="gone" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_sync_email"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_sync_email_label" />
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dip"
|
||||
android:background="@android:drawable/bottom_bar">
|
||||
<Button
|
||||
android:id="@+id/next"
|
||||
android:text="@string/next_action"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="@dimen/button_minWidth"
|
||||
android:drawableRight="@drawable/button_indicator_next"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<Spinner
|
||||
android:id="@+id/account_check_frequency"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<TextView
|
||||
android:id="@+id/account_sync_window_label"
|
||||
android:text="@string/account_setup_options_mail_window_label"
|
||||
android:visibility="gone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
<Spinner
|
||||
android:id="@+id/account_sync_window"
|
||||
android:visibility="gone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_default"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_default_label" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_notify"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_notify_label" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_sync_contacts"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_sync_contacts_label"
|
||||
android:visibility="gone" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_sync_calendar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_sync_calendar_label"
|
||||
android:visibility="gone" />
|
||||
<CheckBox
|
||||
android:id="@+id/account_sync_email"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/account_setup_options_sync_email_label" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
@ -20,32 +20,11 @@
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true" >
|
||||
|
||||
<LinearLayout
|
||||
<fragment
|
||||
android:id="@+id/setup_fragment"
|
||||
class="com.android.email.activity.setup.AccountSetupOutgoingFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<fragment
|
||||
android:id="@+id/setup_outgoing_fragment"
|
||||
class="com.android.email.activity.setup.AccountSetupOutgoingFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dip"
|
||||
android:background="@android:drawable/bottom_bar">
|
||||
<Button
|
||||
android:id="@+id/next"
|
||||
android:text="@string/next_action"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="@dimen/button_minWidth"
|
||||
android:drawableRight="@drawable/button_indicator_next"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
</ScrollView>
|
||||
|
27
res/menu/account_setup_manual_next_option.xml
Normal file
27
res/menu/account_setup_manual_next_option.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2010 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- Two items for setup: "manual" and "next" -->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/manual_setup"
|
||||
android:title="@string/account_setup_basics_manual_setup_action"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
<item android:id="@+id/next"
|
||||
android:title="@string/next_action"
|
||||
android:showAsAction="always"
|
||||
/>
|
||||
</menu>
|
@ -14,7 +14,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<!-- A single "Next" button for the incoming, outgoing, and exchange fragments -->
|
||||
<!-- A menu for for any fragments/screens with a single "Next" button -->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/next"
|
||||
android:title="@string/next_action"
|
@ -93,7 +93,7 @@ public abstract class AccountServerBaseFragment extends Fragment {
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.account_settings_next_option, menu);
|
||||
inflater.inflate(R.menu.account_setup_next_option, menu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,6 @@ package com.android.email.activity.setup;
|
||||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.VendorPolicyLoader;
|
||||
import com.android.email.activity.ActivityHelper;
|
||||
import com.android.email.activity.Welcome;
|
||||
import com.android.email.provider.EmailContent.Account;
|
||||
|
||||
@ -27,9 +26,8 @@ import android.app.Activity;
|
||||
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 android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
/**
|
||||
* Prompts the user for the email address and password. Also prompts for
|
||||
@ -40,11 +38,11 @@ import android.widget.Button;
|
||||
* AccountSetupAccountType activity.
|
||||
*/
|
||||
public class AccountSetupBasics extends AccountSetupActivity
|
||||
implements OnClickListener, AccountSetupBasicsFragment.Callback {
|
||||
implements AccountSetupBasicsFragment.Callback {
|
||||
|
||||
private AccountSetupBasicsFragment mFragment;
|
||||
private Button mNextButton;
|
||||
private Button mManualSetupButton;
|
||||
private boolean mManualButtonDisplayed;
|
||||
private boolean mNextButtonEnabled;
|
||||
|
||||
public static void actionNewAccount(Activity fromActivity) {
|
||||
SetupData.init(SetupData.FLOW_MODE_NORMAL);
|
||||
@ -119,17 +117,14 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||
|
||||
setContentView(R.layout.account_setup_basics);
|
||||
|
||||
mFragment = (AccountSetupBasicsFragment) findFragmentById(R.id.setup_basics_fragment);
|
||||
mNextButton = (Button) findViewById(R.id.next);
|
||||
mManualSetupButton = (Button) findViewById(R.id.manual_setup);
|
||||
|
||||
mNextButton.setOnClickListener(this);
|
||||
mManualSetupButton.setOnClickListener(this);
|
||||
|
||||
mFragment = (AccountSetupBasicsFragment)
|
||||
getFragmentManager().findFragmentById(R.id.setup_basics_fragment);
|
||||
|
||||
mManualButtonDisplayed = true;
|
||||
boolean alternateStrings = false;
|
||||
if (flowMode == SetupData.FLOW_MODE_ACCOUNT_MANAGER_EAS) {
|
||||
// No need for manual button -> next is appropriate
|
||||
mManualSetupButton.setVisibility(View.GONE);
|
||||
mManualButtonDisplayed = false;
|
||||
// Swap welcome text for EAS-specific text
|
||||
alternateStrings = VendorPolicyLoader.getInstance(this).useAlternateExchangeStrings();
|
||||
setTitle(alternateStrings
|
||||
@ -141,7 +136,7 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||
mFragment.setCallback(this, alternateStrings);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* This is used in automatic setup mode to jump directly down to the names screen.
|
||||
*
|
||||
* NOTE: With this organization, it is *not* possible to auto-create an exchange account,
|
||||
@ -156,28 +151,58 @@ public class AccountSetupBasics extends AccountSetupActivity
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
/**
|
||||
* Add "Next" & "Manual" buttons when this activity is displayed
|
||||
*/
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
int menuId = mManualButtonDisplayed
|
||||
? R.menu.account_setup_manual_next_option
|
||||
: R.menu.account_setup_next_option;
|
||||
getMenuInflater().inflate(menuId, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable "Next" & "Manual" buttons
|
||||
*/
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
menu.findItem(R.id.next).setEnabled(mNextButtonEnabled);
|
||||
if (mManualButtonDisplayed) {
|
||||
menu.findItem(R.id.manual_setup).setEnabled(mNextButtonEnabled);
|
||||
}
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond to clicks in the "Next" button
|
||||
*/
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.next:
|
||||
mFragment.onNext();
|
||||
break;
|
||||
return true;
|
||||
case R.id.manual_setup:
|
||||
// no AutoDiscover - user clicked "manual"
|
||||
mFragment.onManualSetup(false);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements AccountSetupBasicsFragment.Callback
|
||||
*/
|
||||
@Override
|
||||
public void onEnableProceedButtons(boolean enable) {
|
||||
mNextButton.setEnabled(enable);
|
||||
mManualSetupButton.setEnabled(enable);
|
||||
// Dim the next button's icon to 50% if the button is disabled.
|
||||
// TODO this can probably be done with a stateful drawable. (check android:state_enabled
|
||||
Utility.setCompoundDrawablesAlpha(mNextButton, mNextButton.isEnabled() ? 255 : 128);
|
||||
public void onEnableProceedButtons(boolean enabled) {
|
||||
boolean wasEnabled = mNextButtonEnabled;
|
||||
mNextButtonEnabled = enabled;
|
||||
|
||||
if (enabled != wasEnabled) {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,7 +18,6 @@ package com.android.email.activity.setup;
|
||||
|
||||
import com.android.email.R;
|
||||
import com.android.email.SecurityPolicy.PolicySet;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.provider.EmailContent.Account;
|
||||
import com.android.email.provider.EmailContent.HostAuth;
|
||||
import com.android.email.service.EmailServiceProxy;
|
||||
@ -27,9 +26,6 @@ import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
||||
/**
|
||||
* Provides generic setup for Exchange accounts. The following fields are supported:
|
||||
@ -71,10 +67,10 @@ import android.widget.Button;
|
||||
* What we really need here is a more "sticky" way to prevent that problem.
|
||||
*/
|
||||
public class AccountSetupExchange extends AccountSetupActivity
|
||||
implements OnClickListener, AccountSetupExchangeFragment.Callback {
|
||||
implements AccountSetupExchangeFragment.Callback {
|
||||
|
||||
/* package */ AccountSetupExchangeFragment mFragment;
|
||||
private Button mNextButton;
|
||||
private boolean mNextButtonEnabled;
|
||||
|
||||
public static void actionIncomingSettings(Activity fromActivity, int mode, Account acct) {
|
||||
SetupData.init(mode, acct);
|
||||
@ -98,10 +94,8 @@ public class AccountSetupExchange extends AccountSetupActivity
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.account_setup_exchange);
|
||||
|
||||
mFragment = (AccountSetupExchangeFragment) findFragmentById(R.id.setup_exchange_fragment);
|
||||
mNextButton = (Button)findViewById(R.id.next);
|
||||
mNextButton.setOnClickListener(this);
|
||||
|
||||
mFragment = (AccountSetupExchangeFragment)
|
||||
getFragmentManager().findFragmentById(R.id.setup_fragment);
|
||||
mFragment.setCallback(this);
|
||||
|
||||
startAutoDiscover();
|
||||
@ -126,7 +120,6 @@ public class AccountSetupExchange extends AccountSetupActivity
|
||||
// If we've got a username and password and we're NOT editing, try autodiscover
|
||||
String username = account.mHostAuthRecv.mLogin;
|
||||
String password = account.mHostAuthRecv.mPassword;
|
||||
Intent intent = getIntent();
|
||||
if (username != null && password != null) {
|
||||
AccountSetupCheckSettings.actionAutoDiscover(this, account.mEmailAddress, password);
|
||||
}
|
||||
@ -208,11 +201,15 @@ public class AccountSetupExchange extends AccountSetupActivity
|
||||
// Otherwise, proceed into this activity for manual setup
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.next:
|
||||
mFragment.onNext();
|
||||
break;
|
||||
/**
|
||||
* Implements AccountServerBaseFragment.Callback
|
||||
*/
|
||||
public void onEnableProceedButtons(boolean enabled) {
|
||||
boolean wasEnabled = mNextButtonEnabled;
|
||||
mNextButtonEnabled = enabled;
|
||||
|
||||
if (enabled != wasEnabled) {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,14 +219,4 @@ public class AccountSetupExchange extends AccountSetupActivity
|
||||
public void onProceedNext(int checkMode) {
|
||||
AccountSetupCheckSettings.actionCheckSettings(this, checkMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements AccountServerBaseFragment.Callback
|
||||
*/
|
||||
public void onEnableProceedButtons(boolean enabled) {
|
||||
mNextButton.setEnabled(enabled);
|
||||
// Dim the next button's icon to 50% if the button is disabled.
|
||||
// TODO this can probably be done with a stateful drawable. (check android:state_enabled)
|
||||
Utility.setCompoundDrawablesAlpha(mNextButton, enabled ? 255 : 128);
|
||||
}
|
||||
}
|
||||
|
@ -17,21 +17,17 @@
|
||||
package com.android.email.activity.setup;
|
||||
|
||||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.provider.EmailContent;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
||||
public class AccountSetupIncoming extends AccountSetupActivity
|
||||
implements OnClickListener, AccountSetupIncomingFragment.Callback {
|
||||
implements AccountSetupIncomingFragment.Callback {
|
||||
|
||||
private AccountSetupIncomingFragment mFragment;
|
||||
private Button mNextButton;
|
||||
private boolean mNextButtonEnabled;
|
||||
|
||||
public static void actionIncomingSettings(Activity fromActivity, int mode,
|
||||
EmailContent.Account account) {
|
||||
@ -49,9 +45,8 @@ public class AccountSetupIncoming extends AccountSetupActivity
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.account_setup_incoming);
|
||||
|
||||
mFragment = (AccountSetupIncomingFragment) findFragmentById(R.id.setup_incoming_fragment);
|
||||
mNextButton = (Button)findViewById(R.id.next);
|
||||
mNextButton.setOnClickListener(this);
|
||||
mFragment = (AccountSetupIncomingFragment)
|
||||
getFragmentManager().findFragmentById(R.id.setup_fragment);
|
||||
|
||||
// Configure fragment
|
||||
mFragment.setCallback(this);
|
||||
@ -76,14 +71,14 @@ public class AccountSetupIncoming extends AccountSetupActivity
|
||||
}
|
||||
|
||||
/**
|
||||
* When the user clicks "next", notify the fragment that it's time to prepare the new
|
||||
* settings to be tested. This will call back via onProceedNext() to actually launch the test.
|
||||
* Implements AccountServerBaseFragment.Callback
|
||||
*/
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.next:
|
||||
mFragment.onNext();
|
||||
break;
|
||||
public void onEnableProceedButtons(boolean enabled) {
|
||||
boolean wasEnabled = mNextButtonEnabled;
|
||||
mNextButtonEnabled = enabled;
|
||||
|
||||
if (enabled != wasEnabled) {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,14 +88,4 @@ public class AccountSetupIncoming extends AccountSetupActivity
|
||||
public void onProceedNext(int checkMode) {
|
||||
AccountSetupCheckSettings.actionCheckSettings(this, checkMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements AccountServerBaseFragment.Callback
|
||||
*/
|
||||
public void onEnableProceedButtons(boolean enabled) {
|
||||
mNextButton.setEnabled(enabled);
|
||||
// Dim the next button's icon to 50% if the button is disabled.
|
||||
// TODO this can probably be done with a stateful drawable. (check android:state_enabled)
|
||||
Utility.setCompoundDrawablesAlpha(mNextButton, enabled ? 255 : 128);
|
||||
}
|
||||
}
|
||||
|
@ -25,28 +25,26 @@ import com.android.email.provider.EmailContent.AccountColumns;
|
||||
import com.android.email.provider.EmailContent.HostAuth;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentUris;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.TextKeyListener;
|
||||
import android.text.method.TextKeyListener.Capitalize;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
|
||||
public class AccountSetupNames extends AccountSetupActivity implements OnClickListener {
|
||||
public class AccountSetupNames extends AccountSetupActivity {
|
||||
private static final int REQUEST_SECURITY = 0;
|
||||
|
||||
private EditText mDescription;
|
||||
private EditText mName;
|
||||
private Button mDoneButton;
|
||||
private boolean mEasAccount = false;
|
||||
private boolean mNextButtonEnabled;
|
||||
|
||||
private CheckAccountStateTask mCheckAccountStateTask;
|
||||
|
||||
@ -60,8 +58,6 @@ public class AccountSetupNames extends AccountSetupActivity implements OnClickLi
|
||||
setContentView(R.layout.account_setup_names);
|
||||
mDescription = (EditText)findViewById(R.id.account_description);
|
||||
mName = (EditText)findViewById(R.id.account_name);
|
||||
mDoneButton = (Button)findViewById(R.id.done);
|
||||
mDoneButton.setOnClickListener(this);
|
||||
|
||||
TextWatcher validationTextWatcher = new TextWatcher() {
|
||||
public void afterTextChanged(Editable s) {
|
||||
@ -121,14 +117,46 @@ public class AccountSetupNames extends AccountSetupActivity implements OnClickLi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add "Next" button when this activity is displayed
|
||||
*/
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.account_setup_next_option, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable "Next" button
|
||||
*/
|
||||
@Override
|
||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||
menu.findItem(R.id.next).setEnabled(mNextButtonEnabled);
|
||||
return super.onPrepareOptionsMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond to clicks in the "Next" button
|
||||
*/
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.next:
|
||||
onNext();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Validator should also trim the name string before checking it.
|
||||
*/
|
||||
private void validateFields() {
|
||||
if (!mEasAccount) {
|
||||
mDoneButton.setEnabled(Utility.isTextViewNotEmpty(mName));
|
||||
boolean newEnabled = !mEasAccount || Utility.isTextViewNotEmpty(mName);
|
||||
if (newEnabled != mNextButtonEnabled) {
|
||||
mNextButtonEnabled = newEnabled;
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
Utility.setCompoundDrawablesAlpha(mDoneButton, mDoneButton.isEnabled() ? 255 : 128);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -175,14 +203,6 @@ public class AccountSetupNames extends AccountSetupActivity implements OnClickLi
|
||||
mCheckAccountStateTask.execute();
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.done:
|
||||
onNext();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This async task is launched just before exiting. It's a last chance test, before leaving
|
||||
* this activity, for the account being in a "hold" state, and gives the user a chance to
|
||||
|
@ -36,15 +36,16 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class AccountSetupOptions extends AccountSetupActivity implements OnClickListener {
|
||||
public class AccountSetupOptions extends AccountSetupActivity {
|
||||
|
||||
private Spinner mCheckFrequencyView;
|
||||
private Spinner mSyncWindowView;
|
||||
@ -78,7 +79,6 @@ public class AccountSetupOptions extends AccountSetupActivity implements OnClick
|
||||
mSyncCalendarView = (CheckBox) findViewById(R.id.account_sync_calendar);
|
||||
mSyncEmailView = (CheckBox) findViewById(R.id.account_sync_email);
|
||||
mSyncEmailView.setChecked(true);
|
||||
findViewById(R.id.next).setOnClickListener(this);
|
||||
|
||||
// Generate spinner entries using XML arrays used by the preferences
|
||||
int frequencyValuesId;
|
||||
@ -135,6 +135,36 @@ public class AccountSetupOptions extends AccountSetupActivity implements OnClick
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add "Next" button when this activity is displayed
|
||||
*/
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.account_setup_next_option, menu);
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond to clicks in the "Next" button
|
||||
*/
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.next:
|
||||
// Don't allow this more than once (Exchange accounts call an async method
|
||||
// before finish()'ing the Activity, which allows this code to potentially be
|
||||
// executed multiple times
|
||||
if (!mDonePressed) {
|
||||
onDone();
|
||||
mDonePressed = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AccountManagerCallback<Bundle> mAccountManagerCallback = new AccountManagerCallback<Bundle>() {
|
||||
public void run(AccountManagerFuture<Bundle> future) {
|
||||
try {
|
||||
@ -248,20 +278,6 @@ public class AccountSetupOptions extends AccountSetupActivity implements OnClick
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.next:
|
||||
// Don't allow this more than once (Exchange accounts call an async method
|
||||
// before finish()'ing the Activity, which allows this code to potentially be
|
||||
// executed multiple times
|
||||
if (!mDonePressed) {
|
||||
onDone();
|
||||
mDonePressed = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable an additional spinner using the arrays normally handled by preferences
|
||||
*/
|
||||
|
@ -17,22 +17,18 @@
|
||||
package com.android.email.activity.setup;
|
||||
|
||||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.provider.EmailContent;
|
||||
import com.android.email.provider.EmailContent.Account;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
|
||||
public class AccountSetupOutgoing extends Activity
|
||||
implements OnClickListener, AccountSetupOutgoingFragment.Callback {
|
||||
implements AccountSetupOutgoingFragment.Callback {
|
||||
|
||||
private AccountSetupOutgoingFragment mFragment;
|
||||
private Button mNextButton;
|
||||
private boolean mNextButtonEnabled;
|
||||
|
||||
public static void actionOutgoingSettings(Activity fromActivity, int mode, Account acct) {
|
||||
SetupData.init(mode, acct);
|
||||
@ -48,9 +44,8 @@ public class AccountSetupOutgoing extends Activity
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.account_setup_outgoing);
|
||||
|
||||
mFragment = (AccountSetupOutgoingFragment) findFragmentById(R.id.setup_outgoing_fragment);
|
||||
mNextButton = (Button)findViewById(R.id.next);
|
||||
mNextButton.setOnClickListener(this);
|
||||
mFragment = (AccountSetupOutgoingFragment)
|
||||
getFragmentManager().findFragmentById(R.id.setup_fragment);
|
||||
|
||||
// Configure fragment
|
||||
mFragment.setCallback(this);
|
||||
@ -74,14 +69,14 @@ public class AccountSetupOutgoing extends Activity
|
||||
}
|
||||
|
||||
/**
|
||||
* When the user clicks "next", notify the fragment that it's time to prepare the new
|
||||
* settings to be tested. This will call back via onProceedNext() to actually launch the test.
|
||||
* Implements AccountServerBaseFragment.Callback
|
||||
*/
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.next:
|
||||
mFragment.onNext();
|
||||
break;
|
||||
public void onEnableProceedButtons(boolean enabled) {
|
||||
boolean wasEnabled = mNextButtonEnabled;
|
||||
mNextButtonEnabled = enabled;
|
||||
|
||||
if (enabled != wasEnabled) {
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,14 +86,4 @@ public class AccountSetupOutgoing extends Activity
|
||||
public void onProceedNext(int checkMode) {
|
||||
AccountSetupCheckSettings.actionCheckSettings(this, checkMode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements AccountServerBaseFragment.Callback
|
||||
*/
|
||||
public void onEnableProceedButtons(boolean enabled) {
|
||||
mNextButton.setEnabled(enabled);
|
||||
// Dim the next button's icon to 50% if the button is disabled.
|
||||
// TODO this can probably be done with a stateful drawable. (check android:state_enabled)
|
||||
Utility.setCompoundDrawablesAlpha(mNextButton, enabled ? 255 : 128);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user