修改帮助反馈的UI
This commit is contained in:
parent
d4d191fad6
commit
34e4765e13
@ -0,0 +1,112 @@
|
|||||||
|
package com.yunbao.common.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cxf on 2018/11/28.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ImagePreviewAdapter extends RecyclerView.Adapter<ImagePreviewAdapter.Vh> {
|
||||||
|
|
||||||
|
private LayoutInflater mInflater;
|
||||||
|
private ActionListener mActionListener;
|
||||||
|
private int mPageCount;
|
||||||
|
private LinearLayoutManager mLayoutManager;
|
||||||
|
private int mCurPosition;
|
||||||
|
|
||||||
|
public ImagePreviewAdapter(Context context, int pageCount) {
|
||||||
|
mPageCount = pageCount;
|
||||||
|
mInflater = LayoutInflater.from(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
|
return new Vh(mInflater.inflate(R.layout.item_preview_img, parent, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||||
|
vh.setData(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mPageCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Vh extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
|
ImageView mImg;
|
||||||
|
|
||||||
|
public Vh(View itemView) {
|
||||||
|
super(itemView);
|
||||||
|
mImg = (ImageView) itemView;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setData(int position) {
|
||||||
|
if (mActionListener != null) {
|
||||||
|
mActionListener.loadImage(mImg, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActionListener(ActionListener actionListener) {
|
||||||
|
mActionListener = actionListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurPosition(int curPosition) {
|
||||||
|
mCurPosition = curPosition;
|
||||||
|
if (mActionListener != null) {
|
||||||
|
mActionListener.onPageChanged(curPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurPosition(){
|
||||||
|
return mCurPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
||||||
|
super.onAttachedToRecyclerView(recyclerView);
|
||||||
|
mLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||||
|
PagerSnapHelper pagerSnapHelper = new PagerSnapHelper();
|
||||||
|
pagerSnapHelper.attachToRecyclerView(recyclerView);
|
||||||
|
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
|
||||||
|
if (position >= 0 && mCurPosition != position) {
|
||||||
|
mCurPosition = position;
|
||||||
|
if (mActionListener != null) {
|
||||||
|
mActionListener.onPageChanged(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface ActionListener {
|
||||||
|
void onPageChanged(int position);
|
||||||
|
|
||||||
|
void loadImage(ImageView imageView, int position);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,160 @@
|
|||||||
|
package com.yunbao.common.dialog;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.ValueAnimator;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.adapter.ImagePreviewAdapter;
|
||||||
|
import com.yunbao.common.utils.StringUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Martin on 2024/3/15.
|
||||||
|
* 图片预览弹窗
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ImagePreviewDialog extends AbsDialogFragment implements View.OnClickListener {
|
||||||
|
|
||||||
|
private View mBg;
|
||||||
|
private RecyclerView mRecyclerView;
|
||||||
|
private ValueAnimator mAnimator;
|
||||||
|
private int mPosition;
|
||||||
|
private int mPageCount;
|
||||||
|
private ActionListener mActionListener;
|
||||||
|
private TextView mCount;
|
||||||
|
private ImagePreviewAdapter mAdapter;
|
||||||
|
private boolean mNeedDelete;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.view_preview_image;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDialogStyle() {
|
||||||
|
return R.style.dialog2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean canCancel() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setWindowAttributes(Window window) {
|
||||||
|
WindowManager.LayoutParams params = window.getAttributes();
|
||||||
|
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
params.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||||
|
window.setAttributes(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
mBg = mRootView.findViewById(R.id.bg);
|
||||||
|
mCount = (TextView) findViewById(R.id.count);
|
||||||
|
findViewById(R.id.btn_close).setOnClickListener(this);
|
||||||
|
if (mNeedDelete) {
|
||||||
|
View btnDelete = findViewById(R.id.btn_delete);
|
||||||
|
btnDelete.setVisibility(View.VISIBLE);
|
||||||
|
btnDelete.setOnClickListener(this);
|
||||||
|
}
|
||||||
|
mRecyclerView = mRootView.findViewById(R.id.recyclerView);
|
||||||
|
mRecyclerView.setHasFixedSize(true);
|
||||||
|
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
||||||
|
mAnimator = ValueAnimator.ofFloat(0, 1);
|
||||||
|
mAnimator.setDuration(150);
|
||||||
|
mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||||
|
mAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationUpdate(ValueAnimator animation) {
|
||||||
|
float v = (float) animation.getAnimatedValue();
|
||||||
|
mBg.setAlpha(v);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mAnimator.addListener(new AnimatorListenerAdapter() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
if (mRecyclerView != null && mPageCount > 0) {
|
||||||
|
ImagePreviewAdapter adapter = new ImagePreviewAdapter(mContext, mPageCount);
|
||||||
|
mAdapter = adapter;
|
||||||
|
adapter.setActionListener(new ImagePreviewAdapter.ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onPageChanged(int position) {
|
||||||
|
if (mCount != null) {
|
||||||
|
mCount.setText(StringUtil.contact(String.valueOf(position + 1), "/", String.valueOf(mPageCount)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadImage(ImageView imageView, int position) {
|
||||||
|
if (mActionListener != null) {
|
||||||
|
mActionListener.loadImage(imageView, position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mRecyclerView.setAdapter(adapter);
|
||||||
|
if (mPosition >= 0 && mPosition < mPageCount) {
|
||||||
|
adapter.setCurPosition(mPosition);
|
||||||
|
mRecyclerView.scrollToPosition(mPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mAnimator.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImageInfo(int pageCount, int position, boolean needDelete, ActionListener actionListener) {
|
||||||
|
mActionListener = actionListener;
|
||||||
|
mPageCount = pageCount;
|
||||||
|
mPosition = position;
|
||||||
|
mNeedDelete = needDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
if (mAnimator != null) {
|
||||||
|
mAnimator.cancel();
|
||||||
|
}
|
||||||
|
mContext = null;
|
||||||
|
mActionListener = null;
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int i = v.getId();
|
||||||
|
if (i == R.id.btn_close) {
|
||||||
|
dismiss();
|
||||||
|
} else if (i == R.id.btn_delete) {
|
||||||
|
delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void delete() {
|
||||||
|
if (mAdapter != null && mActionListener != null) {
|
||||||
|
mActionListener.onDeleteClick(mAdapter.getCurPosition());
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ActionListener {
|
||||||
|
void loadImage(ImageView imageView, int position);
|
||||||
|
|
||||||
|
void onDeleteClick(int position);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1206,4 +1206,8 @@ public interface PDLiveApi {
|
|||||||
|
|
||||||
@GET("/api/public/?service=User.userFeedback")
|
@GET("/api/public/?service=User.userFeedback")
|
||||||
Observable<ResponseModel<List<BaseModel>>> feedback(@Query("problem_description") String content, @Query("problem_image") String images, @Query("contact_information") String ci);
|
Observable<ResponseModel<List<BaseModel>>> feedback(@Query("problem_description") String content, @Query("problem_image") String images, @Query("contact_information") String ci);
|
||||||
|
|
||||||
|
|
||||||
|
@GET("/api/public/?service=User.userFeedbackRestrict")
|
||||||
|
Observable<ResponseModel<List<BaseModel>>> checkFeedback();
|
||||||
}
|
}
|
||||||
|
@ -3219,6 +3219,32 @@ public class LiveNetManager {
|
|||||||
}).isDisposed();
|
}).isDisposed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkFeedback(
|
||||||
|
HttpCallback<HttpCallbackModel> callback) {
|
||||||
|
API.get().pdLiveApi(mContext)
|
||||||
|
.checkFeedback()
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new Consumer<ResponseModel<List<BaseModel>>>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ResponseModel<List<BaseModel>> responseModel) {
|
||||||
|
if (callback != null) {
|
||||||
|
HttpCallbackModel model = new HttpCallbackModel();
|
||||||
|
model.setCode(responseModel.getData().getCode());
|
||||||
|
model.setMsg(responseModel.getData().getMsg());
|
||||||
|
callback.onSuccess(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, new Consumer<Throwable>() {
|
||||||
|
@Override
|
||||||
|
public void accept(Throwable throwable) throws Exception {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.onError(mContext.getString(com.yunbao.common.R.string.net_error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).isDisposed();
|
||||||
|
}
|
||||||
|
|
||||||
private MultipartBody.Part createUploadFile(File file) {
|
private MultipartBody.Part createUploadFile(File file) {
|
||||||
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file);
|
||||||
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
return MultipartBody.Part.createFormData("file", file.getName(), requestBody);
|
||||||
|
8
common/src/main/res/layout/item_preview_img.xml
Normal file
8
common/src/main/res/layout/item_preview_img.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<ImageView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:background="#000"
|
||||||
|
/>
|
78
common/src/main/res/layout/view_preview_image.xml
Normal file
78
common/src/main/res/layout/view_preview_image.xml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/bg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:alpha="0"
|
||||||
|
android:background="#000" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/titleView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/preview"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/btn_close"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:padding="9dp"
|
||||||
|
android:src="@mipmap/icon_back"
|
||||||
|
app:tint="@color/white" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/count"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical|right"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:padding="5dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="40dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_delete"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="#000"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/delete"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
@ -2,8 +2,11 @@ package com.yunbao.main.activity;
|
|||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
|
import com.yunbao.common.bean.HttpCallbackModel;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
import com.yunbao.common.utils.RouteUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.utils.WordUtil;
|
import com.yunbao.common.utils.WordUtil;
|
||||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
@ -41,7 +44,23 @@ public class FeedbackActivity extends AbsActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onViewClicks() {
|
public void onViewClicks() {
|
||||||
//TODO 意见反馈
|
//TODO 意见反馈
|
||||||
|
LiveNetManager.get(mContext)
|
||||||
|
.checkFeedback(new com.yunbao.common.http.base.HttpCallback<HttpCallbackModel>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(HttpCallbackModel data) {
|
||||||
|
if (data.getCode() == 0) {
|
||||||
RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_EDIT_ACTIVITY);
|
RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_EDIT_ACTIVITY);
|
||||||
|
} else {
|
||||||
|
ToastUtil.show(R.string.activity_feedback_edit_submit_tip3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
ToastUtil.show(error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.yunbao.common.activity.AbsActivity;
|
import com.yunbao.common.activity.AbsActivity;
|
||||||
import com.yunbao.common.bean.HttpCallbackModel;
|
import com.yunbao.common.bean.HttpCallbackModel;
|
||||||
|
import com.yunbao.common.dialog.ImagePreviewDialog;
|
||||||
import com.yunbao.common.glide.ImgLoader;
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
import com.yunbao.common.http.base.HttpCallback;
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
@ -42,6 +43,8 @@ public class FeedbackEditActivity extends AbsActivity {
|
|||||||
ProcessImageUtil imageUtil;
|
ProcessImageUtil imageUtil;
|
||||||
Dialog loadingDialog = null;
|
Dialog loadingDialog = null;
|
||||||
int clickImage = 0;
|
int clickImage = 0;
|
||||||
|
View img1Layout, img2Layout, img3Layout;
|
||||||
|
View img1Del, img2Del, img3Del;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getLayoutId() {
|
protected int getLayoutId() {
|
||||||
@ -79,46 +82,40 @@ public class FeedbackEditActivity extends AbsActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(img1, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(img1, () -> {
|
||||||
@Override
|
clickImage = 101;
|
||||||
public void onViewClicks() {
|
|
||||||
SparseArray<String> list;
|
|
||||||
if (img1.getTag() == null) {
|
if (img1.getTag() == null) {
|
||||||
list = getImageType1(100);
|
uploadImage(img1);
|
||||||
} else {
|
} else {
|
||||||
list = getImageType2(110);
|
showImage(img1);
|
||||||
}
|
|
||||||
showUploadImage(list);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(img2, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(img2, () -> {
|
||||||
@Override
|
clickImage = 201;
|
||||||
public void onViewClicks() {
|
|
||||||
SparseArray<String> list;
|
|
||||||
if (img2.getTag() == null) {
|
if (img2.getTag() == null) {
|
||||||
list = getImageType1(200);
|
uploadImage(img2);
|
||||||
} else {
|
} else {
|
||||||
list = getImageType2(210);
|
showImage(img2);
|
||||||
}
|
|
||||||
showUploadImage(list);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(img3, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(img3, () -> {
|
||||||
@Override
|
clickImage = 301;
|
||||||
public void onViewClicks() {
|
|
||||||
SparseArray<String> list;
|
|
||||||
if (img3.getTag() == null) {
|
if (img3.getTag() == null) {
|
||||||
list = getImageType1(300);
|
uploadImage(img3);
|
||||||
} else {
|
} else {
|
||||||
list = getImageType2(310);
|
showImage(img3);
|
||||||
}
|
|
||||||
showUploadImage(list);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(submit, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(img1Del, () -> {
|
||||||
@Override
|
deleteImage(1);
|
||||||
public void onViewClicks() {
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(img2Del, () -> {
|
||||||
|
deleteImage(2);
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(img3Del, () -> {
|
||||||
|
deleteImage(3);
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(submit, () -> {
|
||||||
if (feedbackEdit.getText().length() == 0) {
|
if (feedbackEdit.getText().length() == 0) {
|
||||||
ToastUtil.show(R.string.activity_feedback_edit_submit_tip1);
|
ToastUtil.show(R.string.activity_feedback_edit_submit_tip1);
|
||||||
return;
|
return;
|
||||||
@ -151,28 +148,18 @@ public class FeedbackEditActivity extends AbsActivity {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
img1.setOnLongClickListener(new View.OnLongClickListener() {
|
img1.setOnLongClickListener(view -> {
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View view) {
|
|
||||||
ToastUtil.show("1");
|
ToastUtil.show("1");
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
img2.setOnLongClickListener(new View.OnLongClickListener() {
|
img2.setOnLongClickListener(view -> {
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View view) {
|
|
||||||
ToastUtil.show("2");
|
ToastUtil.show("2");
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
img3.setOnLongClickListener(new View.OnLongClickListener() {
|
img3.setOnLongClickListener(view -> {
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View view) {
|
|
||||||
ToastUtil.show("3");
|
ToastUtil.show("3");
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
});
|
});
|
||||||
imageUtil.setImageResultCallback(new ImageResultCallback() {
|
imageUtil.setImageResultCallback(new ImageResultCallback() {
|
||||||
|
|
||||||
@ -190,29 +177,23 @@ public class FeedbackEditActivity extends AbsActivity {
|
|||||||
switch (clickImage) {
|
switch (clickImage) {
|
||||||
case 101:
|
case 101:
|
||||||
case 112:
|
case 112:
|
||||||
ImgLoader.display(mContext, bean, img1);
|
setShowImage(img1,img1Del,bean);
|
||||||
img1.setTag(bean);
|
|
||||||
if (img2.getTag() == null) {
|
if (img2.getTag() == null) {
|
||||||
img2.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
setDefImage(img2, img2Del, img2Layout);
|
||||||
img2.setVisibility(View.VISIBLE);
|
|
||||||
} else if (img3.getTag() == null) {
|
} else if (img3.getTag() == null) {
|
||||||
img3.setVisibility(View.VISIBLE);
|
setDefImage(img3, img3Del, img3Layout);
|
||||||
img3.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 201:
|
case 201:
|
||||||
case 212:
|
case 212:
|
||||||
ImgLoader.display(mContext, bean, img2);
|
setShowImage(img2,img2Del,bean);
|
||||||
img2.setTag(bean);
|
|
||||||
if (img3.getTag() == null) {
|
if (img3.getTag() == null) {
|
||||||
img3.setVisibility(View.VISIBLE);
|
setDefImage(img3, img3Del, img3Layout);
|
||||||
img3.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 301:
|
case 301:
|
||||||
case 312:
|
case 312:
|
||||||
ImgLoader.display(mContext, bean, img3);
|
setShowImage(img3,img3Del,bean);
|
||||||
img3.setTag(bean);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,6 +211,22 @@ public class FeedbackEditActivity extends AbsActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showImage(ImageView iv) {
|
||||||
|
ImagePreviewDialog dialog = new ImagePreviewDialog();
|
||||||
|
dialog.setImageInfo(1, 1, false, new ImagePreviewDialog.ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void loadImage(ImageView imageView, int position) {
|
||||||
|
ImgLoader.display(mContext, (String) iv.getTag(), imageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeleteClick(int position) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void showUploadImage(SparseArray<String> list) {
|
private void showUploadImage(SparseArray<String> list) {
|
||||||
DialogUitl.showStringArrayDialog(mContext, list, new DialogUitl.StringArrayDialogCallback() {
|
DialogUitl.showStringArrayDialog(mContext, list, new DialogUitl.StringArrayDialogCallback() {
|
||||||
@Override
|
@Override
|
||||||
@ -286,41 +283,50 @@ public class FeedbackEditActivity extends AbsActivity {
|
|||||||
if (img3.getTag() != null) {
|
if (img3.getTag() != null) {
|
||||||
img2.setTag(img3.getTag());
|
img2.setTag(img3.getTag());
|
||||||
ImgLoader.display(mContext, (String) img2.getTag(), img2);
|
ImgLoader.display(mContext, (String) img2.getTag(), img2);
|
||||||
img3.setTag(null);
|
setDefImage(img3, img3Del, img3Layout);
|
||||||
img3.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
|
||||||
} else {
|
} else {
|
||||||
img2.setTag(null);
|
setDefImage(img2, img2Del, img2Layout);
|
||||||
img2.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
setGoneImage(img3, img3Del, img3Layout);
|
||||||
img3.setTag(null);
|
|
||||||
img3.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
img1.setTag(null);
|
setDefImage(img1, img1Del, img1Layout);
|
||||||
img1.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
setGoneImage(img2, img2Del, img2Layout);
|
||||||
img2.setTag(null);
|
setGoneImage(img3, img3Del, img3Layout);
|
||||||
img2.setVisibility(View.GONE);
|
|
||||||
img3.setTag(null);
|
|
||||||
img3.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
} else if (index == 2) {
|
} else if (index == 2) {
|
||||||
if (img3.getTag() != null) {
|
if (img3.getTag() != null) {
|
||||||
img2.setTag(img3.getTag());
|
img2.setTag(img3.getTag());
|
||||||
ImgLoader.display(mContext, (String) img2.getTag(), img2);
|
ImgLoader.display(mContext, (String) img2.getTag(), img2);
|
||||||
img3.setTag(null);
|
setDefImage(img3, img3Del, img3Layout);
|
||||||
img3.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
|
||||||
} else {
|
} else {
|
||||||
img2.setTag(null);
|
setDefImage(img2, img2Del, img2Layout);
|
||||||
img2.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
setGoneImage(img3, img3Del, img3Layout);
|
||||||
img3.setTag(null);
|
|
||||||
img3.setVisibility(View.GONE);
|
|
||||||
}
|
}
|
||||||
} else if (index == 3) {
|
} else if (index == 3) {
|
||||||
img3.setTag(null);
|
setDefImage(img3, img3Del, img3Layout);
|
||||||
img3.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setDefImage(ImageView iv, View ivDel, View ivLayout) {
|
||||||
|
iv.setTag(null);
|
||||||
|
ivDel.setVisibility(View.GONE);
|
||||||
|
iv.setImageResource(R.mipmap.icon_activity_feedback_edit_img_add);
|
||||||
|
ivLayout.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGoneImage(ImageView iv, View ivDel, View ivLayout) {
|
||||||
|
iv.setTag(null);
|
||||||
|
ivDel.setVisibility(View.GONE);
|
||||||
|
ivLayout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setShowImage(ImageView iv, View ivDel, String url) {
|
||||||
|
iv.setTag(url);
|
||||||
|
ImgLoader.display(mContext, url, iv);
|
||||||
|
ivDel.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
private void changeImage(ImageView imageView) {
|
private void changeImage(ImageView imageView) {
|
||||||
uploadImage(imageView);
|
uploadImage(imageView);
|
||||||
}
|
}
|
||||||
@ -344,6 +350,12 @@ public class FeedbackEditActivity extends AbsActivity {
|
|||||||
img1 = findViewById(R.id.img1);
|
img1 = findViewById(R.id.img1);
|
||||||
img2 = findViewById(R.id.img2);
|
img2 = findViewById(R.id.img2);
|
||||||
img3 = findViewById(R.id.img3);
|
img3 = findViewById(R.id.img3);
|
||||||
|
img1Layout = findViewById(R.id.img1Layout);
|
||||||
|
img2Layout = findViewById(R.id.img2Layout);
|
||||||
|
img3Layout = findViewById(R.id.img3Layout);
|
||||||
|
img1Del = findViewById(R.id.img1_del);
|
||||||
|
img2Del = findViewById(R.id.img2_del);
|
||||||
|
img3Del = findViewById(R.id.img3_del);
|
||||||
submit = findViewById(R.id.btn_sub);
|
submit = findViewById(R.id.btn_sub);
|
||||||
editNumber = findViewById(R.id.tv_number);
|
editNumber = findViewById(R.id.tv_number);
|
||||||
editNumber.setTextColor(Color.parseColor("#333333"));
|
editNumber.setTextColor(Color.parseColor("#333333"));
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#FFFFFF"
|
android:background="#FFFFFF">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/include4"
|
android:id="@+id/include4"
|
||||||
layout="@layout/view_title" />
|
layout="@layout/view_title" />
|
||||||
@ -77,16 +82,15 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="0"
|
android:text="0"
|
||||||
android:textColor="#333333"
|
android:textColor="#333333" />
|
||||||
/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_max"
|
android:id="@+id/tv_max"
|
||||||
android:textColor="#333333"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="/500" />
|
android:text="/500"
|
||||||
|
android:textColor="#333333" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@ -107,33 +111,88 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="15dp"
|
android:layout_marginStart="15dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="10dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/img1Layout"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="105dp"
|
||||||
|
android:layout_marginEnd="10dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img1"
|
android:id="@+id/img1"
|
||||||
android:layout_marginEnd="15dp"
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:src="@mipmap/icon_activity_feedback_edit_img_add"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img1_del"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:src="@mipmap/icon_activity_feedback_edit_img_add" />
|
android:src="@mipmap/ic_feedback_edit_image_del"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/img2Layout"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="105dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img2"
|
android:id="@+id/img2"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:src="@mipmap/icon_activity_feedback_edit_img_add"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img2_del"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="15dp"
|
android:src="@mipmap/ic_feedback_edit_image_del"
|
||||||
android:src="@mipmap/icon_activity_feedback_edit_img_add"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/img3Layout"
|
||||||
|
android:layout_width="105dp"
|
||||||
|
android:layout_height="105dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/img3"
|
android:id="@+id/img3"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:src="@mipmap/icon_activity_feedback_edit_img_add"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/img3_del"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="15dp"
|
android:src="@mipmap/ic_feedback_edit_image_del"
|
||||||
android:src="@mipmap/icon_activity_feedback_edit_img_add"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -175,6 +234,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginTop="11dp"
|
android:layout_marginTop="11dp"
|
||||||
|
android:layout_marginBottom="130dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
@ -194,5 +254,5 @@
|
|||||||
android:textColor="#FF5656"
|
android:textColor="#FF5656"
|
||||||
android:textSize="11sp" />
|
android:textSize="11sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
BIN
main/src/main/res/mipmap-xxhdpi/ic_feedback_edit_image_del.png
Normal file
BIN
main/src/main/res/mipmap-xxhdpi/ic_feedback_edit_image_del.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue
Block a user