diff options
author | Winson Chung <winsonc@google.com> | 2012-08-02 17:40:30 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2012-08-08 14:02:22 -0700 |
commit | 0e721a4005b4d119cf641ca0dd0d8744672646f0 (patch) | |
tree | 78aca8d15bf6450d982cb3be1cfff471985938f5 /src | |
parent | 1637d6d64ac85d75b69b90fd976ed449046ccdc6 (diff) | |
download | android_packages_apps_Trebuchet-0e721a4005b4d119cf641ca0dd0d8744672646f0.tar.gz android_packages_apps_Trebuchet-0e721a4005b4d119cf641ca0dd0d8744672646f0.tar.bz2 android_packages_apps_Trebuchet-0e721a4005b4d119cf641ca0dd0d8744672646f0.zip |
Initial changes for new 10inch layout.
Change-Id: Ifaafca469df626a76ab5e16bd2f0d5afa1da172c
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/Hotseat.java | 18 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 21 |
2 files changed, 15 insertions, 24 deletions
diff --git a/src/com/android/launcher2/Hotseat.java b/src/com/android/launcher2/Hotseat.java index 15d606d8f..38feaa4fd 100644 --- a/src/com/android/launcher2/Hotseat.java +++ b/src/com/android/launcher2/Hotseat.java @@ -18,6 +18,7 @@ package com.android.launcher2; 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 @@ public class Hotseat extends FrameLayout { private int mCellCountX; private int mCellCountY; private int mAllAppsButtonRank; + + private boolean mTransposeLayoutWithOrientation; private boolean mIsLandscape; public Hotseat(Context context) { @@ -52,9 +55,12 @@ public class Hotseat extends FrameLayout { 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 @@ public class Hotseat extends FrameLayout { 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 9999e0fe3..ad50bbfd8 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -952,20 +952,7 @@ public final class Launcher extends Activity 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 @@ public final class Launcher extends Activity 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 @@ public final class Launcher extends Activity 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 @@ public final class Launcher extends Activity } 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 @@ public final class Launcher extends Activity 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 @@ public final class Launcher extends Activity 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) { |