Step 1 in - Email support for 7" devices.

This is a cherry-pick of 9f976e29a0 from
honeycomb-mr2. This is still using the old w600 qualifiers but the next
CL will cherry-pick the fix for that.

Change-Id: I40ab6717575cdfd02d5f7d05409f0355e96f2085
This commit is contained in:
Ben Komalo 2011-05-25 12:08:09 -07:00
parent 72b458395d
commit 761390a041
40 changed files with 245 additions and 66 deletions

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- Account-type picker - xlarge - see layout/ for small-screen version -->
<!-- Account-type picker - tablet - see layout/ for small-screen version -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -41,22 +41,12 @@
android:layout_height="1px"
android:background="@color/account_setup_divider_color" />
<!-- Button(s) on the right -->
<Button
android:id="@+id/previous"
android:layout_below="@+id/top_divider"
android:layout_alignParentRight="true"
android:layout_marginTop="@dimen/setup_buttons_padding_top"
android:layout_marginRight="@dimen/setup_buttons_padding_right"
style="@style/accountSetupButton"
android:text="@string/previous_action" />
<!-- Layout on the left containing the setup info -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_content"
android:layout_below="@+id/top_divider"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/previous"
android:layout_marginRight="64dip"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
@ -95,4 +85,14 @@
style="@style/accountSetupButton"
android:text="@string/account_setup_account_type_exchange_action" />
</RelativeLayout>
<!-- Previous button (can be below or to the right) -->
<Button
android:id="@+id/previous"
android:layout_marginTop="@dimen/setup_buttons_padding_top"
android:layout_marginRight="@dimen/setup_buttons_padding_right"
style="@style/accountSetupTypePrevious"
android:text="@string/previous_action" />
</RelativeLayout>

View File

@ -15,7 +15,7 @@
-->
<!-- Common data-entry area of initial account setup screen - email, password, default check -->
<!-- xlarge version -->
<!-- tablet version -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- Exchange server settings - xlarge - see layout/ for phone UX variant -->
<!-- Exchange server settings - tablet - see layout/ for phone UX variant -->
<!-- This is used directly by the account setup activity, but during settings it is
wrapped in an outer layout (account_settings_exchange_fragment) -->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- Incoming server settings - xlarge - see layout/ for phone UX variant -->
<!-- Incoming server settings - tablet - see layout/ for phone UX variant -->
<!-- This is used directly by the account setup activity, but during settings it is
wrapped in an outer layout (account_settings_incoming_fragment) -->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"

View File

@ -15,7 +15,7 @@
-->
<!-- Common data-entry area of account name setup screen - account nickname, user name. -->
<!-- xlarge version -->
<!-- tablet version -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"

View File

@ -15,7 +15,7 @@
-->
<!-- Common data-entry area of account options setup screen - check freq, options, etc. -->
<!-- xlarge version -->
<!-- tablet version -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- Incoming server settings - xlarge - see layout/ for phone UX variant -->
<!-- Incoming server settings - tablet - see layout/ for phone UX variant -->
<!-- This is used directly by the account setup activity, but during settings it is
wrapped in an outer layout (account_settings_outgoing_fragment) -->
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge -->
<!-- tablet -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge -->
<!-- tablet -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge -->
<!-- tablet -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge -->
<!-- tablet -->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge -->
<!-- tablet -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<!-- Note the width of each pane is set by code at runtime. -->
<com.android.email.activity.ThreePaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:splitMotionEvents="true"
>
<include layout="@layout/three_pane_collapsible_impl" />
</com.android.email.activity.ThreePaneLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<!-- Note the width of each pane is set by code at runtime. -->
<com.android.email.activity.ThreePaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:splitMotionEvents="true"
>
<include layout="@layout/three_pane_impl" />
</com.android.email.activity.ThreePaneLayout>

View File

@ -16,12 +16,10 @@
<!-- ThreePaneLayout is based on LinearLayout with the orientation always horizontal -->
<!-- for portrait -->
<!-- Implementation of a three pane layout where in some modes, the left pane is
collapsible. -->
<!-- Note the width of each pane is set by code at runtime. -->
<com.android.email.activity.ThreePaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:splitMotionEvents="true"
>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:id="@+id/left_pane"
@ -62,4 +60,4 @@
android:background="@android:color/transparent"
/>
</FrameLayout>
</com.android.email.activity.ThreePaneLayout>
</merge>

View File

