From fa73ac6d85504bffffd38bd478269f268fcfd4fc Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 17 Apr 2017 13:22:14 -0400 Subject: [PATCH] working build --- .../swiperecyclerview/items/CheckBoxItem.java | 24 ++----------------- .../swiperecyclerview/items/PairItem.java | 16 +++---------- .../capsule_srv_fastitem_checkbox.xml | 14 +++++------ .../layout/capsule_srv_fastitem_checkbox.xml | 14 +++++------ .../res/layout/capsule_srv_fastitem_pair.xml | 4 ++-- capsule/src/main/res/values/dimens.xml | 6 ++--- docs/Changelog.md | 2 ++ 7 files changed, 26 insertions(+), 54 deletions(-) diff --git a/capsule/src/main/java/ca/allanwang/capsule/library/swiperecyclerview/items/CheckBoxItem.java b/capsule/src/main/java/ca/allanwang/capsule/library/swiperecyclerview/items/CheckBoxItem.java index 21864d8..1795552 100644 --- a/capsule/src/main/java/ca/allanwang/capsule/library/swiperecyclerview/items/CheckBoxItem.java +++ b/capsule/src/main/java/ca/allanwang/capsule/library/swiperecyclerview/items/CheckBoxItem.java @@ -10,7 +10,6 @@ import com.mikepenz.fastadapter.FastAdapter; import com.mikepenz.fastadapter.items.AbstractItem; import com.mikepenz.fastadapter.listeners.ClickEventHook; -import com.mikepenz.fastadapter.utils.ViewHolderFactory; import com.mikepenz.materialize.holder.StringHolder; import java.util.List; @@ -22,8 +21,6 @@ */ public class CheckBoxItem extends AbstractItem { - //the static ViewHolderFactory which will be used to generate the ViewHolder for this Item - private static final ViewHolderFactory FACTORY = new ItemFactory(); public String header; public StringHolder name; @@ -79,28 +76,11 @@ public void unbindView(ViewHolder holder) { holder.description.setText(null); } - /** - * our ItemFactory implementation which creates the ViewHolder for our adapter. - * It is highly recommended to implement a ViewHolderFactory as it is 0-1ms faster for ViewHolder creation, - * and it is also many many times more efficient if you define custom listeners on views within your item. - */ - protected static class ItemFactory implements ViewHolderFactory { - public ViewHolder create(View v) { - return new ViewHolder(v); - } - } - - /** - * return our ViewHolderFactory implementation here - * - * @return - */ @Override - public ViewHolderFactory getFactory() { - return FACTORY; + public ViewHolder getViewHolder(View v) { + return new ViewHolder(v); } - /** * our ViewHolder */ diff --git a/capsule/src/main/java/ca/allanwang/capsule/library/swiperecyclerview/items/PairItem.java b/capsule/src/main/java/ca/allanwang/capsule/library/swiperecyclerview/items/PairItem.java index 49f0a81..77feb92 100644 --- a/capsule/src/main/java/ca/allanwang/capsule/library/swiperecyclerview/items/PairItem.java +++ b/capsule/src/main/java/ca/allanwang/capsule/library/swiperecyclerview/items/PairItem.java @@ -7,7 +7,6 @@ import android.widget.TextView; import com.mikepenz.fastadapter.items.AbstractItem; -import com.mikepenz.fastadapter.utils.ViewHolderFactory; import java.util.List; @@ -19,7 +18,6 @@ public class PairItem extends AbstractItem { - private static final ViewHolderFactory FACTORY = new PairItem.ItemFactory(); private String left, right; public PairItem(String left, String right) { @@ -58,8 +56,9 @@ public void unbindView(PairItem.ViewHolder holder) { holder.itemView.setBackgroundColor(0x00000000); } - public ViewHolderFactory getFactory() { - return FACTORY; + @Override + public ViewHolder getViewHolder(View v) { + return new ViewHolder(v); } public static class ViewHolder extends RecyclerView.ViewHolder { @@ -72,13 +71,4 @@ public ViewHolder(View view) { right = (TextView) view.findViewById(R.id.text_right); } } - - protected static class ItemFactory implements ViewHolderFactory { - protected ItemFactory() { - } - - public PairItem.ViewHolder create(View v) { - return new PairItem.ViewHolder(v); - } - } } diff --git a/capsule/src/main/res/layout-v16/capsule_srv_fastitem_checkbox.xml b/capsule/src/main/res/layout-v16/capsule_srv_fastitem_checkbox.xml index 04a758b..7745311 100644 --- a/capsule/src/main/res/layout-v16/capsule_srv_fastitem_checkbox.xml +++ b/capsule/src/main/res/layout-v16/capsule_srv_fastitem_checkbox.xml @@ -1,7 +1,7 @@ + android:layout_height="@dimen/capsule_srv_primary"> + android:paddingEnd="@dimen/capsule_srv_vertical_padding" + android:paddingLeft="@dimen/capsule_srv_vertical_padding" + android:paddingRight="@dimen/capsule_srv_vertical_padding" + android:paddingStart="@dimen/capsule_srv_vertical_padding"> + android:textSize="@dimen/capsule_srv_primary_text" /> + android:textSize="@dimen/capsule_srv_primary_text" /> \ No newline at end of file diff --git a/capsule/src/main/res/layout/capsule_srv_fastitem_checkbox.xml b/capsule/src/main/res/layout/capsule_srv_fastitem_checkbox.xml index a48aba3..be7c8ee 100644 --- a/capsule/src/main/res/layout/capsule_srv_fastitem_checkbox.xml +++ b/capsule/src/main/res/layout/capsule_srv_fastitem_checkbox.xml @@ -1,7 +1,7 @@ + android:layout_height="@dimen/capsule_srv_primary"> + android:paddingEnd="@dimen/capsule_srv_vertical_padding" + android:paddingLeft="@dimen/capsule_srv_vertical_padding" + android:paddingRight="@dimen/capsule_srv_vertical_padding" + android:paddingStart="@dimen/capsule_srv_vertical_padding"> + android:textSize="@dimen/capsule_srv_primary_text" /> + android:textSize="@dimen/capsule_srv_primary_text" /> \ No newline at end of file diff --git a/capsule/src/main/res/layout/capsule_srv_fastitem_pair.xml b/capsule/src/main/res/layout/capsule_srv_fastitem_pair.xml index 4dc18f3..918fb4b 100644 --- a/capsule/src/main/res/layout/capsule_srv_fastitem_pair.xml +++ b/capsule/src/main/res/layout/capsule_srv_fastitem_pair.xml @@ -3,8 +3,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:paddingBottom="@dimen/srv_vertical_padding" - android:paddingTop="@dimen/srv_vertical_padding"> + android:paddingBottom="@dimen/capsule_srv_vertical_padding" + android:paddingTop="@dimen/capsule_srv_vertical_padding"> 16dp 16dp - 16dp - 14sp - 48dp + 16dp + 14sp + 48dp diff --git a/docs/Changelog.md b/docs/Changelog.md index 64cbdaf..a54dd22 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -9,6 +9,8 @@ * Add titleId to ViewPagerFragment * Add page limit abstract in ViewPagerFragment * Add TabClickEvent posting +* Add Appbar collapse listener +* Fully port SRV into Capsule ## v4.2 * Code cleanup