Commit 1916076d by ydl

首页文章冥想动态剔除完成

parent 7d0db4f6
......@@ -40,6 +40,7 @@ import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydlcommon.actions.imagepicker.PickerCallback;
import com.ydl.ydlcommon.adapter.custom.PublishImageAdapter;
import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.base.BaseFragment;
......@@ -49,22 +50,21 @@ import com.ydl.ydlcommon.utils.BuryPointUtils;
import com.ydl.ydlcommon.utils.MoonUtil;
import com.ydl.ydlcommon.utils.SharedPreferencesEditor;
import com.ydl.ydlcommon.utils.StringUtils;
import com.ydl.ydlcommon.view.banner.GlideImageDisplayLoader;
import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.ydl.ydlcommon.view.dialog.NormalDialog;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.common.tools.RxFileTool;
import com.yidianling.dynamic.DynamicConstants;
import com.yidianling.dynamic.bean.DynamicConstants;
import com.yidianling.dynamic.R;
import com.yidianling.dynamic.adapter.PublishTrendImgAdapter;
import com.yidianling.dynamic.common.browsePictures.BrowsePicturesActivity;
import com.yidianling.dynamic.common.emoji.EmoticonPickerView;
import com.yidianling.dynamic.common.emoji.IEmoticonSelectedListener;
import com.yidianling.dynamic.common.net.DynamicApiUtils;
import com.yidianling.dynamic.common.tool.GlideImageLoader;
import com.yidianling.dynamic.common.tool.ImageCompress;
import com.yidianling.dynamic.model.Command;
import com.yidianling.dynamic.model.PublishTrendResult;
import com.yidianling.dynamic.model.RecommendTrendImage;
import com.ydl.ydlcommon.ui.ParcelableImage;
import com.yidianling.dynamic.publishTrend.PublishTrendActivity;
import com.yidianling.dynamic.publishTrend.SelecTopicActivity;
import com.yidianling.dynamic.router.DynamicIn;
......@@ -125,8 +125,8 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
private String head_dir;//目录
private String head_path;//路径
File head_filec;
private List<RecommendTrendImage> publishTrendImgs, publishTrendImgBrows;
private PublishTrendImgAdapter adapter;
private List<ParcelableImage> publishTrendImgs, publishTrendImgBrows;
private PublishImageAdapter adapter;
String topic_id;
String topic_title;
......@@ -198,7 +198,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
public void initDataAndEventLazy() {
rxPermissions = new RxPermissions(getActivity());
ImagePicker imagePicker = ImagePicker.getInstance();
imagePicker.setImageLoader(new GlideImageLoader()); //设置图片加载器
imagePicker.setImageLoader(new GlideImageDisplayLoader()); //设置图片加载器
imagePicker.setShowCamera(true); //显示拍照按钮
imagePicker.setCrop(true); //允许裁剪(单选才有效)
imagePicker.setSaveRectangle(true); //是否按矩形区域保存
......@@ -259,16 +259,16 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
head_dir = RxFileTool.getStorageDirectory(activity) + "/img/publish_img/";
if (adapter == null) {
adapter = new PublishTrendImgAdapter(publishTrendImgs, activity);
adapter = new PublishImageAdapter(publishTrendImgs, activity);
} else {
adapter.notifyDataSetChanged();
}
publish_trend_img_rcv.setLayoutManager(new GridLayoutManager(activity, 4));
publish_trend_img_rcv.setAdapter(adapter);
adapter.setOnItemClickLister(new PublishTrendImgAdapter.OnItemClickLister() {
adapter.setOnItemClickLister(new PublishImageAdapter.OnItemClickLister() {
@Override
public void onItemClick(View view, int position) {
publishTrendImgBrows = new ArrayList<RecommendTrendImage>();
publishTrendImgBrows = new ArrayList<ParcelableImage>();
publishTrendImgBrows.clear();
publishTrendImgBrows.addAll(publishTrendImgs);
if (publishTrendImgBrows.size() < 9) {
......@@ -304,7 +304,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
});
adapter.setOnDeleteClickLister(new PublishTrendImgAdapter.OnDeleteClickLister() {
adapter.setOnDeleteClickLister(new PublishImageAdapter.OnDeleteClickLister() {
@Override
public void onDeleteClick(View view, int position) {
DeleteImg(position);
......@@ -315,7 +315,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
}
});
adapter.setOnAddClickLister(new PublishTrendImgAdapter.OnAddClickLister() {
adapter.setOnAddClickLister(new PublishImageAdapter.OnAddClickLister() {
@Override
public void OnAddClick(View view, int position) {
if (publishTrendImgs.size() < 9) {
......@@ -517,7 +517,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
if (!"".equals(Test_url) && Test_url != null && !"".equals(Test_cover) && Test_cover != null && !"".equals(Test_title) && Test_title != null) {
PublishO(is_niming, topic_id, content, trend_title, null);
} else {
List<RecommendTrendImage> publishImgs = new ArrayList<RecommendTrendImage>();
List<ParcelableImage> publishImgs = new ArrayList<ParcelableImage>();
publishImgs.addAll(publishTrendImgs);
if (publishTrendImgs.size() < 9 && publishTrendImgs.size() > 1) {
publishImgs.remove(publishImgs.size() - 1);
......@@ -651,13 +651,13 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
* @param publishTrendImgs 图片附件
*/
@SuppressLint("WrongConstant")
private void DealFile(final int is_niming, final String topic_id, final String content, final String trend_title, final List<RecommendTrendImage> publishTrendImgs) {
private void DealFile(final int is_niming, final String topic_id, final String content, final String trend_title, final List<ParcelableImage> publishTrendImgs) {
imgFiles = new ArrayList<File>();
Observable.fromIterable(publishTrendImgs)
.subscribeOn(Schedulers.io())
.map(recommendTrendImage -> {
LogUtil.d("url: " + recommendTrendImage.getImage_url());
return DealFile2(recommendTrendImage.getImage_url(), 1500 / publishTrendImgs.size());
.map(parcelableImage -> {
LogUtil.d("url: " + parcelableImage.getImage_url());
return DealFile2(parcelableImage.getImage_url(), 1500 / publishTrendImgs.size());
})
.subscribe(file -> {
if (file != null) {
......@@ -830,7 +830,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
Bundle bundle = data.getBundleExtra("bundle");
publishTrendImgs = bundle.getParcelableArrayList("publish_img");
if (publishTrendImgs.size() > 0) {
publishTrendImgs.add(new RecommendTrendImage("default"));
publishTrendImgs.add(new ParcelableImage("default"));
}
adapter.updateDate(publishTrendImgs);
}
......@@ -865,11 +865,11 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
* 添加照片
*/
private void AddImag(String pic_path) {
RecommendTrendImage trendImage = new RecommendTrendImage(pic_path);
ParcelableImage trendImage = new ParcelableImage(pic_path);
if (publishTrendImgs.size() < 9 && publishTrendImgs.size() > 0) {
publishTrendImgs.add(publishTrendImgs.size() - 1, trendImage);
} else if (publishTrendImgs.size() == 0) {
publishTrendImgs.add(new RecommendTrendImage("default"));
publishTrendImgs.add(new ParcelableImage("default"));
publishTrendImgs.add(publishTrendImgs.size() - 1, trendImage);
} else {
publishTrendImgs.remove(8);
......@@ -970,7 +970,7 @@ public class PublishQuestionAndTrendFragment extends BaseFragment implements Vie
publishTrendImgs.remove(position);
} else {
publishTrendImgs.remove(position);
publishTrendImgs.add(8, new RecommendTrendImage("default"));
publishTrendImgs.add(8, new ParcelableImage("default"));
}
}
......
package com.yidianling.dynamic.adapter;
package com.ydl.ydlcommon.adapter.custom;
import android.content.Context;
import android.net.Uri;
......@@ -13,20 +13,16 @@ import android.widget.ImageView;
import com.miracle.view.imageeditor.utils.FileUtils;
import com.ydl.ydl_image.module.GlideApp;
import com.ydl.ydl_image.transform.GlideRoundTransform;
import com.yidianling.dynamic.R;
import com.yidianling.dynamic.model.RecommendTrendImage;
import com.ydl.ydlcommon.R;
import com.ydl.ydlcommon.ui.ParcelableImage;
import java.util.List;
/**
* Created by xiongyu on 2017/3/17.
*/
public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImgViewHolder> {
public class PublishImageAdapter extends RecyclerView.Adapter<PublishImageViewHolder> {
private static final String TAG = "RecommendTrendImgAdapte";
protected Context mContext;
protected List<RecommendTrendImage> mDatas;
protected List<ParcelableImage> mDatas;
protected LayoutInflater mInflater;
public interface OnItemClickLister {
......@@ -63,24 +59,24 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
this.mOnAddClickLister = lister;
}
public PublishTrendImgAdapter(List<RecommendTrendImage> mDatas, Context mContext) {
public PublishImageAdapter(List<ParcelableImage> mDatas, Context mContext) {
this.mContext = mContext;
this.mDatas = mDatas;
mInflater = LayoutInflater.from(mContext);
}
@Override
public PublishTrendImgViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public PublishImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = null;
view = mInflater.inflate(R.layout.dynamic_item_publish_trend_img, parent, false);
PublishTrendImgViewHolder viewHolder = new PublishTrendImgViewHolder(view);
view = mInflater.inflate(R.layout.platform_item_publish_img, parent, false);
PublishImageViewHolder viewHolder = new PublishImageViewHolder(view);
return viewHolder;
}
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onBindViewHolder(PublishTrendImgViewHolder holder, final int position) {
RecommendTrendImage trendImage = mDatas.get(position);
public void onBindViewHolder(PublishImageViewHolder holder, final int position) {
ParcelableImage trendImage = mDatas.get(position);
String path = trendImage.getImage_url();
if ("default".equals(path)) {
......@@ -94,7 +90,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
Uri uriByPath = FileUtils.INSTANCE.getUriByPath(mContext, path);
GlideApp.with(mContext)
.load(uriByPath)
.error(R.drawable.dynamic_default_img)
.error(R.drawable.platform_default_img)
.transform(new GlideRoundTransform(mContext, 6))
// .centerCrop()
.into(holder.item_publish_iv);
......@@ -111,7 +107,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
}
public void updateDate(List<RecommendTrendImage> mDatas) {
public void updateDate(List<ParcelableImage> mDatas) {
this.mDatas = mDatas;
notifyDataSetChanged();
}
......@@ -122,7 +118,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
* @param pos 数据添加的位置
* @param trendImage 数据
*/
public void addData(int pos, RecommendTrendImage trendImage) {
public void addData(int pos, ParcelableImage trendImage) {
mDatas.add(trendImage);
notifyItemInserted(pos);
}
......@@ -142,7 +138,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
*
* @param holder
*/
protected void setUpItemEvent(final PublishTrendImgViewHolder holder) {
protected void setUpItemEvent(final PublishImageViewHolder holder) {
if (mOnItemClickLister != null) {
holder.item_publish_iv.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -168,7 +164,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
*
* @param holder
*/
protected void setUpDeleteEvent(final PublishTrendImgViewHolder holder) {
protected void setUpDeleteEvent(final PublishImageViewHolder holder) {
if (mOnItemClickLister != null) {
holder.item_publish_cancel_iv.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -194,7 +190,7 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
*
* @param holder
*/
protected void setUpAddEvent(final PublishTrendImgViewHolder holder) {
protected void setUpAddEvent(final PublishImageViewHolder holder) {
if (mOnAddClickLister != null) {
holder.bg_iv.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -218,10 +214,10 @@ public class PublishTrendImgAdapter extends RecyclerView.Adapter<PublishTrendImg
}
class PublishTrendImgViewHolder extends RecyclerView.ViewHolder {
class PublishImageViewHolder extends RecyclerView.ViewHolder {
ImageView item_publish_iv, item_publish_cancel_iv, bg_iv;
public PublishTrendImgViewHolder(View itemView) {
public PublishImageViewHolder(View itemView) {
super(itemView);
bg_iv = (ImageView) itemView.findViewById(R.id.item_publish_defult_iv);
item_publish_iv = (ImageView) itemView.findViewById(R.id.item_publish_iv);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment