summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2015-03-02 22:52:47 (GMT)
committerRaj Yengisetty <rajesh@cyngn.com>2015-03-06 23:37:44 (GMT)
commit369851799cfc890ddbc8af777f7f662f6304dd65 (patch)
tree40aa4284aea51e593243cea0b40c9e33e1b79815
parentf4784dd14191cbc433becaa651b2a92fa5950f47 (diff)
downloadandroid_packages_apps_Trebuchet-369851799cfc890ddbc8af777f7f662f6304dd65.zip
android_packages_apps_Trebuchet-369851799cfc890ddbc8af777f7f662f6304dd65.tar.gz
android_packages_apps_Trebuchet-369851799cfc890ddbc8af777f7f662f6304dd65.tar.bz2
App drawer smooth scrolling
Also fixes searchbar visibility when dragging icons from app drawer Change-Id: I418dc3210a95cc57c81979452def8240c27d2214
-rw-r--r--res/layout/app_drawer_container.xml2
-rw-r--r--res/layout/app_drawer_item.xml4
-rw-r--r--res/layout/scrub_layout.xml2
-rw-r--r--res/values/dimens.xml1
-rw-r--r--src/com/android/launcher3/AppDrawerListAdapter.java17
-rw-r--r--src/com/android/launcher3/AppDrawerScrubber.java4
-rw-r--r--src/com/android/launcher3/DragLayer.java5
7 files changed, 11 insertions, 24 deletions
diff --git a/res/layout/app_drawer_container.xml b/res/layout/app_drawer_container.xml
index 3706e44..f5db08c 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 e2d105f..08043eb 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 4b10e45..90a9d09 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 7ceaf8b..91bfaef 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 9c97642..52e35ff 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 dff0266..0ace60d 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 e28f001..328c311 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);