|
@@ -17,14 +17,19 @@ import com.xplora.xplauncher.model.ContactModel;
|
|
|
import com.xplora.xplauncher.model.RecentModel;
|
|
|
import com.xplora.xplauncher.utils.Constant;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
public class ContactsPager extends BasePager {
|
|
|
private ContactsRecyclerAdapter mRecyclerAdapter;
|
|
|
+ private List<ContactModel> mRecentList = new ArrayList<>();
|
|
|
+ private List<ContactModel> mContactsList = new ArrayList<>();
|
|
|
|
|
|
- public ContactsPager(Context context, List<RecentModel> recentList, List<ContactModel> contactsList, ContactsRecyclerAdapter.ContactItemOnClickListener listener) {
|
|
|
+ public ContactsPager(Context context, List<ContactModel> recentList, List<ContactModel> contactsList, ContactsRecyclerAdapter.ContactItemOnClickListener listener) {
|
|
|
super(context);
|
|
|
+ mRecentList = recentList;
|
|
|
+ mContactsList = contactsList;
|
|
|
|
|
|
mBaseView = LayoutInflater.from(mContext).inflate(R.layout.view_screen_contacts, null);
|
|
|
RecyclerView mRecyclerView = (RecyclerView)mBaseView.findViewById(R.id.recyclerView);
|
|
@@ -35,7 +40,7 @@ public class ContactsPager extends BasePager {
|
|
|
mRecyclerView.setHasFixedSize(true);
|
|
|
mRecyclerView.setLayoutManager(mLayoutManager);
|
|
|
|
|
|
- mRecyclerAdapter = new ContactsRecyclerAdapter(mContext, 0, recentList, contactsList);
|
|
|
+ mRecyclerAdapter = new ContactsRecyclerAdapter(mContext, 0, recentList);
|
|
|
mRecyclerAdapter.setListOnClickListener(listener);
|
|
|
mRecyclerView.setAdapter(mRecyclerAdapter);
|
|
|
|
|
@@ -43,20 +48,22 @@ public class ContactsPager extends BasePager {
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- //((GridLayoutManager) mLayoutManager).setSpanCount(1);
|
|
|
+ ((GridLayoutManager) mLayoutManager).setSpanCount(1);
|
|
|
+ ((GridLayoutManager) mLayoutManager).onItemsChanged(mRecyclerView);
|
|
|
mRecyclerAdapter.setViewType(0);
|
|
|
- //mRecyclerAdapter.notifyDataSetChanged();
|
|
|
- mRecyclerAdapter.notifyAll();
|
|
|
+ mRecyclerAdapter.setDataList(mRecentList);
|
|
|
+ mRecyclerAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
mContactButton.setOnClickListener(new View.OnClickListener() {
|
|
|
@SuppressLint("NotifyDataSetChanged")
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- //((GridLayoutManager) mLayoutManager).setSpanCount(2);
|
|
|
+ ((GridLayoutManager) mLayoutManager).setSpanCount(2);
|
|
|
+ ((GridLayoutManager) mLayoutManager).onItemsChanged(mRecyclerView);
|
|
|
mRecyclerAdapter.setViewType(1);
|
|
|
- //mRecyclerAdapter.notifyDataSetChanged();
|
|
|
- mRecyclerAdapter.notifyAll();
|
|
|
+ mRecyclerAdapter.setDataList(mContactsList);
|
|
|
+ mRecyclerAdapter.notifyDataSetChanged();
|
|
|
}
|
|
|
});
|
|
|
}
|