Loading packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java +16 −4 Original line number Original line Diff line number Diff line Loading @@ -28,10 +28,13 @@ import android.support.v7.preference.PreferenceViewHolder; import android.text.TextUtils; import android.text.TextUtils; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.SparseArray; import android.util.SparseArray; import android.view.View; import android.widget.TextView; import android.widget.TextView; import com.android.settingslib.R; import com.android.settingslib.R; import java.util.Objects; public class AccessPointPreference extends Preference { public class AccessPointPreference extends Preference { private static final int[] STATE_SECURED = { private static final int[] STATE_SECURED = { Loading Loading @@ -108,6 +111,7 @@ public class AccessPointPreference extends Preference { mTitleView.setCompoundDrawablePadding(mBadgePadding); mTitleView.setCompoundDrawablePadding(mBadgePadding); } } view.itemView.setContentDescription(mContentDescription); view.itemView.setContentDescription(mContentDescription); view.itemView.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } protected void updateIcon(int level, Context context) { protected void updateIcon(int level, Context context) { Loading Loading @@ -148,6 +152,7 @@ public class AccessPointPreference extends Preference { * Updates the title and summary; may indirectly call notifyChanged(). * Updates the title and summary; may indirectly call notifyChanged(). */ */ public void refresh() { public void refresh() { boolean updated = false; if (mForSavedNetworks) { if (mForSavedNetworks) { setTitle(mAccessPoint.getConfigName()); setTitle(mAccessPoint.getConfigName()); } else { } else { Loading @@ -159,21 +164,28 @@ public class AccessPointPreference extends Preference { if (level != mLevel) { if (level != mLevel) { mLevel = level; mLevel = level; updateIcon(mLevel, context); updateIcon(mLevel, context); notifyChanged(); updated = true; } } updateBadge(context); updateBadge(context); setSummary(mForSavedNetworks ? mAccessPoint.getSavedNetworkSummary() setSummary(mForSavedNetworks ? mAccessPoint.getSavedNetworkSummary() : mAccessPoint.getSettingsSummary()); : mAccessPoint.getSettingsSummary()); mContentDescription = getTitle(); CharSequence contentDescription = getTitle(); if (getSummary() != null) { if (getSummary() != null) { mContentDescription = TextUtils.concat(mContentDescription, ",", getSummary()); contentDescription = TextUtils.concat(contentDescription, ",", getSummary()); } } if (level >= 0 && level < WIFI_CONNECTION_STRENGTH.length) { if (level >= 0 && level < WIFI_CONNECTION_STRENGTH.length) { mContentDescription = TextUtils.concat(mContentDescription, ",", contentDescription = TextUtils.concat(contentDescription, ",", getContext().getString(WIFI_CONNECTION_STRENGTH[level])); getContext().getString(WIFI_CONNECTION_STRENGTH[level])); } } if (!Objects.equals(contentDescription, mContentDescription)) { mContentDescription = contentDescription; updated = true; } if (updated) { notifyChanged(); } } } @Override @Override Loading Loading
packages/SettingsLib/src/com/android/settingslib/wifi/AccessPointPreference.java +16 −4 Original line number Original line Diff line number Diff line Loading @@ -28,10 +28,13 @@ import android.support.v7.preference.PreferenceViewHolder; import android.text.TextUtils; import android.text.TextUtils; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.SparseArray; import android.util.SparseArray; import android.view.View; import android.widget.TextView; import android.widget.TextView; import com.android.settingslib.R; import com.android.settingslib.R; import java.util.Objects; public class AccessPointPreference extends Preference { public class AccessPointPreference extends Preference { private static final int[] STATE_SECURED = { private static final int[] STATE_SECURED = { Loading Loading @@ -108,6 +111,7 @@ public class AccessPointPreference extends Preference { mTitleView.setCompoundDrawablePadding(mBadgePadding); mTitleView.setCompoundDrawablePadding(mBadgePadding); } } view.itemView.setContentDescription(mContentDescription); view.itemView.setContentDescription(mContentDescription); view.itemView.setAccessibilityLiveRegion(View.ACCESSIBILITY_LIVE_REGION_POLITE); } } protected void updateIcon(int level, Context context) { protected void updateIcon(int level, Context context) { Loading Loading @@ -148,6 +152,7 @@ public class AccessPointPreference extends Preference { * Updates the title and summary; may indirectly call notifyChanged(). * Updates the title and summary; may indirectly call notifyChanged(). */ */ public void refresh() { public void refresh() { boolean updated = false; if (mForSavedNetworks) { if (mForSavedNetworks) { setTitle(mAccessPoint.getConfigName()); setTitle(mAccessPoint.getConfigName()); } else { } else { Loading @@ -159,21 +164,28 @@ public class AccessPointPreference extends Preference { if (level != mLevel) { if (level != mLevel) { mLevel = level; mLevel = level; updateIcon(mLevel, context); updateIcon(mLevel, context); notifyChanged(); updated = true; } } updateBadge(context); updateBadge(context); setSummary(mForSavedNetworks ? mAccessPoint.getSavedNetworkSummary() setSummary(mForSavedNetworks ? mAccessPoint.getSavedNetworkSummary() : mAccessPoint.getSettingsSummary()); : mAccessPoint.getSettingsSummary()); mContentDescription = getTitle(); CharSequence contentDescription = getTitle(); if (getSummary() != null) { if (getSummary() != null) { mContentDescription = TextUtils.concat(mContentDescription, ",", getSummary()); contentDescription = TextUtils.concat(contentDescription, ",", getSummary()); } } if (level >= 0 && level < WIFI_CONNECTION_STRENGTH.length) { if (level >= 0 && level < WIFI_CONNECTION_STRENGTH.length) { mContentDescription = TextUtils.concat(mContentDescription, ",", contentDescription = TextUtils.concat(contentDescription, ",", getContext().getString(WIFI_CONNECTION_STRENGTH[level])); getContext().getString(WIFI_CONNECTION_STRENGTH[level])); } } if (!Objects.equals(contentDescription, mContentDescription)) { mContentDescription = contentDescription; updated = true; } if (updated) { notifyChanged(); } } } @Override @Override Loading