This repository was archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
447 additions
and
392 deletions.
There are no files selected for viewing
83 changes: 48 additions & 35 deletions
83
XposedLibrary/src/de/robv/android/xposed/library/ui/SeparatorPreference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,49 @@ | ||
package de.robv.android.xposed.library.ui; | ||
|
||
import android.content.Context; | ||
import android.graphics.Color; | ||
import android.preference.Preference; | ||
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) { | ||
super(context); | ||
setSelectable(false); | ||
} | ||
|
||
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; | ||
} | ||
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; | ||
} | ||
} |
89 changes: 60 additions & 29 deletions
89
XposedLibrary/src/de/robv/android/xposed/library/ui/TextViewPreference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,60 @@ | ||
package de.robv.android.xposed.library.ui; | ||
|
||
import android.content.Context; | ||
import android.preference.Preference; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
public class TextViewPreference extends Preference { | ||
private TextView textView = null; | ||
|
||
public TextViewPreference(Context context) { | ||
super(context); | ||
} | ||
|
||
@Override | ||
protected View onCreateView(ViewGroup parent) { | ||
return getTextView(); | ||
} | ||
|
||
public TextView getTextView() { | ||
if (textView == null) { | ||
textView = new TextView(getContext()); | ||
textView.setId(android.R.id.title); | ||
textView.setPadding(5,5,5,5); | ||
} | ||
return textView; | ||
} | ||
} | ||
package de.robv.android.xposed.library.ui; | ||
|
||
import android.content.Context; | ||
import android.graphics.Typeface; | ||
import android.preference.Preference; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
public class TextViewPreference extends Preference { | ||
private TextView textView = null; | ||
private int padding = 7; | ||
private int textSize = -1; | ||
private boolean bold = false; | ||
private boolean italic = false; | ||
|
||
public TextViewPreference(Context context, AttributeSet attrs, int defStyle) { | ||
super(context, attrs, defStyle); | ||
|
||
if (attrs != null) { | ||
textSize = attrs.getAttributeIntValue(null, "textSize", textSize); | ||
padding = attrs.getAttributeIntValue(null, "padding", padding); | ||
bold = attrs.getAttributeBooleanValue(null, "bold", bold); | ||
italic = attrs.getAttributeBooleanValue(null, "italic", italic); | ||
} | ||
} | ||
|
||
public TextViewPreference(Context context, AttributeSet attrs) { | ||
this(context, attrs, android.R.attr.preferenceStyle); | ||
} | ||
|
||
public TextViewPreference(Context context) { | ||
this(context, null); | ||
} | ||
|
||
@Override | ||
protected View onCreateView(ViewGroup parent) { | ||
return getTextView(); | ||
} | ||
|
||
public TextView getTextView() { | ||
if (textView == null) { | ||
textView = new TextView(getContext()); | ||
textView.setId(android.R.id.title); | ||
textView.setPadding(padding,padding,padding,padding); | ||
|
||
if (textSize > 0) | ||
textView.setTextSize(textSize); | ||
|
||
if (bold && italic) | ||
textView.setTypeface(null, Typeface.BOLD_ITALIC); | ||
else if (bold) | ||
textView.setTypeface(null, Typeface.BOLD); | ||
else if (italic) | ||
textView.setTypeface(null, Typeface.ITALIC); | ||
} | ||
return textView; | ||
} | ||
} |
Oops, something went wrong.