Commit dd89f911 authored by jdduke's avatar jdduke Committed by Commit bot

[Android] Overscroll appearance tweaks

Add back auto recede, and hasten the recession upon explicit release.

BUG=389744

Review URL: https://codereview.chromium.org/543123002

Cr-Commit-Position: refs/heads/master@{#294240}
parent 701934e5
...@@ -12,12 +12,16 @@ namespace content { ...@@ -12,12 +12,16 @@ namespace content {
namespace { namespace {
// Time it will take the effect to fully recede in ms // Time it will take the effect to fully recede in ms
const int kRecedeTimeMs = 1000; const int kRecedeTimeMs = 600;
// Time it will take before a pulled glow begins receding in ms // Time it will take before a pulled glow begins receding in ms
const int kPullTimeMs = 167; const int kPullTimeMs = 167;
const float kMaxAlpha = 1.f; // Time it will take for a pulled glow to decay to partial strength before
// release
const int kPullDecayTimeMs = 2000;
const float kMaxAlpha = 0.5f;
const float kPullGlowBegin = 0.f; const float kPullGlowBegin = 0.f;
...@@ -32,9 +36,9 @@ const float kCos = 0.866f; // cos(PI / 6); ...@@ -32,9 +36,9 @@ const float kCos = 0.866f; // cos(PI / 6);
// How much dragging should effect the height of the glow image. // How much dragging should effect the height of the glow image.
// Number determined by user testing. // Number determined by user testing.
const float kPullDistanceAlphaGlowFactor = 1.1f; const float kPullDistanceAlphaGlowFactor = 0.8f;
const int kVelocityGlowFactor = 12; const int kVelocityGlowFactor = 6;
const ui::SystemUIResourceManager::ResourceType kResourceType = const ui::SystemUIResourceManager::ResourceType kResourceType =
ui::SystemUIResourceManager::OVERSCROLL_GLOW_L; ui::SystemUIResourceManager::OVERSCROLL_GLOW_L;
...@@ -196,7 +200,16 @@ bool EdgeEffectL::Update(base::TimeTicks current_time) { ...@@ -196,7 +200,16 @@ bool EdgeEffectL::Update(base::TimeTicks current_time) {
glow_scale_y_finish_ = 0.f; glow_scale_y_finish_ = 0.f;
break; break;
case STATE_PULL: case STATE_PULL:
// Hold in this state until explicitly released. state_ = STATE_PULL_DECAY;
start_time_ = current_time;
duration_ = base::TimeDelta::FromMilliseconds(kPullDecayTimeMs);
glow_alpha_start_ = glow_alpha_;
glow_scale_y_start_ = glow_scale_y_;
// After pull, the glow should fade to nothing.
glow_alpha_finish_ = 0.f;
glow_scale_y_finish_ = 0.f;
break; break;
case STATE_PULL_DECAY: case STATE_PULL_DECAY:
state_ = STATE_RECEDE; state_ = STATE_RECEDE;
...@@ -233,8 +246,13 @@ void EdgeEffectL::ApplyToLayers(const gfx::SizeF& size, ...@@ -233,8 +246,13 @@ void EdgeEffectL::ApplyToLayers(const gfx::SizeF& size,
const float r = size.width() * 0.75f / kSin; const float r = size.width() * 0.75f / kSin;
const float y = kCos * r; const float y = kCos * r;
const float h = r - y; const float h = r - y;
const float o_r = size.height() * 0.75f / kSin;
const float o_y = kCos * o_r;
const float o_h = o_r - o_y;
const float base_glow_scale = h > 0.f ? std::min(o_h / h, 1.f) : 1.f;
bounds_ = gfx::Size(size.width(), (int)std::min(size.height(), h)); bounds_ = gfx::Size(size.width(), (int)std::min(size.height(), h));
gfx::Size image_bounds(r, std::min(1.f, glow_scale_y_) * bounds_.height()); gfx::Size image_bounds(
r, std::min(1.f, glow_scale_y_) * base_glow_scale * bounds_.height());
glow_->SetIsDrawable(true); glow_->SetIsDrawable(true);
glow_->SetUIResourceId(resource_manager_->GetUIResourceId(kResourceType)); glow_->SetUIResourceId(resource_manager_->GetUIResourceId(kResourceType));
......
...@@ -29,7 +29,7 @@ SkBitmap CreateOverscrollGlowLBitmap(const gfx::Size& screen_size) { ...@@ -29,7 +29,7 @@ SkBitmap CreateOverscrollGlowLBitmap(const gfx::Size& screen_size) {
SkPaint paint; SkPaint paint;
paint.setAntiAlias(true); paint.setAntiAlias(true);
paint.setAlpha(0x33); paint.setAlpha(0xBB);
paint.setStyle(SkPaint::kFill_Style); paint.setStyle(SkPaint::kFill_Style);
const float arc_width = const float arc_width =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment