/*
 * Copyright (c) 2015 Ha Duy Trung
 *
 * 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 io.github.hidroh.materialistic.preference;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.PreferenceGroup;
import android.util.AttributeSet;

import io.github.hidroh.materialistic.R;

public class PreferenceHelp extends PreferenceGroup {
    private final int mLayoutResId;
    private final String mTitle;

    public PreferenceHelp(Context context, AttributeSet attrs) {
        super(context, attrs, R.attr.preferenceHelpStyle);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PreferenceHelp);
        try {
            mLayoutResId = a.getResourceId(R.styleable.PreferenceHelp_dialogLayout, 0);
            mTitle = a.getString(R.styleable.PreferenceHelp_dialogTitle);
        } finally {
            a.recycle();
        }
    }

    @Override
    protected void onClick() {
        if (mLayoutResId == 0) {
            return;
        }
        new AlertDialog.Builder(getContext())
                .setTitle(mTitle)
                .setView(mLayoutResId)
                .setPositiveButton(R.string.got_it, null)
                .create()
                .show();
    }
}

@@ -814,16 +814,75 @@
 eGroup;%0A
+import android.support.v7.preference.PreferenceViewHolder;%0A
 import a
@@ -1867,11 +1867,182 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public void onBindViewHolder(PreferenceViewHolder holder) %7B%0A        super.onBindViewHolder(holder);%0A        holder.setDividerAllowedAbove(false);%0A    %7D
 %0A%7D%0A

Remove extra divider from preference help