// Path: example/src/main/java/com/github/captain_miao/android/bluetoothletutorial/app/AppLog.java
// public class AppLog {
//     private static boolean isPrintLog = true;
// 
//    	private AppLog() {}
// 
//    	public static boolean isPrintLog() {
//    		return isPrintLog;
//    	}
// 
//    	public static void setPrintLog(boolean isPrintLog) {
//         AppLog.isPrintLog = isPrintLog;
//    	}
// 
//    	public static void v(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.v(tag, msg);
//    		}
//    	}
// 
//    	public static void d(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.d(tag, msg);
//    		}
//    	}
// 
//    	public static void i(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.i(tag, msg);
//    		}
//    	}
// 
//    	public static void w(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.w(tag, msg);
//    		}
//    	}
// 
//    	public static void e(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.e(tag, msg);
//    		}
//    	}
// }


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bignerdranch.expandablerecyclerview.Model.ParentListItem;
import com.github.captain_miao.android.bluetoothletutorial.R;
import com.github.captain_miao.android.bluetoothletutorial.app.AppLog;
import java.util.List;
package com.github.captain_miao.android.bluetoothletutorial.expandablerecyclerview;




/**
 * An example custom implementation of the ExpandableRecyclerAdapter.
 *
 * @author YanLu
 * @version 1.0
 * @since 19/9/2015
 */
public abstract class VerticalExpandableAdapter extends ExpandableRecyclerAdapter2<VerticalParentViewHolder, VerticalChildViewHolder> {
    private static final String TAG = VerticalExpandableAdapter.class.getSimpleName();
    private LayoutInflater mInflater;

    protected abstract void onClickCharacteristic(String serviceUUID, String characteristicUUID);
    /**
     * Public primary constructor.
     *
     * @param context for inflating views
     * @param parentItemList the list of parent items to be displayed in the RecyclerView
     */
    public VerticalExpandableAdapter(Context context, List<ParentListItem> parentItemList) {
        super(context, parentItemList);
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public void onListItemExpanded(int position) {

    }

    @Override
    public void onListItemCollapsed(int position) {

    }

    /**
     * OnCreateViewHolder implementation for parent items. The desired ParentViewHolder should
     * be inflated here
     *
     * @param parent for inflating the View
     * @return the user's custom parent ViewHolder that must extend ParentViewHolder
     */
    @Override
    public VerticalParentViewHolder onCreateParentViewHolder(ViewGroup parent) {
        View view = mInflater.inflate(R.layout.list_item_parent_vertical, parent, false);
        return new VerticalParentViewHolder(view);
    }

    /**
     * OnCreateViewHolder implementation for child items. The desired ChildViewHolder should
     * be inflated here
     *
     * @param parent for inflating the View
     * @return the user's custom parent ViewHolder that must extend ParentViewHolder
     */
    @Override
    public VerticalChildViewHolder onCreateChildViewHolder(ViewGroup parent) {
        View view = mInflater.inflate(R.layout.list_item_child_vertical, parent, false);
        return new VerticalChildViewHolder(view) {
            @Override
            void onClickChildView(int position) {
                int parentPositon = position - getExpandedItemCount2(position);
                //int childPositon = getExpandedItemCount(parentPositon);

                Object parentItem = getParentItem(parentPositon);
                Object helperItem = getHelperItem(position);
                if(helperItem instanceof VerticalChildObject && parentItem instanceof VerticalParentObject){
// Path: example/src/main/java/com/github/captain_miao/android/bluetoothletutorial/app/AppLog.java
// public class AppLog {
//     private static boolean isPrintLog = true;
// 
//    	private AppLog() {}
// 
//    	public static boolean isPrintLog() {
//    		return isPrintLog;
//    	}
// 
//    	public static void setPrintLog(boolean isPrintLog) {
//         AppLog.isPrintLog = isPrintLog;
//    	}
// 
//    	public static void v(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.v(tag, msg);
//    		}
//    	}
// 
//    	public static void d(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.d(tag, msg);
//    		}
//    	}
// 
//    	public static void i(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.i(tag, msg);
//    		}
//    	}
// 
//    	public static void w(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.w(tag, msg);
//    		}
//    	}
// 
//    	public static void e(String tag, String msg) {
//    		if (isPrintLog) {
//    			Log.e(tag, msg);
//    		}
//    	}
// }


// Path: example/src/main/java/com/github/captain_miao/android/bluetoothletutorial/expandablerecyclerview/VerticalExpandableAdapter.java
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bignerdranch.expandablerecyclerview.Model.ParentListItem;
import com.github.captain_miao.android.bluetoothletutorial.R;
import com.github.captain_miao.android.bluetoothletutorial.app.AppLog;
import java.util.List;

package com.github.captain_miao.android.bluetoothletutorial.expandablerecyclerview;




/**
 * An example custom implementation of the ExpandableRecyclerAdapter.
 *
 * @author YanLu
 * @version 1.0
 * @since 19/9/2015
 */
public abstract class VerticalExpandableAdapter extends ExpandableRecyclerAdapter2<VerticalParentViewHolder, VerticalChildViewHolder> {
    private static final String TAG = VerticalExpandableAdapter.class.getSimpleName();
    private LayoutInflater mInflater;

    protected abstract void onClickCharacteristic(String serviceUUID, String characteristicUUID);
    /**
     * Public primary constructor.
     *
     * @param context for inflating views
     * @param parentItemList the list of parent items to be displayed in the RecyclerView
     */
    public VerticalExpandableAdapter(Context context, List<ParentListItem> parentItemList) {
        super(context, parentItemList);
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public void onListItemExpanded(int position) {

    }

    @Override
    public void onListItemCollapsed(int position) {

    }

    /**
     * OnCreateViewHolder implementation for parent items. The desired ParentViewHolder should
     * be inflated here
     *
     * @param parent for inflating the View
     * @return the user's custom parent ViewHolder that must extend ParentViewHolder
     */
    @Override
    public VerticalParentViewHolder onCreateParentViewHolder(ViewGroup parent) {
        View view = mInflater.inflate(R.layout.list_item_parent_vertical, parent, false);
        return new VerticalParentViewHolder(view);
    }

    /**
     * OnCreateViewHolder implementation for child items. The desired ChildViewHolder should
     * be inflated here
     *
     * @param parent for inflating the View
     * @return the user's custom parent ViewHolder that must extend ParentViewHolder
     */
    @Override
    public VerticalChildViewHolder onCreateChildViewHolder(ViewGroup parent) {
        View view = mInflater.inflate(R.layout.list_item_child_vertical, parent, false);
        return new VerticalChildViewHolder(view) {
            @Override
            void onClickChildView(int position) {
                int parentPositon = position - getExpandedItemCount2(position);
                //int childPositon = getExpandedItemCount(parentPositon);

                Object parentItem = getParentItem(parentPositon);
                Object helperItem = getHelperItem(position);
                if(helperItem instanceof VerticalChildObject && parentItem instanceof VerticalParentObject){
                    AppLog.i(TAG, helperItem.toString());