am 777885a4: Merge "Remove wide-mode and normal-mode from TL" into ub-gmail-ur14-dev
* commit '777885a47872772e4953dae6dc18023e310e41b6':
Remove wide-mode and normal-mode from TL
diff --git a/res/values-land/arrays.xml b/res/values-land/arrays.xml
deleted file mode 100644
index ee7a5ad..0000000
--- a/res/values-land/arrays.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2011 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>
- <integer-array name="senders_with_attachment_lengths">
- <item>40</item>
- <item>40</item>
- </integer-array>
- <integer-array name="senders_lengths">
- <item>42</item>
- <item>42</item>
- </integer-array>
-</resources>
\ No newline at end of file
diff --git a/res/values-land/constants.xml b/res/values-land/constants.xml
new file mode 100644
index 0000000..546ff53
--- /dev/null
+++ b/res/values-land/constants.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <!-- Maximum width in characters of the senders in the thread list -->
+ <integer name="senders_with_attachment_lengths">40</integer>
+ <integer name="senders_lengths">42</integer>
+</resources>
\ No newline at end of file
diff --git a/res/values-sw600dp/arrays.xml b/res/values-sw600dp/arrays.xml
deleted file mode 100644
index ba18cb2..0000000
--- a/res/values-sw600dp/arrays.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2011 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>
- <integer-array name="senders_with_attachment_lengths">
- <item>50</item>
- <item>30</item>
- </integer-array>
- <integer-array name="senders_lengths">
- <item>50</item>
- <item>35</item>
- </integer-array>
-</resources>
diff --git a/res/values-sw600dp/constants.xml b/res/values-sw600dp/constants.xml
index d1d9da0..05102a5 100644
--- a/res/values-sw600dp/constants.xml
+++ b/res/values-sw600dp/constants.xml
@@ -27,4 +27,8 @@
<bool name="auto_scroll_cc">false</bool>
<integer name="conversation_desired_font_size_px">16</integer>
+
+ <!-- Maximum width in characters of the senders in the thread list -->
+ <integer name="senders_with_attachment_lengths">30</integer>
+ <integer name="senders_lengths">35</integer>
</resources>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
deleted file mode 100644
index 16c11ad..0000000
--- a/res/values/arrays.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2011 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>
- <integer-array name="senders_with_attachment_lengths">
- <item>25</item>
- <item>25</item>
- </integer-array>
- <integer-array name="senders_lengths">
- <item>27</item>
- <item>27</item>
- </integer-array>
-</resources>
diff --git a/res/values/constants.xml b/res/values/constants.xml
index 5acb506..7ae19b0 100644
--- a/res/values/constants.xml
+++ b/res/values/constants.xml
@@ -121,4 +121,8 @@
<integer name="conversation_list_max_folder_count">4</integer>
<integer name="folder_max_width_proportion">31</integer>
<integer name="folder_cell_max_width_proportion">22</integer>
+
+ <!-- Maximum width in characters of the senders in the thread list -->
+ <integer name="senders_with_attachment_lengths">25</integer>
+ <integer name="senders_lengths">27</integer>
</resources>
diff --git a/res/values/dimen.xml b/res/values/dimen.xml
index de49cee..730974f 100644
--- a/res/values/dimen.xml
+++ b/res/values/dimen.xml
@@ -23,7 +23,6 @@
<dimen name="two_pane_drawer_width_open">288dp</dimen>
<dimen name="two_pane_tl_side">24dp</dimen>
<dimen name="two_pane_tl_top">16dp</dimen>
- <dimen name="list_min_width_is_wide">720dp</dimen>
<dimen name="senders_font_size">18sp</dimen>
<dimen name="attachment_tile_min_size">120dp</dimen>
<dimen name="attachment_tile_max_size">164dp</dimen>
diff --git a/src/com/android/mail/browse/ConversationItemView.java b/src/com/android/mail/browse/ConversationItemView.java
index a43b5f3..2010be0 100644
--- a/src/com/android/mail/browse/ConversationItemView.java
+++ b/src/com/android/mail/browse/ConversationItemView.java
@@ -662,8 +662,7 @@
}
mHeader.viewWidth = mViewWidth;
- mConfig.updateWidth(wSize).setViewMode(currentMode)
- .setLayoutDirection(ViewCompat.getLayoutDirection(this));
+ mConfig.updateWidth(wSize).setLayoutDirection(ViewCompat.getLayoutDirection(this));
Resources res = getResources();
mHeader.standardScaledDimen = res.getDimensionPixelOffset(R.dimen.standard_scaled_dimen);
@@ -764,8 +763,8 @@
Context context = getContext();
mHeader.messageInfoString = SendersView
.createMessageInfo(context, mHeader.conversation, true);
- int maxChars = ConversationItemViewCoordinates.getSendersLength(context,
- mCoordinates.getMode(), mHeader.conversation.hasAttachments);
+ final int maxChars = ConversationItemViewCoordinates.getSendersLength(context,
+ mHeader.conversation.hasAttachments);
mHeader.mSenderAvatarModel.clear();
mHeader.displayableNames.clear();
@@ -812,9 +811,8 @@
}
if (mCoordinates.contactImagesWidth <= 0 || mCoordinates.contactImagesHeight <= 0) {
LogUtils.w(LOG_TAG,
- "Contact image width(%d) or height(%d) is 0 for mode: (%d).",
- mCoordinates.contactImagesWidth, mCoordinates.contactImagesHeight,
- mCoordinates.getMode());
+ "Contact image width(%d) or height(%d) is 0",
+ mCoordinates.contactImagesWidth, mCoordinates.contactImagesHeight);
return;
}
diff --git a/src/com/android/mail/browse/ConversationItemViewCoordinates.java b/src/com/android/mail/browse/ConversationItemViewCoordinates.java
index c19cf5b..b6a1029 100644
--- a/src/com/android/mail/browse/ConversationItemViewCoordinates.java
+++ b/src/com/android/mail/browse/ConversationItemViewCoordinates.java
@@ -31,7 +31,6 @@
import android.widget.TextView;
import com.android.mail.R;
-import com.android.mail.ui.ViewMode;
import com.android.mail.utils.Utils;
import com.android.mail.utils.ViewUtils;
import com.google.common.base.Objects;
@@ -48,11 +47,6 @@
public class ConversationItemViewCoordinates {
private static final int SINGLE_LINE = 1;
- // Modes
- static final int MODE_COUNT = 2;
- static final int WIDE_MODE = 0;
- static final int NORMAL_MODE = 1;
-
// Left-side gadget modes
static final int GADGET_NONE = 0;
static final int GADGET_CONTACT_PHOTO = 1;
@@ -65,7 +59,6 @@
*/
public static final class Config {
private int mWidth;
- private int mViewMode = ViewMode.UNKNOWN;
private int mGadgetMode = GADGET_NONE;
private int mLayoutDirection = View.LAYOUT_DIRECTION_LTR;
private boolean mShowFolders = false;
@@ -74,11 +67,6 @@
private boolean mShowPersonalIndicator = false;
private boolean mUseFullMargins = false;
- public Config setViewMode(int viewMode) {
- mViewMode = viewMode;
- return this;
- }
-
public Config withGadget(int gadget) {
mGadgetMode = gadget;
return this;
@@ -113,10 +101,6 @@
return mWidth;
}
- public int getViewMode() {
- return mViewMode;
- }
-
public int getGadgetMode() {
return mGadgetMode;
}
@@ -139,7 +123,7 @@
private int getCacheKey() {
// hash the attributes that contribute to item height and child view geometry
- return Objects.hashCode(mWidth, mViewMode, mGadgetMode, mShowFolders, mShowReplyState,
+ return Objects.hashCode(mWidth, mGadgetMode, mShowFolders, mShowReplyState,
mShowPersonalIndicator, mLayoutDirection, mUseFullMargins);
}
@@ -184,11 +168,6 @@
}
}
- /**
- * One of either NORMAL_MODE or WIDE_MODE.
- */
- private final int mMode;
-
final int height;
// Star.
@@ -262,19 +241,10 @@
final int contactImagesX;
final int contactImagesY;
-
- /**
- * The smallest item width for which we use the "wide" layout.
- */
- private final int mMinListWidthForWide;
-
private ConversationItemViewCoordinates(final Context context, final Config config,
final CoordinatesCache cache) {
Utils.traceBeginSection("CIV coordinates constructor");
final Resources res = context.getResources();
- mMinListWidthForWide = res.getDimensionPixelSize(R.dimen.list_min_width_is_wide);
-
- mMode = calculateMode(res, config);
final int layoutId = R.layout.conversation_item_view;
@@ -449,10 +419,6 @@
}
}
- public int getMode() {
- return mMode;
- }
-
/**
* Returns a negative corrective value that you can apply to a TextView's vertical dimensions
* that will nudge the first line of text upwards such that uppercase Latin characters are
@@ -468,22 +434,6 @@
}
/**
- * Returns the mode of the header view (Wide/Normal).
- */
- private int calculateMode(Resources res, Config config) {
- switch (config.getViewMode()) {
- case ViewMode.CONVERSATION_LIST:
- return config.getWidth() >= mMinListWidthForWide ? WIDE_MODE : NORMAL_MODE;
-
- case ViewMode.SEARCH_RESULTS_LIST:
- return res.getInteger(R.integer.conversation_list_search_header_mode);
-
- default:
- return res.getInteger(R.integer.conversation_header_mode);
- }
- }
-
- /**
* Returns the x coordinates of a view by tracing up its hierarchy.
*/
private static int getX(View view) {
@@ -510,12 +460,12 @@
/**
* Returns the length (maximum of characters) of subject in this mode.
*/
- public static int getSendersLength(Context context, int mode, boolean hasAttachments) {
+ public static int getSendersLength(Context context, boolean hasAttachments) {
final Resources res = context.getResources();
if (hasAttachments) {
- return res.getIntArray(R.array.senders_with_attachment_lengths)[mode];
+ return res.getInteger(R.integer.senders_with_attachment_lengths);
} else {
- return res.getIntArray(R.array.senders_lengths)[mode];
+ return res.getInteger(R.integer.senders_lengths);
}
}