summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/nfc
diff options
context:
space:
mode:
authorToby Chuang <tobychuang@google.com>2020-04-06 07:28:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-06 07:28:00 +0000
commit36b00c5e4f872759ed7702ea9c5c0f74c0d564d2 (patch)
tree4d58c649f7e9d2ab732ceb287213f0b694332dcf /src/com/android/settings/nfc
parent75c84f8e648a075c309ba8ddb8e8eb42e7c82c3f (diff)
parent204fa8a42048a7e760827e0d9920ba61d2fb488b (diff)
downloadpackages_apps_Settings-36b00c5e4f872759ed7702ea9c5c0f74c0d564d2.tar.gz
packages_apps_Settings-36b00c5e4f872759ed7702ea9c5c0f74c0d564d2.tar.bz2
packages_apps_Settings-36b00c5e4f872759ed7702ea9c5c0f74c0d564d2.zip
Merge "[NFC] Add a picture under NFC settings to show NFC detection point." into rvc-dev
Diffstat (limited to 'src/com/android/settings/nfc')
-rw-r--r--src/com/android/settings/nfc/NfcDetectionPointController.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/com/android/settings/nfc/NfcDetectionPointController.java b/src/com/android/settings/nfc/NfcDetectionPointController.java
new file mode 100644
index 0000000000..b2e8f6abde
--- /dev/null
+++ b/src/com/android/settings/nfc/NfcDetectionPointController.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.nfc;
+
+import android.content.Context;
+
+import androidx.annotation.VisibleForTesting;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+/**
+ * Controller that used to show nfc detection point guidance
+ */
+public class NfcDetectionPointController extends BasePreferenceController {
+ private boolean mEnabled;
+
+ public NfcDetectionPointController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ mEnabled = mContext.getResources().getBoolean(R.bool.config_nfc_detection_point);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ if (!mEnabled) {
+ return UNSUPPORTED_ON_DEVICE;
+ }
+ return AVAILABLE;
+ }
+
+ @VisibleForTesting
+ public void setConfig(boolean value) {
+ mEnabled = value;
+ }
+}