support: ColorPicker: Disable dividers by default

Use provided attrs to enable if needed

Change-Id: Ib1e852a293b9e2a2365739de4ef893e35eeaa660
Signed-off-by: Anushek Prasal <anushekprasal@gmail.com>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 8d7665d..243d4e7 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -29,6 +29,8 @@
         <attr name="alphaSlider" format="boolean" />
         <attr name="showPreview" format="boolean" />
         <attr name="showReset" format="boolean" />
+        <attr name="dividerAbove" format="boolean" />
+        <attr name="dividerBelow" format="boolean" />
     </declare-styleable>
 
 </resources>
diff --git a/src/com/bliss/support/colorpicker/ColorPickerPreference.java b/src/com/bliss/support/colorpicker/ColorPickerPreference.java
index 2c63072..a2b97b5 100644
--- a/src/com/bliss/support/colorpicker/ColorPickerPreference.java
+++ b/src/com/bliss/support/colorpicker/ColorPickerPreference.java
@@ -61,6 +61,8 @@
     private boolean mShowLedPreview;
     private boolean mShowReset;
     private boolean mShowPreview;
+    private boolean mDividerAbove;
+    private boolean mDividerBelow;
     private EditText mEditText;
 
     //private boolean mIsCrappyLedDevice;
@@ -92,7 +94,7 @@
     @Override
     protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue) {
         // when using PreferenceDataStore, restorePersistedValue is always true (see Preference class for reference)
-        // so we load the persistent value with getPersistedInt if available in the data store, 
+        // so we load the persistent value with getPersistedInt if available in the data store,
         // and use defaultValue as fallback (onGetDefaultValue has been already called and it loaded the android:defaultValue attr from our xml).
         if (defaultValue == null) {
             // if we forgot to add android:defaultValue, default to black color
@@ -110,6 +112,8 @@
             mDefaultValue = attrs.getAttributeIntValue(ANDROIDNS, "defaultValue", Color.BLACK);
             mShowReset = attrs.getAttributeBooleanValue(SETTINGS_NS, "showReset", false);
             mShowPreview = attrs.getAttributeBooleanValue(SETTINGS_NS, "showPreview", true);
+            mDividerAbove = attrs.getAttributeBooleanValue(SETTINGS_NS, "dividerAbove", false);
+            mDividerBelow = attrs.getAttributeBooleanValue(SETTINGS_NS, "dividerBelow", false);
         }
     }
 
@@ -117,6 +121,8 @@
     public void onBindViewHolder(PreferenceViewHolder view) {
         mView = view;
         super.onBindViewHolder(view);
+        view.setDividerAllowedAbove(mDividerAbove);
+        view.setDividerAllowedBelow(mDividerBelow);
 
         view.itemView.setOnClickListener(new View.OnClickListener() {
             @Override