|
@@ -1,7 +1,10 @@
|
|
|
package com.xplora.xplauncher.view;
|
|
|
|
|
|
+import android.annotation.SuppressLint;
|
|
|
import android.content.Context;
|
|
|
import android.view.LayoutInflater;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
|
|
|
import androidx.recyclerview.widget.GridLayoutManager;
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
@@ -18,22 +21,43 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
public class ContactsPager extends BasePager {
|
|
|
-
|
|
|
private ContactsRecyclerAdapter mRecyclerAdapter;
|
|
|
|
|
|
public ContactsPager(Context context, List<RecentModel> recentList, List<ContactModel> contactsList, ContactsRecyclerAdapter.ContactItemOnClickListener listener) {
|
|
|
super(context);
|
|
|
|
|
|
mBaseView = LayoutInflater.from(mContext).inflate(R.layout.view_screen_contacts, null);
|
|
|
-
|
|
|
RecyclerView mRecyclerView = (RecyclerView)mBaseView.findViewById(R.id.recyclerView);
|
|
|
+ Button mRecentButton = (Button)mBaseView.findViewById(R.id.button_recent);
|
|
|
+ Button mContactButton = (Button)mBaseView.findViewById(R.id.button_contact);
|
|
|
|
|
|
RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(mContext, 1);
|
|
|
mRecyclerView.setHasFixedSize(true);
|
|
|
mRecyclerView.setLayoutManager(mLayoutManager);
|
|
|
|
|
|
- mRecyclerAdapter = new ContactsRecyclerAdapter(mContext, recentList, contactsList);
|
|
|
+ mRecyclerAdapter = new ContactsRecyclerAdapter(mContext, 0, recentList, contactsList);
|
|
|
mRecyclerAdapter.setListOnClickListener(listener);
|
|
|
mRecyclerView.setAdapter(mRecyclerAdapter);
|
|
|
+
|
|
|
+ mRecentButton.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @SuppressLint("NotifyDataSetChanged")
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ //((GridLayoutManager) mLayoutManager).setSpanCount(1);
|
|
|
+ mRecyclerAdapter.setViewType(0);
|
|
|
+ //mRecyclerAdapter.notifyDataSetChanged();
|
|
|
+ mRecyclerAdapter.notifyAll();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ mContactButton.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @SuppressLint("NotifyDataSetChanged")
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ //((GridLayoutManager) mLayoutManager).setSpanCount(2);
|
|
|
+ mRecyclerAdapter.setViewType(1);
|
|
|
+ //mRecyclerAdapter.notifyDataSetChanged();
|
|
|
+ mRecyclerAdapter.notifyAll();
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|