diff --git a/packages/SystemUI/res/drawable/ic_qs_nfc_enabled.xml b/packages/SystemUI/res/drawable/ic_qs_nfc.xml similarity index 95% rename from packages/SystemUI/res/drawable/ic_qs_nfc_enabled.xml rename to packages/SystemUI/res/drawable/ic_qs_nfc.xml index becb18ad8ba2..2c080964b48e 100644 --- a/packages/SystemUI/res/drawable/ic_qs_nfc_enabled.xml +++ b/packages/SystemUI/res/drawable/ic_qs_nfc.xml @@ -14,8 +14,8 @@ limitations under the License. --> diff --git a/packages/SystemUI/res/drawable/ic_qs_nfc_disabled.xml b/packages/SystemUI/res/drawable/ic_qs_nfc_disabled.xml deleted file mode 100644 index 558f3d083f42..000000000000 --- a/packages/SystemUI/res/drawable/ic_qs_nfc_disabled.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index e4f2dbb299ae..83282de00ca0 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -114,7 +114,7 @@ - wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord,reverse,heads_up,dataswitch,sync,volume_panel,reboot,caffeine + wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,nfc,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord,reverse,heads_up,dataswitch,sync,volume_panel,reboot,caffeine diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java index 336f6c9ec6c3..407c9500f2ff 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/NfcTile.java @@ -39,6 +39,8 @@ /** Quick settings tile: Enable/Disable NFC **/ public class NfcTile extends QSTileImpl { + private final Icon mIcon = ResourceIcon.get(R.drawable.ic_qs_nfc); + private NfcAdapter mAdapter; private BroadcastDispatcher mBroadcastDispatcher; @@ -109,8 +111,7 @@ protected void handleUpdateState(BooleanState state, Object arg) { state.state = getAdapter() == null ? Tile.STATE_UNAVAILABLE : state.value ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE; - state.icon = ResourceIcon.get( - state.value ? R.drawable.ic_qs_nfc_enabled : R.drawable.ic_qs_nfc_disabled); + state.icon = mIcon; state.label = mContext.getString(R.string.quick_settings_nfc_label); state.expandedAccessibilityClassName = Switch.class.getName(); state.contentDescription = state.label; @@ -133,7 +134,7 @@ protected String composeChangeAnnouncement() { private NfcAdapter getAdapter() { if (mAdapter == null) { try { - mAdapter = NfcAdapter.getDefaultAdapter(mContext); + mAdapter = NfcAdapter.getNfcAdapter(mContext.getApplicationContext()); } catch (UnsupportedOperationException e) { mAdapter = null; }