Merge "Add friction icon for metered networks." into oc-dev

This commit is contained in:
TreeHugger Robot
2017-04-03 18:23:56 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 0 deletions

View File

@@ -36,6 +36,9 @@
<declare-styleable name="WifiEncryptionState">
<attr name="state_encrypted" format="boolean" />
</declare-styleable>
<declare-styleable name="WifiMeteredState">
<attr name="state_metered" format="boolean" />
</declare-styleable>
<declare-styleable name="WifiSavedState">
<attr name="state_saved" format="boolean" />
</declare-styleable>

View File

@@ -44,6 +44,10 @@ public class AccessPointPreference extends Preference {
R.attr.state_encrypted
};
private static final int[] STATE_METERED = {
R.attr.state_metered
};
private static final int[] wifi_friction_attributes = { R.attr.wifi_friction };
private final StateListDrawable mFrictionSld;
@@ -179,6 +183,8 @@ public class AccessPointPreference extends Preference {
}
if (mAccessPoint.getSecurity() != AccessPoint.SECURITY_NONE) {
mFrictionSld.setState(STATE_SECURED);
} else if (mAccessPoint.getConfig() != null && mAccessPoint.getConfig().meteredHint) {
mFrictionSld.setState(STATE_METERED);
}
Drawable drawable = mFrictionSld.getCurrent();
frictionImageView.setImageDrawable(drawable);