Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
classichu committed Mar 10, 2017
1 parent b749da5 commit 9e1f5ca
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.classichu.adapter.helper;

import android.content.Context;
import android.view.ViewGroup;

import com.classichu.adapter.widget.ClassicEmptyView;

/**
* Created by louisgeek on 2017/3/10.
*/

public class ClassicEmptyViewHelper {
public static ClassicEmptyView getClassicEmptyView(Context context, ClassicEmptyView.OnEmptyViewClickListener onEmptyViewClickListener) {
ClassicEmptyView classicEmptyView = new ClassicEmptyView(context);
classicEmptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
classicEmptyView.setOnEmptyViewClickListener(onEmptyViewClickListener);
return classicEmptyView;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType
} else if (footerView != null) {
return new ClassicRVHeaderFooterViewHolder(footerView);
} else if (viewType == VIEW_TYPE_EMPTY) {
mEmptyView.setVisibility(View.VISIBLE);
// empty 类型
return new ClassicRVHeaderFooterViewHolder(mEmptyView);
} else {
Expand Down
10 changes: 3 additions & 7 deletions app/src/main/java/com/classichu/classicadapter/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.widget.TextView;
import android.widget.Toast;

import com.classichu.adapter.helper.ClassicEmptyViewHelper;
import com.classichu.adapter.recyclerview.ClassicRVHeaderFooterAdapter;
import com.classichu.adapter.recyclerview.ClassicRecyclerViewAdapter;
import com.classichu.adapter.widget.ClassicEmptyView;
Expand Down Expand Up @@ -65,28 +66,23 @@ public boolean onItemLongClick(View itemView, int position) {

//ClassicEmptyView cev= (ClassicEmptyView) findViewById(R.id.id_cev);
//cev.setEmptyImage(null);

ClassicEmptyView classicEmptyView = new ClassicEmptyView(this);
classicEmptyView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
classicEmptyView.setOnEmptyViewClickListener(new ClassicEmptyView.OnEmptyViewClickListener() {
ClassicEmptyView classicEmptyView=ClassicEmptyViewHelper.getClassicEmptyView(this, new ClassicEmptyView.OnEmptyViewClickListener() {
@Override
public void onClickTextView(View view) {
super.onClickTextView(view);
Toast.makeText(MainActivity.this, "onClickTextView", Toast.LENGTH_SHORT).show();
}

@Override
public void onClickImageView(View view) {
super.onClickImageView(view);
Toast.makeText(MainActivity.this, "onClickImageView", Toast.LENGTH_SHORT).show();
}

@Override
public void onClickEmptyView(View view) {
super.onClickEmptyView(view);
Toast.makeText(MainActivity.this, "onClickEmptyView", Toast.LENGTH_SHORT).show();
}
});

//
//id_recycler_view.setVisibility(View.GONE);
///// mDatas.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import com.classichu.adapter.recyclerview.ClassicRVHeaderFooterAdapter;
import com.classichu.adapter.recyclerview.ClassicRVHeaderFooterViewHolder;
import com.classichu.adapter.recyclerview.ClassicRecyclerViewHolder;

import java.util.List;

Expand Down Expand Up @@ -41,8 +40,4 @@ public void findBindView(int realPosition, ClassicRVHeaderFooterViewHolder class
}


@Override
public void findBindView(int position, ClassicRecyclerViewHolder classicRecyclerViewHolder) {

}
}

0 comments on commit 9e1f5ca

Please sign in to comment.