RTL - quoted text checkbox and respond inline.

Fixes b/12683654.

Change-Id: I5fd032560a93058e0a2b7c476bdf43f0c8958a79
diff --git a/res/layout/quoted_text.xml b/res/layout/quoted_text.xml
index 8a9f1b8..0accc29 100644
--- a/res/layout/quoted_text.xml
+++ b/res/layout/quoted_text.xml
@@ -15,54 +15,38 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/quoted_text_area"
     android:layout_height="wrap_content"
-    android:layout_width="match_parent">
+    android:layout_width="match_parent"
+    android:orientation="vertical">
 
-    <View
+    <View android:id="@+id/upper_quotedtext_divider_bar"
         android:layout_width="match_parent"
         android:layout_height="2dip"
         android:background="#babebe"
-        android:id="@+id/upper_quotedtext_divider_bar"
         android:visibility="gone" />
 
-    <LinearLayout android:layout_width="match_parent"
-        android:layout_height="48dip"
-        android:id="@+id/quoted_text_button_bar"
-        android:layout_below="@id/upper_quotedtext_divider_bar"
-        android:layout_alignWithParentIfMissing="true"
-        android:layout_alignParentTop="true">
+    <LinearLayout android:id="@+id/quoted_text_button_bar"
+        android:layout_width="match_parent"
+        android:layout_height="48dip" >
 
-        <RelativeLayout android:layout_width="0dip"
-            android:layout_weight="1"
+        <CheckBox android:id="@+id/hide_quoted_text"
+            android:layout_width="0dip"
             android:layout_height="match_parent"
-            android:id="@+id/quoted_text_row">
+            android:layout_weight="1"
+            android:contentDescription="@string/quoted_text"
+            android:drawablePadding="@dimen/quoted_text_header_padding"
+            android:ellipsize="end"
+            android:gravity="center_vertical"
+            android:text="@string/quoted_text_label"
+            android:textAllCaps="true"
+            android:textColor="@color/quoted_text_color"
+            android:textSize="12sp" />
 
-            <CheckBox android:id="@+id/hide_quoted_text"
-                android:layout_height="match_parent"
-                android:layout_width="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:gravity="center_vertical"
-                android:contentDescription="@string/quoted_text"/>
-
-            <TextView
-                android:id="@+id/hide_quoted_text_label"
-                android:text="@string/quoted_text_label"
-                android:textAllCaps="true"
-                android:layout_height="match_parent"
-                android:layout_width="wrap_content"
-                android:layout_marginLeft="8dip"
-                style="@style/QuotedTextHeaderStyle"
-                android:layout_toRightOf="@+id/hide_quoted_text"
-                android:gravity="center_vertical|left"
-                android:ellipsize="end"
-                android:clickable="true" />
-        </RelativeLayout>
-
-        <View android:layout_height="match_parent"
+        <View
             android:layout_width="2dip"
-            android:layout_marginRight="16dip"
+            android:layout_height="match_parent"
             android:background="#babebe"
             android:layout_marginTop="12dip"
             android:layout_marginBottom="12dip"
@@ -75,7 +59,7 @@
             android:textAllCaps="true"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:background="@null"/>
+            android:background="?android:attr/selectableItemBackground"/>
 
     </LinearLayout>
 
@@ -83,14 +67,12 @@
         android:layout_width="match_parent"
         android:layout_height="2dip"
         android:background="#babebe"
-        android:layout_below="@id/quoted_text_button_bar"
         android:id="@+id/divider_bar" />
 
     <WebView android:id="@+id/quoted_text_web_view"
         android:layout_height="wrap_content"
         android:layout_width="match_parent"
-        android:layout_below="@id/divider_bar"
         android:focusableInTouchMode="false"
         android:focusable="false" />
 
-</RelativeLayout>
+</LinearLayout>
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index 4b7fde0..da0f96d 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -188,4 +188,6 @@
     <dimen name="badge_rounded_corner_radius">2dip</dimen>
 
     <dimen name="custom_from_inner_padding">6dip</dimen>
+
+    <dimen name="quoted_text_header_padding">8dip</dimen>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 35f6098..7fb1b37 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -123,15 +123,11 @@
         <item name="android:layout_height">wrap_content</item>
     </style>
 
-    <style name="QuotedTextHeaderStyle">
-        <item name="android:textColor">@color/quoted_text_color</item>
-        <item name="android:textSize">12sp</item>
-    </style>
-
     <style name="RespondInlineButtonStyle">
         <item name="android:textColor">@color/quotedTextColor</item>
         <item name="android:textStyle">bold</item>
         <item name="android:textSize">12sp</item>
+        <item name="android:paddingLeft">16dip</item>
         <item name="android:paddingRight">16dip</item>
         <item name="android:gravity">center_vertical|right</item>
     </style>
diff --git a/src/com/android/mail/compose/QuotedTextView.java b/src/com/android/mail/compose/QuotedTextView.java
index 8ebac6f..2dd64d5 100644
--- a/src/com/android/mail/compose/QuotedTextView.java
+++ b/src/com/android/mail/compose/QuotedTextView.java
@@ -61,7 +61,7 @@
     private CharSequence mQuotedText;
     private WebView mQuotedTextWebView;
     private ShowHideQuotedTextListener mShowHideListener;
-    private CheckBox mShowHideCheckBox;
+    private CheckBox mQuotedTextCheckBox;
     private boolean mIncludeText = true;
     private Button mRespondInlineButton;
     private RespondInlineListener mRespondInlineListener;
@@ -85,11 +85,10 @@
         WebSettings settings = mQuotedTextWebView.getSettings();
         settings.setBlockNetworkLoads(true);
 
-        mShowHideCheckBox = (CheckBox) findViewById(R.id.hide_quoted_text);
-        mShowHideCheckBox.setChecked(true);
-        mShowHideCheckBox.setOnClickListener(this);
+        mQuotedTextCheckBox = (CheckBox) findViewById(R.id.hide_quoted_text);
+        mQuotedTextCheckBox.setChecked(true);
+        mQuotedTextCheckBox.setOnClickListener(this);
         sQuoteBegin = context.getResources().getString(R.string.quote_begin);
-        findViewById(R.id.hide_quoted_text_label).setOnClickListener(this);
 
 
         mRespondInlineButton = (Button) findViewById(R.id.respond_inline_button);
@@ -109,9 +108,8 @@
      * @param allow
      */
     public void allowQuotedText(boolean allow) {
-        View quotedTextRow = findViewById(R.id.quoted_text_row);
-        if (quotedTextRow != null) {
-            quotedTextRow.setVisibility(allow? View.VISIBLE: View.INVISIBLE);
+        if (mQuotedTextCheckBox != null) {
+            mQuotedTextCheckBox.setVisibility(allow ? View.VISIBLE : View.INVISIBLE);
         }
     }
 
@@ -166,9 +164,7 @@
         if (id == R.id.respond_inline_button) {
             respondInline();
         } else if (id == R.id.hide_quoted_text) {
-            updateCheckedState(mShowHideCheckBox.isChecked());
-        } else if (id == R.id.hide_quoted_text_label) {
-            updateCheckedState(!mShowHideCheckBox.isChecked());
+            updateCheckedState(mQuotedTextCheckBox.isChecked());
         }
     }
 
@@ -178,7 +174,7 @@
      * @param checked Either true or false.
      */
     public void updateCheckedState(boolean checked) {
-        mShowHideCheckBox.setChecked(checked);
+        mQuotedTextCheckBox.setChecked(checked);
         updateQuotedTextVisibility(checked);
         if (mShowHideListener != null) {
             mShowHideListener.onShowHideQuotedText(checked);