Fix 6613962: Update keyguard to use new GlowPadView UX design.
Change-Id: I4f1ef3107e5550f7df9dcb412943a84b66432b7d
This commit is contained in:
1226
core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
Normal file
1226
core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -117,8 +117,6 @@ public class MultiWaveView extends View {
|
||||
private float mWaveCenterY;
|
||||
private int mMaxTargetHeight;
|
||||
private int mMaxTargetWidth;
|
||||
private float mHorizontalOffset;
|
||||
private float mVerticalOffset;
|
||||
|
||||
private float mOuterRadius = 0.0f;
|
||||
private float mHitRadius = 0.0f;
|
||||
@ -215,9 +213,6 @@ public class MultiWaveView extends View {
|
||||
|
||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MultiWaveView);
|
||||
mOuterRadius = a.getDimension(R.styleable.MultiWaveView_outerRadius, mOuterRadius);
|
||||
// mHorizontalOffset = a.getDimension(R.styleable.MultiWaveView_horizontalOffset,
|
||||
// mHorizontalOffset);
|
||||
// mVerticalOffset = a.getDimension(R.styleable.MultiWaveView_verticalOffset, mVerticalOffset);
|
||||
mHitRadius = a.getDimension(R.styleable.MultiWaveView_hitRadius, mHitRadius);
|
||||
mSnapMargin = a.getDimension(R.styleable.MultiWaveView_snapMargin, mSnapMargin);
|
||||
mVibrationDuration = a.getInt(R.styleable.MultiWaveView_vibrationDuration,
|
||||
@ -230,7 +225,6 @@ public class MultiWaveView extends View {
|
||||
mOuterRing = new TargetDrawable(res,
|
||||
a.peekValue(R.styleable.MultiWaveView_waveDrawable).resourceId);
|
||||
mAlwaysTrackFinger = a.getBoolean(R.styleable.MultiWaveView_alwaysTrackFinger, false);
|
||||
mGravity = a.getInt(R.styleable.MultiWaveView_gravity, Gravity.TOP);
|
||||
|
||||
// Read array of chevron drawables
|
||||
TypedValue outValue = new TypedValue();
|
||||
@ -244,24 +238,6 @@ public class MultiWaveView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
// Support old-style chevron specification if new specification not found
|
||||
if (mChevronDrawables.size() == 0) {
|
||||
final int chevronResIds[] = {
|
||||
R.styleable.MultiWaveView_rightChevronDrawable,
|
||||
R.styleable.MultiWaveView_topChevronDrawable,
|
||||
R.styleable.MultiWaveView_leftChevronDrawable,
|
||||
R.styleable.MultiWaveView_bottomChevronDrawable
|
||||
};
|
||||
|
||||
for (int i = 0; i < chevronResIds.length; i++) {
|
||||
TypedValue typedValue = a.peekValue(chevronResIds[i]);
|
||||
for (int k = 0; k < mFeedbackCount; k++) {
|
||||
mChevronDrawables.add(
|
||||
typedValue != null ? new TargetDrawable(res, typedValue.resourceId) : null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Read array of target drawables
|
||||
if (a.getValue(R.styleable.MultiWaveView_targetDrawables, outValue)) {
|
||||
internalSetTargetResources(outValue.resourceId);
|
||||
@ -289,6 +265,12 @@ public class MultiWaveView extends View {
|
||||
}
|
||||
|
||||
a.recycle();
|
||||
|
||||
// Use gravity attribute from LinearLayout
|
||||
a = context.obtainStyledAttributes(attrs, android.R.styleable.LinearLayout);
|
||||
mGravity = a.getInt(android.R.styleable.LinearLayout_gravity, Gravity.TOP);
|
||||
a.recycle();
|
||||
|
||||
setVibrateEnabled(mVibrationDuration > 0);
|
||||
assignDefaultsIfNeeded();
|
||||
}
|
||||
@ -302,8 +284,6 @@ public class MultiWaveView extends View {
|
||||
Log.v(TAG, "TapRadius = " + mTapRadius);
|
||||
Log.v(TAG, "WaveCenterX = " + mWaveCenterX);
|
||||
Log.v(TAG, "WaveCenterY = " + mWaveCenterY);
|
||||
Log.v(TAG, "HorizontalOffset = " + mHorizontalOffset);
|
||||
Log.v(TAG, "VerticalOffset = " + mVerticalOffset);
|
||||
}
|
||||
|
||||
public void suspendAnimations() {
|
||||
@ -1042,9 +1022,9 @@ public class MultiWaveView extends View {
|
||||
// width or the specified outer radius.
|
||||
final float placementWidth = Math.max(mOuterRing.getWidth(), 2 * mOuterRadius);
|
||||
final float placementHeight = Math.max(mOuterRing.getHeight(), 2 * mOuterRadius);
|
||||
float newWaveCenterX = mHorizontalOffset + mHorizontalInset
|
||||
float newWaveCenterX = mHorizontalInset
|
||||
+ Math.max(width, mMaxTargetWidth + placementWidth) / 2;
|
||||
float newWaveCenterY = mVerticalOffset + mVerticalInset
|
||||
float newWaveCenterY = mVerticalInset
|
||||
+ Math.max(height, + mMaxTargetHeight + placementHeight) / 2;
|
||||
|
||||
if (mInitialLayout) {
|
||||
|
@ -0,0 +1,235 @@
|
||||
/*
|
||||
* Copyright (C) 2012 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.internal.widget.multiwaveview;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.FloatMath;
|
||||
import android.util.Log;
|
||||
|
||||
public class PointCloud {
|
||||
private static final float MIN_POINT_SIZE = 2.0f;
|
||||
private static final float MAX_POINT_SIZE = 4.0f;
|
||||
private static final int INNER_POINTS = 8;
|
||||
private static final String TAG = "PointCloud";
|
||||
private ArrayList<Point> mPointCloud = new ArrayList<Point>();
|
||||
private Drawable mDrawable;
|
||||
private float mCenterX;
|
||||
private float mCenterY;
|
||||
private Paint mPaint;
|
||||
private float mScale = 1.0f;
|
||||
private static final float PI = (float) Math.PI;
|
||||
|
||||
// These allow us to have multiple concurrent animations.
|
||||
WaveManager waveManager = new WaveManager();
|
||||
GlowManager glowManager = new GlowManager();
|
||||
private float mOuterRadius;
|
||||
|
||||
public class WaveManager {
|
||||
private float radius = 50;
|
||||
private float width = 200.0f; // TODO: Make configurable
|
||||
private float alpha = 0.0f;
|
||||
public void setRadius(float r) {
|
||||
radius = r;
|
||||
}
|
||||
|
||||
public float getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setAlpha(float a) {
|
||||
alpha = a;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return alpha;
|
||||
}
|
||||
};
|
||||
|
||||
public class GlowManager {
|
||||
private float x;
|
||||
private float y;
|
||||
private float radius = 0.0f;
|
||||
private float alpha = 0.0f;
|
||||
|
||||
public void setX(float x1) {
|
||||
x = x1;
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setY(float y1) {
|
||||
y = y1;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setAlpha(float a) {
|
||||
alpha = a;
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return alpha;
|
||||
}
|
||||
|
||||
public void setRadius(float r) {
|
||||
radius = r;
|
||||
}
|
||||
|
||||
public float getRadius() {
|
||||
return radius;
|
||||
}
|
||||
}
|
||||
|
||||
class Point {
|
||||
float x;
|
||||
float y;
|
||||
float radius;
|
||||
|
||||
public Point(float x2, float y2, float r) {
|
||||
x = (float) x2;
|
||||
y = (float) y2;
|
||||
radius = r;
|
||||
}
|
||||
}
|
||||
|
||||
public PointCloud(Drawable drawable) {
|
||||
mPaint = new Paint();
|
||||
mPaint.setFilterBitmap(true);
|
||||
mPaint.setColor(Color.rgb(255, 255, 255)); // TODO: make configurable
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setDither(true);
|
||||
|
||||
mDrawable = drawable;
|
||||
if (mDrawable != null) {
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
}
|
||||
}
|
||||
|
||||
public void setCenter(float x, float y) {
|
||||
mCenterX = x;
|
||||
mCenterY = y;
|
||||
}
|
||||
|
||||
public void makePointCloud(float innerRadius, float outerRadius) {
|
||||
if (innerRadius == 0) {
|
||||
Log.w(TAG, "Must specify an inner radius");
|
||||
return;
|
||||
}
|
||||
mOuterRadius = outerRadius;
|
||||
mPointCloud.clear();
|
||||
final float pointAreaRadius = (outerRadius - innerRadius);
|
||||
final float ds = (2.0f * PI * innerRadius / INNER_POINTS);
|
||||
final int bands = (int) Math.round(pointAreaRadius / ds);
|
||||
final float dr = pointAreaRadius / bands;
|
||||
float r = innerRadius;
|
||||
for (int b = 0; b <= bands; b++, r += dr) {
|
||||
float circumference = 2.0f * PI * r;
|
||||
final int pointsInBand = (int) (circumference / ds);
|
||||
float eta = PI/2.0f;
|
||||
float dEta = 2.0f * PI / pointsInBand;
|
||||
for (int i = 0; i < pointsInBand; i++) {
|
||||
float x = r * FloatMath.cos(eta);
|
||||
float y = r * FloatMath.sin(eta);
|
||||
eta += dEta;
|
||||
mPointCloud.add(new Point(x, y, r));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setScale(float scale) {
|
||||
mScale = scale;
|
||||
}
|
||||
|
||||
public float getScale() {
|
||||
return mScale;
|
||||
}
|
||||
|
||||
private static float hypot(float x, float y) {
|
||||
return FloatMath.sqrt(x*x + y*y);
|
||||
}
|
||||
|
||||
private static float max(float a, float b) {
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
public int getAlphaForPoint(Point point) {
|
||||
// Contribution from positional glow
|
||||
float glowDistance = hypot(glowManager.x - point.x, glowManager.y - point.y);
|
||||
float glowAlpha = 0.0f;
|
||||
if (glowDistance < glowManager.radius) {
|
||||
float cosf = FloatMath.cos(PI * 0.5f * glowDistance / glowManager.radius);
|
||||
glowAlpha = glowManager.alpha * max(0.0f, (float) Math.pow(cosf, 0.5f));
|
||||
}
|
||||
|
||||
// Compute contribution from Wave
|
||||
float radius = hypot(point.x, point.y);
|
||||
float distanceToWaveRing = Math.abs(radius - waveManager.radius);
|
||||
float waveAlpha = 0.0f;
|
||||
if (distanceToWaveRing < waveManager.width * 0.5f) {
|
||||
float cosf = FloatMath.cos(PI * 0.5f * distanceToWaveRing / waveManager.width);
|
||||
waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 15.0f));
|
||||
}
|
||||
|
||||
return (int) (max(glowAlpha, waveAlpha) * 255);
|
||||
}
|
||||
|
||||
private float interp(float min, float max, float f) {
|
||||
return min + (max - min) * f;
|
||||
}
|
||||
|
||||
public void draw(Canvas canvas) {
|
||||
ArrayList<Point> points = mPointCloud;
|
||||
final float cx = mDrawable != null ? (-mDrawable.getIntrinsicWidth() / 2) : 0;
|
||||
final float cy = mDrawable != null ? (-mDrawable.getIntrinsicHeight() / 2) : 0;
|
||||
canvas.save(Canvas.MATRIX_SAVE_FLAG);
|
||||
canvas.scale(mScale, mScale, mCenterX, mCenterY);
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
Point point = points.get(i);
|
||||
final float pointSize = interp(MAX_POINT_SIZE, MIN_POINT_SIZE,
|
||||
point.radius / mOuterRadius);
|
||||
final float px = point.x + cx + mCenterX;
|
||||
final float py = point.y + cy + mCenterY;
|
||||
int alpha = getAlphaForPoint(point);
|
||||
|
||||
if (alpha == 0) continue;
|
||||
|
||||
if (mDrawable != null) {
|
||||
canvas.save(Canvas.MATRIX_SAVE_FLAG);
|
||||
float s = pointSize / MAX_POINT_SIZE;
|
||||
canvas.scale(s, s, px, py);
|
||||
canvas.translate(px, py);
|
||||
mDrawable.setAlpha(alpha);
|
||||
mDrawable.draw(canvas);
|
||||
canvas.restore();
|
||||
} else {
|
||||
mPaint.setAlpha(alpha);
|
||||
canvas.drawCircle(px, py, pointSize, mPaint);
|
||||
}
|
||||
}
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
}
|
BIN
core/res/res/drawable-hdpi/ic_lockscreen_glowdot.png
Normal file
BIN
core/res/res/drawable-hdpi/ic_lockscreen_glowdot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 738 B |
BIN
core/res/res/drawable-mdpi/ic_lockscreen_glowdot.png
Normal file
BIN
core/res/res/drawable-mdpi/ic_lockscreen_glowdot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 538 B |
BIN
core/res/res/drawable-xhdpi/ic_lockscreen_glowdot.png
Normal file
BIN
core/res/res/drawable-xhdpi/ic_lockscreen_glowdot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 964 B |
@ -82,7 +82,7 @@
|
||||
android:drawablePadding="4dip"
|
||||
/>
|
||||
|
||||
<com.android.internal.widget.multiwaveview.MultiWaveView
|
||||
<com.android.internal.widget.multiwaveview.GlowPadView
|
||||
android:id="@+id/unlock_widget"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
@ -94,13 +94,15 @@
|
||||
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
|
||||
android:directionDescriptions="@array/lockscreen_direction_descriptions"
|
||||
android:handleDrawable="@drawable/ic_lockscreen_handle"
|
||||
android:waveDrawable="@drawable/ic_lockscreen_outerring"
|
||||
android:outerRadius="@dimen/multiwaveview_target_placement_radius"
|
||||
android:snapMargin="@dimen/multiwaveview_snap_margin"
|
||||
android:hitRadius="@dimen/multiwaveview_hit_radius"
|
||||
android:chevronDrawables="@array/lockscreen_chevron_drawables"
|
||||
android:feedbackCount="3"
|
||||
android:outerRingDrawable="@drawable/ic_lockscreen_outerring"
|
||||
android:outerRadius="@dimen/glowpadview_target_placement_radius"
|
||||
android:innerRadius="@dimen/glowpadview_inner_radius"
|
||||
android:snapMargin="@dimen/glowpadview_snap_margin"
|
||||
android:hitRadius="@dimen/glowpadview_hit_radius"
|
||||
android:feedbackCount="1"
|
||||
android:vibrationDuration="20"
|
||||
android:glowRadius="@dimen/glowpadview_glow_radius"
|
||||
android:pointDrawable="@drawable/ic_lockscreen_glowdot"
|
||||
/>
|
||||
|
||||
<!-- emergency call button shown when sim is PUKd and tab_selector is hidden -->
|
||||
|
@ -82,7 +82,7 @@
|
||||
android:layout_alignParentTop="true"
|
||||
android:drawablePadding="4dip"/>
|
||||
|
||||
<com.android.internal.widget.multiwaveview.MultiWaveView
|
||||
<com.android.internal.widget.multiwaveview.GlowPadView
|
||||
android:id="@+id/unlock_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@ -94,13 +94,15 @@
|
||||
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
|
||||
android:directionDescriptions="@array/lockscreen_direction_descriptions"
|
||||
android:handleDrawable="@drawable/ic_lockscreen_handle"
|
||||
android:waveDrawable="@drawable/ic_lockscreen_outerring"
|
||||
android:outerRadius="@dimen/multiwaveview_target_placement_radius"
|
||||
android:snapMargin="@dimen/multiwaveview_snap_margin"
|
||||
android:hitRadius="@dimen/multiwaveview_hit_radius"
|
||||
android:chevronDrawables="@array/lockscreen_chevron_drawables"
|
||||
android:feedbackCount="3"
|
||||
android:outerRingDrawable="@drawable/ic_lockscreen_outerring"
|
||||
android:outerRadius="@dimen/glowpadview_target_placement_radius"
|
||||
android:innerRadius="@dimen/glowpadview_inner_radius"
|
||||
android:snapMargin="@dimen/glowpadview_snap_margin"
|
||||
android:hitRadius="@dimen/glowpadview_hit_radius"
|
||||
android:feedbackCount="1"
|
||||
android:vibrationDuration="20"
|
||||
android:glowRadius="@dimen/glowpadview_glow_radius"
|
||||
android:pointDrawable="@drawable/ic_lockscreen_glowdot"
|
||||
/>
|
||||
|
||||
<!-- emergency call button shown when sim is PUKd and tab_selector is hidden -->
|
||||
|
@ -123,7 +123,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="302dip">
|
||||
|
||||
<com.android.internal.widget.multiwaveview.MultiWaveView
|
||||
<com.android.internal.widget.multiwaveview.GlowPadView
|
||||
android:id="@+id/unlock_widget"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
@ -135,13 +135,15 @@
|
||||
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
|
||||
android:directionDescriptions="@array/lockscreen_direction_descriptions"
|
||||
android:handleDrawable="@drawable/ic_lockscreen_handle"
|
||||
android:waveDrawable="@drawable/ic_lockscreen_outerring"
|
||||
android:outerRadius="@dimen/multiwaveview_target_placement_radius"
|
||||
android:snapMargin="@dimen/multiwaveview_snap_margin"
|
||||
android:hitRadius="@dimen/multiwaveview_hit_radius"
|
||||
android:chevronDrawables="@array/lockscreen_chevron_drawables"
|
||||
android:feedbackCount="3"
|
||||
android:outerRingDrawable="@drawable/ic_lockscreen_outerring"
|
||||
android:outerRadius="@dimen/glowpadview_target_placement_radius"
|
||||
android:innerRadius="@dimen/glowpadview_inner_radius"
|
||||
android:snapMargin="@dimen/glowpadview_snap_margin"
|
||||
android:hitRadius="@dimen/glowpadview_hit_radius"
|
||||
android:feedbackCount="1"
|
||||
android:vibrationDuration="20"
|
||||
android:glowRadius="@dimen/glowpadview_glow_radius"
|
||||
android:pointDrawable="@drawable/ic_lockscreen_glowdot"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
|
@ -129,24 +129,26 @@
|
||||
<Space android:layout_width="64dip" android:layout_rowSpan="7" />
|
||||
|
||||
<!-- Column 2 -->
|
||||
<com.android.internal.widget.multiwaveview.MultiWaveView
|
||||
<com.android.internal.widget.multiwaveview.GlowPadView
|
||||
android:id="@+id/unlock_widget"
|
||||
android:layout_width="302dip"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_rowSpan="7"
|
||||
android:gravity="center"
|
||||
android:gravity="left|center_vertical"
|
||||
|
||||
android:targetDrawables="@array/lockscreen_targets_with_camera"
|
||||
android:targetDescriptions="@array/lockscreen_target_descriptions_with_camera"
|
||||
android:directionDescriptions="@array/lockscreen_direction_descriptions"
|
||||
android:handleDrawable="@drawable/ic_lockscreen_handle"
|
||||
android:waveDrawable="@drawable/ic_lockscreen_outerring"
|
||||
android:outerRadius="@dimen/multiwaveview_target_placement_radius"
|
||||
android:snapMargin="@dimen/multiwaveview_snap_margin"
|
||||
android:hitRadius="@dimen/multiwaveview_hit_radius"
|
||||
android:chevronDrawables="@array/lockscreen_chevron_drawables"
|
||||
android:feedbackCount="3"
|
||||
android:outerRingDrawable="@drawable/ic_lockscreen_outerring"
|
||||
android:outerRadius="@dimen/glowpadview_target_placement_radius"
|
||||
android:innerRadius="@dimen/glowpadview_inner_radius"
|
||||
android:snapMargin="@dimen/glowpadview_snap_margin"
|
||||
android:hitRadius="@dimen/glowpadview_hit_radius"
|
||||
android:feedbackCount="1"
|
||||
android:vibrationDuration="20"
|
||||
android:glowRadius="@dimen/glowpadview_glow_radius"
|
||||
android:pointDrawable="@drawable/ic_lockscreen_glowdot"
|
||||
/>
|
||||
|
||||
<!-- Music transport control -->
|
||||
|
@ -19,7 +19,7 @@
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Resources for MultiWaveView in LockScreen -->
|
||||
<!-- Resources for GlowPadView in LockScreen -->
|
||||
<array name="lockscreen_targets_when_silent">
|
||||
<item>@null</item>"
|
||||
<item>@drawable/ic_lockscreen_unlock</item>
|
||||
|
@ -19,7 +19,7 @@
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- Resources for MultiWaveView in LockScreen -->
|
||||
<!-- Resources for GlowPadView in LockScreen -->
|
||||
<array name="lockscreen_targets_when_silent">
|
||||
<item>@drawable/ic_lockscreen_unlock</item>
|
||||
<item>@null</item>
|
||||
|
@ -45,8 +45,8 @@
|
||||
<!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
|
||||
<dimen name="keyguard_lockscreen_outerring_diameter">364dp</dimen>
|
||||
|
||||
<!-- target placement radius for MultiWaveView -->
|
||||
<dimen name="multiwaveview_target_placement_radius">182dip</dimen>
|
||||
<!-- target placement radius for GlowPadView. Should be 1/2 of outerring diameter. -->
|
||||
<dimen name="glowpadview_target_placement_radius">182dip</dimen>
|
||||
|
||||
<!-- Size of status line font in LockScreen. -->
|
||||
<dimen name="keyguard_pattern_unlock_status_line_font_size">14sp</dimen>
|
||||
|
@ -350,7 +350,7 @@
|
||||
<item>中文 (繁體)</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Resources for MultiWaveView in LockScreen -->
|
||||
<!-- Resources for GlowPadView in LockScreen -->
|
||||
<array name="lockscreen_targets_when_silent">
|
||||
<item>@drawable/ic_lockscreen_unlock</item>
|
||||
<item>@drawable/ic_lockscreen_search</item>
|
||||
|
@ -5376,6 +5376,54 @@
|
||||
<attr name="orientation" />
|
||||
</declare-styleable>
|
||||
|
||||
<!-- =============================== -->
|
||||
<!-- GlowPadView class attributes -->
|
||||
<!-- =============================== -->
|
||||
<eat-comment />
|
||||
<declare-styleable name="GlowPadView">
|
||||
<!-- Reference to an array resource that be shown as targets around a circle. -->
|
||||
<attr name="targetDrawables"/>
|
||||
|
||||
<!-- Reference to an array resource that be used as description for the targets around the circle. -->
|
||||
<attr name="targetDescriptions"/>
|
||||
|
||||
<!-- Reference to an array resource that be used to announce the directions with targets around the circle. -->
|
||||
<attr name="directionDescriptions"/>
|
||||
|
||||
<!-- Sets a drawable as the center. -->
|
||||
<attr name="handleDrawable"/>
|
||||
|
||||
<!-- Drawable to use for wave ripple animation. -->
|
||||
<attr name="outerRingDrawable" format="reference"/>
|
||||
|
||||
<!-- Drawble used for drawing points -->
|
||||
<attr name="pointDrawable" format="reference" />
|
||||
|
||||
<!-- Inner radius of glow area. -->
|
||||
<attr name="innerRadius"/>
|
||||
|
||||
<!-- Outer radius of glow area. Target icons will be drawn on this circle. -->
|
||||
<attr name="outerRadius"/>
|
||||
|
||||
<!-- Size of target radius. Points within this distance of target center is a "hit". -->
|
||||
<attr name="hitRadius"/>
|
||||
|
||||
<!-- Radius of glow under finger. -->
|
||||
<attr name="glowRadius" format="dimension" />
|
||||
|
||||
<!-- Tactile feedback duration for actions. Set to '0' for no vibration. -->
|
||||
<attr name="vibrationDuration"/>
|
||||
|
||||
<!-- How close we need to be before snapping to a target. -->
|
||||
<attr name="snapMargin"/>
|
||||
|
||||
<!-- Number of waves/chevrons to show in animation. -->
|
||||
<attr name="feedbackCount"/>
|
||||
|
||||
<!-- Used when the handle shouldn't wait to be hit before following the finger -->
|
||||
<attr name="alwaysTrackFinger"/>
|
||||
</declare-styleable>
|
||||
|
||||
<!-- =============================== -->
|
||||
<!-- MultiWaveView class attributes -->
|
||||
<!-- =============================== -->
|
||||
@ -5393,22 +5441,6 @@
|
||||
<!-- Sets a drawable as the drag center. -->
|
||||
<attr name="handleDrawable" format="reference" />
|
||||
|
||||
<!-- Drawable to use for chevron animation on the left. May be null.
|
||||
@deprecated use chevronDrawables instead -->
|
||||
<attr name="leftChevronDrawable" format="reference" />
|
||||
|
||||
<!-- Drawable to use for chevron animation on the right. May be null.
|
||||
@deprecated use chevronDrawables instead -->
|
||||
<attr name="rightChevronDrawable" format="reference" />
|
||||
|
||||
<!-- Drawable to use for chevron animation on the top. May be null.
|
||||
@deprecated use chevronDrawables instead -->
|
||||
<attr name="topChevronDrawable" format="reference" />
|
||||
|
||||
<!-- Drawable to use for chevron animation on the bottom. May be null.
|
||||
@deprecated use chevronDrawables instead -->
|
||||
<attr name="bottomChevronDrawable" format="reference" />
|
||||
|
||||
<!-- Drawables to use for chevron animations. May be null. -->
|
||||
<attr name="chevronDrawables" format="reference"/>
|
||||
|
||||
@ -5430,17 +5462,6 @@
|
||||
<!-- Number of waves/chevrons to show in animation. -->
|
||||
<attr name="feedbackCount" format="integer" />
|
||||
|
||||
<!-- {@deprecated Not used by the framework. Use android:gravity instead}
|
||||
Used to shift center of pattern vertically. -->
|
||||
<attr name="verticalOffset" format="dimension" />
|
||||
|
||||
<!-- {@deprecated Not used by the framework. Use android:gravity instead}
|
||||
Used to shift center of pattern horizontally. -->
|
||||
<attr name="horizontalOffset" format="dimension" />
|
||||
|
||||
<!-- How the items in this layout should be positioned -->
|
||||
<attr name="gravity" />
|
||||
|
||||
<!-- Used when the handle shouldn't wait to be hit before following the finger -->
|
||||
<attr name="alwaysTrackFinger" format="boolean" />
|
||||
</declare-styleable>
|
||||
|
@ -73,14 +73,20 @@
|
||||
<!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
|
||||
<dimen name="keyguard_lockscreen_outerring_diameter">270dp</dimen>
|
||||
|
||||
<!-- Default target placement radius for MultiWaveView -->
|
||||
<dimen name="multiwaveview_target_placement_radius">135dip</dimen>
|
||||
<!-- Default target placement radius for GlowPadView. Should be 1/2 of outerring diameter. -->
|
||||
<dimen name="glowpadview_target_placement_radius">135dip</dimen>
|
||||
|
||||
<!-- Default distance beyond which MultiWaveView snaps to the target radius -->
|
||||
<dimen name="multiwaveview_snap_margin">20dip</dimen>
|
||||
<!-- Default glow radius for GlowPadView -->
|
||||
<dimen name="glowpadview_glow_radius">75dip</dimen>
|
||||
|
||||
<!-- Default distance from each snap target that MultiWaveView considers a "hit" -->
|
||||
<dimen name="multiwaveview_hit_radius">60dip</dimen>
|
||||
<!-- Default distance beyond which GlowPadView snaps to the target radius -->
|
||||
<dimen name="glowpadview_snap_margin">20dip</dimen>
|
||||
|
||||
<!-- Default distance from each snap target that GlowPadView considers a "hit" -->
|
||||
<dimen name="glowpadview_hit_radius">60dip</dimen>
|
||||
|
||||
<!-- Default distance from each snap target that GlowPadView considers a "hit" -->
|
||||
<dimen name="glowpadview_inner_radius">15dip</dimen>
|
||||
|
||||
<!-- Preference activity side margins -->
|
||||
<dimen name="preference_screen_side_margin">0dp</dimen>
|
||||
@ -228,10 +234,10 @@
|
||||
a few are present. -->
|
||||
<dimen name="action_bar_stacked_tab_max_width">180dp</dimen>
|
||||
|
||||
<!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
|
||||
<!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
|
||||
<dimen name="notification_text_size">14dp</dimen>
|
||||
<!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
|
||||
<!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
|
||||
<dimen name="notification_title_text_size">18dp</dimen>
|
||||
<!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
|
||||
<!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
|
||||
<dimen name="notification_subtext_size">12dp</dimen>
|
||||
</resources>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
Binary file not shown.
Before Width: | Height: | Size: 11 KiB |
Binary file not shown.
Before Width: | Height: | Size: 34 KiB |
@ -38,25 +38,29 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentRight="true">
|
||||
|
||||
<com.android.internal.widget.multiwaveview.MultiWaveView
|
||||
android:id="@+id/multi_wave_view"
|
||||
<com.android.internal.widget.multiwaveview.GlowPadView
|
||||
android:id="@+id/glow_pad_view"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="@dimen/navbar_search_panel_height"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/navbar_search_bg_scrim"
|
||||
android:gravity="left"
|
||||
|
||||
prvandroid:targetDrawables="@array/navbar_search_targets"
|
||||
prvandroid:targetDescriptions="@array/navbar_search_target_descriptions"
|
||||
prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
|
||||
prvandroid:handleDrawable="@drawable/navbar_search_handle"
|
||||
prvandroid:waveDrawable="@drawable/navbar_search_outerring"
|
||||
prvandroid:outerRingDrawable="@drawable/navbar_search_outerring"
|
||||
prvandroid:outerRadius="@dimen/navbar_search_outerring_radius"
|
||||
prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius"
|
||||
prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
|
||||
prvandroid:hitRadius="@dimen/navbar_search_hit_radius"
|
||||
prvandroid:feedbackCount="0"
|
||||
prvandroid:vibrationDuration="@integer/config_vibration_duration"
|
||||
prvandroid:alwaysTrackFinger="true"/>
|
||||
prvandroid:alwaysTrackFinger="true"
|
||||
prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
|
||||
prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -38,25 +38,29 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<com.android.internal.widget.multiwaveview.MultiWaveView
|
||||
android:id="@+id/multi_wave_view"
|
||||
<com.android.internal.widget.multiwaveview.GlowPadView
|
||||
android:id="@+id/glow_pad_view"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/navbar_search_panel_height"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/navbar_search_bg_scrim"
|
||||
android:gravity="top"
|
||||
|
||||
prvandroid:targetDrawables="@array/navbar_search_targets"
|
||||
prvandroid:targetDescriptions="@array/navbar_search_target_descriptions"
|
||||
prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
|
||||
prvandroid:handleDrawable="@drawable/navbar_search_handle"
|
||||
prvandroid:waveDrawable="@drawable/navbar_search_outerring"
|
||||
prvandroid:outerRingDrawable="@drawable/navbar_search_outerring"
|
||||
prvandroid:outerRadius="@dimen/navbar_search_outerring_radius"
|
||||
prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius"
|
||||
prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
|
||||
prvandroid:hitRadius="@dimen/navbar_search_hit_radius"
|
||||
prvandroid:feedbackCount="0"
|
||||
prvandroid:vibrationDuration="@integer/config_vibration_duration"
|
||||
prvandroid:alwaysTrackFinger="true"/>
|
||||
prvandroid:alwaysTrackFinger="true"
|
||||
prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
|
||||
prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -25,23 +25,26 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<com.android.internal.widget.multiwaveview.MultiWaveView
|
||||
android:id="@+id/multi_wave_view"
|
||||
<com.android.internal.widget.multiwaveview.GlowPadView
|
||||
android:id="@+id/glow_pad_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/navbar_search_panel_height"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:gravity="center_horizontal|top"
|
||||
android:background="@drawable/navbar_search_bg_scrim"
|
||||
|
||||
prvandroid:targetDrawables="@array/navbar_search_targets"
|
||||
prvandroid:targetDescriptions="@array/navbar_search_target_descriptions"
|
||||
prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
|
||||
prvandroid:handleDrawable="@drawable/navbar_search_handle"
|
||||
prvandroid:waveDrawable="@drawable/navbar_search_outerring"
|
||||
prvandroid:outerRingDrawable="@drawable/navbar_search_outerring"
|
||||
prvandroid:outerRadius="@dimen/navbar_search_outerring_radius"
|
||||
prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius"
|
||||
prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
|
||||
prvandroid:hitRadius="@dimen/navbar_search_hit_radius"
|
||||
prvandroid:feedbackCount="0"
|
||||
prvandroid:vibrationDuration="@integer/config_vibration_duration"
|
||||
prvandroid:alwaysTrackFinger="true"/>
|
||||
prvandroid:alwaysTrackFinger="true"
|
||||
prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
|
||||
prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"/>
|
||||
|
||||
</com.android.systemui.SearchPanelView>
|
||||
|
@ -25,24 +25,27 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<com.android.internal.widget.multiwaveview.MultiWaveView
|
||||
android:id="@+id/multi_wave_view"
|
||||
<com.android.internal.widget.multiwaveview.GlowPadView
|
||||
android:id="@+id/glow_pad_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/navbar_search_panel_height"
|
||||
android:layout_gravity="left|bottom"
|
||||
android:gravity="top|right"
|
||||
android:layout_marginLeft="-150dip"
|
||||
android:background="@drawable/navbar_search_bg_scrim"
|
||||
|
||||
prvandroid:targetDrawables="@array/navbar_search_targets"
|
||||
prvandroid:targetDescriptions="@array/navbar_search_target_descriptions"
|
||||
prvandroid:directionDescriptions="@array/navbar_search_direction_descriptions"
|
||||
prvandroid:handleDrawable="@drawable/navbar_search_handle"
|
||||
prvandroid:waveDrawable="@drawable/navbar_search_outerring"
|
||||
prvandroid:outerRingDrawable="@drawable/navbar_search_outerring"
|
||||
prvandroid:outerRadius="@dimen/navbar_search_outerring_radius"
|
||||
prvandroid:innerRadius="@*android:dimen/glowpadview_inner_radius"
|
||||
prvandroid:snapMargin="@dimen/navbar_search_snap_margin"
|
||||
prvandroid:hitRadius="@dimen/navbar_search_hit_radius"
|
||||
prvandroid:feedbackCount="0"
|
||||
prvandroid:vibrationDuration="@integer/config_vibration_duration"
|
||||
prvandroid:alwaysTrackFinger="true"/>
|
||||
prvandroid:alwaysTrackFinger="true"
|
||||
prvandroid:glowRadius="@*android:dimen/glowpadview_glow_radius"
|
||||
prvandroid:pointDrawable="@*android:drawable/ic_lockscreen_glowdot"/>
|
||||
|
||||
</com.android.systemui.SearchPanelView>
|
||||
|
@ -30,6 +30,9 @@
|
||||
<!-- Diameter of outer shape drawable shown in navbar search-->
|
||||
<dimen name="navbar_search_outerring_diameter">430dip</dimen>
|
||||
|
||||
<!-- Diameter of outer shape drawable shown in navbar search. Should be 1/2 of above value. -->
|
||||
<dimen name="navbar_search_outerring_radius">215dip</dimen>
|
||||
|
||||
<!-- Height of search panel including navigation bar height -->
|
||||
<dimen name="navbar_search_panel_height">280dip</dimen>
|
||||
|
||||
|
@ -119,6 +119,9 @@
|
||||
<!-- Diameter of outer shape drawable shown in navbar search-->
|
||||
<dimen name="navbar_search_outerring_diameter">340dp</dimen>
|
||||
|
||||
<!-- Diameter of outer shape drawable shown in navbar search. Should be 1/2 of above value -->
|
||||
<dimen name="navbar_search_outerring_radius">170dp</dimen>
|
||||
|
||||
<!-- Threshold for swipe-up gesture to activate search dialog -->
|
||||
<dimen name="navbar_search_up_threshhold">40dip</dimen>
|
||||
|
||||
|
@ -35,8 +35,8 @@ import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.ViewTreeObserver.OnPreDrawListener;
|
||||
import android.widget.FrameLayout;
|
||||
import com.android.internal.widget.multiwaveview.MultiWaveView;
|
||||
import com.android.internal.widget.multiwaveview.MultiWaveView.OnTriggerListener;
|
||||
import com.android.internal.widget.multiwaveview.GlowPadView;
|
||||
import com.android.internal.widget.multiwaveview.GlowPadView.OnTriggerListener;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.recent.StatusBarTouchProxy;
|
||||
import com.android.systemui.statusbar.BaseStatusBar;
|
||||
@ -58,7 +58,7 @@ public class SearchPanelView extends FrameLayout implements
|
||||
|
||||
private boolean mShowing;
|
||||
private View mSearchTargetsContainer;
|
||||
private MultiWaveView mMultiWaveView;
|
||||
private GlowPadView mGlowPadView;
|
||||
|
||||
public SearchPanelView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
@ -125,7 +125,7 @@ public class SearchPanelView extends FrameLayout implements
|
||||
}
|
||||
}
|
||||
|
||||
class MultiWaveTriggerListener implements MultiWaveView.OnTriggerListener {
|
||||
class GlowPadTriggerListener implements GlowPadView.OnTriggerListener {
|
||||
boolean mWaitingForLaunch;
|
||||
|
||||
public void onGrabbed(View v, int handle) {
|
||||
@ -141,7 +141,7 @@ public class SearchPanelView extends FrameLayout implements
|
||||
}
|
||||
|
||||
public void onTrigger(View v, final int target) {
|
||||
final int resId = mMultiWaveView.getResourceIdForTarget(target);
|
||||
final int resId = mGlowPadView.getResourceIdForTarget(target);
|
||||
switch (resId) {
|
||||
case com.android.internal.R.drawable.ic_lockscreen_search:
|
||||
mWaitingForLaunch = true;
|
||||
@ -154,13 +154,13 @@ public class SearchPanelView extends FrameLayout implements
|
||||
public void onFinishFinalAnimation() {
|
||||
}
|
||||
}
|
||||
final MultiWaveTriggerListener mMultiWaveViewListener = new MultiWaveTriggerListener();
|
||||
final GlowPadTriggerListener mGlowPadViewListener = new GlowPadTriggerListener();
|
||||
|
||||
@Override
|
||||
public void onAnimationStarted() {
|
||||
postDelayed(new Runnable() {
|
||||
public void run() {
|
||||
mMultiWaveViewListener.mWaitingForLaunch = false;
|
||||
mGlowPadViewListener.mWaitingForLaunch = false;
|
||||
mBar.hideSearchPanel();
|
||||
}
|
||||
}, SEARCH_PANEL_HOLD_DURATION);
|
||||
@ -173,13 +173,13 @@ public class SearchPanelView extends FrameLayout implements
|
||||
mSearchTargetsContainer = findViewById(R.id.search_panel_container);
|
||||
mStatusBarTouchProxy = (StatusBarTouchProxy) findViewById(R.id.status_bar_touch_proxy);
|
||||
// TODO: fetch views
|
||||
mMultiWaveView = (MultiWaveView) findViewById(R.id.multi_wave_view);
|
||||
mMultiWaveView.setOnTriggerListener(mMultiWaveViewListener);
|
||||
mGlowPadView = (GlowPadView) findViewById(R.id.glow_pad_view);
|
||||
mGlowPadView.setOnTriggerListener(mGlowPadViewListener);
|
||||
SearchManager searchManager = getSearchManager();
|
||||
if (searchManager != null) {
|
||||
ComponentName component = searchManager.getGlobalSearchActivity();
|
||||
if (component != null) {
|
||||
if (!mMultiWaveView.replaceTargetDrawablesIfPresent(component,
|
||||
if (!mGlowPadView.replaceTargetDrawablesIfPresent(component,
|
||||
ASSIST_ICON_METADATA_NAME,
|
||||
com.android.internal.R.drawable.ic_lockscreen_search)) {
|
||||
Slog.w(TAG, "Couldn't grab icon from component " + component);
|
||||
@ -214,7 +214,7 @@ public class SearchPanelView extends FrameLayout implements
|
||||
private final OnPreDrawListener mPreDrawListener = new ViewTreeObserver.OnPreDrawListener() {
|
||||
public boolean onPreDraw() {
|
||||
getViewTreeObserver().removeOnPreDrawListener(this);
|
||||
mMultiWaveView.resumeAnimations();
|
||||
mGlowPadView.resumeAnimations();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -240,7 +240,8 @@ public class SearchPanelView extends FrameLayout implements
|
||||
setVisibility(View.VISIBLE);
|
||||
// Don't start the animation until we've created the layer, which is done
|
||||
// right before we are drawn
|
||||
mMultiWaveView.suspendAnimations();
|
||||
mGlowPadView.suspendAnimations();
|
||||
mGlowPadView.ping();
|
||||
getViewTreeObserver().addOnPreDrawListener(mPreDrawListener);
|
||||
vibrate();
|
||||
}
|
||||
@ -299,7 +300,7 @@ public class SearchPanelView extends FrameLayout implements
|
||||
public void setStatusBarView(final View statusBarView) {
|
||||
if (mStatusBarTouchProxy != null) {
|
||||
mStatusBarTouchProxy.setStatusBar(statusBarView);
|
||||
// mMultiWaveView.setOnTouchListener(new OnTouchListener() {
|
||||
// mGlowPadView.setOnTouchListener(new OnTouchListener() {
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// return statusBarView.onTouchEvent(event);
|
||||
// }
|
||||
|
@ -404,6 +404,7 @@ public class TabletStatusBar extends BaseStatusBar implements
|
||||
mRecentsPanel.updateValuesFromResources();
|
||||
mShowSearchHoldoff = mContext.getResources().getInteger(
|
||||
R.integer.config_show_search_delay);
|
||||
updateSearchPanel();
|
||||
}
|
||||
|
||||
protected void loadDimens() {
|
||||
|
@ -23,7 +23,7 @@ import com.android.internal.telephony.IccCard.State;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.internal.widget.SlidingTab;
|
||||
import com.android.internal.widget.WaveView;
|
||||
import com.android.internal.widget.multiwaveview.MultiWaveView;
|
||||
import com.android.internal.widget.multiwaveview.GlowPadView;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
@ -286,16 +286,16 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
||||
return mSearchManager;
|
||||
}
|
||||
|
||||
class MultiWaveViewMethods implements MultiWaveView.OnTriggerListener,
|
||||
class GlowPadViewMethods implements GlowPadView.OnTriggerListener,
|
||||
UnlockWidgetCommonMethods {
|
||||
private final MultiWaveView mMultiWaveView;
|
||||
private final GlowPadView mGlowPadView;
|
||||
|
||||
MultiWaveViewMethods(MultiWaveView multiWaveView) {
|
||||
mMultiWaveView = multiWaveView;
|
||||
GlowPadViewMethods(GlowPadView glowPadView) {
|
||||
mGlowPadView = glowPadView;
|
||||
}
|
||||
|
||||
public boolean isTargetPresent(int resId) {
|
||||
return mMultiWaveView.getTargetPosition(resId) != -1;
|
||||
return mGlowPadView.getTargetPosition(resId) != -1;
|
||||
}
|
||||
|
||||
public void updateResources() {
|
||||
@ -307,8 +307,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
||||
} else {
|
||||
resId = R.array.lockscreen_targets_with_camera;
|
||||
}
|
||||
if (mMultiWaveView.getTargetResourceId() != resId) {
|
||||
mMultiWaveView.setTargetResources(resId);
|
||||
if (mGlowPadView.getTargetResourceId() != resId) {
|
||||
mGlowPadView.setTargetResources(resId);
|
||||
}
|
||||
|
||||
// Update the search icon with drawable from the search .apk
|
||||
@ -317,7 +317,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
||||
if (searchManager != null) {
|
||||
ComponentName component = searchManager.getGlobalSearchActivity();
|
||||
if (component != null) {
|
||||
if (!mMultiWaveView.replaceTargetDrawablesIfPresent(component,
|
||||
if (!mGlowPadView.replaceTargetDrawablesIfPresent(component,
|
||||
ASSIST_ICON_METADATA_NAME,
|
||||
com.android.internal.R.drawable.ic_lockscreen_search)) {
|
||||
Slog.w(TAG, "Couldn't grab icon from package " + component);
|
||||
@ -343,7 +343,7 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
||||
}
|
||||
|
||||
public void onTrigger(View v, int target) {
|
||||
final int resId = mMultiWaveView.getResourceIdForTarget(target);
|
||||
final int resId = mGlowPadView.getResourceIdForTarget(target);
|
||||
switch (resId) {
|
||||
case com.android.internal.R.drawable.ic_lockscreen_search:
|
||||
Intent assistIntent = getAssistIntent();
|
||||
@ -393,33 +393,33 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
||||
// Don't poke the wake lock when returning to a state where the handle is
|
||||
// not grabbed since that can happen when the system (instead of the user)
|
||||
// cancels the grab.
|
||||
if (handle != MultiWaveView.OnTriggerListener.NO_HANDLE) {
|
||||
if (handle != GlowPadView.OnTriggerListener.NO_HANDLE) {
|
||||
mCallback.pokeWakelock();
|
||||
}
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
return mMultiWaveView;
|
||||
return mGlowPadView;
|
||||
}
|
||||
|
||||
public void reset(boolean animate) {
|
||||
mMultiWaveView.reset(animate);
|
||||
mGlowPadView.reset(animate);
|
||||
}
|
||||
|
||||
public void ping() {
|
||||
mMultiWaveView.ping();
|
||||
mGlowPadView.ping();
|
||||
}
|
||||
|
||||
public void setEnabled(int resourceId, boolean enabled) {
|
||||
mMultiWaveView.setEnableTarget(resourceId, enabled);
|
||||
mGlowPadView.setEnableTarget(resourceId, enabled);
|
||||
}
|
||||
|
||||
public int getTargetPosition(int resourceId) {
|
||||
return mMultiWaveView.getTargetPosition(resourceId);
|
||||
return mGlowPadView.getTargetPosition(resourceId);
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
mMultiWaveView.setOnTriggerListener(null);
|
||||
mGlowPadView.setOnTriggerListener(null);
|
||||
}
|
||||
|
||||
public void onFinishFinalAnimation() {
|
||||
@ -531,11 +531,11 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
||||
WaveViewMethods waveViewMethods = new WaveViewMethods(waveView);
|
||||
waveView.setOnTriggerListener(waveViewMethods);
|
||||
return waveViewMethods;
|
||||
} else if (unlockWidget instanceof MultiWaveView) {
|
||||
MultiWaveView multiWaveView = (MultiWaveView) unlockWidget;
|
||||
MultiWaveViewMethods multiWaveViewMethods = new MultiWaveViewMethods(multiWaveView);
|
||||
multiWaveView.setOnTriggerListener(multiWaveViewMethods);
|
||||
return multiWaveViewMethods;
|
||||
} else if (unlockWidget instanceof GlowPadView) {
|
||||
GlowPadView glowPadView = (GlowPadView) unlockWidget;
|
||||
GlowPadViewMethods glowPadViewMethods = new GlowPadViewMethods(glowPadView);
|
||||
glowPadView.setOnTriggerListener(glowPadViewMethods);
|
||||
return glowPadViewMethods;
|
||||
} else {
|
||||
throw new IllegalStateException("Unrecognized unlock widget: " + unlockWidget);
|
||||
}
|
||||
@ -545,12 +545,12 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
|
||||
boolean disabledByAdmin = mLockPatternUtils.getDevicePolicyManager()
|
||||
.getCameraDisabled(null);
|
||||
boolean disabledBySimState = mUpdateMonitor.isSimLocked();
|
||||
boolean cameraTargetPresent = (mUnlockWidgetMethods instanceof MultiWaveViewMethods)
|
||||
? ((MultiWaveViewMethods) mUnlockWidgetMethods)
|
||||
boolean cameraTargetPresent = (mUnlockWidgetMethods instanceof GlowPadViewMethods)
|
||||
? ((GlowPadViewMethods) mUnlockWidgetMethods)
|
||||
.isTargetPresent(com.android.internal.R.drawable.ic_lockscreen_camera)
|
||||
: false;
|
||||
boolean searchTargetPresent = (mUnlockWidgetMethods instanceof MultiWaveViewMethods)
|
||||
? ((MultiWaveViewMethods) mUnlockWidgetMethods)
|
||||
boolean searchTargetPresent = (mUnlockWidgetMethods instanceof GlowPadViewMethods)
|
||||
? ((GlowPadViewMethods) mUnlockWidgetMethods)
|
||||
.isTargetPresent(com.android.internal.R.drawable.ic_lockscreen_search)
|
||||
: false;
|
||||
|
||||
|
Reference in New Issue
Block a user