Convert server settings to dialog

b/8134410

Change-Id: I3c4c9a02a37571a9c7af10971840fbe39458244e
This commit is contained in:
Tony Mantler 2014-07-29 15:12:04 -07:00
parent 6e976f1d05
commit 751a029c31
10 changed files with 119 additions and 89 deletions

View File

@ -165,7 +165,10 @@
<activity
android:name=".activity.setup.AccountCredentials"
android:label="@string/sign_in_title">
android:label="@string/sign_in_title"
android:exported="false"
android:excludeFromRecents="true"
android:theme="@style/AccountSetupDialogActivityTheme">
</activity>
<activity
@ -301,10 +304,12 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".activity.setup.AccountServerSettingsActivity"
android:label="@string/mailbox_settings_activity_title"
android:exported="false">
</activity>
<activity
android:name=".activity.setup.AccountServerSettingsActivity"
android:label="@string/mailbox_settings_activity_title"
android:exported="false"
android:excludeFromRecents="true"
android:theme="@style/AccountSetupDialogActivityTheme" />
<!-- a Headless Activity to load the account from the account id before navigating to the
Incoming Account Settings fragment -->
<activity

View File

@ -13,20 +13,30 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent" >
<LinearLayout
style="@style/account_setup_fragment_container"
android:layout_width="match_parent"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:divider="?android:attr/dividerHorizontal"
android:showDividers="middle" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingTop="@dimen/settings_fragment_padding_top" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:paddingLeft="@dimen/settings_fragment_padding_side"
android:paddingRight="@dimen/settings_fragment_padding_side" >
<include
layout="@layout/account_setup_credentials_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<include layout="@layout/account_setup_credentials_fragment" />
<include layout="@layout/account_settings_buttons" />
</LinearLayout>
</ScrollView>
</FrameLayout>
</ScrollView>
<include layout="@layout/account_settings_buttons"/>
</LinearLayout>

View File

@ -14,9 +14,7 @@
limitations under the License.
-->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/account_server_settings_container">
</ScrollView>
android:id="@+id/account_server_settings_container" />

View File

@ -18,19 +18,20 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="@dimen/settings_buttons_padding_top"
android:paddingBottom="@dimen/settings_buttons_padding_bottom">
style="?android:attr/buttonBarStyle" >
<Button
android:id="@+id/cancel"
style="@style/account_settings_button"
android:layout_width="0dip"
android:layout_width="0dp"
android:layout_height="48sp"
android:layout_weight="1"
android:text="@android:string/cancel" />
android:text="@android:string/cancel"
style="?android:attr/buttonBarButtonStyle" />
<Button
android:id="@+id/done"
style="@style/account_settings_button"
android:layout_width="0dip"
android:layout_width="0dp"
android:layout_height="48sp"
android:layout_weight="1"
android:text="@string/done" />
</LinearLayout>
android:text="@string/done"
style="?android:attr/buttonBarButtonStyle" />
</LinearLayout>

View File

@ -15,38 +15,31 @@
-->
<!-- Incoming server settings. This is a wrapper around the "incoming setup" fragment
that adds scrollview & buttons and makes it more compatible with a 2-pane PreferenceActivity
such as AccountSettingsXL. -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
that adds scrollview & buttons -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/settings_fragment_padding_top"
android:paddingLeft="@dimen/settings_fragment_padding_side"
android:paddingRight="@dimen/settings_fragment_padding_side"
>
android:layout_height="wrap_content"
android:orientation="vertical"
android:divider="?android:attr/dividerHorizontal"
android:showDividers="middle" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingTop="@dimen/settings_fragment_padding_top" >
<!-- Fields entry -->
<FrameLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<include
layout="@layout/account_setup_incoming_fragment"
/>
android:paddingLeft="@dimen/settings_fragment_padding_side"
android:paddingRight="@dimen/settings_fragment_padding_side" >
<include layout="@layout/account_setup_incoming_fragment" />
</FrameLayout>
<!-- This spacer fills the viewport and moves the buttons to the bottom -->
<View
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" />
</ScrollView>
<include layout="@layout/account_settings_buttons" />
</LinearLayout>
</ScrollView>
<include layout="@layout/account_settings_buttons"/>
</LinearLayout>

View File

@ -15,38 +15,31 @@
-->
<!-- Outgoing server settings. This is a wrapper around the "outgoing setup" fragment
that adds scrollview & buttons and makes it more compatible with a 2-pane PreferenceActivity
such as AccountSettingsXL. -->
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
that adds scrollview & buttons -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="@dimen/settings_fragment_padding_top"
android:paddingLeft="@dimen/settings_fragment_padding_side"
android:paddingRight="@dimen/settings_fragment_padding_side"
>
android:layout_height="wrap_content"
android:orientation="vertical"
android:divider="?android:attr/dividerHorizontal"
android:showDividers="middle" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingTop="@dimen/settings_fragment_padding_top" >
<!-- Fields entry -->
<FrameLayout
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<include
layout="@layout/account_setup_outgoing_fragment"
/>
android:paddingLeft="@dimen/settings_fragment_padding_side"
android:paddingRight="@dimen/settings_fragment_padding_side" >
<include layout="@layout/account_setup_outgoing_fragment" />
</FrameLayout>
<!-- This spacer fills the viewport and moves the buttons to the bottom -->
<View
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" />
</ScrollView>
<include layout="@layout/account_settings_buttons" />
</LinearLayout>
</ScrollView>
<include layout="@layout/account_settings_buttons"/>
</LinearLayout>

26
res/values-v21/styles.xml Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->
<resources>
<style name="AccountSetupDialogActivityTheme"
parent="@android:style/Theme.Material.Light.Dialog.NoActionBar">
<!-- ActionBar color -->
<item name="android:colorPrimary">@color/actionbar_color</item>
<!-- Used by the StatusBar and NavBar (currently broken?) -->
<item name="android:colorPrimaryDark">@color/statusbar_color</item>
<item name="android:colorAccent">@color/accent_blue</item>
</style>
</resources>

View File

@ -15,6 +15,8 @@
-->
<resources>
<style name="AccountSetupDialogActivityTheme"
parent="@android:style/Theme.Holo.Light.Dialog.NoActionBar" />
<!-- Account Setup Activity -->
<style name="account_setup_content">
<item name="android:background">@drawable/account_setup_background</item>

View File

@ -32,6 +32,8 @@ public class AccountCredentials extends Activity
final String emailAddress = getIntent().getStringExtra(EXTRA_EMAIL);
final String protocol = getIntent().getStringExtra(EXTRA_PROTOCOL);
setFinishOnTouchOutside(false);
if (savedInstanceState == null) {
final AccountSetupCredentialsFragment f =
AccountSetupCredentialsFragment.newInstance(emailAddress, protocol,

View File

@ -67,8 +67,8 @@ public class AccountServerSettingsActivity extends AccountSetupActivity implemen
mSetupData.setFlowMode(SetupDataFragment.FLOW_MODE_EDIT);
// TODO: this activity is ugly as sin
setContentView(R.layout.account_server_settings);
setFinishOnTouchOutside(false);
if (savedInstanceState == null) {
final Account account = getIntent().getParcelableExtra(EXTRA_ACCOUNT);