Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1403)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java

Issue 2748793003: [Payments] Remove toggle of Android payment apps in settings (Closed)
Patch Set: keep the text Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
index 8117be6cabf5e8039df6fcad1a72965017c5c7c8..087eba3aeb5bfde82c9b6ab39e566bc820c2e08a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
@@ -6,9 +6,6 @@ package org.chromium.chrome.browser.preferences;
import android.content.Context;
import android.content.res.TypedArray;
-import android.graphics.Rect;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.LayerDrawable;
import android.preference.SwitchPreference;
import android.support.v7.widget.SwitchCompat;
import android.text.TextUtils;
@@ -17,6 +14,7 @@ import android.view.View;
import android.widget.TextView;
import org.chromium.chrome.R;
+import org.chromium.ui.HorizontalListDividerDrawable;
/**
* A super-powered SwitchPreference designed especially for Chrome. Special features:
@@ -71,7 +69,7 @@ public class ChromeSwitchPreference extends SwitchPreference {
int right = view.getPaddingRight();
int top = view.getPaddingTop();
int bottom = view.getPaddingBottom();
- view.setBackground(DividerDrawable.create(getContext()));
+ view.setBackground(HorizontalListDividerDrawable.create(getContext()));
view.setPadding(left, top, right, bottom);
}
@@ -100,31 +98,4 @@ public class ChromeSwitchPreference extends SwitchPreference {
if (mManagedPrefDelegate != null && mManagedPrefDelegate.onClickPreference(this)) return;
super.onClick();
}
-
- /**
- * Draws a horizontal list divider line at the bottom of its drawing area.
- *
- * Because ?android:attr/listDivider may be a 9-patch, there's no way to achieve this drawing
- * effect with the platform Drawable classes; hence this custom Drawable.
- */
- private static class DividerDrawable extends LayerDrawable {
-
- static DividerDrawable create(Context context) {
- TypedArray a = context.obtainStyledAttributes(new int[] { android.R.attr.listDivider });
- Drawable listDivider = a.getDrawable(0);
- a.recycle();
- return new DividerDrawable(new Drawable[] { listDivider });
- }
-
- private DividerDrawable(Drawable[] layers) {
- super(layers);
- }
-
- @Override
- protected void onBoundsChange(Rect bounds) {
- int listDividerHeight = getDrawable(0).getIntrinsicHeight();
- setLayerInset(0, 0, bounds.height() - listDividerHeight, 0, 0);
- super.onBoundsChange(bounds);
- }
- }
}

Powered by Google App Engine
This is Rietveld 408576698