Initial changes for new 10inch layout.
Change-Id: Ifaafca469df626a76ab5e16bd2f0d5afa1da172c
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java
index 15d606d..38feaa4 100644
--- a/src/com/android/launcher2/Hotseat.java
+++ b/src/com/android/launcher2/Hotseat.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.content.res.Configuration;
+import android.content.res.Resources;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -37,6 +38,8 @@
private int mCellCountX;
private int mCellCountY;
private int mAllAppsButtonRank;
+
+ private boolean mTransposeLayoutWithOrientation;
private boolean mIsLandscape;
public Hotseat(Context context) {
@@ -52,9 +55,12 @@
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.Hotseat, defStyle, 0);
+ Resources r = context.getResources();
mCellCountX = a.getInt(R.styleable.Hotseat_cellCountX, -1);
mCellCountY = a.getInt(R.styleable.Hotseat_cellCountY, -1);
- mAllAppsButtonRank = context.getResources().getInteger(R.integer.hotseat_all_apps_index);
+ mAllAppsButtonRank = r.getInteger(R.integer.hotseat_all_apps_index);
+ mTransposeLayoutWithOrientation =
+ r.getBoolean(R.bool.hotseat_transpose_layout_with_orientation);
mIsLandscape = context.getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE;
}
@@ -67,17 +73,21 @@
CellLayout getLayout() {
return mContent;
}
+
+ private boolean hasVerticalHotseat() {
+ return (mIsLandscape && mTransposeLayoutWithOrientation);
+ }
/* Get the orientation invariant order of the item in the hotseat for persistence. */
int getOrderInHotseat(int x, int y) {
- return mIsLandscape ? (mContent.getCountY() - y - 1) : x;
+ return hasVerticalHotseat() ? (mContent.getCountY() - y - 1) : x;
}
/* Get the orientation specific coordinates given an invariant order in the hotseat. */
int getCellXFromOrder(int rank) {
- return mIsLandscape ? 0 : rank;
+ return hasVerticalHotseat() ? 0 : rank;
}
int getCellYFromOrder(int rank) {
- return mIsLandscape ? (mContent.getCountY() - (rank + 1)) : 0;
+ return hasVerticalHotseat() ? (mContent.getCountY() - (rank + 1)) : 0;
}
public boolean isAllAppsButtonRank(int rank) {
return rank == mAllAppsButtonRank;
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 9999e0f..ad50bbf 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -952,20 +952,7 @@
mAppsCustomizeContent = (AppsCustomizePagedView)
mAppsCustomizeTabHost.findViewById(R.id.apps_customize_pane_content);
mAppsCustomizeContent.setup(this, dragController);
-
- // Get the all apps button
- mAllAppsButton = findViewById(R.id.all_apps_button);
- if (mAllAppsButton != null) {
- mAllAppsButton.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if ((event.getAction() & MotionEvent.ACTION_MASK) == MotionEvent.ACTION_DOWN) {
- onTouchDownAllAppsButton(v);
- }
- return false;
- }
- });
- }
+
// Setup the drag controller (drop targets have to be added in reverse order in priority)
dragController.setDragScoller(mWorkspace);
dragController.setScrollView(mDragLayer);
@@ -3020,7 +3007,6 @@
private boolean updateGlobalSearchIcon() {
final View searchButtonContainer = findViewById(R.id.search_button_container);
final ImageView searchButton = (ImageView) findViewById(R.id.search_button);
- final View searchDivider = findViewById(R.id.search_divider);
final View voiceButtonContainer = findViewById(R.id.voice_button_container);
final View voiceButton = findViewById(R.id.voice_button);
final View voiceButtonProxy = findViewById(R.id.voice_button_proxy);
@@ -3039,14 +3025,12 @@
TOOLBAR_ICON_METADATA_NAME);
}
- if (searchDivider != null) searchDivider.setVisibility(View.VISIBLE);
if (searchButtonContainer != null) searchButtonContainer.setVisibility(View.VISIBLE);
searchButton.setVisibility(View.VISIBLE);
invalidatePressedFocusedStates(searchButtonContainer, searchButton);
return true;
} else {
// We disable both search and voice search when there is no global search provider
- if (searchDivider != null) searchDivider.setVisibility(View.GONE);
if (searchButtonContainer != null) searchButtonContainer.setVisibility(View.GONE);
if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.GONE);
searchButton.setVisibility(View.GONE);
@@ -3066,7 +3050,6 @@
}
private boolean updateVoiceSearchIcon(boolean searchVisible) {
- final View searchDivider = findViewById(R.id.search_divider);
final View voiceButtonContainer = findViewById(R.id.voice_button_container);
final View voiceButton = findViewById(R.id.voice_button);
final View voiceButtonProxy = findViewById(R.id.voice_button_proxy);
@@ -3100,7 +3083,6 @@
R.id.voice_button, activityName, R.drawable.ic_home_voice_search_holo,
TOOLBAR_ICON_METADATA_NAME);
}
- if (searchDivider != null) searchDivider.setVisibility(View.VISIBLE);
if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.VISIBLE);
voiceButton.setVisibility(View.VISIBLE);
if (voiceButtonProxy != null) {
@@ -3109,7 +3091,6 @@
invalidatePressedFocusedStates(voiceButtonContainer, voiceButton);
return true;
} else {
- if (searchDivider != null) searchDivider.setVisibility(View.GONE);
if (voiceButtonContainer != null) voiceButtonContainer.setVisibility(View.GONE);
voiceButton.setVisibility(View.GONE);
if (voiceButtonProxy != null) {