package me.ingeni.smartviewpager;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

/**
 * Created by jinseongho on 2016. 7. 18..
 */

public class SmartViewPager extends LinearLayout {

    private ViewPager viewPager;
    private LinearLayout indicatorlayout;

    public SmartViewPager(Context context) {
        super(context);
        initView();
    }

    public SmartViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView();
        getAttrs(attrs);
    }

    public SmartViewPager(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs);
        initView();
        getAttrs(attrs, defStyle);
    }

    public void initView() {
        LayoutInflater mInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View v = mInflater.inflate(R.layout.layout_smart_viewpager, this, false);
        viewPager = (ViewPager) v.findViewById(R.id.smart_view_pager);
        indicatorlayout = (LinearLayout) v.findViewById(R.id.indicator_layout);
        addView(v);
    }

    private void getAttrs(AttributeSet attrs) {
        TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.SmartViewPager);

        setTypeArray(typedArray);
    }


    private void getAttrs(AttributeSet attrs, int defStyle) {
        TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.SmartViewPager, defStyle, 0);
        setTypeArray(typedArray);
    }

    private void setTypeArray(TypedArray typedArray) {
        typedArray.recycle();
    }

}

@@ -99,16 +99,47 @@
 dArray;%0A
+import android.graphics.Color;%0A
 import a
@@ -1457,17 +1457,16 @@
 Pager);%0A
-%0A
         
@@ -1773,16 +1773,173 @@
 Array) %7B
+%0A%0A        int bg_resID = typedArray.getResourceId(R.styleable.SmartViewPager_bg, Color.TRANSPARENT);%0A        indicatorlayout.setBackgroundResource(bg_resID);
 %0A       

Modify setTypeArray