resolve merge conflicts of 8c1e6e49f9 to oc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution. Change-Id: If41b96601018976c8f5a5ea8d124bc0abb4ef605
This commit is contained in:
@@ -56,13 +56,6 @@ public class NfcTile extends QSTileImpl<BooleanState> {
|
||||
if (mListening) {
|
||||
mContext.registerReceiver(mNfcReceiver,
|
||||
new IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED));
|
||||
if (mAdapter == null) {
|
||||
try {
|
||||
mAdapter = NfcAdapter.getNfcAdapter(mContext);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
mAdapter = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mContext.unregisterReceiver(mNfcReceiver);
|
||||
}
|
||||
@@ -84,11 +77,10 @@ public class NfcTile extends QSTileImpl<BooleanState> {
|
||||
|
||||
@Override
|
||||
protected void handleClick() {
|
||||
if (mAdapter == null) return;
|
||||
if (!mAdapter.isEnabled()) {
|
||||
mAdapter.enable();
|
||||
if (!getAdapter().isEnabled()) {
|
||||
getAdapter().enable();
|
||||
} else {
|
||||
mAdapter.disable();
|
||||
getAdapter().disable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +98,7 @@ public class NfcTile extends QSTileImpl<BooleanState> {
|
||||
protected void handleUpdateState(BooleanState state, Object arg) {
|
||||
final Drawable mEnable = mContext.getDrawable(R.drawable.ic_qs_nfc_enabled);
|
||||
final Drawable mDisable = mContext.getDrawable(R.drawable.ic_qs_nfc_disabled);
|
||||
state.value = mAdapter == null ? false : mAdapter.isEnabled();
|
||||
state.value = getAdapter().isEnabled();
|
||||
state.label = mContext.getString(R.string.quick_settings_nfc_label);
|
||||
state.icon = new DrawableIcon(state.value ? mEnable : mDisable);
|
||||
state.expandedAccessibilityClassName = Switch.class.getName();
|
||||
@@ -127,6 +119,17 @@ public class NfcTile extends QSTileImpl<BooleanState> {
|
||||
}
|
||||
}
|
||||
|
||||
private NfcAdapter getAdapter() {
|
||||
if (mAdapter == null) {
|
||||
try {
|
||||
mAdapter = NfcAdapter.getNfcAdapter(mContext);
|
||||
} catch (UnsupportedOperationException e) {
|
||||
mAdapter = null;
|
||||
}
|
||||
}
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
private BroadcastReceiver mNfcReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
Reference in New Issue
Block a user