Fix portrait mode

Change-Id: I42186513ce1069b3ceb18a6ea93ea7d9b7c99943
diff --git a/res/values-sw600dp-port/constants.xml b/res/values-sw600dp-port/constants.xml
index 90883a3..80d7ccb 100644
--- a/res/values-sw600dp-port/constants.xml
+++ b/res/values-sw600dp-port/constants.xml
@@ -23,4 +23,7 @@
     <integer name="folder_list_weight">1</integer>
     <integer name="conversation_list_weight">2</integer>
     <integer name="conversation_view_weight">1</integer>
+
+    <!-- Whether the list is collapsed in conversation view mode -->
+    <bool name="list_collapsed">true</bool>
 </resources>
\ No newline at end of file
diff --git a/res/values-sw600dp/constants.xml b/res/values-sw600dp/constants.xml
index 2ee2643..2241e32 100644
--- a/res/values-sw600dp/constants.xml
+++ b/res/values-sw600dp/constants.xml
@@ -23,4 +23,7 @@
     <integer name="conversation_list_weight">3</integer>
     <integer name="conversation_view_weight">3</integer>
     <integer name="conversation_text_zoom_percent">100</integer>
+
+    <!-- Whether the list is collapsed in conversation view mode -->
+    <bool name="list_collapsed">false</bool>
 </resources>
diff --git a/res/values-sw720dp-port/constants.xml b/res/values-sw720dp-port/constants.xml
new file mode 100644
index 0000000..75b2f59
--- /dev/null
+++ b/res/values-sw720dp-port/constants.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright (C) 2012 Google Inc.
+     Licensed to 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>
+    <!-- Whether the list is collapsed in conversation view mode -->
+    <bool name="list_collapsed">true</bool>
+</resources>
\ No newline at end of file
diff --git a/res/values-sw720dp/constants.xml b/res/values-sw720dp/constants.xml
index 756f38e..a89bc57 100644
--- a/res/values-sw720dp/constants.xml
+++ b/res/values-sw720dp/constants.xml
@@ -19,4 +19,7 @@
     <integer name="folder_list_weight">1</integer>
     <integer name="conversation_list_weight">3</integer>
     <integer name="conversation_view_weight">3</integer>
+
+    <!-- Whether the list is collapsed in conversation view mode -->
+    <bool name="list_collapsed">false</bool>
 </resources>
\ No newline at end of file
diff --git a/res/values/constants.xml b/res/values/constants.xml
index 73055c3..13067d5 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -51,4 +51,7 @@
     activity.  Throttle loader updates. -->
     <integer name="folder_item_refresh_delay_ms">500</integer>
     <integer name="conversation_text_zoom_percent">87</integer>
+
+    <!-- Whether the list is collapsed in conversation view mode -->
+    <bool name="list_collapsed">true</bool>
 </resources>
diff --git a/src/com/android/mail/ui/TwoPaneLayout.java b/src/com/android/mail/ui/TwoPaneLayout.java
index a3ec263..93b6036 100644
--- a/src/com/android/mail/ui/TwoPaneLayout.java
+++ b/src/com/android/mail/ui/TwoPaneLayout.java
@@ -68,19 +68,16 @@
  *
  * In the Gmail source code, this was called TriStateSplitLayout
  */
