Use SettingsLib's versions of Custom* classes.

Test: make RunSettingsRoboTests
Change-Id: I2584e820b72bb4672c53fd1a9f63c7f1662e0809
diff --git a/src/com/android/settings/BugreportPreference.java b/src/com/android/settings/BugreportPreference.java
index 7572d97..6371e3a 100644
--- a/src/com/android/settings/BugreportPreference.java
+++ b/src/com/android/settings/BugreportPreference.java
@@ -29,6 +29,7 @@
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.CustomDialogPreference;
 
 public class BugreportPreference extends CustomDialogPreference {
 
diff --git a/src/com/android/settings/CustomDialogPreference.java b/src/com/android/settings/CustomDialogPreference.java
deleted file mode 100644
index 383163f..0000000
--- a/src/com/android/settings/CustomDialogPreference.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2015 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;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.support.v14.preference.PreferenceDialogFragment;
-import android.support.v7.preference.DialogPreference;
-import android.util.AttributeSet;
-import android.view.View;
-
-public class CustomDialogPreference extends DialogPreference {
-
-    private CustomPreferenceDialogFragment mFragment;
-
-    public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr,
-            int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-    }
-
-    public CustomDialogPreference(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    public CustomDialogPreference(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public CustomDialogPreference(Context context) {
-        super(context);
-    }
-
-    public boolean isDialogOpen() {
-        return getDialog() != null && getDialog().isShowing();
-    }
-
-    public Dialog getDialog() {
-        return mFragment != null ? mFragment.getDialog() : null;
-    }
-
-    protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
-            DialogInterface.OnClickListener listener) {
-    }
-
-    protected void onDialogClosed(boolean positiveResult) {
-    }
-
-    protected void onClick(DialogInterface dialog, int which) {
-    }
-
-    protected void onBindDialogView(View view) {
-    }
-
-    private void setFragment(CustomPreferenceDialogFragment fragment) {
-        mFragment = fragment;
-    }
-
-    public static class CustomPreferenceDialogFragment extends PreferenceDialogFragment {
-
-        public static CustomPreferenceDialogFragment newInstance(String key) {
-            final CustomPreferenceDialogFragment fragment = new CustomPreferenceDialogFragment();
-            final Bundle b = new Bundle(1);
-            b.putString(ARG_KEY, key);
-            fragment.setArguments(b);
-            return fragment;
-        }
-
-        private CustomDialogPreference getCustomizablePreference() {
-            return (CustomDialogPreference) getPreference();
-        }
-
-        @Override
-        protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
-            super.onPrepareDialogBuilder(builder);
-            getCustomizablePreference().setFragment(this);
-            getCustomizablePreference().onPrepareDialogBuilder(builder, this);
-        }
-
-        @Override
-        public void onDialogClosed(boolean positiveResult) {
-            getCustomizablePreference().onDialogClosed(positiveResult);
-        }
-
-        @Override
-        protected void onBindDialogView(View view) {
-            super.onBindDialogView(view);
-            getCustomizablePreference().onBindDialogView(view);
-        }
-
-        @Override
-        public void onClick(DialogInterface dialog, int which) {
-            super.onClick(dialog, which);
-            getCustomizablePreference().onClick(dialog, which);
-        }
-    }
-}
diff --git a/src/com/android/settings/CustomEditTextPreference.java b/src/com/android/settings/CustomEditTextPreference.java
deleted file mode 100644
index 66c6932..0000000
--- a/src/com/android/settings/CustomEditTextPreference.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2015 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;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.os.Bundle;
-import android.support.v14.preference.EditTextPreferenceDialogFragment;
-import android.support.v7.preference.EditTextPreference;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.EditText;
-
-public class CustomEditTextPreference extends EditTextPreference {
-
-    private CustomPreferenceDialogFragment mFragment;
-
-    public CustomEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
-        super(context, attrs, defStyleAttr, defStyleRes);
-    }
-
-    public CustomEditTextPreference(Context context, AttributeSet attrs, int defStyleAttr) {
-        super(context, attrs, defStyleAttr);
-    }
-
-    public CustomEditTextPreference(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    public CustomEditTextPreference(Context context) {
-        super(context);
-    }
-
-    public EditText getEditText() {
-        return mFragment != null ? (EditText) mFragment.getDialog().findViewById(android.R.id.edit)
-                : null;
-    }
-
-    public boolean isDialogOpen() {
-        return getDialog() != null && getDialog().isShowing();
-    }
-
-    public Dialog getDialog() {
-        return mFragment != null ? mFragment.getDialog() : null;
-    }
-
-    protected void onPrepareDialogBuilder(AlertDialog.Builder builder,
-            DialogInterface.OnClickListener listener) {
-    }
-
-    protected void onDialogClosed(boolean positiveResult) {
-    }
-
-    protected void onClick(DialogInterface dialog, int which) {
-    }
-
-    protected void onBindDialogView(View view) {
-    }
-
-    private void setFragment(CustomPreferenceDialogFragment fragment) {
-        mFragment = fragment;
-    }
-
-    public static class CustomPreferenceDialogFragment extends EditTextPreferenceDialogFragment {
-
-        public static CustomPreferenceDialogFragment newInstance(String key) {
-            final CustomPreferenceDialogFragment fragment = new CustomPreferenceDialogFragment();
-            final Bundle b = new Bundle(1);
-            b.putString(ARG_KEY, key);
-            fragment.setArguments(b);
-            return fragment;
-        }
-
-        private CustomEditTextPreference getCustomizablePreference() {
-            return (CustomEditTextPreference) getPreference();
-        }
-
-        @Override
-        protected void onBindDialogView(View view) {
-            super.onBindDialogView(view);
-            getCustomizablePreference().onBindDialogView(view);
-        }
-
-        @Override
-        protected void onPrepareDialogBuilder(AlertDialog.Builder builder) {
-            super.onPrepareDialogBuilder(builder);
-            getCustomizablePreference().setFragment(this);
-            getCustomizablePreference().onPrepareDialogBuilder(builder, this);
-        }
-
-        @Override
-        public void onDialogClosed(boolean positiveResult) {
-            super.onDialogClosed(positiveResult);
-            getCustomizablePreference().onDialogClosed(positiveResult);
-        }
-
-        @Override
-        public void onClick(DialogInterface dialog, int which) {
-            super.onClick(dialog, which);
-            getCustomizablePreference().onClick(dialog, which);
-        }
-    }
-}
diff --git a/src/com/android/settings/EditPinPreference.java b/src/com/android/settings/EditPinPreference.java
index fdad0a1..3f992e9 100644
--- a/src/com/android/settings/EditPinPreference.java
+++ b/src/com/android/settings/EditPinPreference.java
@@ -23,6 +23,8 @@
 import android.view.View;
 import android.widget.EditText;
 
