diff options
author | Maurice Lam <yukl@google.com> | 2015-10-08 17:51:13 -0700 |
---|---|---|
committer | Maurice Lam <yukl@google.com> | 2015-10-08 18:41:25 -0700 |
commit | b922482e73fc63840d86b78898d0165ffcad1c72 (patch) | |
tree | dee437c337695ae5428f54137424534306a8b496 /library/main/src/com/android/setupwizardlib | |
parent | c5bf1cb9cb52f95f862eedb8d4f2c71c1ff1a79f (diff) | |
download | setupwizard-b922482e73fc63840d86b78898d0165ffcad1c72.tar.gz |
[SuwLib] Make Items editable
Add setters to the properties of items to make them editable.
Change-Id: I04ab8a0fd31f52e60a699198fe1422bed5163e61
Diffstat (limited to 'library/main/src/com/android/setupwizardlib')
-rw-r--r-- | library/main/src/com/android/setupwizardlib/items/Item.java | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/library/main/src/com/android/setupwizardlib/items/Item.java b/library/main/src/com/android/setupwizardlib/items/Item.java index d6af65d..3dcdfab 100644 --- a/library/main/src/com/android/setupwizardlib/items/Item.java +++ b/library/main/src/com/android/setupwizardlib/items/Item.java @@ -31,13 +31,17 @@ import com.android.setupwizardlib.R; */ public class Item { - private boolean mEnabled; + private boolean mEnabled = true; private Drawable mIcon; - private int mId; + private int mId = 0; private int mLayoutRes; private CharSequence mSummary; private CharSequence mTitle; + public Item() { + mLayoutRes = getDefaultLayoutResource(); + } + public Item(Context context, AttributeSet attrs) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SuwItem); mEnabled = a.getBoolean(R.styleable.SuwItem_android_enabled, true); @@ -54,26 +58,50 @@ public class Item { return R.layout.suw_items_text; } + public void setEnabled(boolean enabled) { + mEnabled = enabled; + } + public boolean isEnabled() { return mEnabled; } + public void setIcon(Drawable icon) { + mIcon = icon; + } + public Drawable getIcon() { return mIcon; } + public void setId(int id) { + mId = id; + } + public int getId() { return mId; } + public void setLayoutResource(int layoutResource) { + mLayoutRes = layoutResource; + } + public int getLayoutResource() { return mLayoutRes; } + public void setSummary(CharSequence summary) { + mSummary = summary; + } + public CharSequence getSummary() { return mSummary; } + public void setTitle(CharSequence title) { + mTitle = title; + } + public CharSequence getTitle() { return mTitle; } |