|
@@ -1,18 +1,25 @@
|
|
package com.cooleshow.chatmodule.adapter;
|
|
package com.cooleshow.chatmodule.adapter;
|
|
|
|
|
|
import android.view.View;
|
|
import android.view.View;
|
|
|
|
+import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.ImageView;
|
|
|
|
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
|
|
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
|
|
import com.cooleshow.base.utils.GlideImageLoaderUtils;
|
|
import com.cooleshow.base.utils.GlideImageLoaderUtils;
|
|
import com.cooleshow.base.utils.GlideUtils;
|
|
import com.cooleshow.base.utils.GlideUtils;
|
|
|
|
+import com.cooleshow.base.utils.SizeUtils;
|
|
|
|
+import com.cooleshow.base.utils.Utils;
|
|
|
|
+import com.cooleshow.base.utils.helper.QMUIDeviceHelper;
|
|
import com.cooleshow.chatmodule.R;
|
|
import com.cooleshow.chatmodule.R;
|
|
import com.cooleshow.chatmodule.utils.helper.IMThemManager;
|
|
import com.cooleshow.chatmodule.utils.helper.IMThemManager;
|
|
import com.luck.picture.lib.entity.LocalMedia;
|
|
import com.luck.picture.lib.entity.LocalMedia;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
|
+import androidx.recyclerview.widget.RecyclerView;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 创建日期:2022/6/13 14:22
|
|
* 创建日期:2022/6/13 14:22
|
|
*
|
|
*
|
|
@@ -21,9 +28,12 @@ import java.util.List;
|
|
*/
|
|
*/
|
|
public class AddPhotoListAdapter extends BaseQuickAdapter<LocalMedia, BaseViewHolder> {
|
|
public class AddPhotoListAdapter extends BaseQuickAdapter<LocalMedia, BaseViewHolder> {
|
|
|
|
|
|
|
|
+ private final boolean isTablet;
|
|
|
|
+
|
|
public AddPhotoListAdapter(List<LocalMedia> data) {
|
|
public AddPhotoListAdapter(List<LocalMedia> data) {
|
|
super(R.layout.tc_photo_list_item, data);
|
|
super(R.layout.tc_photo_list_item, data);
|
|
addChildClickViewIds(R.id.iv_del);
|
|
addChildClickViewIds(R.id.iv_del);
|
|
|
|
+ isTablet = QMUIDeviceHelper.isTablet(Utils.getApp());
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -36,9 +46,19 @@ public class AddPhotoListAdapter extends BaseQuickAdapter<LocalMedia, BaseViewHo
|
|
ivIcon.setImageResource(addPicDefaultImgRes != -1 ? addPicDefaultImgRes : R.drawable.tc_ic_update_photo);
|
|
ivIcon.setImageResource(addPicDefaultImgRes != -1 ? addPicDefaultImgRes : R.drawable.tc_ic_update_photo);
|
|
} else {
|
|
} else {
|
|
iv_del.setVisibility(View.VISIBLE);
|
|
iv_del.setVisibility(View.VISIBLE);
|
|
- GlideImageLoaderUtils.getInstance().loadCustRoundCircleImage(getContext(),item.getPath(), ivIcon,10);
|
|
|
|
|
|
+ GlideImageLoaderUtils.getInstance().loadCustRoundCircleImage(getContext(), item.getPath(), ivIcon, 10);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ConstraintLayout cs_root = helper.getView(R.id.cs_root);
|
|
|
|
+ RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams) cs_root.getLayoutParams();
|
|
|
|
+ if (isTablet) {
|
|
|
|
+ layoutParams.width = RecyclerView.LayoutParams.WRAP_CONTENT;
|
|
|
|
+ cs_root.setPadding(0, 0, SizeUtils.dp2px(16), 0);
|
|
|
|
+ } else {
|
|
|
|
+ layoutParams.width = RecyclerView.LayoutParams.MATCH_PARENT;
|
|
|
|
+ cs_root.setPadding(0, 0, 0, 0);
|
|
|
|
+ }
|
|
|
|
+ cs_root.setLayoutParams(layoutParams);
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|