WidgetTray revamp work
- RecyclerView is rendering
- Animation is connected
- Drag and drop is now handled
- UI tweaking: background, margins, more to come.
- Flicker and preview not loading issue:
fixed height for the horizontal scroll view.
- Shortcuts are added
- Widget Preview loading should support shortPress for drop
- UI tweaks left: overlay of arrow when there are more items to scroll
- icons are added in the section header
- Sorting of widget sections and widget horizontal list
- Adding all the padding constants to dimen.xml file
- RecyclerView should only support one view type
For items to be addressed in follow up patches OR CLs,
TODO is added to the comment.
b/19897708
Change-Id: Ibfc4da1696a23d20bada93db46e126706eb13cdc
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
index eacf341..e92bfb0 100644
--- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java
+++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
@@ -23,6 +23,7 @@
import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator;
import android.content.res.Resources;
+import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.ViewAnimationUtils;
@@ -30,6 +31,7 @@
import android.view.animation.DecelerateInterpolator;
import com.android.launcher3.util.Thunk;
+import com.android.launcher3.widget.WidgetsContainerView;
import java.util.HashMap;
@@ -179,20 +181,12 @@
* Starts an animation to the widgets view.
*/
public void startAnimationToWidgets(final boolean animated) {
- final AppsCustomizeTabHost toView = mLauncher.getWidgetsView();
+ final WidgetsContainerView toView = mLauncher.getWidgetsView();
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() {
@Override
public void onRevealViewVisible(View revealView, View contentView,
View allAppsButtonView) {
- // Hide the real page background, and swap in the fake one
- ((AppsCustomizePagedView) contentView).setPageBackgroundsVisible(false);
- revealView.setBackground(
- mLauncher.getResources().getDrawable(R.drawable.quantum_panel_dark));
- }
- @Override
- public void onAnimationComplete(View revealView, View contentView, View allAppsButtonView) {
- // Show the real page background
- ((AppsCustomizePagedView) contentView).setPageBackgroundsVisible(true);
+ revealView.setBackground(mLauncher.getDrawable(R.drawable.quantum_panel_dark));
}
@Override
public float getMaterialRevealViewFinalAlpha(View revealView) {
@@ -204,7 +198,7 @@
}
};
startAnimationToOverlay(Workspace.State.OVERVIEW_HIDDEN, toView, toView.getContentView(),
- toView.getRevealView(), toView.getPageIndicators(), animated, cb);
+ toView.getRevealView(), null, animated, cb);
}
/**
@@ -500,45 +494,9 @@
private void startAnimationToWorkspaceFromWidgets(final Launcher.State fromState,
final Workspace.State toWorkspaceState, final boolean animated,
final Runnable onCompleteRunnable) {
- AppsCustomizeTabHost widgetsView = mLauncher.getWidgetsView();
+ WidgetsContainerView widgetsView = mLauncher.getWidgetsView();
PrivateTransitionCallbacks cb = new PrivateTransitionCallbacks() {
@Override
- public void onRevealViewVisible(View revealView, View contentView, View allAppsButtonView) {
- AppsCustomizePagedView pagedView = ((AppsCustomizePagedView) contentView);
-
- // Hide the real page background, and swap in the fake one
- pagedView.stopScrolling();
- pagedView.setPageBackgroundsVisible(false);
- revealView.setBackground(
- mLauncher.getResources().getDrawable(R.drawable.quantum_panel_dark));
-
- // Hide the side pages of the Widget tray to avoid some ugly edge cases
- final View currentPage = pagedView.getPageAt(pagedView.getNextPage());
- int count = pagedView.getChildCount();
- for (int i = 0; i < count; i++) {
- View child = pagedView.getChildAt(i);
- if (child != currentPage) {
- child.setVisibility(View.INVISIBLE);
- }
- }
- }
- @Override
- public void onAnimationComplete(View revealView, View contentView, View allAppsButtonView) {
- AppsCustomizePagedView pagedView = ((AppsCustomizePagedView) contentView);
-
- // Show the real page background and force-update the page
- pagedView.setPageBackgroundsVisible(true);
- pagedView.setCurrentPage(pagedView.getNextPage());
- pagedView.updateCurrentPageScroll();
-
- // Unhide the side pages
- int count = pagedView.getChildCount();
- for (int i = 0; i < count; i++) {
- View child = pagedView.getChildAt(i);
- child.setVisibility(View.VISIBLE);
- }
- }
- @Override
public float getMaterialRevealViewFinalYDrift(View revealView) {
return revealView.getMeasuredHeight() / 2;
}
@@ -559,7 +517,7 @@
};
startAnimationToWorkspaceFromOverlay(toWorkspaceState, widgetsView,
widgetsView.getContentView(), widgetsView.getRevealView(),
- widgetsView.getPageIndicators(), animated, onCompleteRunnable, cb);
+ null, animated, onCompleteRunnable, cb);
}
/**