Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Unified Diff: ui/app_list/contents_view.cc

Issue 10890049: app_list: Touch scroll and animation improvement. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/apps_grid_view.cc ('k') | ui/app_list/pagination_model.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/contents_view.cc
diff --git a/ui/app_list/contents_view.cc b/ui/app_list/contents_view.cc
index 21712e32e2e321eb63bd3139ead378603737cf36..a213526ef12dbc61de3fb1f45ba18600fd430ea8 100644
--- a/ui/app_list/contents_view.cc
+++ b/ui/app_list/contents_view.cc
@@ -31,7 +31,10 @@ const int kIndexSearchResults = 2;
const int kMinMouseWheelToSwitchPage = 20;
const int kMinScrollToSwitchPage = 20;
-const int kMinHorizVelocityToSwitchPage = 1100;
+const int kMinHorizVelocityToSwitchPage = 800;
+
+const double kFinishTransitionThreshold = 0.33;
+const int kTransitionAnimationDurationInMs = 180;
// Helpers to get certain child view from |model|.
AppsGridView* GetAppsGridView(views::ViewModel* model) {
@@ -56,6 +59,8 @@ ContentsView::ContentsView(AppListView* app_list_view,
view_model_(new views::ViewModel),
ALLOW_THIS_IN_INITIALIZER_LIST(
bounds_animator_(new views::BoundsAnimator(this))) {
+ pagination_model_->SetTransitionDuration(kTransitionAnimationDurationInMs);
+
AppsGridView* apps_grid_view = new AppsGridView(app_list_view,
pagination_model);
apps_grid_view->SetLayout(kPreferredIconDimension,
@@ -202,12 +207,12 @@ ui::GestureStatus ContentsView::OnGestureEvent(
event.details().scroll_x() / GetContentsBounds().width());
return ui::GESTURE_STATUS_CONSUMED;
case ui::ET_GESTURE_SCROLL_END:
- pagination_model_->EndScroll();
+ pagination_model_->EndScroll(pagination_model_->
+ transition().progress < kFinishTransitionThreshold);
return ui::GESTURE_STATUS_CONSUMED;
case ui::ET_SCROLL_FLING_START: {
- pagination_model_->EndScroll();
+ pagination_model_->EndScroll(true);
if (fabs(event.details().velocity_x()) > kMinHorizVelocityToSwitchPage) {
- pagination_model_->ResetTransitionAnimation();
pagination_model_->SelectPageRelative(
event.details().velocity_x() < 0 ? 1 : -1,
true);
« no previous file with comments | « ui/app_list/apps_grid_view.cc ('k') | ui/app_list/pagination_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698