All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.holoeverywhere.widget.Divider Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version

package org.holoeverywhere.widget;

import org.holoeverywhere.R;
import org.holoeverywhere.internal._View;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;

public class Divider extends _View {
    public Divider(Context context) {
        super(context);
        init(context, null, 0);
    }

    public Divider(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs, 0);
    }

    public Divider(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context, attrs, defStyle);
    }

    protected void init(Context context, AttributeSet attrs, int defStyle) {
        TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.Divider, defStyle, 0);
        boolean vertical = a.getInt(R.styleable.Divider_android_orientation,
                android.widget.LinearLayout.VERTICAL) == android.widget.LinearLayout.VERTICAL;
        a.recycle();
        TypedValue value = new TypedValue();
        context.getTheme().resolveAttribute(
                vertical ? R.attr.dividerVertical : R.attr.dividerHorizontal,
                value, true);
        if (value.resourceId > 0) {
            setBackgroundResource(value.resourceId);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy