diff options
-rw-r--r-- | res/layout/app_drawer_container.xml | 2 | ||||
-rw-r--r-- | res/layout/app_drawer_item.xml | 4 | ||||
-rw-r--r-- | res/layout/scrub_layout.xml | 2 | ||||
-rw-r--r-- | res/values/dimens.xml | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/AppDrawerListAdapter.java | 17 | ||||
-rw-r--r-- | src/com/android/launcher3/AppDrawerScrubber.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/DragLayer.java | 5 |
7 files changed, 11 insertions, 24 deletions
diff --git a/res/layout/app_drawer_container.xml b/res/layout/app_drawer_container.xml index 3706e448d..f5db08ce1 100644 --- a/res/layout/app_drawer_container.xml +++ b/res/layout/app_drawer_container.xml @@ -42,6 +42,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" + android:paddingBottom="@dimen/scrubber_height" android:overScrollMode="never"/> </FrameLayout> @@ -63,6 +64,7 @@ android:id="@+id/app_drawer_scrubber" android:layout_width="match_parent" android:layout_height="wrap_content" + android:clickable="true" android:layout_gravity="bottom"/> </FrameLayout> diff --git a/res/layout/app_drawer_item.xml b/res/layout/app_drawer_item.xml index e2d105f5a..08043eb1f 100644 --- a/res/layout/app_drawer_item.xml +++ b/res/layout/app_drawer_item.xml @@ -44,8 +44,4 @@ android:layout_height="wrap_content" android:orientation="horizontal" /> </LinearLayout> - <Space android:id="@+id/spacer" - android:layout_width="match_parent" - android:layout_height="0dp" - android:visibility="gone" /> </LinearLayout> diff --git a/res/layout/scrub_layout.xml b/res/layout/scrub_layout.xml index 4b10e45d7..90a9d094d 100644 --- a/res/layout/scrub_layout.xml +++ b/res/layout/scrub_layout.xml @@ -27,7 +27,7 @@ android:layout_width="match_parent" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" - android:layout_height="48dp"> + android:layout_height="@dimen/scrubber_height"> <SeekBar android:id="@+id/scrubber" diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 7ceaf8bd5..91bfaef29 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -120,6 +120,7 @@ <dimen name="grid_custom_text">50dp</dimen> <dimen name="scrubber_bottom_padding">30dp</dimen> + <dimen name="scrubber_height">48dp</dimen> <!-- Vertical app drawer padding --> <dimen name="vertical_app_drawer_icon_padding">5px</dimen> diff --git a/src/com/android/launcher3/AppDrawerListAdapter.java b/src/com/android/launcher3/AppDrawerListAdapter.java index 9c97642f6..52e35ff2c 100644 --- a/src/com/android/launcher3/AppDrawerListAdapter.java +++ b/src/com/android/launcher3/AppDrawerListAdapter.java @@ -38,7 +38,6 @@ import java.util.ListIterator; public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdapter.ViewHolder> implements View.OnLongClickListener, DragSource, SectionIndexer { - private static final int SCRUBBER_MARGIN_FROM_BOTTOM_DP = 80; private static final char NUMERIC_OR_SPECIAL_CHAR = '#'; private static final String NUMERIC_OR_SPECIAL_HEADER = "#"; @@ -48,18 +47,16 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap private Launcher mLauncher; private DeviceProfile mDeviceProfile; private LinkedHashMap<String, Integer> mSectionHeaders; - private LinearLayout.LayoutParams mIconParams, mSpacerParams; + private LinearLayout.LayoutParams mIconParams; private Rect mIconRect; public static class ViewHolder extends RecyclerView.ViewHolder { public AutoFitTextView mTextView; public ViewGroup mLayout; - public View mSpacer; public ViewHolder(View itemView) { super(itemView); mTextView = (AutoFitTextView) itemView.findViewById(R.id.drawer_item_title); mLayout = (ViewGroup) itemView.findViewById(R.id.drawer_item_flow); - mSpacer = itemView.findViewById(R.id.spacer); } } @@ -75,9 +72,6 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap mIconParams = new LinearLayout.LayoutParams(mDeviceProfile.folderCellWidthPx, ViewGroup.LayoutParams.WRAP_CONTENT); - mSpacerParams = new - LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, - (int) Utilities.convertDpToPixel(SCRUBBER_MARGIN_FROM_BOTTOM_DP, mLauncher)); LauncherAppState app = LauncherAppState.getInstance(); DeviceProfile grid = app.getDynamicGrid().getDeviceProfile(); mIconRect = new Rect(0, 0, grid.allAppsIconSizePx, grid.allAppsIconSizePx); @@ -295,7 +289,6 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap View v = LayoutInflater.from(parent.getContext()). inflate(R.layout.app_drawer_item, parent, false); ViewHolder holder = new ViewHolder(v); - holder.mSpacer.setLayoutParams(mSpacerParams); holder.mTextView.setPadding(0, 0, 0, mDeviceProfile.iconTextSizePx + 10); for (int i = 0; i < mDeviceProfile.numColumnsBase; i++) { AppDrawerIconView icon = (AppDrawerIconView) mLayoutInflater.inflate( @@ -348,11 +341,6 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap icon.mLabel.setText(info.title); } } - if (position == getItemCount() - 1) { - holder.mSpacer.setVisibility(View.VISIBLE); - } else { - holder.mSpacer.setVisibility(View.GONE); - } holder.itemView.setTag(indexedInfo); } @@ -360,7 +348,7 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap public boolean onLongClick(View v) { if (v instanceof AppDrawerIconView) { beginDraggingApplication(v); - mLauncher.showWorkspace(); + mLauncher.enterSpringLoadedDragMode(); } return false; } @@ -439,7 +427,6 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap } private void beginDraggingApplication(View v) { - // mLauncher.getWorkspace().onDragStartedWithItem(v); mLauncher.getWorkspace().beginDragShared(v, this); } diff --git a/src/com/android/launcher3/AppDrawerScrubber.java b/src/com/android/launcher3/AppDrawerScrubber.java index dff02661a..0ace60da8 100644 --- a/src/com/android/launcher3/AppDrawerScrubber.java +++ b/src/com/android/launcher3/AppDrawerScrubber.java @@ -92,8 +92,8 @@ public class AppDrawerScrubber extends LinearLayout { mScrubberIndicator.setText(section); } - mLayoutManager.scrollToPositionWithOffset( - mAdapter.getPositionForSection(progress), 0); + mLayoutManager.smoothScrollToPosition(mListView, null, + mAdapter.getPositionForSection(progress)); } @Override diff --git a/src/com/android/launcher3/DragLayer.java b/src/com/android/launcher3/DragLayer.java index e28f00189..328c31173 100644 --- a/src/com/android/launcher3/DragLayer.java +++ b/src/com/android/launcher3/DragLayer.java @@ -154,9 +154,10 @@ public class DragLayer extends FrameLayout implements ViewGroup.OnHierarchyChang View view = child.findViewById(R.id.app_drawer_recyclerview); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) view.getLayoutParams(); - lp.bottomMargin += insets.bottom - mInsets.bottom; - lp.topMargin += insets.top - mInsets.top; + int paddingBottom = view.getPaddingBottom() + insets.bottom - mInsets.bottom; + int paddingTop = view.getPaddingTop() + insets.top - mInsets.top; view.setLayoutParams(lp); + view.setPadding(view.getPaddingLeft(), paddingTop, view.getPaddingRight(), paddingBottom); // Scrubber view = child.findViewById(R.id.app_drawer_scrubber_container); |