Skip to content

Commit fef47f4

Browse files
Jim MillerAndroid (Google) Code Review
authored andcommitted
Merge "Fix 6398209: Improve MultiWaveView animations and interaction" into jb-dev
2 parents b1b55e6 + 10c66af commit fef47f4

12 files changed

+281
-134
lines changed

core/java/com/android/internal/widget/multiwaveview/MultiWaveView.java

Lines changed: 173 additions & 130 deletions
Large diffs are not rendered by default.

core/java/com/android/internal/widget/multiwaveview/TargetDrawable.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ public class TargetDrawable {
3232
public static final int[] STATE_INACTIVE =
3333
{ android.R.attr.state_enabled, -android.R.attr.state_active };
3434
public static final int[] STATE_FOCUSED =
35-
{ android.R.attr.state_enabled, android.R.attr.state_focused };
35+
{ android.R.attr.state_enabled, -android.R.attr.state_active,
36+
android.R.attr.state_focused };
3637

3738
private float mTranslationX = 0.0f;
3839
private float mTranslationY = 0.0f;
40+
private float mPositionX = 0.0f;
41+
private float mPositionY = 0.0f;
3942
private float mScaleX = 1.0f;
4043
private float mScaleY = 1.0f;
4144
private float mAlpha = 1.0f;
@@ -196,6 +199,22 @@ public float getAlpha() {
196199
return mAlpha;
197200
}
198201

202+
public void setPositionX(float x) {
203+
mPositionX = x;
204+
}
205+
206+
public void setPositionY(float y) {
207+
mPositionY = y;
208+
}
209+
210+
public float getPositionX() {
211+
return mPositionX;
212+
}
213+
214+
public float getPositionY() {
215+
return mPositionY;
216+
}
217+
199218
public int getWidth() {
200219
return mDrawable != null ? mDrawable.getIntrinsicWidth() : 0;
201220
}
@@ -209,8 +228,8 @@ public void draw(Canvas canvas) {
209228
return;
210229
}
211230
canvas.save(Canvas.MATRIX_SAVE_FLAG);
212-
canvas.translate(mTranslationX, mTranslationY);
213-
canvas.scale(mScaleX, mScaleY);
231+
canvas.scale(mScaleX, mScaleY, mPositionX, mPositionY);
232+
canvas.translate(mTranslationX + mPositionX, mTranslationY + mPositionY);
214233
canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
215234
mDrawable.setAlpha((int) Math.round(mAlpha * 255f));
216235
mDrawable.draw(canvas);

core/res/res/drawable/ic_lockscreen_answer.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
android:state_focused="false"
2828
android:drawable="@drawable/ic_lockscreen_answer_active" />
2929

30+
<item
31+
android:state_enabled="true"
32+
android:state_active="false"
33+
android:state_focused="true"
34+
android:drawable="@drawable/ic_lockscreen_answer_active" />
35+
3036
</selector>

core/res/res/drawable/ic_lockscreen_camera.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
android:state_focused="false"
2828
android:drawable="@drawable/ic_lockscreen_camera_activated" />
2929

30+
<item
31+
android:state_enabled="true"
32+
android:state_active="false"
33+
android:state_focused="true"
34+
android:drawable="@drawable/ic_lockscreen_camera_activated" />
35+
3036
</selector>

core/res/res/drawable/ic_lockscreen_decline.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
android:state_focused="false"
2828
android:drawable="@drawable/ic_lockscreen_decline_activated" />
2929

30+
<item
31+
android:state_enabled="true"
32+
android:state_active="false"
33+
android:state_focused="true"
34+
android:drawable="@drawable/ic_lockscreen_decline_activated" />
35+
3036
</selector>

core/res/res/drawable/ic_lockscreen_outerring.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
<shape xmlns:android="http://schemas.android.com/apk/res/android"
1818
android:shape="oval"
1919
>
20-
<size android:height="@dimen/keyguard_lockscreen_outerring_diameter" android:width="@dimen/keyguard_lockscreen_outerring_diameter" />
20+
<size android:height="@dimen/keyguard_lockscreen_outerring_diameter"
21+
android:width="@dimen/keyguard_lockscreen_outerring_diameter" />
2122
<solid android:color="#00000000" />
2223
<stroke android:color="#1affffff" android:width="2dp" />
2324
</shape>

core/res/res/drawable/ic_lockscreen_search.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
android:state_focused="false"
2828
android:drawable="@drawable/ic_lockscreen_google_activated" />
2929

30+
<item
31+
android:state_enabled="true"
32+
android:state_active="false"
33+
android:state_focused="true"
34+
android:drawable="@drawable/ic_lockscreen_google_activated" />
35+
3036
</selector>

core/res/res/drawable/ic_lockscreen_send_sms.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
android:state_focused="false"
2828
android:drawable="@drawable/ic_lockscreen_text_activated" />
2929

30+
<item
31+
android:state_enabled="true"
32+
android:state_active="false"
33+
android:state_focused="true"
34+
android:drawable="@drawable/ic_lockscreen_text_activated" />
35+
3036
</selector>

core/res/res/drawable/ic_lockscreen_silent.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
android:state_focused="false"
2828
android:drawable="@drawable/ic_lockscreen_silent_activated" />
2929

30+
<item
31+
android:state_enabled="true"
32+
android:state_active="false"
33+
android:state_focused="true"
34+
android:drawable="@drawable/ic_lockscreen_silent_activated" />
35+
3036
</selector>

core/res/res/drawable/ic_lockscreen_soundon.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,10 @@
2727
android:state_focused="false"
2828
android:drawable="@drawable/ic_lockscreen_soundon_activated" />
2929

30+
<item
31+
android:state_enabled="true"
32+
android:state_active="false"
33+
android:state_focused="true"
34+
android:drawable="@drawable/ic_lockscreen_soundon_activated" />
35+
3036
</selector>

0 commit comments

Comments
 (0)