Merge changes Ia2bf4d17,I8242523d
* changes: Fix alert dialog alignment and touch feedback masking Fix VectorDrawable states
This commit is contained in:
committed by
Android (Google) Code Review
commit
f805b40c44
@@ -16,6 +16,7 @@
|
||||
|
||||
<touch-feedback xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="?attr/colorButtonPressed">
|
||||
<item android:drawable="@color/transparent" />
|
||||
<item android:id="@id/mask"
|
||||
android:drawable="@drawable/btn_qntm_alpha" />
|
||||
</touch-feedback>
|
||||
|
||||
@@ -25,26 +25,29 @@
|
||||
android:viewportHeight="320"
|
||||
android:viewportWidth="320" />
|
||||
|
||||
<group>
|
||||
<path
|
||||
android:name="check"
|
||||
android:pathData="M 232.1,80.6 L 248.5,92.1 L 145.2,239.5 L 71.5,187.8 L 83,171.5 L 140.3,211.7 z"
|
||||
android:fill="?attr/colorControlActivated" />
|
||||
</group>
|
||||
<group>
|
||||
<path
|
||||
android:name="box1"
|
||||
android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
|
||||
android:fill="?attr/colorControlActivated"
|
||||
android:stroke="?attr/colorControlActivated"
|
||||
android:pathData="M 240,80 L 240,240 L 80,240 L 80,80 L 240,80 L 240,80 z"
|
||||
android:stroke="?attr/colorControlNormal"
|
||||
android:strokeWidth="20"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</group>
|
||||
<group>
|
||||
<path
|
||||
android:name="box2"
|
||||
android:pathData="M 160,200 L 160,240 L 120,240 L 120,200 L 160,200 L 160,200 z"
|
||||
android:stroke="?attr/colorControlNormal"
|
||||
android:strokeWidth="10"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</group>
|
||||
<group>
|
||||
<path
|
||||
android:name="box3"
|
||||
android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
|
||||
android:rotation="-35"
|
||||
android:rotation="35"
|
||||
android:pivotX="140"
|
||||
android:pivotY="220"
|
||||
android:fill="?attr/colorControlNormal"
|
||||
@@ -55,25 +58,22 @@
|
||||
</group>
|
||||
<group>
|
||||
<path
|
||||
android:name="box3"
|
||||
android:pathData="M 160,200 L 160,240 L 120,240 L 120,200 L 160,200 L 160,200 z"
|
||||
android:stroke="?attr/colorControlNormal"
|
||||
android:strokeWidth="10"
|
||||
android:name="box4"
|
||||
android:pathData="M 160,216.5 L 143.5,240 L 120,223.5 L 136.5,200 L 160,216.5 L 160,216.5 z"
|
||||
android:fill="?attr/colorControlActivated"
|
||||
android:stroke="?attr/colorControlActivated"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</group>
|
||||
<group>
|
||||
<path
|
||||
android:name="box4"
|
||||
android:pathData="M 240,80 L 240,240 L 80,240 L 80,80 L 240,80 L 240,80 z"
|
||||
android:stroke="?attr/colorControlNormal"
|
||||
android:strokeWidth="20"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
android:name="check"
|
||||
android:pathData="M 232.1,80.6 L 248.5,92.1 L 145.2,239.5 L 71.5,187.8 L 83,171.5 L 140.3,211.7 z"
|
||||
android:fill="?attr/colorControlActivated" />
|
||||
</group>
|
||||
|
||||
<animation
|
||||
android:durations="300,100,0,300"
|
||||
android:sequence="check,box1,box2,box3,box4" />
|
||||
android:sequence="box1,box2,box3,box4,check" />
|
||||
|
||||
</vector>
|
||||
|
||||
@@ -91,32 +91,32 @@
|
||||
style="?android:attr/buttonBarStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layoutDirection="locale"
|
||||
android:measureWithLargestChild="true">
|
||||
android:layoutDirection="locale">
|
||||
<Button android:id="@+id/button3"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginRight="8dip"
|
||||
android:maxLines="2"
|
||||
android:minHeight="@dimen/alert_dialog_button_bar_height"
|
||||
style="?android:attr/buttonBarButtonStyle" />
|
||||
android:minHeight="@dimen/alert_dialog_button_bar_height" />
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/alert_dialog_button_bar_height"
|
||||
android:layout_weight="1"
|
||||
android:visibility="invisible" />
|
||||
<Button android:id="@+id/button2"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginRight="8dip"
|
||||
android:maxLines="2"
|
||||
android:minHeight="@dimen/alert_dialog_button_bar_height"
|
||||
style="?android:attr/buttonBarButtonStyle" />
|
||||
android:minHeight="@dimen/alert_dialog_button_bar_height" />
|
||||
<Button android:id="@+id/button1"
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_marginLeft="8dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:maxLines="2"
|
||||
android:minHeight="@dimen/alert_dialog_button_bar_height"
|
||||
style="?android:attr/buttonBarButtonStyle" />
|
||||
android:minHeight="@dimen/alert_dialog_button_bar_height" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@@ -317,7 +317,7 @@ please see themes_device_defaults.xml.
|
||||
<item name="dividerVertical">?attr/listDivider</item>
|
||||
<item name="dividerHorizontal">?attr/listDivider</item>
|
||||
<item name="buttonBarStyle">@style/Widget.Quantum.ButtonBar</item>
|
||||
<item name="buttonBarButtonStyle">?attr/borderlessButtonStyle</item>
|
||||
<item name="buttonBarButtonStyle">@style/Widget.Quantum.Button.Borderless.Small</item>
|
||||
<item name="segmentedButtonStyle">@style/Widget.Quantum.SegmentedButton</item>
|
||||
|
||||
<!-- SearchView attributes -->
|
||||
@@ -662,7 +662,7 @@ please see themes_device_defaults.xml.
|
||||
<item name="dividerVertical">?attr/listDivider</item>
|
||||
<item name="dividerHorizontal">?attr/listDivider</item>
|
||||
<item name="buttonBarStyle">@style/Widget.Quantum.Light.ButtonBar</item>
|
||||
<item name="buttonBarButtonStyle">?attr/borderlessButtonStyle</item>
|
||||
<item name="buttonBarButtonStyle">@style/Widget.Quantum.Light.Button.Borderless.Small</item>
|
||||
<item name="segmentedButtonStyle">@style/Widget.Quantum.Light.SegmentedButton</item>
|
||||
|
||||
<!-- SearchView attributes -->
|
||||
|
||||
@@ -44,6 +44,8 @@ import java.io.IOException;
|
||||
* Documentation pending.
|
||||
*/
|
||||
public class TouchFeedbackDrawable extends LayerDrawable {
|
||||
private static final PorterDuffXfermode DST_IN = new PorterDuffXfermode(Mode.DST_IN);
|
||||
|
||||
/** The maximum number of ripples supported. */
|
||||
private static final int MAX_RIPPLES = 10;
|
||||
|
||||
@@ -397,7 +399,7 @@ public class TouchFeedbackDrawable extends LayerDrawable {
|
||||
if (mask != null && drewRipples) {
|
||||
// TODO: This will also mask the lower layer, which is bad.
|
||||
canvas.saveLayer(bounds.left, bounds.top, bounds.right,
|
||||
bounds.bottom, getMaskingPaint(mState.mTintXfermode), 0);
|
||||
bounds.bottom, getMaskingPaint(DST_IN), 0);
|
||||
mask.draw(canvas);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,14 +182,14 @@ public class VectorDrawable extends Drawable {
|
||||
|
||||
public VectorDrawable() {
|
||||
mVectorState = new VectorDrawableState(null);
|
||||
mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 1);
|
||||
mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 0);
|
||||
|
||||
setDuration(DEFAULT_DURATION);
|
||||
}
|
||||
|
||||
private VectorDrawable(VectorDrawableState state, Resources res, Theme theme) {
|
||||
mVectorState = new VectorDrawableState(state);
|
||||
mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 1);
|
||||
mVectorState.mBasicAnimator = ObjectAnimator.ofFloat(this, "AnimationFraction", 0, 0);
|
||||
|
||||
if (theme != null && canApplyTheme()) {
|
||||
applyTheme(theme);
|
||||
@@ -213,7 +213,7 @@ public class VectorDrawable extends Drawable {
|
||||
|
||||
@Override
|
||||
public void jumpToCurrentState() {
|
||||
mVectorState.mBasicAnimator.end();
|
||||
stop();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -318,7 +318,7 @@ public class VectorDrawable extends Drawable {
|
||||
|
||||
private void animateBackward() {
|
||||
if (!mVectorState.mBasicAnimator.isStarted()) {
|
||||
mVectorState.mBasicAnimator.setFloatValues(.99f, 0);
|
||||
mVectorState.mBasicAnimator.setFloatValues(1, 0);
|
||||
start();
|
||||
}
|
||||
}
|
||||
@@ -985,7 +985,13 @@ public class VectorDrawable extends Drawable {
|
||||
|
||||
for (int j = 0; j < sp.length; j++) {
|
||||
mSeqMap.add(sp[j].trim());
|
||||
VectorDrawable.VPath path = groups.get(j).get(sp[j]);
|
||||
|
||||
final VectorDrawable.VPath path = groups.get(j).get(sp[j]);
|
||||
if (path == null) {
|
||||
throw new XmlPullParserException(a.getPositionDescription()
|
||||
+ " missing path with name: " + sp[j]);
|
||||
}
|
||||
|
||||
path.mAnimated = true;
|
||||
paths[j] = path;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user