Fixing drop targets in phone / small tablet landscape (issue 12192781)

Change-Id: I4dc8a82c8cd5ef279506e7868e33a455fba5a3be
This commit is contained in:
Adam Cohen 2014-01-14 16:18:14 -08:00
parent 13b563bcae
commit 24ce0b3708
13 changed files with 22 additions and 38 deletions

View File

@ -45,8 +45,8 @@
android:layout_gravity="end" /> android:layout_gravity="end" />
<include <include
android:id="@+id/qsb_bar" android:id="@+id/search_drop_target_bar"
layout="@layout/qsb_bar" /> layout="@layout/search_drop_target_bar" />
<include layout="@layout/overview_panel" <include layout="@layout/overview_panel"
android:id="@+id/overview_panel" android:id="@+id/overview_panel"

View File

@ -57,8 +57,8 @@
android:layout_gravity="center_horizontal" /> android:layout_gravity="center_horizontal" />
<include <include
android:id="@+id/qsb_bar" android:id="@+id/search_drop_target_bar"
layout="@layout/qsb_bar" /> layout="@layout/search_drop_target_bar" />
<!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure <!-- The Workspace cling must appear under the AppsCustomizePagedView below to ensure
that it is still visible during the transition to AllApps and doesn't overlay on that it is still visible during the transition to AllApps and doesn't overlay on

View File

@ -16,7 +16,6 @@
<RelativeLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
style="@style/SearchDropTargetBar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/search_frame"> android:background="@drawable/search_frame">

View File

@ -45,8 +45,8 @@
android:layout_height="match_parent" /> android:layout_height="match_parent" />
<include <include
android:id="@+id/qsb_bar" android:id="@+id/search_drop_target_bar"
layout="@layout/qsb_bar" /> layout="@layout/search_drop_target_bar" />
<include layout="@layout/overview_panel" <include layout="@layout/overview_panel"
android:id="@+id/overview_panel" android:id="@+id/overview_panel"

View File

@ -16,7 +16,8 @@
<RelativeLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3" xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3"
style="@style/SearchDropTargetBar" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/search_frame"> android:background="@drawable/search_frame">
<!-- Global search icon --> <!-- Global search icon -->
<com.android.launcher3.HolographicLinearLayout <com.android.launcher3.HolographicLinearLayout

View File

@ -15,14 +15,13 @@
--> -->
<com.android.launcher3.SearchDropTargetBar <com.android.launcher3.SearchDropTargetBar
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/QSBBar" android:orientation="horizontal"
android:focusable="false" android:focusable="false"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<!-- Drag specific targets container --> <!-- Drag specific targets container -->
<LinearLayout <LinearLayout
style="@style/SearchDropTargetBar"
android:id="@+id/drag_target_bar" android:id="@+id/drag_target_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"

View File

@ -19,10 +19,6 @@
<resources> <resources>
<!-- Search Bar --> <!-- Search Bar -->
<style name="QSBBar">
</style>
<style name="SearchDropTargetBar">
</style>
<style name="SearchButton"> <style name="SearchButton">
</style> </style>
<style name="DropTargetButtonContainer"> <style name="DropTargetButtonContainer">

View File

@ -58,11 +58,6 @@
<item name="android:maxWidth">240dp</item> <item name="android:maxWidth">240dp</item>
</style> </style>
<!-- QSB Search / Drop Target bar -->
<style name="QSBBar">
</style>
<style name="SearchDropTargetBar">
</style>
<style name="SearchButton"> <style name="SearchButton">
</style> </style>
<style name="DropTargetButtonContainer"> <style name="DropTargetButtonContainer">

View File

@ -91,10 +91,6 @@
<item name="android:shadowRadius">4.0</item> <item name="android:shadowRadius">4.0</item>
<item name="android:shadowColor">#FF000000</item> <item name="android:shadowColor">#FF000000</item>
</style> </style>
<style name="QSBBar">
<item name="android:orientation">horizontal</item>
</style>
<style name="SearchDropTargetBar"> <style name="SearchDropTargetBar">
</style> </style>
<style name="SearchButton"> <style name="SearchButton">

View File