-final class TwoPaneLayout extends RelativeLayout
-        implements ModeChangeListener, OnTouchListener {
+final class TwoPaneLayout extends RelativeLayout implements ModeChangeListener {
 
     /**
      * Scaling modifier for sAnimationSlideRightDuration.
      */
     private static final double SLIDE_DURATION_SCALE = 2.0 / 3.0;
     private static final String LOG_TAG = new LogUtils().getLogTag();
-    private static final TimeInterpolator sCollapseInterpolator = new DecelerateInterpolator(2.5f);
     private static final TimeInterpolator sLeftInterpolator = new DecelerateInterpolator(2.25f);
     private static final TimeInterpolator sRightInterpolator = new DecelerateInterpolator(2.5f);
 
-    private static int sAnimationCollapseDuration;
     private static int sAnimationSlideLeftDuration;
     private static int sAnimationSlideRightDuration;
     private static double sScaledConversationListWeight;
@@ -113,7 +110,7 @@
     private int mListBitmapLeft;
     /** Whether or not the conversation list can be collapsed all the way to hidden on the left.
      * This is used only in portrait view*/
-    private boolean mListCollapsed;
+    private Boolean mListCollapsed;
     private LayoutListener mListener;
     private int mListLeft;
     private Paint mListPaint;
@@ -128,18 +125,12 @@
 
     private final AnimatorListener mConversationListListener =
             new AnimatorListener(AnimatorListener.CONVERSATION_LIST);
-    private final AnimatorListener mCollapseListListener =
-            new AnimatorListener(AnimatorListener.COLLAPSE_LIST);
     private final AnimatorListener mConversationListener =
             new AnimatorListener(AnimatorListener.CONVERSATION);
-    private final AnimatorListener mUncollapseListListener =
-            new AnimatorListener(AnimatorListener.UNCOLLAPSE_LIST);
 
     private class AnimatorListener implements Animator.AnimatorListener {
         public static final int CONVERSATION_LIST = 1;
-        public static final int COLLAPSE_LIST = 2;
-        public static final int CONVERSATION = 3;
-        public static final int UNCOLLAPSE_LIST = 4;
+        public static final int CONVERSATION = 2;
 
         /**
          * Different animator listeners need to perform different actions on start and finish based
@@ -174,15 +165,9 @@
                 case CONVERSATION_LIST:
                     onFinishEnteringConversationListMode();
                     return;
-                case COLLAPSE_LIST:
-                    onCollapseList();
-                    return;
                 case CONVERSATION:
                     onFinishEnteringConversationMode();
                     return;
-                case UNCOLLAPSE_LIST:
-                    onUncollapseList();
-                    return;
             }
         }
 
@@ -243,26 +228,6 @@
     }
 
     /**
-     * Collapses the conversation list to the left if it is in an expanded state.
-     * Only applies in portrait mode.
-     */
-    private boolean collapseList() {
-        if (mListCollapsed) {
-            return false;
-        }
-        mListCollapsed = true;
-
-        PropertyValuesHolder listLeftValues = PropertyValuesHolder.ofInt(
-                "conversationListLeft",
-                getConversationListLeft(),
-                computeConversationListLeft(computeConversationListWidth()));
-
-        startLayoutAnimation(sAnimationCollapseDuration, mCollapseListListener,
-                sCollapseInterpolator, listLeftValues);
-        return true;
-    }
-
-    /**
      * Computes left position of the conversation list relative to its uncollapsed position.
      * This is only relevant in a collapsible view, and will be 0 otherwise.
      */
@@ -519,7 +484,6 @@
 
         sAnimationSlideLeftDuration = res.getInteger(R.integer.activity_slide_left_duration);
         sAnimationSlideRightDuration = res.getInteger(R.integer.activity_slide_right_duration);
-        sAnimationCollapseDuration = res.getInteger(R.integer.activity_collapse_duration);
         final int sFolderListWeight = res.getInteger(R.integer.folder_list_weight);
         final int sConversationListWeight = res.getInteger(R.integer.conversation_list_weight);
         final int sConversationViewWeight = res.getInteger(R.integer.conversation_view_weight);
@@ -553,15 +517,11 @@
      * @return Whether or not the conversation list is visible on screen.
      */
     public boolean isConversationListVisible() {
-        return !isConversationListCollapsible() || !mListCollapsed;
-    }
-
-    /**
-     * Finalizes state after animations settle when collapsing the conversation list.
-     */
-    private void onCollapseList() {
-        mConversationViewOverlay.setVisibility(View.GONE);
-        dispatchConversationListVisibilityChange();
+        if (mListCollapsed == null) {
+            mListCollapsed = new Boolean(mContext.getResources()
+                    .getBoolean(R.bool.list_collapsed));
+        }
+        return !mListCollapsed;
     }
 
     /**
@@ -590,9 +550,6 @@
     private void onFinishEnteringConversationMode() {
         mFoldersView.setVisibility(View.GONE);
         setConversationListWidth(computeConversationListWidth());
-        if (isConversationListCollapsible()) {
-            onCollapseList();
-        }
         dispatchConversationVisibilityChanged(true);
     }
 
@@ -635,27 +592,6 @@
     }
 
     @Override
-    public boolean onTouch(View target, MotionEvent event) {
-        if (isConversationListCollapsible() && (target == mConversationViewOverlay)) {
-            collapseList();
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * Finalizes state after animations complete when expanding the conversation list.
-     */
-    private void onUncollapseList() {
-        if (isConversationListCollapsible()) {
-            mConversationViewOverlay.setVisibility(View.VISIBLE);
-        } else {
-            mConversationViewOverlay.setVisibility(View.GONE);
-        }
-        dispatchConversationListVisibilityChange();
-    }
-
-    @Override
     public void onViewModeChanged(int newMode) {
         currentMode = newMode;
         // Finish the current animation before changing mode.
@@ -794,23 +730,4 @@
         mOutstandingAnimator = animator;
         animator.start();
     }
-
-    /**
-     * Expands the conversation list out from the left if it is in a collapsed state.
-     * Only applies in portrait mode.
-     */
-    public boolean uncollapseList() {
-        if (!mListCollapsed) {
-            return false;
-        }
-        mListCollapsed = false;
-
-        PropertyValuesHolder listLeftValues = PropertyValuesHolder.ofInt(
-                "conversationListLeft",
-                getConversationListLeft(), 0);
-
-        startLayoutAnimation(sAnimationCollapseDuration, mUncollapseListListener,
-                sCollapseInterpolator, listLeftValues);
-        return true;
-    }
 }