+import com.android.settingslib.CustomEditTextPreference;
+
 /**
  * TODO: Add a soft dialpad for PIN entry.
  */
diff --git a/src/com/android/settings/SeekBarDialogPreference.java b/src/com/android/settings/SeekBarDialogPreference.java
index a40df55..507c551 100644
--- a/src/com/android/settings/SeekBarDialogPreference.java
+++ b/src/com/android/settings/SeekBarDialogPreference.java
@@ -23,6 +23,8 @@
 import android.widget.ImageView;
 import android.widget.SeekBar;
 
+import com.android.settingslib.CustomDialogPreference;
+
 /**
  * Based on frameworks/base/core/java/android/preference/SeekBarDialogPreference.java
  * except uses support lib preferences.
diff --git a/src/com/android/settings/SelectableEditTextPreference.java b/src/com/android/settings/SelectableEditTextPreference.java
index f6237ec..551b5e5 100644
--- a/src/com/android/settings/SelectableEditTextPreference.java
+++ b/src/com/android/settings/SelectableEditTextPreference.java
@@ -22,6 +22,8 @@
 import android.view.View;
 import android.widget.EditText;
 
+import com.android.settingslib.CustomEditTextPreference;
+
 public class SelectableEditTextPreference extends CustomEditTextPreference {
 
     private int mSelectionMode;
diff --git a/src/com/android/settings/SettingsPreferenceFragment.java b/src/com/android/settings/SettingsPreferenceFragment.java
index 7319908..5f22545 100644
--- a/src/com/android/settings/SettingsPreferenceFragment.java
+++ b/src/com/android/settings/SettingsPreferenceFragment.java
@@ -49,6 +49,8 @@
 import com.android.settings.core.InstrumentedPreferenceFragment;
 import com.android.settings.core.instrumentation.Instrumentable;
 import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
+import com.android.settingslib.CustomDialogPreference;
+import com.android.settingslib.CustomEditTextPreference;
 import com.android.settingslib.HelpUtils;
 import com.android.settingslib.widget.FooterPreferenceMixin;
 
diff --git a/src/com/android/settings/accessibility/ListDialogPreference.java b/src/com/android/settings/accessibility/ListDialogPreference.java
index a67bf48..cfb77bb 100644
--- a/src/com/android/settings/accessibility/ListDialogPreference.java
+++ b/src/com/android/settings/accessibility/ListDialogPreference.java
@@ -31,7 +31,7 @@
 import android.widget.AdapterView;
 import android.widget.BaseAdapter;
 
-import com.android.settings.CustomDialogPreference;
+import com.android.settingslib.CustomDialogPreference;
 
 /**
  * Abstract dialog preference that displays a set of values and optional titles.
diff --git a/src/com/android/settings/datausage/CellDataPreference.java b/src/com/android/settings/datausage/CellDataPreference.java
index 77460ef..d24c092 100644
--- a/src/com/android/settings/datausage/CellDataPreference.java
+++ b/src/com/android/settings/datausage/CellDataPreference.java
@@ -36,10 +36,10 @@
 import android.widget.Checkable;
 
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-import com.android.settings.CustomDialogPreference;
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.CustomDialogPreference;
 
 import java.util.List;
 
diff --git a/src/com/android/settings/display/DensityPreference.java b/src/com/android/settings/display/DensityPreference.java
index fdd3fae..a62e6b5 100644
--- a/src/com/android/settings/display/DensityPreference.java
+++ b/src/com/android/settings/display/DensityPreference.java
@@ -25,8 +25,8 @@
 import android.view.View;
 import android.widget.EditText;
 
-import com.android.settings.CustomEditTextPreference;
 import com.android.settings.R;
+import com.android.settingslib.CustomEditTextPreference;
 import com.android.settingslib.display.DisplayDensityUtils;
 
 import java.text.NumberFormat;
diff --git a/src/com/android/settings/nfc/NfcPaymentPreference.java b/src/com/android/settings/nfc/NfcPaymentPreference.java
index 072d454..239377d 100644
--- a/src/com/android/settings/nfc/NfcPaymentPreference.java
+++ b/src/com/android/settings/nfc/NfcPaymentPreference.java
@@ -30,9 +30,9 @@
 import android.widget.ImageView;
 import android.widget.RadioButton;
 
-import com.android.settings.CustomDialogPreference;
 import com.android.settings.R;
 import com.android.settings.nfc.PaymentBackend.PaymentAppInfo;
+import com.android.settingslib.CustomDialogPreference;
 
 import java.util.List;
 
diff --git a/src/com/android/settings/widget/ValidatedEditTextPreference.java b/src/com/android/settings/widget/ValidatedEditTextPreference.java
index 53ff37a..76331d4 100644
--- a/src/com/android/settings/widget/ValidatedEditTextPreference.java
+++ b/src/com/android/settings/widget/ValidatedEditTextPreference.java
@@ -26,7 +26,7 @@
 import android.view.View;
 import android.widget.EditText;
 
-import com.android.settings.CustomEditTextPreference;
+import com.android.settingslib.CustomEditTextPreference;
 
 /**
  * {@code EditTextPreference} that supports input validation.