am 0b2d184a: Merge "Update setup wizard icons"
* commit '0b2d184a426f49c115ea55098ae6073ccd7d6a94': Update setup wizard iconsmain
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 697 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 763 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 985 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1013 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1017 B |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 597 B |
After Width: | Height: | Size: 634 B |
After Width: | Height: | Size: 965 B |
After Width: | Height: | Size: 957 B |
After Width: | Height: | Size: 709 B |
After Width: | Height: | Size: 709 B |
After Width: | Height: | Size: 685 B |
After Width: | Height: | Size: 849 B |
After Width: | Height: | Size: 876 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
|
@ -22,23 +22,23 @@ import android.widget.TextView;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public final class TextViewCompatUtils {
|
public final class TextViewCompatUtils {
|
||||||
// Note that TextView.setCompoundDrawablesRelative(Drawable,Drawable,Drawable,Drawable) has
|
// Note that TextView.setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable,Drawable,
|
||||||
// been introduced in API level 17 (Build.VERSION_CODE.JELLY_BEAN_MR1).
|
// Drawable,Drawable) has been introduced in API level 17 (Build.VERSION_CODE.JELLY_BEAN_MR1).
|
||||||
private static final Method METHOD_setCompoundDrawablesRelative = CompatUtils.getMethod(
|
private static final Method METHOD_setCompoundDrawablesRelativeWithIntrinsicBounds =
|
||||||
TextView.class, "setCompoundDrawablesRelative",
|
CompatUtils.getMethod(TextView.class, "setCompoundDrawablesRelativeWithIntrinsicBounds",
|
||||||
Drawable.class, Drawable.class, Drawable.class, Drawable.class);
|
Drawable.class, Drawable.class, Drawable.class, Drawable.class);
|
||||||
|
|
||||||
private TextViewCompatUtils() {
|
private TextViewCompatUtils() {
|
||||||
// This utility class is not publicly instantiable.
|
// This utility class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setCompoundDrawablesRelative(final TextView textView, final Drawable start,
|
public static void setCompoundDrawablesRelativeWithIntrinsicBounds(final TextView textView,
|
||||||
final Drawable top, final Drawable end, final Drawable bottom) {
|
final Drawable start, final Drawable top, final Drawable end, final Drawable bottom) {
|
||||||
if (METHOD_setCompoundDrawablesRelative == null) {
|
if (METHOD_setCompoundDrawablesRelativeWithIntrinsicBounds == null) {
|
||||||
textView.setCompoundDrawables(start, top, end, bottom);
|
textView.setCompoundDrawablesWithIntrinsicBounds(start, top, end, bottom);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompatUtils.invoke(textView, null, METHOD_setCompoundDrawablesRelative,
|
CompatUtils.invoke(textView, null, METHOD_setCompoundDrawablesRelativeWithIntrinsicBounds,
|
||||||
start, top, end, bottom);
|
start, top, end, bottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,10 +313,8 @@ public final class SetupActivity extends Activity {
|
||||||
final int paddingEnd = ViewCompatUtils.getPaddingEnd(mActionLabel);
|
final int paddingEnd = ViewCompatUtils.getPaddingEnd(mActionLabel);
|
||||||
ViewCompatUtils.setPaddingRelative(mActionLabel, paddingEnd, 0, paddingEnd, 0);
|
ViewCompatUtils.setPaddingRelative(mActionLabel, paddingEnd, 0, paddingEnd, 0);
|
||||||
} else {
|
} else {
|
||||||
final Drawable icon = res.getDrawable(actionIcon);
|
TextViewCompatUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(
|
||||||
icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
|
mActionLabel, res.getDrawable(actionIcon), null, null, null);
|
||||||
TextViewCompatUtils.setCompoundDrawablesRelative(
|
|
||||||
mActionLabel, icon, null, null, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|