@ -34,6 +34,7 @@ import android.view.View;
import android.view.ViewGroup.LayoutParams; import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -605,10 +606,13 @@ public class DeviceProfile {
// Vertical search bar space // Vertical search bar space
lp.gravity = Gravity.TOP | Gravity.LEFT; lp.gravity = Gravity.TOP | Gravity.LEFT;
lp.width = searchBarSpaceHeightPx; lp.width = searchBarSpaceHeightPx;
lp.height = LayoutParams.MATCH_PARENT; lp.height = LayoutParams.WRAP_CONTENT;
searchBar.setPadding( searchBar.setPadding(
0, 2 * edgeMarginPx, 0, 0, 2 * edgeMarginPx, 0,
2 * edgeMarginPx); 2 * edgeMarginPx);
LinearLayout targets = (LinearLayout) searchBar.findViewById(R.id.drag_target_bar);
targets.setOrientation(LinearLayout.VERTICAL);
} else { } else {
// Horizontal search bar space // Horizontal search bar space
lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL;
@ -621,13 +625,6 @@ public class DeviceProfile {
} }
searchBar.setLayoutParams(lp); searchBar.setLayoutParams(lp);
// Layout the search bar
View qsbBar = launcher.getQsbBar();
LayoutParams vglp = qsbBar.getLayoutParams();
vglp.width = LayoutParams.MATCH_PARENT;
vglp.height = LayoutParams.MATCH_PARENT;
qsbBar.setLayoutParams(vglp);
// Layout the voice proxy // Layout the voice proxy
View voiceButtonProxy = launcher.findViewById(R.id.voice_button_proxy); View voiceButtonProxy = launcher.findViewById(R.id.voice_button_proxy);
if (voiceButtonProxy != null) { if (voiceButtonProxy != null) {

View File

@ -665,7 +665,7 @@ public class FocusHelper {
final CellLayout layout = (CellLayout) parent.getParent(); final CellLayout layout = (CellLayout) parent.getParent();
final Workspace workspace = (Workspace) layout.getParent(); final Workspace workspace = (Workspace) layout.getParent();
final ViewGroup launcher = (ViewGroup) workspace.getParent(); final ViewGroup launcher = (ViewGroup) workspace.getParent();
final ViewGroup tabs = (ViewGroup) launcher.findViewById(R.id.qsb_bar); final ViewGroup tabs = (ViewGroup) launcher.findViewById(R.id.search_drop_target_bar);
final ViewGroup hotseat = (ViewGroup) launcher.findViewById(R.id.hotseat); final ViewGroup hotseat = (ViewGroup) launcher.findViewById(R.id.hotseat);
int pageIndex = workspace.indexOfChild(layout); int pageIndex = workspace.indexOfChild(layout);
int pageCount = workspace.getChildCount(); int pageCount = workspace.getChildCount();

View File

@ -256,7 +256,7 @@ public class Launcher extends Activity
private AppsCustomizeTabHost mAppsCustomizeTabHost; private AppsCustomizeTabHost mAppsCustomizeTabHost;
private AppsCustomizePagedView mAppsCustomizeContent; private AppsCustomizePagedView mAppsCustomizeContent;
private boolean mAutoAdvanceRunning = false; private boolean mAutoAdvanceRunning = false;
private View mQsbBar; private View mQsb;
private Bundle mSavedState; private Bundle mSavedState;
// We set the state in both onCreate and then onNewIntent in some cases, which causes both // We set the state in both onCreate and then onNewIntent in some cases, which causes both
@ -1284,7 +1284,8 @@ public class Launcher extends Activity
dragController.addDragListener(mWorkspace); dragController.addDragListener(mWorkspace);
// Get the search/delete bar // Get the search/delete bar
mSearchDropTargetBar = (SearchDropTargetBar) mDragLayer.findViewById(R.id.qsb_bar); mSearchDropTargetBar = (SearchDropTargetBar)
mDragLayer.findViewById(R.id.search_drop_target_bar);
// Setup AppsCustomize // Setup AppsCustomize
mAppsCustomizeTabHost = (AppsCustomizeTabHost) findViewById(R.id.apps_customize_pane); mAppsCustomizeTabHost = (AppsCustomizeTabHost) findViewById(R.id.apps_customize_pane);
@ -3458,11 +3459,11 @@ public class Launcher extends Activity
} }
public View getQsbBar() { public View getQsbBar() {
if (mQsbBar == null) { if (mQsb == null) {
mQsbBar = mInflater.inflate(R.layout.search_bar, mSearchDropTargetBar, false); mQsb = mInflater.inflate(R.layout.qsb, mSearchDropTargetBar, false);
mSearchDropTargetBar.addView(mQsbBar); mSearchDropTargetBar.addView(mQsb);
} }
return mQsbBar; return mQsb;
} }
protected boolean updateGlobalSearchIcon() { protected boolean updateGlobalSearchIcon() {