Merge "Fixed the default of AlphaOptimizedImageViews overlapping rendering" into nyc-dev

This commit is contained in:
Selim Cinek
2016-03-22 23:12:09 +00:00
committed by Android (Google) Code Review
7 changed files with 24 additions and 30 deletions

View File

@@ -17,7 +17,6 @@
<!-- Extends LinearLayout -->
<com.android.systemui.qs.QSDetail
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/qs_detail_background"
@@ -41,7 +40,6 @@
android:background="@color/qs_detail_progress_track"
android:layout_width="match_parent"
android:layout_height="wrap_content"
systemui:hasOverlappingRendering="false"
/>
<FrameLayout

View File

@@ -184,7 +184,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
systemui:hasOverlappingRendering="false"
/>
<TextView

View File

@@ -19,7 +19,6 @@
<!-- extends LinearLayout -->
<com.android.systemui.statusbar.SignalClusterView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:systemui="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:gravity="center_vertical"
@@ -43,7 +42,6 @@
android:id="@+id/ethernet"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
systemui:hasOverlappingRendering="false"
/>
<com.android.systemui.statusbar.AlphaOptimizedImageView
android:theme="@style/DualToneDarkTheme"
@@ -51,7 +49,6 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:alpha="0.0"
systemui:hasOverlappingRendering="false"
/>
</FrameLayout>
<FrameLayout
@@ -64,7 +61,6 @@
android:id="@+id/wifi_signal"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
systemui:hasOverlappingRendering="false"
/>
<com.android.systemui.statusbar.AlphaOptimizedImageView
android:theme="@style/DualToneDarkTheme"
@@ -72,7 +68,6 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:alpha="0.0"
systemui:hasOverlappingRendering="false"
/>
</FrameLayout>
<View
@@ -98,7 +93,6 @@
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/stat_sys_no_sims"
systemui:hasOverlappingRendering="false"
/>
<com.android.systemui.statusbar.AlphaOptimizedImageView
android:theme="@style/DualToneDarkTheme"
@@ -107,7 +101,6 @@
android:layout_width="wrap_content"
android:src="@drawable/stat_sys_no_sims"
android:alpha="0.0"
systemui:hasOverlappingRendering="false"
/>
</FrameLayout>
<View

View File

@@ -177,7 +177,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
systemui:hasOverlappingRendering="false"
/>
<TextView

View File

@@ -85,7 +85,7 @@
<attr name="ignoreRightInset" format="boolean" />
</declare-styleable>
<declare-styleable name="AlphaOptimizedImageView">
<declare-styleable name="AnimatedImageView">
<attr name="hasOverlappingRendering" format="boolean" />
</declare-styleable>

View File

@@ -17,18 +17,14 @@
package com.android.systemui.statusbar;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
import com.android.systemui.R;
/**
* An ImageView which supports an attribute specifying whether it has overlapping rendering
* commands and therefore does not need a layer when alpha is changed.
*/
public class AlphaOptimizedImageView extends ImageView {
private final boolean mHasOverlappingRendering;
public AlphaOptimizedImageView(Context context) {
this(context, null /* attrs */);
@@ -45,21 +41,10 @@ public class AlphaOptimizedImageView extends ImageView {
public AlphaOptimizedImageView(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
R.styleable.AlphaOptimizedImageView, 0, 0);
try {
// Default to true, which is what View.java defaults to
mHasOverlappingRendering = a.getBoolean(
R.styleable.AlphaOptimizedImageView_hasOverlappingRendering, true);
} finally {
a.recycle();
}
}
@Override
public boolean hasOverlappingRendering() {
return mHasOverlappingRendering;
return false;
}
}

View File

@@ -17,14 +17,19 @@
package com.android.systemui.statusbar;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RemoteViews.RemoteView;
import com.android.systemui.R;
@RemoteView
public class AnimatedImageView extends AlphaOptimizedImageView {
public class AnimatedImageView extends ImageView {
private final boolean mHasOverlappingRendering;
AnimationDrawable mAnim;
boolean mAttached;
@@ -34,11 +39,21 @@ public class AnimatedImageView extends AlphaOptimizedImageView {
int mDrawableId;
public AnimatedImageView(Context context) {
super(context);
this(context, null);
}
public AnimatedImageView(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
R.styleable.AnimatedImageView, 0, 0);
try {
// Default to true, which is what View.java defaults toA
mHasOverlappingRendering = a.getBoolean(
R.styleable.AnimatedImageView_hasOverlappingRendering, true);
} finally {
a.recycle();
}
}
private void updateAnim() {
@@ -106,5 +121,10 @@ public class AnimatedImageView extends AlphaOptimizedImageView {
}
}
}
@Override
public boolean hasOverlappingRendering() {
return mHasOverlappingRendering;
}
}