@ -16,12 +16,10 @@
<!-- ThreePaneLayout is based on LinearLayout with the orientation always horizontal -->
<!-- for landscape -->
<!-- Implementation of a three pane layout where two panes are always visible at
any given time. -->
<!-- Note the width of each pane is set by code at runtime. -->
<com.android.email.activity.ThreePaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:splitMotionEvents="true"
>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<FrameLayout
android:id="@+id/left_pane"
@ -49,4 +47,4 @@
android:layout_width="0dip"
android:layout_height="match_parent"
/>
</com.android.email.activity.ThreePaneLayout>
</merge>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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.
-->
<!-- large, landscape -->
<resources>
<!-- Account Setup Activities -->
<dimen name="setup_padding_top">16dip</dimen>
<dimen name="setup_padding_left">64dip</dimen>
<dimen name="setup_padding_right">64dip</dimen>
</resources>

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="accountSetupTypePrevious" parent="@style/accountSetupButton">
<item name="android:layout_alignParentBottom">true</item>
<item name="android:layout_alignParentLeft">true</item>
<item name="android:layout_marginBottom">48dip</item>
<item name="android:layout_marginLeft">48dip</item>
</style>
</resources>

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge, landscape -->
<!-- tablet, landscape -->
<resources>
<dimen name="message_compose_field_label_width">120dip</dimen>

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge, landscape -->
<!-- tablet, landscape -->
<resources>
<!-- Use fixed width in landscape -->

View File

@ -14,12 +14,9 @@
limitations under the License.
-->
<!-- xlarge, portrait -->
<resources>
<dimen name="message_compose_field_label_width">120dip</dimen>
<!-- XL activity dimensions -->
<!-- width of mailbox list -->
<dimen name="mailbox_list_width">206dip</dimen>
<!--

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge, portrait -->
<!-- tablet, portrait -->
<resources>
<!-- Use fixed margin in portrait -->

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 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>
<bool name="use_two_pane">true</bool>
</resources>

View File

@ -0,0 +1,24 @@
<?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.
-->
<resources>
<color name="message_view_fogged_glass_color">#00000000</color>
<!-- Standard text colors -->
<color name="text_primary_color">#000000</color>
<color name="text_secondary_color">#666666</color>
</resources>

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- xlarge -->
<!-- tablet -->
<resources>
<!-- Account Setup Activities -->

View File

@ -14,7 +14,7 @@
limitations under the License.
-->
<!-- Specializations for xlarge screens - most colors are in values/colors.xml -->
<!-- Specializations for tablet screens - most colors are in values/colors.xml -->
<resources>
<!-- The headline at the top of every account settings fragments (in preferences) -->
<style name="accountSettingsHeadline">
@ -134,4 +134,9 @@
<item name="android:singleLine">true</item>
<item name="android:ellipsize">end</item>
</style>
<style name="accountSetupTypePrevious" parent="@style/accountSetupButton">
<item name="android:layout_toRightOf">@+id/main_content"</item>
<item name="android:layout_alignParentRight">true</item>
</style>
</resources>

View File

@ -0,0 +1,24 @@
<?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.
-->
<!-- tablet, landscape -->
<resources>
<!-- Account Setup Activities -->
<dimen name="setup_padding_top">16dip</dimen>
<dimen name="setup_padding_left">128dip</dimen>
<dimen name="setup_padding_right">128dip</dimen>
</resources>

View File

