Skip to content

Commit

Permalink
working build
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanWang committed Apr 17, 2017
1 parent 8fe7b3f commit fa73ac6
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,8 +21,6 @@
*/

public class CheckBoxItem extends AbstractItem<CheckBoxItem, CheckBoxItem.ViewHolder> {
//the static ViewHolderFactory which will be used to generate the ViewHolder for this Item
private static final ViewHolderFactory<? extends ViewHolder> FACTORY = new ItemFactory();

public String header;
public StringHolder name;
Expand Down Expand Up @@ -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<ViewHolder> {
public ViewHolder create(View v) {
return new ViewHolder(v);
}
}

/**
* return our ViewHolderFactory implementation here
*
* @return
*/
@Override
public ViewHolderFactory<? extends ViewHolder> getFactory() {
return FACTORY;
public ViewHolder getViewHolder(View v) {
return new ViewHolder(v);
}


/**
* our ViewHolder
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import android.widget.TextView;

import com.mikepenz.fastadapter.items.AbstractItem;
import com.mikepenz.fastadapter.utils.ViewHolderFactory;

import java.util.List;

Expand All @@ -19,7 +18,6 @@

public class PairItem extends AbstractItem<PairItem, PairItem.ViewHolder> {

private static final ViewHolderFactory<? extends ViewHolder> FACTORY = new PairItem.ItemFactory();
private String left, right;

public PairItem(String left, String right) {
Expand Down Expand Up @@ -58,8 +56,9 @@ public void unbindView(PairItem.ViewHolder holder) {
holder.itemView.setBackgroundColor(0x00000000);
}

public ViewHolderFactory<? extends PairItem.ViewHolder> getFactory() {
return FACTORY;
@Override
public ViewHolder getViewHolder(View v) {
return new ViewHolder(v);
}

public static class ViewHolder extends RecyclerView.ViewHolder {
Expand All @@ -72,13 +71,4 @@ public ViewHolder(View view) {
right = (TextView) view.findViewById(R.id.text_right);
}
}

protected static class ItemFactory implements ViewHolderFactory<PairItem.ViewHolder> {
protected ItemFactory() {
}

public PairItem.ViewHolder create(View v) {
return new PairItem.ViewHolder(v);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/srv_primary">
android:layout_height="@dimen/capsule_srv_primary">

<CheckBox
android:id="@+id/checkbox"
Expand All @@ -20,10 +20,10 @@
android:layout_toStartOf="@+id/checkbox"
android:gravity="center_vertical|start"
android:orientation="vertical"
android:paddingEnd="@dimen/srv_vertical_padding"
android:paddingLeft="@dimen/srv_vertical_padding"
android:paddingRight="@dimen/srv_vertical_padding"
android:paddingStart="@dimen/srv_vertical_padding">
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">

<TextView
android:id="@+id/title"
Expand All @@ -32,7 +32,7 @@
android:fontFamily="sans-serif-medium"
android:gravity="center_vertical|start"
android:lines="1"
android:textSize="@dimen/srv_primary_text" />
android:textSize="@dimen/capsule_srv_primary_text" />

<TextView
android:id="@+id/description"
Expand All @@ -41,6 +41,6 @@
android:fontFamily="sans-serif"
android:gravity="center_vertical|start"
android:lines="1"
android:textSize="@dimen/srv_primary_text" />
android:textSize="@dimen/capsule_srv_primary_text" />
</LinearLayout>
</RelativeLayout>
14 changes: 7 additions & 7 deletions capsule/src/main/res/layout/capsule_srv_fastitem_checkbox.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/srv_primary">
android:layout_height="@dimen/capsule_srv_primary">

<CheckBox
android:id="@+id/checkbox"
Expand All @@ -20,25 +20,25 @@
android:layout_toStartOf="@+id/checkbox"
android:gravity="center_vertical|start"
android:orientation="vertical"
android:paddingEnd="@dimen/srv_vertical_padding"
android:paddingLeft="@dimen/srv_vertical_padding"
android:paddingRight="@dimen/srv_vertical_padding"
android:paddingStart="@dimen/srv_vertical_padding">
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">

<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|start"
android:lines="1"
android:textSize="@dimen/srv_primary_text" />
android:textSize="@dimen/capsule_srv_primary_text" />

<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|start"
android:lines="1"
android:textSize="@dimen/srv_primary_text" />
android:textSize="@dimen/capsule_srv_primary_text" />
</LinearLayout>
</RelativeLayout>
4 changes: 2 additions & 2 deletions capsule/src/main/res/layout/capsule_srv_fastitem_pair.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<Space
android:layout_width="0dp"
Expand Down
6 changes: 3 additions & 3 deletions capsule/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<dimen name="capsule_activity_horizontal_margin">16dp</dimen>
<dimen name="capsule_activity_vertical_margin">16dp</dimen>

<dimen name="srv_vertical_padding">16dp</dimen>
<dimen name="srv_primary_text">14sp</dimen>
<dimen name="srv_primary">48dp</dimen>
<dimen name="capsule_srv_vertical_padding">16dp</dimen>
<dimen name="capsule_srv_primary_text">14sp</dimen>
<dimen name="capsule_srv_primary">48dp</dimen>
</resources>
2 changes: 2 additions & 0 deletions docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fa73ac6

Please sign in to comment.