package com.android.infosessions;

import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckedTextView;
import android.widget.CursorAdapter;
import android.widget.TextView;

import com.android.infosessions.data.FilterContract.FilterEntry;

/**
 * Created by Thao on 5/16/17.
 */

public class FilterCursorAdapter extends CursorAdapter {

    public FilterCursorAdapter(Context context, Cursor c) {
        super(context, c, 0);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
        return LayoutInflater.from(context).inflate(R.layout.item_filter, viewGroup, false);

    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        String key = cursor.getString(cursor.getColumnIndexOrThrow(FilterEntry.COLUMN_FILTER_KEY));
        int value = cursor.getInt(cursor.getColumnIndexOrThrow(FilterEntry.COLUMN_FILTER_VALUE));

        TextView textView = (TextView) view.findViewById(R.id.general_division);
        CheckedTextView box = (CheckedTextView) view.findViewById(R.id.specific_division);
        box.setVisibility(View.VISIBLE);
        textView.setVisibility(View.GONE);
        box.setTag(cursor.getPosition());
        box.setText(key);
        if (value == FilterEntry.VALUE_CHECKED)
            box.setChecked(true);
        else
            box.setChecked(false);

    }
}

@@ -92,16 +92,98 @@
 Cursor;%0A
+import android.text.SpannableString;%0Aimport android.text.style.LeadingMarginSpan;%0A
 import a
@@ -1457,19 +1457,46 @@
 setText(
-key
+createIndentedText(key, 0, 50)
 );%0A     
@@ -1626,11 +1626,310 @@
 ;%0A%0A    %7D
+%0A%0A    static SpannableString createIndentedText(String text, int marginFirstLine, int marginNextLines) %7B%0A        SpannableString result=new SpannableString(text);%0A        result.setSpan(new LeadingMarginSpan.Standard(marginFirstLine, marginNextLines),0,text.length(),0);%0A        return result;%0A    %7D
 %0A%7D%0A

Indent second of filter text