Mercurial > gmapzoominvert
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3da8a7a621cd |
---|---|
1 package de.robv.android.xposed.library.ui; | |
2 | |
3 import android.content.Context; | |
4 import android.graphics.Color; | |
5 import android.preference.Preference; | |
6 import android.util.AttributeSet; | |
7 import android.view.View; | |
8 import android.view.ViewGroup; | |
9 import android.view.ViewGroup.LayoutParams; | |
10 import android.widget.AbsListView; | |
11 import android.widget.ImageView; | |
12 | |
13 public class SeparatorPreference extends Preference { | |
14 int color = Color.GRAY; | |
15 int height = 7; | |
16 | |
17 public SeparatorPreference(Context context, AttributeSet attrs, int defStyle) { | |
18 super(context, attrs, defStyle); | |
19 setSelectable(false); | |
20 | |
21 if (attrs != null) { | |
22 height = attrs.getAttributeIntValue(null, "height", height); | |
23 } | |
24 } | |
25 | |
26 public SeparatorPreference(Context context, AttributeSet attrs) { | |
27 this(context, attrs, android.R.attr.preferenceStyle); | |
28 } | |
29 | |
30 public SeparatorPreference(Context context) { | |
31 this(context, null); | |
32 } | |
33 | |
34 public void setColor(int color) { | |
35 this.color = color; | |
36 } | |
37 | |
38 public void setHeight(int height) { | |
39 this.height = height; | |
40 } | |
41 | |
42 @Override | |
43 protected View onCreateView(ViewGroup parent) { | |
44 ImageView iview = new ImageView(getContext()); | |
45 iview.setBackgroundColor(color); | |
46 iview.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.MATCH_PARENT, height)); | |
47 return iview; | |
48 } | |
49 } |