summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-08-01 18:05:29 +0000
committerSunny Goyal <sunnygoyal@google.com>2017-08-01 18:05:29 +0000
commit0c793abf563c3f832bcfe8a29542008ba6456d79 (patch)
tree0f11a68bb52e5e584223a7f412b893859d7b72de
parentcefbb15656f9373e3b1045724c729b270cf985ac (diff)
parentb65e13ca837376e9712f31fdf947bad23b1107ef (diff)
downloadandroid_packages_apps_Trebuchet-0c793abf563c3f832bcfe8a29542008ba6456d79.tar.gz
android_packages_apps_Trebuchet-0c793abf563c3f832bcfe8a29542008ba6456d79.tar.bz2
android_packages_apps_Trebuchet-0c793abf563c3f832bcfe8a29542008ba6456d79.zip
[automerger] Making the whole preference entry a single tap target when notification access is not available am: b65e13ca83
Change-Id: I4a2aab526002c59fcbc479121451988ae0872c23
-rw-r--r--res/layout/notification_pref_warning.xml3
-rw-r--r--src/com/android/launcher3/SettingsActivity.java9
-rw-r--r--src/com/android/launcher3/views/ButtonPreference.java15
3 files changed, 11 insertions, 16 deletions
diff --git a/res/layout/notification_pref_warning.xml b/res/layout/notification_pref_warning.xml
index 795699e99..100fac5e4 100644
--- a/res/layout/notification_pref_warning.xml
+++ b/res/layout/notification_pref_warning.xml
@@ -17,8 +17,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="48dp"
android:layout_height="match_parent"
- android:background="?android:attr/selectableItemBackgroundBorderless"
- android:contentDescription="@string/title_missing_notification_access"
+ android:importantForAccessibility="no"
android:scaleType="center"
android:src="@drawable/ic_warning"
android:tint="?android:attr/textColorSecondary" />
diff --git a/src/com/android/launcher3/SettingsActivity.java b/src/com/android/launcher3/SettingsActivity.java
index d5d5eab76..fa7769e3f 100644
--- a/src/com/android/launcher3/SettingsActivity.java
+++ b/src/com/android/launcher3/SettingsActivity.java
@@ -34,7 +34,6 @@ import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.provider.Settings;
import android.provider.Settings.System;
-import android.view.View;
import com.android.launcher3.graphics.IconShapeOverride;
import com.android.launcher3.notification.NotificationListener;
@@ -172,7 +171,7 @@ public class SettingsActivity extends Activity {
* and updates the launcher badging setting subtext accordingly.
*/
private static class IconBadgingObserver extends ContentObserver
- implements View.OnClickListener {
+ implements Preference.OnPreferenceClickListener {
private final ButtonPreference mBadgingPref;
private final ContentResolver mResolver;
@@ -205,14 +204,16 @@ public class SettingsActivity extends Activity {
summary = R.string.title_missing_notification_access;
}
}
- mBadgingPref.setButtonOnClickListener(serviceEnabled ? null : this);
+ mBadgingPref.setWidgetFrameVisible(!serviceEnabled);
+ mBadgingPref.setOnPreferenceClickListener(serviceEnabled ? null : this);
mBadgingPref.setSummary(summary);
}
@Override
- public void onClick(View view) {
+ public boolean onPreferenceClick(Preference preference) {
new NotificationAccessConfirmation().show(mFragmentManager, "notification_access");
+ return true;
}
}
diff --git a/src/com/android/launcher3/views/ButtonPreference.java b/src/com/android/launcher3/views/ButtonPreference.java
index 4697e25e4..fdcf2ca5b 100644
--- a/src/com/android/launcher3/views/ButtonPreference.java
+++ b/src/com/android/launcher3/views/ButtonPreference.java
@@ -28,7 +28,7 @@ import android.view.ViewGroup;
*/
public class ButtonPreference extends Preference {
- private View.OnClickListener mClickListener;
+ private boolean mWidgetFrameVisible = false;
public ButtonPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
@@ -46,9 +46,9 @@ public class ButtonPreference extends Preference {
super(context);
}
- public void setButtonOnClickListener(View.OnClickListener clickListener) {
- if (mClickListener != clickListener) {
- mClickListener = clickListener;
+ public void setWidgetFrameVisible(boolean isVisible) {
+ if (mWidgetFrameVisible != isVisible) {
+ mWidgetFrameVisible = isVisible;
notifyChanged();
}
}
@@ -59,12 +59,7 @@ public class ButtonPreference extends Preference {
ViewGroup widgetFrame = view.findViewById(android.R.id.widget_frame);
if (widgetFrame != null) {
- View button = widgetFrame.getChildAt(0);
- if (button != null) {
- button.setOnClickListener(mClickListener);
- }
- widgetFrame.setVisibility(
- (mClickListener == null || button == null) ? View.GONE : View.VISIBLE);
+ widgetFrame.setVisibility(mWidgetFrameVisible ? View.VISIBLE : View.GONE);
}
}
}