diff options
author | Maurice Lam <yukl@google.com> | 2015-12-14 11:11:57 -0800 |
---|---|---|
committer | Maurice Lam <yukl@google.com> | 2015-12-15 13:19:23 -0800 |
commit | 575ec4f0150a3607d0b6902a9b52866c170822f9 (patch) | |
tree | 9d93b32086b8cf97e0004372d9da1d92b0cba495 /library/main/src/com/android | |
parent | 0a51b2852ce9940075774191dce7b81ce91eb4a1 (diff) | |
download | setupwizard-575ec4f0150a3607d0b6902a9b52866c170822f9.tar.gz |
[SuwLib] Allow setting visibility of items
Added setVisible and android:visible to Item so that it will be
hidden if not visible.
Change-Id: If8d2e3ec95c2f1aaffe8991c283f5c474e1f459a
Diffstat (limited to 'library/main/src/com/android')
-rw-r--r-- | library/main/src/com/android/setupwizardlib/items/Item.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/library/main/src/com/android/setupwizardlib/items/Item.java b/library/main/src/com/android/setupwizardlib/items/Item.java index a33e68a..d03b990 100644 --- a/library/main/src/com/android/setupwizardlib/items/Item.java +++ b/library/main/src/com/android/setupwizardlib/items/Item.java @@ -37,6 +37,7 @@ public class Item extends AbstractItem { private int mLayoutRes; private CharSequence mSummary; private CharSequence mTitle; + private boolean mVisible = true; public Item() { super(); @@ -52,6 +53,7 @@ public class Item extends AbstractItem { mSummary = a.getText(R.styleable.SuwItem_android_summary); mLayoutRes = a.getResourceId(R.styleable.SuwItem_android_layout, getDefaultLayoutResource()); + mVisible = a.getBoolean(R.styleable.SuwItem_android_visible, true); a.recycle(); } @@ -64,6 +66,11 @@ public class Item extends AbstractItem { } @Override + public int getCount() { + return isVisible() ? 1 : 0; + } + + @Override public boolean isEnabled() { return mEnabled; } @@ -101,6 +108,14 @@ public class Item extends AbstractItem { return mTitle; } + public void setVisible(boolean visible) { + mVisible = visible; + } + + public boolean isVisible() { + return mVisible; + } + public int getViewId() { return getId(); } |