Mercurial > gmapzoominvert
diff XposedLibrary/src/de/robv/android/xposed/library/ui/SeparatorPreference.java @ 0:3da8a7a621cd
Initial commit
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Mon, 20 Jan 2014 22:56:13 -0600 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/XposedLibrary/src/de/robv/android/xposed/library/ui/SeparatorPreference.java Mon Jan 20 22:56:13 2014 -0600 @@ -0,0 +1,49 @@ +package de.robv.android.xposed.library.ui; + +import android.content.Context; +import android.graphics.Color; +import android.preference.Preference; +import android.util.AttributeSet; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewGroup.LayoutParams; +import android.widget.AbsListView; +import android.widget.ImageView; + +public class SeparatorPreference extends Preference { + int color = Color.GRAY; + int height = 7; + + public SeparatorPreference(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + setSelectable(false); + + if (attrs != null) { + height = attrs.getAttributeIntValue(null, "height", height); + } + } + + public SeparatorPreference(Context context, AttributeSet attrs) { + this(context, attrs, android.R.attr.preferenceStyle); + } + + public SeparatorPreference(Context context) { + this(context, null); + } + + public void setColor(int color) { + this.color = color; + } + + public void setHeight(int height) { + this.height = height; + } + + @Override + protected View onCreateView(ViewGroup parent) { + ImageView iview = new ImageView(getContext()); + iview.setBackgroundColor(color); + iview.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, height)); + return iview; + } +} \ No newline at end of file