package com.android.car.dialer.ui.fragment.contact;
import static android.content.Context.INPUT_METHOD_SERVICE;
import android.bluetooth.BluetoothPbapClient;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.car.btcallsdk.utils.HandlerUtils;
import com.android.car.dialer.DialerApplication;
import com.android.car.dialer.R;
import com.android.car.dialer.adapter.ContactAdapter;
import com.android.car.dialer.adapter.ContactsDetailsAdapter;
import com.android.car.dialer.adapter.FavoriteContactAdapter;
import com.android.car.dialer.bean.Contacts;
import com.android.car.dialer.bean.ContactsBean;
import com.android.car.dialer.bean.FavoriteContactBean;
import com.android.car.dialer.common.CallBackManager;
import com.android.car.dialer.common.DownloadContactCallBack;
import com.android.car.dialer.common.HidePopupListener;
import com.android.car.dialer.common.IDataClearListener;
import com.android.car.dialer.database.BTCallDataBase;
import com.android.car.dialer.database.ContactsDao;
import com.android.car.dialer.fastscroll.FastScrollRecyclerView;
import com.android.car.dialer.log.L;
import com.android.car.dialer.mode.ContactsAndCallLogPBAPClientCallback;
import com.android.car.dialer.ui.TelecomActivity;
import com.android.car.dialer.util.BlueToothManager;
import com.android.car.dialer.util.BlueToothUtil;
import com.android.car.dialer.util.ConstantUtil;
import com.android.car.dialer.util.ContactsHelper;
import com.android.car.dialer.util.PinyinComparatorUtil;
import com.android.car.dialer.util.RecycleViewSpacesItemDecoration;
import com.android.car.dialer.util.ThreadPoolHelper;
import com.android.car.dialer.util.ViewUtil;
import com.android.car.dialer.viewmodel.ContactListViewModel;
import com.fawvw.cnsviews.dd.CursorDD;
import com.fawvw.cnsviews.dlg.GenericPopupDialog;
import com.fawvw.cnsviews.loading.LoadingView;
import com.fawvw.cnsviews.scrollbar.VerticalRecyclerViewScrollbar;
import com.fawvw.cnsviews.search.SearchView;
import com.fawvw.cnsviews.tab.TabLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author caoyifan
*/
public class ContactsFragment extends Fragment implements View.OnClickListener, ContactAdapter.ShowContactDetailsListener
, FavoriteContactAdapter.OnAddFavorListener, ContactsDetailsAdapter.ContactItemDetailsListener, DownloadContactCallBack, IDataClearListener
, HidePopupListener {
private static final String TAG = ConstantUtil.TAG_PREFIX + "ContactsFragment";
/**
* 收藏的tab位置
*/
private static final int FAVORITE_POSITION = 0;
/**
* 收藏的联系人显示列数
*/
private static final int FAVORITE_SPAN_COUNT = 3;
/**
* 展示收藏联系人页面
*/
private static final int VIEW_TYPE_FAVORITE = 0;
/**
* 展示全部联系人页面
*/
private static final int VIEW_TYPE_ALL = 1;
private View mView;
private int pageJump;
private ImageView mContactItemDetailIconAvatar, mContactItemDetailAvatar;
private TextView mDetailsName,mSearchNotContact;
private ImageView mCircleAvatarImageBg;
private RecyclerView mFavorContactRecycle, mContactsDetailRecycler;
private FastScrollRecyclerView mContactRecycle = null;
private SearchView mSearchInput;
private RelativeLayout mLayoutHeadPart, mDeleteEntry, mDeleteAll, mContactsSearch,mSearchBack,mDetailsReturn;
private FrameLayout mLayoutContentPart;
private ContactAdapter mContactAdapter;
private FavoriteContactAdapter mFavorContactAdapter;
private LinearLayout mContactsDetails;
private boolean isDelete = true;
private final List<ContactsBean> mDataList = new ArrayList<>();
private ContactListViewModel mContactListViewModel;
private PinyinComparatorUtil mPinyinComparatorUtil;
private ContactsDetailsAdapter mContactsDetailsAdapter;
private BluetoothPbapClient mBluetoothPBAPClient;
private ContactsDao mContactsDao;
public BTCallDataBase mBtCallDataBase;
private LoadingView mLoaderProgressBar;
private int mLoadMark;
private TelecomActivity mTelecomActivity;
private DialerApplication mDialerApplication;
private ItemTouchHelper mItemTouchHelper;
private TabLayout mContactTabLayout;
private ArrayList<TabLayout.TabData> contactsTabData = new ArrayList<>();
private int contactsTabPosition;
private RelativeLayout mContactsRelativeLayout;
private CursorDD mCursorDD;
private GenericPopupDialog.Builder mGenericPopupDialog;
private GenericPopupDialog mFavoriteContactBuild;
private boolean isClearContactsData = true;
public void setIsClearContactsData(boolean isClearContactsData) {
this.isClearContactsData = isClearContactsData;
}
// 空联系人
private GenericPopupDialog mEmptyContactDialog;
// PBAP client 未授权/无已连接设备
private GenericPopupDialog mPbapClientDisableDialog;
private Runnable mShowEmptyContactDialogRunnable = this::showEmptyContactDialog;
public void setContactsTabPosition(int contactsTabPosition) {
this.contactsTabPosition = contactsTabPosition;
}
public RelativeLayout getSearchBack() {
return mSearchBack;
}
public ContactsFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e(TAG, "onCreate: ");
// if (!EventBus.getDefault().isRegistered(this)) {
// EventBus.getDefault().register(this);
// }
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.e(TAG, "onCreateView: ");
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
mView = inflater.inflate(R.layout.fragment_contact, container, false);
initViewMode();
initView();
initTab();
return mView;
}
private Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
// 拼音搜索完成,更新UI
List<ContactsBean> filterDateList = (List<ContactsBean>) msg.obj;
mContactAdapter.notifyDataChanged(filterDateList);
break;
}
}
};
private void initTab() {
//联系人搜索输入监听
mSearchInput.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int
没有合适的资源?快使用搜索试试~ 我知道了~
快速滑动代码,具体描述见博客
共8个文件
java:6个
xml:1个
gradle:1个
需积分: 1 0 下载量 88 浏览量
2024-07-31
11:37:23
上传
评论
收藏 24KB ZIP 举报
温馨提示
https://blog.csdn.net/weixin_43080188/article/details/140145098?spm=1001.2014.3001.5501
资源推荐
资源详情
资源评论
收起资源包目录
快速滑动.zip (8个子文件)
快速滑动
build.gradle 5KB
fastscroll
Utils.java 2KB
FastScroller.java 17KB
OnFastScrollStateChangeListener.java 270B
FastScrollRecyclerView.java 23KB
FastScrollPopup.java 9KB
fragment_contact.xml 7KB
ContactsFragment.java 39KB
共 8 条
- 1
资源评论
星期九丶
- 粉丝: 30
- 资源: 16
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功