Skip to content

Commit

Permalink
Fix: Add test case in RecyclerView(with a button frame)
Browse files Browse the repository at this point in the history
  • Loading branch information
whilu committed Jul 10, 2016
1 parent b3095e8 commit 1772eff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 4 additions & 1 deletion sample/src/main/java/co/lujun/sample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public TagViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
@Override
public void onBindViewHolder(TagViewHolder holder, int position) {
holder.tagContainerLayout.setTags(mData);
holder.button.setOnClickListener(mOnClickListener);
}

public void setOnClickListener(View.OnClickListener listener){
Expand All @@ -183,12 +184,14 @@ class TagViewHolder extends RecyclerView.ViewHolder implements View.OnClickListe

TagContainerLayout tagContainerLayout;
View.OnClickListener clickListener;
Button button;

public TagViewHolder(View v, View.OnClickListener listener){
super(v);
this.clickListener = listener;
tagContainerLayout = (TagContainerLayout) v.findViewById(R.id.tagcontainerLayout);
v.setOnClickListener(this);
button = (Button) v.findViewById(R.id.button);
// v.setOnClickListener(this);
}

@Override
Expand Down
16 changes: 11 additions & 5 deletions sample/src/main/res/layout/view_recyclerview_item.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_marginTop="20dp"
android:layout_height="60dp">

<co.lujun.androidtagview.TagContainerLayout
android:id="@+id/tagcontainerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_height="match_parent"
android:padding="10dp"
app:container_enable_drag="true"
app:horizontal_interval="10dp"
app:tag_clickable="true"
app:tag_theme="pure_teal"
app:vertical_interval="10dp" />
</LinearLayout>

<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"/>
</RelativeLayout>

0 comments on commit 1772eff

Please sign in to comment.