@ -37,7 +37,8 @@ import android.widget.LinearLayout;
/**
* The "three pane" layout used on tablet.
*
* It'll encapsulate the behavioral differences between portrait mode and landscape mode.
* This layout can show up to two panes at any given time, and operates in two different modes.
* See {@link #isPaneCollapsible()} for details on the two modes.
*
* TODO Unit tests, when UX is settled.
*/
@ -50,14 +51,21 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
/** Uninitialized state -- {@link #changePaneState} hasn't been called yet. */
private static final int STATE_UNINITIALIZED = -1;
/** Mailbox list + message list */
/** Mailbox list + message list both visible. */
private static final int STATE_LEFT_VISIBLE = 0;
/** Message view on portrait, + message list on landscape. */
/**
* A view where the MessageView is visible. The MessageList is visible if
* {@link #isPaneCollapsible} is false, but is otherwise collapsed and hidden.
*/
private static final int STATE_RIGHT_VISIBLE = 1;
/** Portrait mode only: message view + expanded message list */
private static final int STATE_PORTRAIT_MIDDLE_EXPANDED = 2;
/**
* A view where the MessageView is partially visible and a collapsible MessageList on the left
* has been expanded to be in view. {@link #isPaneCollapsible} must return true for this
* state to be active.
*/
private static final int STATE_MIDDLE_EXPANDED = 2;
// Flags for getVisiblePanes()
public static final int PANE_LEFT = 1 << 2;
@ -75,7 +83,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
private View mRightPane;
private MessageCommandButtonView mMessageCommandButtons;
// Views used only on portrait
// Views used only when the left pane is collapsible.
private View mFoggedGlass;
private boolean mFirstSizeChangedDone;
@ -84,8 +92,8 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
private int mMailboxListWidth;
/**
* Message list width, on:
* - the message list + message view mode, on landscape.
* - the message view + expanded message list mode, on portrait.
* - the message list + message view mode, when the left pane is not collapsible
* - the message view + expanded message list mode, when the left pane is collapsible
* Comes from resources.
*/
private int mMessageListWidth;
@ -152,14 +160,14 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
(MessageCommandButtonView) findViewById(R.id.message_command_buttons);
mFoggedGlass = findViewById(R.id.fogged_glass);
if (mFoggedGlass != null) { // If it's around, it's portrait.
if (mFoggedGlass != null) {
mRightPane = findViewById(R.id.right_pane_with_fog);
mFoggedGlass.setOnClickListener(this);
} else { // landscape
} else {
mRightPane = findViewById(R.id.right_pane);
}
if (isLandscape()) {
if (!isPaneCollapsible()) {
mShowHideViews = new View[][][] {
// STATE_LEFT_VISIBLE
{
@ -173,7 +181,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
{mLeftPane}, // Invisible
{}, // Gone
},
// STATE_PORTRAIT_MIDDLE_EXPANDED -- not used in landscape
// STATE_MIDDLE_EXPANDED
{
{}, // Visible
{}, // Invisible
@ -194,7 +202,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
{mLeftPane, mMiddlePane, mFoggedGlass}, // Invisible
{}, // Gone
},
// STATE_PORTRAIT_MIDDLE_EXPANDED
// STATE_MIDDLE_EXPANDED
{
{mMiddlePane, mRightPane, mMessageCommandButtons, mFoggedGlass}, // Visible
{mLeftPane}, // Invisible
@ -216,8 +224,11 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
mCallback = (callback == null) ? EmptyCallback.INSTANCE : callback;
}
private boolean isLandscape() {
return mFoggedGlass == null;
/**
* Return whether or not the left pane should be collapsible.
*/
private boolean isPaneCollapsible() {
return mFoggedGlass != null;
}
public MessageCommandButtonView getMessageCommandButtons() {
@ -268,7 +279,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
* @return true if the event is handled.
*/
public boolean onBackPressed(boolean isSystemBackKey) {
if (isLandscape()) {
if (!isPaneCollapsible()) {
switch (mPaneState) {
case STATE_RIGHT_VISIBLE:
changePaneState(STATE_LEFT_VISIBLE, true); // Close the right pane
@ -280,10 +291,10 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
if (isSystemBackKey) {
changePaneState(STATE_LEFT_VISIBLE, true);
} else {
changePaneState(STATE_PORTRAIT_MIDDLE_EXPANDED, true);
changePaneState(STATE_MIDDLE_EXPANDED, true);
}
return true;
case STATE_PORTRAIT_MIDDLE_EXPANDED:
case STATE_MIDDLE_EXPANDED:
changePaneState(STATE_LEFT_VISIBLE, true);
return true;
}
@ -319,7 +330,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
}
private void changePaneState(int newState, boolean animate) {
if (isLandscape() && (newState == STATE_PORTRAIT_MIDDLE_EXPANDED)) {
if (!isPaneCollapsible() && (newState == STATE_MIDDLE_EXPANDED)) {
newState = STATE_RIGHT_VISIBLE;
}
if (!mFirstSizeChangedDone) {
@ -349,7 +360,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
final String animatorLabel; // for debug purpose
if (isLandscape()) { // Landscape
if (!isPaneCollapsible()) {
setViewWidth(mLeftPane, mMailboxListWidth);
setViewWidth(mRightPane, totalWidth - mMessageListWidth);
@ -370,7 +381,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
throw new IllegalStateException();
}
} else { // Portrait
} else {
setViewWidth(mLeftPane, mMailboxListWidth);
setViewWidth(mRightPane, totalWidth);
@ -381,7 +392,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
expectedMailboxLeft = 0;
expectedMessageListWidth = totalWidth - mMailboxListWidth;
break;
case STATE_PORTRAIT_MIDDLE_EXPANDED:
case STATE_MIDDLE_EXPANDED:
// mailbox + message list -> message list + message view
animatorLabel = "moving to [message list + message view]";
expectedMailboxLeft = -mMailboxListWidth;
@ -439,7 +450,7 @@ public class ThreePaneLayout extends LinearLayout implements View.OnClickListene
public void onClick(View v) {
switch (v.getId()) {
case R.id.fogged_glass:
if (isLandscape()) {
if (!isPaneCollapsible()) {
return; // Shouldn't happen
}
changePaneState(STATE_RIGHT_VISIBLE, true);