好运司机端2.0初始化
This commit is contained in:
parent
d4c300b19f
commit
434e59db97
@ -1,7 +1,9 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import android.content.Context
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
|
||||
@ -11,7 +13,19 @@ import com.dahe.glex.bean.WayBillBean
|
||||
* @Date 2024/1/24 14:40
|
||||
* @Description TODO
|
||||
*/
|
||||
class MessageAdapter: BaseQuickAdapter<WayBillBean, BaseViewHolder>(R.layout.item_message) {
|
||||
override fun convert(holder: BaseViewHolder, item: WayBillBean) {
|
||||
class MessageAdapter: BaseQuickAdapter<WayBillBean, QuickViewHolder>() {
|
||||
|
||||
|
||||
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: WayBillBean?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
context: Context,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): QuickViewHolder {
|
||||
// 返回一个 ViewHolder
|
||||
return QuickViewHolder(R.layout.item_message, parent)
|
||||
}
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
|
||||
@ -13,7 +15,17 @@ import com.dahe.glex.bean.WayBillBean
|
||||
* @Description TODO
|
||||
*/
|
||||
class WaybillAdapter :
|
||||
BaseQuickAdapter<WayBillBean, BaseViewHolder>(R.layout.item_waybill) {
|
||||
override fun convert(holder: BaseViewHolder, item: WayBillBean) {
|
||||
BaseQuickAdapter<WayBillBean, QuickViewHolder>() {
|
||||
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: WayBillBean?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
context: Context,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): QuickViewHolder {
|
||||
// 返回一个 ViewHolder
|
||||
return QuickViewHolder(R.layout.item_waybill, parent)
|
||||
}
|
||||
}
|
@ -1,7 +1,9 @@
|
||||
package com.dahe.gldriver.adapter
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder
|
||||
import android.content.Context
|
||||
import android.view.ViewGroup
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.chad.library.adapter4.viewholder.QuickViewHolder
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.glex.bean.WayBillBean
|
||||
|
||||
@ -12,7 +14,17 @@ import com.dahe.glex.bean.WayBillBean
|
||||
* @Description TODO
|
||||
*/
|
||||
class WaybillListAdapter() :
|
||||
BaseQuickAdapter<WayBillBean, BaseViewHolder>(R.layout.item_waybill) {
|
||||
override fun convert(holder: BaseViewHolder, item: WayBillBean) {
|
||||
BaseQuickAdapter<WayBillBean, QuickViewHolder>() {
|
||||
override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: WayBillBean?) {
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
context: Context,
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): QuickViewHolder {
|
||||
// 返回一个 ViewHolder
|
||||
return QuickViewHolder(R.layout.item_waybill, parent)
|
||||
}
|
||||
|
||||
}
|
@ -4,9 +4,7 @@ import android.graphics.Color
|
||||
import android.widget.LinearLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||
import com.chad.library.adapter.base.listener.OnItemChildClickListener
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener
|
||||
import com.chad.library.adapter4.BaseQuickAdapter
|
||||
import com.dahe.gldriver.R
|
||||
import com.dahe.gldriver.adapter.GridItemAdapter
|
||||
import com.dahe.gldriver.adapter.WaybillAdapter
|
||||
@ -86,15 +84,15 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(), RefreshCallBack {
|
||||
adapter = WaybillAdapter()
|
||||
adapter as WaybillAdapter
|
||||
}.apply {
|
||||
setOnItemClickListener(OnItemClickListener { adapter, view, position ->
|
||||
ToastUtils.showToast(mContext,position.toString())
|
||||
})
|
||||
addChildClickViewIds(R.id.btnOk)
|
||||
setOnItemChildClickListener() { adapter, view, position ->
|
||||
ActivityUtils.startActivity(mContext,WaybillDetailActivity::class.java)
|
||||
setOnItemClickListener { _, _, position ->
|
||||
ToastUtils.showToast(mContext, position.toString())
|
||||
}
|
||||
addOnItemChildClickListener(R.id.btnOk) { adapter, view, position ->
|
||||
ActivityUtils.startActivity(mContext, WaybillDetailActivity::class.java)
|
||||
}
|
||||
}
|
||||
adapter.addData(datas)
|
||||
|
||||
adapter.submitList(datas)
|
||||
}
|
||||
|
||||
}
|
@ -74,7 +74,7 @@ class MessageFragment : BaseFragment<FragmentMessageBinding>(), RefreshCallBack
|
||||
adapter as MessageAdapter
|
||||
}
|
||||
|
||||
adapter.addData(datas)
|
||||
adapter.submitList(datas)
|
||||
}
|
||||
|
||||
}
|
@ -38,6 +38,6 @@ class AllWaybillFragment : BaseFragment<FragmentWaybillListBinding>() {
|
||||
adapter = WaybillListAdapter()
|
||||
adapter as WaybillListAdapter
|
||||
}
|
||||
adapter.addData(datas)
|
||||
adapter.submitList(datas)
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ def OkHttpVersion = '4.11.0'
|
||||
def AutoSizeVersion = '1.1.2'
|
||||
def FlycoTabLayoutVersion = '3.0.0'
|
||||
def ZxingVersion = '1.3.8'
|
||||
def BaseRecyclerViewAdapterHelper = '3.0.14'
|
||||
def BaseRecyclerViewAdapterHelper = '4.1.4'
|
||||
def MagicIndicator = '1.7.0'
|
||||
def PickerView = '4.1.9'
|
||||
def Permissionx = '1.7.1'
|
||||
@ -27,8 +27,8 @@ def CheckVersionLib = '2.4.2'
|
||||
def BuglyVersion = 'latest.release'
|
||||
project.ext {
|
||||
android = [
|
||||
compileSdkVersion: 32,
|
||||
buildToolsVersion: "32",
|
||||
compileSdkVersion: 33,
|
||||
buildToolsVersion: "33",
|
||||
applicationId : "com.dahe.gldriver",
|
||||
minSdkVersion : 24,
|
||||
targetSdkVersion : 32,
|
||||
@ -63,7 +63,7 @@ project.ext {
|
||||
"FlycoTabLayout" : "io.github.h07000223:flycoTabLayout:${FlycoTabLayoutVersion}",
|
||||
"AndPermission" : "com.yanzhenjie:permission:${AndPermissionVersion}",
|
||||
"Zxing" : "com.github.bingoogolapple.BGAQRCode-Android:zxing:${ZxingVersion}",
|
||||
"BaseRecyclerViewAdapterHelper" :"io.github.cymchad:BaseRecyclerViewAdapterHelper:${BaseRecyclerViewAdapterHelper}",
|
||||
"BaseRecyclerViewAdapterHelper" :"io.github.cymchad:BaseRecyclerViewAdapterHelper4:${BaseRecyclerViewAdapterHelper}",
|
||||
"MagicIndicator" :"com.github.hackware1993:MagicIndicator:${MagicIndicator}",
|
||||
"NiceSpinner" :"com.github.arcadefire:nice-spinner:${NiceSpinner}",
|
||||
"Countdownview" :"com.github.iwgang:countdownview:${Countdownview}",
|
||||
|
@ -1,30 +0,0 @@
|
||||
package com.dahe.mylibrary.adapter;
|
||||
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.bean.CarBean;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CarAdapter extends BaseQuickAdapter<CarBean, BaseViewHolder> {
|
||||
|
||||
public CarAdapter(int layoutResId, @Nullable List<CarBean> data) {
|
||||
super(R.layout.item_car_select, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(@NotNull BaseViewHolder helper, CarBean item) {
|
||||
helper.setText(R.id.tv_title, item.getVehicle())
|
||||
.setText(R.id.tv_lxr, "司机信息:"+item.getDriverName() + " " + item.getDriverPhone())
|
||||
.setText(R.id.tv_zz, "载重(Kg):"+item.getApprovedLoad())
|
||||
.setText(R.id.tv_ckg, "长宽高(毫米):"+item.getOutlineLong()+"*"+item.getOutlineWide()+"*"+item.getOutlineHigh());
|
||||
CheckBox cb = helper.getView(R.id.cb);
|
||||
cb.setChecked(item.isSelect());
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package com.dahe.mylibrary.adapter;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.bean.StateBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CenterSimAdapter extends BaseQuickAdapter<StateBean, BaseViewHolder> {
|
||||
private StateBean selectString=null;
|
||||
|
||||
|
||||
public CenterSimAdapter(int layoutResId, @Nullable List<StateBean> data, StateBean selectString) {
|
||||
super(R.layout.item_select, data);
|
||||
this.selectString = selectString;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, StateBean item) {
|
||||
helper.setText(R.id.tv_content,item.getDictLabel());
|
||||
TextView tv = helper.getView(R.id.tv_content);
|
||||
if (selectString!=null&&item.getDictValue()!=null){
|
||||
if (item.getDictValue().equals(selectString.getDictValue())){
|
||||
tv.setSelected(true);
|
||||
}else{
|
||||
tv.setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setSelect(StateBean selectString){
|
||||
this.selectString = selectString;
|
||||
}
|
||||
}
|
@ -1,222 +0,0 @@
|
||||
package com.dahe.mylibrary.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.callback.OnItemLongClickListener;
|
||||
import com.luck.picture.lib.config.PictureMimeType;
|
||||
import com.luck.picture.lib.config.SelectMimeType;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.luck.picture.lib.utils.DateUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author:luck
|
||||
* @date:2016-7-27 23:02
|
||||
* @describe:GridImageAdapter
|
||||
*/
|
||||
public class GridImageAdapter extends RecyclerView.Adapter<GridImageAdapter.ViewHolder> {
|
||||
public static final String TAG = "PictureSelector";
|
||||
public static final int TYPE_CAMERA = 1;
|
||||
public static final int TYPE_PICTURE = 2;
|
||||
private final LayoutInflater mInflater;
|
||||
private final ArrayList<LocalMedia> list = new ArrayList<>();
|
||||
private int selectMax = 9;
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public void delete(int position) {
|
||||
try {
|
||||
|
||||
if (position != RecyclerView.NO_POSITION && list.size() > position) {
|
||||
list.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
notifyItemRangeChanged(position, list.size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public GridImageAdapter(Context context, List<LocalMedia> result) {
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.list.addAll(result);
|
||||
}
|
||||
|
||||
public void setSelectMax(int selectMax) {
|
||||
this.selectMax = selectMax;
|
||||
}
|
||||
|
||||
public int getSelectMax() {
|
||||
return selectMax;
|
||||
}
|
||||
|
||||
public ArrayList<LocalMedia> getData() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void remove(int position) {
|
||||
if (position < list.size()) {
|
||||
list.remove(position);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mImg;
|
||||
ImageView mIvDel;
|
||||
TextView tvDuration;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
super(view);
|
||||
mImg = view.findViewById(R.id.fiv);
|
||||
mIvDel = view.findViewById(R.id.iv_del);
|
||||
tvDuration = view.findViewById(R.id.tv_duration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if (list.size() < selectMax) {
|
||||
return list.size() + 1;
|
||||
} else {
|
||||
return list.size();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (isShowAddItem(position)) {
|
||||
return TYPE_CAMERA;
|
||||
} else {
|
||||
return TYPE_PICTURE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建ViewHolder
|
||||
*/
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
View view = mInflater.inflate(R.layout.gv_filter_image, viewGroup, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
private boolean isShowAddItem(int position) {
|
||||
int size = list.size();
|
||||
return position == size;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置值
|
||||
*/
|
||||
@Override
|
||||
public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
|
||||
//少于MaxSize张,显示继续添加的图标
|
||||
if (getItemViewType(position) == TYPE_CAMERA) {
|
||||
viewHolder.mImg.setImageResource(R.drawable.ic_add_image);
|
||||
viewHolder.mImg.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mItemClickListener != null) {
|
||||
mItemClickListener.openPicture();
|
||||
}
|
||||
}
|
||||
});
|
||||
viewHolder.mIvDel.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
viewHolder.mIvDel.setVisibility(View.VISIBLE);
|
||||
viewHolder.mIvDel.setOnClickListener(view -> {
|
||||
int index = viewHolder.getAbsoluteAdapterPosition();
|
||||
if (index != RecyclerView.NO_POSITION && list.size() > index) {
|
||||
list.remove(index);
|
||||
notifyItemRemoved(index);
|
||||
notifyItemRangeChanged(index, list.size());
|
||||
}
|
||||
});
|
||||
LocalMedia media = list.get(position);
|
||||
int chooseModel = media.getChooseModel();
|
||||
String path = media.getAvailablePath();
|
||||
long duration = media.getDuration();
|
||||
viewHolder.tvDuration.setVisibility(PictureMimeType.isHasVideo(media.getMimeType())
|
||||
? View.VISIBLE : View.GONE);
|
||||
if (chooseModel == SelectMimeType.ofAudio()) {
|
||||
viewHolder.tvDuration.setVisibility(View.VISIBLE);
|
||||
viewHolder.tvDuration.setCompoundDrawablesRelativeWithIntrinsicBounds
|
||||
(R.drawable.ps_ic_audio, 0, 0, 0);
|
||||
|
||||
} else {
|
||||
viewHolder.tvDuration.setCompoundDrawablesRelativeWithIntrinsicBounds
|
||||
(R.drawable.ps_ic_video, 0, 0, 0);
|
||||
}
|
||||
viewHolder.tvDuration.setText(DateUtils.formatDurationTime(duration));
|
||||
if (chooseModel == SelectMimeType.ofAudio()) {
|
||||
viewHolder.mImg.setImageResource(R.drawable.ps_audio_placeholder);
|
||||
} else {
|
||||
Glide.with(viewHolder.itemView.getContext())
|
||||
.load(PictureMimeType.isContent(path) && !media.isCut() && !media.isCompressed() ? Uri.parse(path)
|
||||
: path)
|
||||
.centerCrop()
|
||||
.placeholder(R.color.app_color_f6)
|
||||
.diskCacheStrategy(DiskCacheStrategy.ALL)
|
||||
.into(viewHolder.mImg);
|
||||
}
|
||||
//itemView 的点击事件
|
||||
if (mItemClickListener != null) {
|
||||
viewHolder.itemView.setOnClickListener(v -> {
|
||||
int adapterPosition = viewHolder.getAbsoluteAdapterPosition();
|
||||
mItemClickListener.onItemClick(v, adapterPosition);
|
||||
});
|
||||
}
|
||||
|
||||
if (mItemLongClickListener != null) {
|
||||
viewHolder.itemView.setOnLongClickListener(v -> {
|
||||
int adapterPosition = viewHolder.getAbsoluteAdapterPosition();
|
||||
mItemLongClickListener.onItemLongClick(viewHolder, adapterPosition, v);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private OnItemClickListener mItemClickListener;
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener l) {
|
||||
this.mItemClickListener = l;
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
/**
|
||||
* Item click event
|
||||
*
|
||||
* @param v
|
||||
* @param position
|
||||
*/
|
||||
void onItemClick(View v, int position);
|
||||
|
||||
/**
|
||||
* Open PictureSelector
|
||||
*/
|
||||
void openPicture();
|
||||
}
|
||||
|
||||
private OnItemLongClickListener mItemLongClickListener;
|
||||
|
||||
public void setItemLongClickListener(OnItemLongClickListener l) {
|
||||
this.mItemLongClickListener = l;
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package com.dahe.mylibrary.adapter;
|
||||
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.bean.NodeBean;
|
||||
import com.dahe.mylibrary.utils.StringUtils;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NodeAdapter extends BaseQuickAdapter<NodeBean, BaseViewHolder> {
|
||||
|
||||
public NodeAdapter(int layoutResId, @Nullable List<NodeBean> data) {
|
||||
super(R.layout.item_node_select, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(@NotNull BaseViewHolder helper, NodeBean item) {
|
||||
helper.setText(R.id.tv_title, item.getNode())
|
||||
.setText(R.id.tv_lxr, StringUtils.isEmpty(item.getDocking())?"":item.getDocking() + " " + (StringUtils.isEmpty(item.getDockingPhone())?"":item.getDockingPhone()))
|
||||
.setText(R.id.tv_addres, item.getFreighter());
|
||||
CheckBox cb = helper.getView(R.id.cb);
|
||||
cb.setChecked("1".equals(item.isSelect())?true:false);
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package com.dahe.mylibrary.adapter;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.bean.StateBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SelectDicAdapter extends BaseQuickAdapter<StateBean, BaseViewHolder> {
|
||||
private int selectPos = -1;
|
||||
|
||||
|
||||
public SelectDicAdapter(int layoutResId, @Nullable List<StateBean> data, int selectPos) {
|
||||
super(R.layout.item_dic_select, data);
|
||||
this.selectPos = selectPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, StateBean item) {
|
||||
helper.setText(R.id.tv_content,item.getDictLabel());
|
||||
// TextView tv = helper.getView(R.id.tv_content);
|
||||
// if (item.equals(selectString)){
|
||||
// tv.setSelected(true);
|
||||
// }else{
|
||||
// tv.setSelected(false);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public void setSelect(int selectString){
|
||||
this.selectPos = selectString;
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
package com.dahe.mylibrary.cuspop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.adapter.CarAdapter;
|
||||
import com.dahe.mylibrary.bean.CarBean;
|
||||
import com.dahe.mylibrary.net.JsonUtils;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CarSelPopupView extends CenterPopupView {
|
||||
|
||||
|
||||
private Context context;
|
||||
private List<CarBean> data;
|
||||
public CarSelPopupView(Context context, String data) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
ArrayList<CarBean> nodeBeans = JsonUtils.getInstance().jsonToList(data, CarBean.class);
|
||||
this.data = nodeBeans;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.view_node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
TextView tvTitle = (TextView) findViewById(R.id.tvTitle);
|
||||
ImageView ivCha = (ImageView) findViewById(R.id.ivCha);
|
||||
LinearLayout llCha = (LinearLayout) findViewById(R.id.llCha);
|
||||
Button btnOK = (Button) findViewById(R.id.btnOK);
|
||||
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context,RecyclerView.VERTICAL,false));
|
||||
recyclerView.setHasFixedSize(true);
|
||||
CarAdapter nodeAdapter = new CarAdapter(-1,data);
|
||||
recyclerView.setAdapter(nodeAdapter);
|
||||
|
||||
tvTitle.setText("关联司机");
|
||||
nodeAdapter.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
|
||||
CarBean nodeSelectBean = data.get(position);
|
||||
nodeSelectBean.setSelect(!nodeSelectBean.isSelect());
|
||||
nodeAdapter.notifyItemChanged(position);
|
||||
}
|
||||
});
|
||||
|
||||
btnOK.setOnClickListener(v -> {
|
||||
if (listener!=null){
|
||||
// ArrayList<CarBean> temp = new ArrayList<>();
|
||||
// for (int i = 0; i < data.size(); i++) {
|
||||
// CarBean nodeSelectBean = data.get(i);
|
||||
// if ("1".equals(nodeSelectBean.isSelect())){
|
||||
// temp.add(nodeSelectBean);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// if (temp.size()<=0){
|
||||
// ToastUtils.showToast(context,"至少存在一个节点");
|
||||
// return;
|
||||
// }
|
||||
listener.okClick(JsonUtils.getInstance().toJson(nodeAdapter.getData()));
|
||||
// temp = null;
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
llCha.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private OnOkListener listener;
|
||||
|
||||
public CarSelPopupView setOnOkListener(OnOkListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface OnOkListener {
|
||||
void okClick(String data);
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
package com.dahe.mylibrary.cuspop;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.adapter.CenterSimAdapter;
|
||||
import com.dahe.mylibrary.bean.StateBean;
|
||||
import com.dahe.mylibrary.wapper.SelectSimAdapter;
|
||||
import com.luck.picture.lib.decoration.GridSpacingItemDecoration;
|
||||
import com.lxj.xpopup.impl.PartShadowPopupView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description: 自定义局部阴影弹窗
|
||||
* Create by dance, at 2018/12/21
|
||||
*/
|
||||
public class CenterPopupView extends PartShadowPopupView {
|
||||
private Context ctx;
|
||||
private RecyclerView recyclerView;
|
||||
private List<StateBean> wordList;
|
||||
private CenterSimAdapter adapter;
|
||||
private StateBean selectString;
|
||||
|
||||
public CenterPopupView(@NonNull Activity context, List<StateBean> wordList, StateBean selectString) {
|
||||
super(context);
|
||||
this.wordList= wordList;
|
||||
this.selectString = selectString;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.custom_part_shadow_popup;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(ctx, 4);
|
||||
recyclerView.addItemDecoration(new GridSpacingItemDecoration(4, 20, false));
|
||||
recyclerView.setLayoutManager(gridLayoutManager);
|
||||
adapter = new CenterSimAdapter(-1, wordList,selectString);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
adapter.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
|
||||
if (listener!=null){
|
||||
listener.selectChange(wordList.get(position),position);
|
||||
}
|
||||
((CenterSimAdapter)adapter).setSelect(wordList.get(position));
|
||||
adapter.notifyDataSetChanged();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
Log.e("tag", "CustomPartShadowPopupView onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
Log.e("tag", "CustomPartShadowPopupView onDismiss");
|
||||
}
|
||||
|
||||
|
||||
private OnSelectChangeListener listener;
|
||||
public CenterPopupView setOnSelectChangeListener(OnSelectChangeListener listener){
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
public interface OnSelectChangeListener{
|
||||
void selectChange(StateBean item ,int postion);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package com.dahe.mylibrary.cuspop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.adapter.SelectDicAdapter;
|
||||
import com.dahe.mylibrary.bean.DictBean;
|
||||
import com.dahe.mylibrary.bean.StateBean;
|
||||
import com.lxj.xpopup.core.AttachPopupView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description: 自定义局部阴影弹窗
|
||||
* Create by dance, at 2018/12/21
|
||||
*/
|
||||
public class CustomDicPopView extends AttachPopupView {
|
||||
private Context ctx;
|
||||
private RecyclerView recyclerView;
|
||||
private List<StateBean> wordList;
|
||||
private SelectDicAdapter adapter;
|
||||
private int selectPos;
|
||||
|
||||
public CustomDicPopView(@NonNull Context context, List<StateBean> wordList, int selectPos) {
|
||||
super(context);
|
||||
this.ctx = context;
|
||||
this.wordList= wordList;
|
||||
this.selectPos = selectPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.custom_dic_popup;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(ctx, RecyclerView.VERTICAL, false);
|
||||
// recyclerView.addItemDecoration(new RecycleViewDivider(ctx,RecyclerView.VERTICAL));
|
||||
recyclerView.setLayoutManager(linearLayoutManager);
|
||||
adapter = new SelectDicAdapter(-1, wordList,selectPos);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
adapter.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
|
||||
if (listener!=null){
|
||||
listener.selectChange(wordList.get(position),position);
|
||||
}
|
||||
((SelectDicAdapter)adapter).setSelect(position);
|
||||
adapter.notifyDataSetChanged();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
Log.e("tag", "CustomPartShadowPopupView onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
Log.e("tag", "CustomPartShadowPopupView onDismiss");
|
||||
}
|
||||
|
||||
|
||||
private OnSelectChangeListener listener;
|
||||
public CustomDicPopView setOnSelectChangeListener(OnSelectChangeListener listener){
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
public interface OnSelectChangeListener{
|
||||
void selectChange(StateBean item ,int postion);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package com.dahe.mylibrary.cuspop;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.wapper.SelectSimAdapter;
|
||||
import com.luck.picture.lib.decoration.GridSpacingItemDecoration;
|
||||
import com.lxj.xpopup.impl.PartShadowPopupView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description: 自定义局部阴影弹窗
|
||||
* Create by dance, at 2018/12/21
|
||||
*/
|
||||
public class CustomPartShadowPopupView extends PartShadowPopupView {
|
||||
private Context ctx;
|
||||
private RecyclerView recyclerView;
|
||||
private List<String> wordList;
|
||||
private SelectSimAdapter adapter;
|
||||
private String selectString;
|
||||
|
||||
public CustomPartShadowPopupView(@NonNull Activity context, List<String> wordList, String selectString) {
|
||||
super(context);
|
||||
this.wordList= wordList;
|
||||
this.selectString = selectString;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.custom_part_shadow_popup;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
recyclerView = findViewById(R.id.recyclerView);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(ctx, 4);
|
||||
recyclerView.addItemDecoration(new GridSpacingItemDecoration(4, 20, false));
|
||||
recyclerView.setLayoutManager(gridLayoutManager);
|
||||
adapter = new SelectSimAdapter(-1, wordList,selectString);
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
adapter.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int position) {
|
||||
if (listener!=null){
|
||||
listener.selectChange(wordList.get(position),position);
|
||||
}
|
||||
((SelectSimAdapter)adapter).setSelect(wordList.get(position));
|
||||
adapter.notifyDataSetChanged();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
Log.e("tag", "CustomPartShadowPopupView onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
Log.e("tag", "CustomPartShadowPopupView onDismiss");
|
||||
}
|
||||
|
||||
|
||||
private OnSelectChangeListener listener;
|
||||
public CustomPartShadowPopupView setOnSelectChangeListener(OnSelectChangeListener listener){
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
public interface OnSelectChangeListener{
|
||||
void selectChange(String item ,int postion);
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
package com.dahe.mylibrary.cuspop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.lxj.xpopup.util.KeyboardUtils;
|
||||
|
||||
/**
|
||||
* Description: 自定义局部阴影弹窗
|
||||
* Create by dance, at 2018/12/21
|
||||
*/
|
||||
public class InputPopupView extends CenterPopupView {
|
||||
private Context ctx;
|
||||
|
||||
|
||||
public InputPopupView(@NonNull Context context) {
|
||||
super(context);
|
||||
this.ctx = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.my_confim_popup_input;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
EditText etInput = findViewById(R.id.et_input);
|
||||
TextView tvCancel = findViewById(R.id.tv_cancel);
|
||||
TextView tvConfirm = findViewById(R.id.tv_confirm);
|
||||
if (listener != null) {
|
||||
tvConfirm.setOnClickListener(view -> {
|
||||
if (TextUtils.isEmpty(etInput.getText().toString().trim())){
|
||||
KeyboardUtils.hideSoftInput(tvConfirm);
|
||||
ToastUtils.showToast(ctx,"请填写取消原因");
|
||||
return;
|
||||
}
|
||||
listener.okClick(etInput.getText().toString());
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
tvCancel.setOnClickListener(v -> dismiss());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
Log.e("tag", "CustomPartShadowPopupView onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
Log.e("tag", "CustomPartShadowPopupView onDismiss");
|
||||
}
|
||||
|
||||
|
||||
private OnOkListener listener;
|
||||
|
||||
public InputPopupView setOnOkListener(OnOkListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface OnOkListener {
|
||||
void okClick(String item);
|
||||
}
|
||||
}
|
@ -1,107 +0,0 @@
|
||||
package com.dahe.mylibrary.cuspop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.listener.OnItemClickListener;
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.adapter.NodeAdapter;
|
||||
import com.dahe.mylibrary.bean.NodeBean;
|
||||
import com.dahe.mylibrary.net.JsonUtils;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NodePopupView extends CenterPopupView {
|
||||
|
||||
|
||||
private Context context;
|
||||
private List<NodeBean> data;
|
||||
public NodePopupView(Context context,String data) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
ArrayList<NodeBean> nodeBeans = JsonUtils.getInstance().jsonToList(data, NodeBean.class);
|
||||
this.data = nodeBeans;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.view_node;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
TextView tvTitle = (TextView) findViewById(R.id.tvTitle);
|
||||
ImageView ivCha = (ImageView) findViewById(R.id.ivCha);
|
||||
LinearLayout llCha = (LinearLayout) findViewById(R.id.llCha);
|
||||
Button btnOK = (Button) findViewById(R.id.btnOK);
|
||||
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context,RecyclerView.VERTICAL,false));
|
||||
recyclerView.setHasFixedSize(true);
|
||||
NodeAdapter nodeAdapter = new NodeAdapter(-1,data);
|
||||
recyclerView.setAdapter(nodeAdapter);
|
||||
|
||||
|
||||
nodeAdapter.setOnItemClickListener(new OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(@NonNull @NotNull BaseQuickAdapter<?, ?> adapter, @NonNull @NotNull View view, int position) {
|
||||
NodeBean nodeSelectBean = data.get(position);
|
||||
if (!"0".equals(nodeSelectBean.getState())){
|
||||
ToastUtils.showToast(context,"该节点不可操作");
|
||||
return;
|
||||
}
|
||||
nodeSelectBean.setSelect("1".equals(nodeSelectBean.isSelect())?"0":"1");
|
||||
nodeAdapter.notifyItemChanged(position);
|
||||
}
|
||||
});
|
||||
|
||||
btnOK.setOnClickListener(v -> {
|
||||
if (listener!=null){
|
||||
ArrayList<NodeBean> temp = new ArrayList<>();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
NodeBean nodeSelectBean = data.get(i);
|
||||
if ("1".equals(nodeSelectBean.isSelect())){
|
||||
temp.add(nodeSelectBean);
|
||||
}
|
||||
|
||||
}
|
||||
if (temp.size()<=0){
|
||||
ToastUtils.showToast(context,"至少存在一个节点");
|
||||
return;
|
||||
}
|
||||
listener.okClick(JsonUtils.getInstance().toJson(data));
|
||||
temp = null;
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
llCha.setOnClickListener(v -> {
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private OnOkListener listener;
|
||||
|
||||
public NodePopupView setOnOkListener(OnOkListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface OnOkListener {
|
||||
void okClick(String data);
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
package com.dahe.mylibrary.cuspop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.bean.TipsBean;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
|
||||
/**
|
||||
* Description: 自定义局部阴影弹窗
|
||||
* Create by dance, at 2018/12/21
|
||||
*/
|
||||
public class TextPopupTipsView extends CenterPopupView {
|
||||
private TipsBean data;
|
||||
private Context ctx;
|
||||
|
||||
|
||||
public TextPopupTipsView(@NonNull Context context, TipsBean data) {
|
||||
super(context);
|
||||
this.data = data;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.my_confim_popup_tip;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
TextView etInput = findViewById(R.id.tv_input);
|
||||
TextView tvTitle = findViewById(R.id.tv_title);
|
||||
TextView tvCancel = findViewById(R.id.tv_cancel);
|
||||
TextView tvConfirm = findViewById(R.id.tv_confirm);
|
||||
tvTitle.setText(data.getTitle());
|
||||
etInput.setText(data.getContent());
|
||||
if (listener != null) {
|
||||
tvConfirm.setOnClickListener(view -> {
|
||||
listener.okClick();
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
tvCancel.setOnClickListener(v -> dismiss());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
Log.e("tag", "CustomPartShadowPopupView onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
Log.e("tag", "CustomPartShadowPopupView onDismiss");
|
||||
}
|
||||
|
||||
|
||||
private OnOkListener listener;
|
||||
|
||||
public TextPopupTipsView setOnOkListener(OnOkListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface OnOkListener {
|
||||
void okClick();
|
||||
}
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
package com.dahe.mylibrary.cuspop;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
|
||||
/**
|
||||
* Description: 自定义局部阴影弹窗
|
||||
* Create by dance, at 2018/12/21
|
||||
*/
|
||||
public class TextPopupView extends CenterPopupView {
|
||||
private String data;
|
||||
private Context ctx;
|
||||
|
||||
|
||||
public TextPopupView(@NonNull Context context,String data) {
|
||||
super(context);
|
||||
this.data = data;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getImplLayoutId() {
|
||||
return R.layout.my_confim_popup_unus;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate() {
|
||||
super.onCreate();
|
||||
TextView etInput = findViewById(R.id.tv_input);
|
||||
TextView tvCancel = findViewById(R.id.tv_cancel);
|
||||
TextView tvConfirm = findViewById(R.id.tv_confirm);
|
||||
etInput.setText(data);
|
||||
if (listener != null) {
|
||||
tvConfirm.setOnClickListener(view -> {
|
||||
listener.okClick(etInput.getText().toString());
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
tvCancel.setOnClickListener(v -> dismiss());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onShow() {
|
||||
super.onShow();
|
||||
Log.e("tag", "CustomPartShadowPopupView onShow");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDismiss() {
|
||||
super.onDismiss();
|
||||
Log.e("tag", "CustomPartShadowPopupView onDismiss");
|
||||
}
|
||||
|
||||
|
||||
private OnOkListener listener;
|
||||
|
||||
public TextPopupView setOnOkListener(OnOkListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public interface OnOkListener {
|
||||
void okClick(String item);
|
||||
}
|
||||
}
|
@ -1,247 +0,0 @@
|
||||
package com.dahe.mylibrary.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.dahe.mylibrary.R;
|
||||
import com.dahe.mylibrary.adapter.GridImageAdapter;
|
||||
import com.dahe.mylibrary.dialog.DialogPhotoSelect;
|
||||
import com.dahe.mylibrary.glide.GlideEngine;
|
||||
import com.dahe.mylibrary.weight.FullyGridLayoutManager;
|
||||
import com.luck.picture.lib.PictureSelectorPreviewFragment;
|
||||
import com.luck.picture.lib.basic.IBridgeViewLifecycle;
|
||||
import com.luck.picture.lib.basic.PictureSelector;
|
||||
import com.luck.picture.lib.config.InjectResourceSource;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
import com.luck.picture.lib.config.PictureMimeType;
|
||||
import com.luck.picture.lib.config.SelectMimeType;
|
||||
import com.luck.picture.lib.decoration.GridSpacingItemDecoration;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.luck.picture.lib.interfaces.OnExternalPreviewEventListener;
|
||||
import com.luck.picture.lib.interfaces.OnInjectActivityPreviewListener;
|
||||
import com.luck.picture.lib.interfaces.OnInjectLayoutResourceListener;
|
||||
import com.luck.picture.lib.interfaces.OnResultCallbackListener;
|
||||
import com.luck.picture.lib.style.PictureSelectorStyle;
|
||||
import com.luck.picture.lib.utils.DensityUtil;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import me.jessyan.autosize.utils.ScreenUtils;
|
||||
|
||||
public class SelectPhotoUtils6 implements View.OnClickListener {
|
||||
private Activity ctx;
|
||||
private OnResultCallbackListener listener;
|
||||
private GridImageAdapter mAdapter;
|
||||
private Build build;
|
||||
private final List<LocalMedia> mData = new ArrayList<>();
|
||||
|
||||
private SelectPhotoUtils6(Build build, Activity ctx) {
|
||||
this.build = build;
|
||||
this.ctx = ctx;
|
||||
this.listener = build.listener;
|
||||
if (null == listener) {
|
||||
ToastUtils.showToast(ctx, "请初始化回调listener");
|
||||
return;
|
||||
}
|
||||
if (build.isSingle) {//单选
|
||||
if (null == build.imageView) {
|
||||
ToastUtils.showToast(ctx, "请初始化ImageView");
|
||||
return;
|
||||
}
|
||||
selectSimple(build.imageView);
|
||||
} else {//多选
|
||||
if (null == build.recyclerView || !(build.recyclerView instanceof RecyclerView)) {
|
||||
ToastUtils.showToast(ctx, "请初始化RecycleView");
|
||||
return;
|
||||
}
|
||||
selectMul(build.recyclerView);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Build {
|
||||
private int maxSelect;
|
||||
private boolean isSingle;
|
||||
private boolean isOnlyShow;
|
||||
private ImageView imageView;
|
||||
private RecyclerView recyclerView;
|
||||
private List<LocalMedia> pics;
|
||||
private OnResultCallbackListener listener;
|
||||
|
||||
public Build maxSelect(int max) {
|
||||
this.maxSelect = max;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Build isSingle(boolean isSingle) {
|
||||
this.isSingle = isSingle;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Build isOnlyShow(boolean isOnlyShow) {
|
||||
this.isOnlyShow = isOnlyShow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Build imageview(ImageView imageView) {
|
||||
this.imageView = imageView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Build recycleview(RecyclerView recyclerView) {
|
||||
this.recyclerView = recyclerView;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Build newPics(List<LocalMedia> pics) {
|
||||
this.pics = pics;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Build resultListener(OnResultCallbackListener listener) {
|
||||
this.listener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SelectPhotoUtils6 create(Activity ctx) {
|
||||
return new SelectPhotoUtils6(this, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
public GridImageAdapter getmAdapter() {
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
|
||||
public void selectSimple(ImageView imageView) {
|
||||
imageView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
public void selectMul(RecyclerView recyclerView) {
|
||||
FullyGridLayoutManager manager = new FullyGridLayoutManager(ctx,
|
||||
4, GridLayoutManager.VERTICAL, false);
|
||||
|
||||
recyclerView.addItemDecoration(new GridSpacingItemDecoration(40,
|
||||
DensityUtil.dip2px(ctx, 8), true
|
||||
));
|
||||
recyclerView.setLayoutManager(manager);
|
||||
mAdapter = new GridImageAdapter(ctx, mData);
|
||||
mAdapter.setSelectMax(build.maxSelect);
|
||||
// mAdapter.setIsOnlyShow(build.isOnlyShow);
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
|
||||
|
||||
mAdapter.setOnItemClickListener(new GridImageAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View v, int position) {
|
||||
// 预览图片、视频、音频
|
||||
PictureSelector.create(ctx)
|
||||
.openPreview()
|
||||
.setImageEngine(GlideEngine.createGlideEngine())
|
||||
.setSelectorUIStyle(new PictureSelectorStyle())
|
||||
// .isAutoVideoPlay(cb_auto_video.isChecked())
|
||||
// .isLoopAutoVideoPlay(cb_auto_video.isChecked())
|
||||
// .isPreviewFullScreenMode(cb_preview_full.isChecked())
|
||||
// .isVideoPauseResumePlay(cb_video_resume.isChecked())
|
||||
// .setCustomLoadingListener(getCustomLoadingListener())
|
||||
.isPreviewZoomEffect(true, recyclerView)
|
||||
.setExternalPreviewEventListener(new MyExternalPreviewEventListener())
|
||||
.setAttachViewLifecycle(new IBridgeViewLifecycle() {
|
||||
@Override
|
||||
public void onViewCreated(Fragment fragment, View view, Bundle savedInstanceState) {
|
||||
// PictureSelectorPreviewFragment previewFragment = (PictureSelectorPreviewFragment) fragment;
|
||||
// MediumBoldTextView tvShare = view.findViewById(R.id.tv_share);
|
||||
// tvShare.setVisibility(View.VISIBLE)
|
||||
// previewFragment.addAminViews(tvShare);
|
||||
// ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) tvShare.getLayoutParams();
|
||||
// layoutParams.topMargin = cb_preview_full.isChecked() ? DensityUtil.getStatusBarHeight(getContext()) : 0;
|
||||
// tvShare.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// PicturePreviewAdapter previewAdapter = previewFragment.getAdapter();
|
||||
// ViewPager2 viewPager2 = previewFragment.getViewPager2();
|
||||
// LocalMedia media = previewAdapter.getItem(viewPager2.getCurrentItem());
|
||||
// ToastUtils.showToast(fragment.getContext(), "自定义分享事件:" + viewPager2.getCurrentItem());
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(Fragment fragment) {
|
||||
// if (cb_preview_full.isChecked()) {
|
||||
// // 如果是全屏预览模式且是startFragmentPreview预览,回到自己的界面时需要恢复一下自己的沉浸式状态
|
||||
// // 以下提供2种解决方案:
|
||||
// // 1.通过ImmersiveManager.immersiveAboveAPI23重新设置一下沉浸式
|
||||
// int statusBarColor = ContextCompat.getColor(getContext(), R.color.ps_color_grey);
|
||||
// int navigationBarColor = ContextCompat.getColor(getContext(), R.color.ps_color_grey);
|
||||
// ImmersiveManager.immersiveAboveAPI23(MainActivity.this,
|
||||
// true, true,
|
||||
// statusBarColor, navigationBarColor, false);
|
||||
// // 2.让自己的titleBar的高度加上一个状态栏高度且内容PaddingTop下沉一个状态栏的高度
|
||||
// }
|
||||
}
|
||||
})
|
||||
.startActivityPreview(position, true, mAdapter.getData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openPicture() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
DialogPhotoSelect dialogPhotoSelect = new DialogPhotoSelect(ctx);
|
||||
dialogPhotoSelect.show();
|
||||
dialogPhotoSelect.setOnSelectClickListener(new DialogPhotoSelect.onSelectClickListener() {
|
||||
@Override
|
||||
public void onTakePhoto() {
|
||||
// doTakePhoto(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelectPhoto() {
|
||||
// doSelectPhoto(ctx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 外部预览监听事件
|
||||
*/
|
||||
private class MyExternalPreviewEventListener implements OnExternalPreviewEventListener {
|
||||
|
||||
@Override
|
||||
public void onPreviewDelete(int position) {
|
||||
mAdapter.remove(position);
|
||||
mAdapter.notifyItemRemoved(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongPressDownload(Context context, LocalMedia media) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
package com.dahe.mylibrary.wapper;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
|
||||
import com.dahe.mylibrary.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SelectSimAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
|
||||
private String selectString = "";
|
||||
|
||||
|
||||
public SelectSimAdapter(int layoutResId, @Nullable List<String> data, String selectString) {
|
||||
super(R.layout.item_select, data);
|
||||
this.selectString = selectString;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, String item) {
|
||||
helper.setText(R.id.tv_content,item);
|
||||
TextView tv = helper.getView(R.id.tv_content);
|
||||
if (item.equals(selectString)){
|
||||
tv.setSelected(true);
|
||||
}else{
|
||||
tv.setSelected(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setSelect(String selectString){
|
||||
this.selectString = selectString;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user