From 1f12187766b96691a0959f4cf157158c0e20d9e4 Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Fri, 26 Apr 2024 10:08:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=B5=8B=E8=AF=95=E5=8F=8D?= =?UTF-8?q?=E9=A6=88=E4=BF=AE=E6=94=B9=E5=B8=AE=E5=8A=A9=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E6=96=B0=E5=A2=9E=E5=B0=8F=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E8=B7=B3=E4=B8=80=E8=B7=B3=E5=9B=9E=E8=A1=80=E5=92=8C?= =?UTF-8?q?=E5=BF=85=E4=B8=AD=E7=9A=84=E5=9B=9E=E8=B0=83=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=85=B3=E9=97=AD=E5=8F=91=E7=BA=A2=E5=8C=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=90=8E=E8=87=AA=E5=8A=A8=E6=89=93=E5=BC=80=E7=A4=BC?= =?UTF-8?q?=E7=89=A9=E6=A0=8F=E7=9A=84=E5=8A=9F=E8=83=BD=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=B0=8F=E6=B8=B8=E6=88=8F=E8=B7=B3=E4=B8=80=E8=B7=B3?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E9=98=B2=E6=8A=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunbao/common/http/CommonHttpUtil.java | 2 +- .../com/yunbao/common/http/PDLiveApi.java | 22 ++++++ .../common/http/live/LiveNetManager.java | 37 +++++++++- .../interfaces/ImageResultCallback.java | 2 +- .../yunbao/common/sud/BaseGameViewModel.java | 5 +- .../sud/decorator/SudFSMMGDecorator.java | 26 ++++++- .../sud/decorator/SudFSMMGListener.java | 9 ++- .../common/sud/decorator/game/JumpEvent.java | 47 +++++++++++++ .../common/sud/state/SudMGPMGState.java | 4 ++ .../yunbao/common/utils/ProcessImageUtil.java | 23 ++++--- config.gradle | 2 +- .../live/dialog/SendRendPacketPopup.java | 24 +++++++ .../main/activity/FeedbackActivity.java | 15 ++++ .../main/activity/FeedbackEditActivity.java | 68 ++++++++++++++----- .../yunbao/main/activity/SettingActivity.java | 13 ++-- .../yunbao/main/views/MainMeViewHolder.java | 2 +- .../src/main/res/layout/activity_feedback.xml | 1 + .../res/layout/activity_feedback_edit.xml | 15 ++-- main/src/main/res/values-zh/strings.xml | 2 + main/src/main/res/values/strings.xml | 2 + 20 files changed, 271 insertions(+), 50 deletions(-) create mode 100644 common/src/main/java/com/yunbao/common/sud/decorator/game/JumpEvent.java diff --git a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java index c4444841e..50237cf73 100644 --- a/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java +++ b/common/src/main/java/com/yunbao/common/http/CommonHttpUtil.java @@ -454,7 +454,7 @@ public class CommonHttpUtil { * 上传文件 获取七牛云token的接口 */ public static void getUploadQiNiuToken(HttpCallback callback, boolean isImg) { - HttpClient.getInstance().get("Pdluserhome.getQiNiuToken", "Pdluserhome.getQiNiuToken") + HttpClient.getInstance().get("Pdluserhome.getQiNiuToken2", "Pdluserhome.getQiNiuToken2") .params("uid", CommonAppConfig.getInstance().getUid()) .params("token", CommonAppConfig.getInstance().getToken()) .params("ext", isImg ? ".jpeg" : ".mp4") diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 2a981f8fc..f9396488f 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1210,4 +1210,26 @@ public interface PDLiveApi { @GET("/api/public/?service=User.userFeedbackRestrict") Observable>> checkFeedback(); + + /** + * + * @param roomId 房间ID + * @param cmd 事件名称 生命值:addHeart 自动跳:hit + * @param value 价格 + * @param gameId 游戏ID + * @param fromUid 付费用户uid + * @param toUid 目标用户uid + * @param payload 附加值 + * @return + */ + @GET("/api/public/?service=Sudgameserver.createOrder") + Observable>> createGameOrder( + @Query("room_id")String roomId, + @Query("cmd")String cmd, + @Query("value")String value, + @Query("mg_id")String gameId, + @Query("from_uid")String fromUid, + @Query("to_uid")String toUid, + @Query("payload")String payload + ); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 9448c17c8..c781e647d 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -95,6 +95,7 @@ import io.reactivex.schedulers.Schedulers; import okhttp3.MediaType; import okhttp3.MultipartBody; import okhttp3.RequestBody; +import retrofit2.http.Query; /** @@ -3220,7 +3221,7 @@ public class LiveNetManager { } public void checkFeedback( - HttpCallback callback) { + HttpCallback callback) { API.get().pdLiveApi(mContext) .checkFeedback() .subscribeOn(Schedulers.io()) @@ -3245,6 +3246,40 @@ public class LiveNetManager { }).isDisposed(); } + public void createGameOrder( + String roomId, + String cmd, + String value, + String gameId, + String fromUid, + String toUid, + String roundId, + String payload + , HttpCallback callback) { + API.get().pdLiveApi(mContext) + .createGameOrder(roomId, cmd, value, gameId, fromUid, toUid,payload) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(new Consumer>>() { + @Override + public void accept(ResponseModel> responseModel) { + if (callback != null) { + HttpCallbackModel model = new HttpCallbackModel(); + model.setCode(responseModel.getData().getCode()); + model.setMsg(responseModel.getData().getMsg()); + callback.onSuccess(model); + } + } + }, new Consumer() { + @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) { RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); return MultipartBody.Part.createFormData("file", file.getName(), requestBody); diff --git a/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java b/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java index 9615ffbe2..f3a34309c 100644 --- a/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java +++ b/common/src/main/java/com/yunbao/common/interfaces/ImageResultCallback.java @@ -47,7 +47,7 @@ public abstract class ImageResultCallback { UploadQnImpl mUploadStrategy = new UploadQnImpl(mContext); List beans = new ArrayList<>(); beans.add(new UploadBean(file, UploadBean.IMG)); - mUploadStrategy.upload(beans, false, new UploadCallback() { + mUploadStrategy.upload(beans, true, new UploadCallback() { @Override public void onFinish(List list, boolean success) { if (success) { diff --git a/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java b/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java index 141e829f4..589fee469 100644 --- a/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java +++ b/common/src/main/java/com/yunbao/common/sud/BaseGameViewModel.java @@ -142,7 +142,10 @@ public abstract class BaseGameViewModel implements SudFSMMGListener { // 给装饰类设置回调 sudFSMMGDecorator.setSudFSMMGListener(this); - + sudFSMMGDecorator.setGameId(gameId); + sudFSMMGDecorator.setRoomId(gameRoomId); + sudFSMMGDecorator.setUserId(getUserId()); + Log.i("游戏回调",code+" "+gameId+" "+gameRoomId+" "); // 调用游戏sdk加载游戏 ISudFSTAPP iSudFSTAPP = SudMGP.loadMG(activity, getUserId(), gameRoomId, code, gameId, getLanguageCode(), sudFSMMGDecorator); diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java index a52a68409..010d7c2f7 100644 --- a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGDecorator.java @@ -23,6 +23,10 @@ import tech.sud.mgp.core.ISudFSMStateHandle; */ public class SudFSMMGDecorator implements ISudFSMMG { + private static final String TAG = "游戏回调"; + private long gameId; + private String gameRoomId; + private String userId; // 回调 private SudFSMMGListener sudFSMMGListener; @@ -227,10 +231,10 @@ public class SudFSMMGDecorator implements ISudFSMMG { } break; case SudMGPMGState.MG_COMMON_GAME_STATE: // 10. 游戏状态 - Log.e("onGameStateChange", "mg_common_game_state:::::" + "dataJson:::::"+dataJson); + Log.e("onGameStateChange", "mg_common_game_state:::::" + "dataJson:::::" + dataJson); SudMGPMGState.MGCommonGameState mgCommonGameState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameState.class); sudFSMMGCache.onGameMGCommonGameState(mgCommonGameState); - if (mgCommonGameState.gameState==2){ + if (mgCommonGameState.gameState == 2) { Bus.get().post(new CheckRemainingBalanceEvent().setSudMGPMGState(SudMGPMGState.MG_COMMON_GAME_STATE)); } if (listener == null) { @@ -354,6 +358,13 @@ public class SudFSMMGDecorator implements ISudFSMMG { break; case SudMGPMGState.MG_COMMON_GAME_CREATE_ORDER: // 25. 创建订单 SudMGPMGState.MGCommonGameCreateOrder mgCommonGameCreateOrder = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameCreateOrder.class); + if (mgCommonGameCreateOrder != null) { + mgCommonGameCreateOrder.gameId = gameId; + mgCommonGameCreateOrder.gameRoomId = gameRoomId; + mgCommonGameCreateOrder.userId = userId; + } + + Log.i(TAG, "onGameStateChange: " + dataJson); if (listener == null) { ISudFSMStateHandleUtils.handleSuccess(handle); } else { @@ -1021,4 +1032,15 @@ public class SudFSMMGDecorator implements ISudFSMMG { return sudFSMMGCache; } + public void setGameId(long gameId) { + this.gameId = gameId; + } + + public void setRoomId(String gameRoomId) { + this.gameRoomId = gameRoomId; + } + + public void setUserId(String userId) { + this.userId = userId; + } } diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java index 8b6da8ba1..2bc23c6e9 100644 --- a/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java +++ b/common/src/main/java/com/yunbao/common/sud/decorator/SudFSMMGListener.java @@ -5,6 +5,7 @@ package com.yunbao.common.sud.decorator; +import com.yunbao.common.sud.decorator.game.JumpEvent; import com.yunbao.common.sud.state.SudMGPMGState; import com.yunbao.common.utils.ISudFSMStateHandleUtils; @@ -271,7 +272,13 @@ public interface SudFSMMGListener { * mg_common_game_create_order */ default void onGameMGCommonGameCreateOrder(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameCreateOrder model) { - ISudFSMStateHandleUtils.handleSuccess(handle); + if ("addHeart".equals(model.cmd)) { + JumpEvent.addHeart(model); + } else if ("hit".equals(model.cmd)) { + JumpEvent.hit(model); + } else { + ISudFSMStateHandleUtils.handleSuccess(handle); + } } /** diff --git a/common/src/main/java/com/yunbao/common/sud/decorator/game/JumpEvent.java b/common/src/main/java/com/yunbao/common/sud/decorator/game/JumpEvent.java new file mode 100644 index 000000000..0b5210b81 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/sud/decorator/game/JumpEvent.java @@ -0,0 +1,47 @@ +package com.yunbao.common.sud.decorator.game; + +import com.yunbao.common.bean.HttpCallbackModel; +import com.yunbao.common.http.base.HttpCallback; +import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.sud.state.SudMGPMGState; +import com.yunbao.common.utils.AppManager; + +public class JumpEvent { + private static long clickTimer = 0; + + public static void addHeart(SudMGPMGState.MGCommonGameCreateOrder order) { + createOrder(order); + } + + public static void hit(SudMGPMGState.MGCommonGameCreateOrder order) { + createOrder(order); + } + + private synchronized static void createOrder(SudMGPMGState.MGCommonGameCreateOrder order) { + if (System.currentTimeMillis() - clickTimer < 1000) { + //TODO 防止重复点击 + return; + } + clickTimer = System.currentTimeMillis(); + LiveNetManager.get(AppManager.getInstance().getLastActivity()) + .createGameOrder(order.gameRoomId, + order.cmd, + order.value + "", + order.gameId + "", + order.fromUid, + order.toUid, + order.gameRoomId, + order.payload, + new HttpCallback() { + @Override + public void onSuccess(HttpCallbackModel data) { + + } + + @Override + public void onError(String error) { + + } + }); + } +} diff --git a/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java b/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java index 1523a5a16..e8f76a0b2 100644 --- a/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java +++ b/common/src/main/java/com/yunbao/common/sud/state/SudMGPMGState.java @@ -496,6 +496,10 @@ public class SudMGPMGState implements Serializable { public String toUid; // 目标用户uid public long value; // 所属的游戏价值 public String payload; // 扩展数据 json 字符串, 特殊可选 + + public long gameId; + public String gameRoomId; + public String userId; } /** diff --git a/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java b/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java index 6a750bd1d..0464f9d7c 100644 --- a/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/ProcessImageUtil.java @@ -1,20 +1,12 @@ package com.yunbao.common.utils; -import static com.yalantis.ucrop.util.FileUtils.getDataColumn; - import android.Manifest; -import android.content.ContentUris; import android.content.Context; import android.content.Intent; -import android.database.Cursor; import android.net.Uri; import android.os.Build; -import android.os.Environment; -import android.provider.DocumentsContract; -import android.provider.DocumentsProvider; import android.provider.MediaStore; -import androidx.documentfile.provider.DocumentFile; import androidx.fragment.app.FragmentActivity; import androidx.core.content.FileProvider; @@ -46,6 +38,11 @@ public class ProcessImageUtil extends ProcessResultUtil { private File mCorpResult;//裁剪后得到的图片 private ImageResultCallback mResultCallback; private boolean mNeedCrop;//是否需要裁剪 + private boolean mNeedGif;//允许gif图 + + public void setNeedGif(boolean mNeedGif) { + this.mNeedGif = mNeedGif; + } public ProcessImageUtil(FragmentActivity activity) { super(activity); @@ -103,6 +100,9 @@ public class ProcessImageUtil extends ProcessResultUtil { @Override public void onFailure() { ToastUtil.show(mContext.getString(R.string.img_camera_cancel)); + if (mResultCallback != null) { + mResultCallback.onFailure(); + } } }; mAlumbResultCallback = new ActivityResultCallback() { @@ -221,9 +221,14 @@ public class ProcessImageUtil extends ProcessResultUtil { * 打开相册,选择文件 */ private void chooseFile() { + String[] mimeTypes = {"image/png", "image/jpg", "image/jpeg"}; Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setType("image/*"); + intent.setType("*/*"); + if (mNeedGif) { + mimeTypes = new String[]{"image/png", "image/jpg", "image/jpeg", "image/gif"}; + } + intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); if (Build.VERSION.SDK_INT < 19) { intent.setAction(Intent.ACTION_GET_CONTENT); } else { diff --git a/config.gradle b/config.gradle index 3136158c6..98e8cbf9f 100644 --- a/config.gradle +++ b/config.gradle @@ -21,7 +21,7 @@ ext { baiduAppSecretKey: "nEVSgmuGpU0pjPr6VleEGGAl0hzGW52S", // true表示谷歌支付 false 0 链接包 1 谷歌包 2华为包 3 samsung包 - isGooglePlay : 3, + isGooglePlay : 0, //是否上报异常日志 isUploadLog : true, //是否打包成插件包模式 diff --git a/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java b/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java index 153709be1..4a90883e3 100644 --- a/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java +++ b/live/src/main/java/com/yunbao/live/dialog/SendRendPacketPopup.java @@ -2,7 +2,9 @@ package com.yunbao.live.dialog; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; +import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.graphics.Color; import android.text.Editable; import android.text.TextUtils; @@ -19,10 +21,12 @@ import com.lxj.xpopup.core.CenterPopupView; import com.umeng.analytics.MobclickAgent; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.Bus; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.live.R; +import com.yunbao.live.event.LiveAudienceEvent; public class SendRendPacketPopup extends CenterPopupView { private Button thereIsNo, followingAnchor, joinFansGroup; @@ -31,6 +35,8 @@ public class SendRendPacketPopup extends CenterPopupView { private FrameLayout redPacketIllustrate; private ImageView iconInstructions, illustrateClose; private String mLiveID, conditions = "0"; + private DialogInterface onDismissListener; + private boolean sendSuccess; public SendRendPacketPopup(@NonNull Context context, String liveID) { super(context); @@ -51,6 +57,23 @@ public class SendRendPacketPopup extends CenterPopupView { initView(); } + public void setOnDismissListener(DialogInterface onDismissListener) { + this.onDismissListener = onDismissListener; + } + + @Override + protected void onDismiss() { + super.onDismiss(); + + if (sendSuccess) { + // onDismissListener.dismiss(); + } else { + // onDismissListener.cancel(); + Bus.get().post(new LiveAudienceEvent() + .setType(LiveAudienceEvent.LiveAudienceType.GIFT_POPUP)); + } + } + private void initView() { thereIsNo = findViewById(R.id.there_is_no); followingAnchor = findViewById(R.id.following_anchor); @@ -222,6 +245,7 @@ public class SendRendPacketPopup extends CenterPopupView { MobclickAgent.onEvent(getContext(), "gif_list_redpk_seed", "用户发送红包"); ToastUtil.show(getContext().getString(R.string.red_envelope_released_successfully)); + sendSuccess = true; dismiss(); } diff --git a/main/src/main/java/com/yunbao/main/activity/FeedbackActivity.java b/main/src/main/java/com/yunbao/main/activity/FeedbackActivity.java index cf96343a8..4b9984982 100644 --- a/main/src/main/java/com/yunbao/main/activity/FeedbackActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/FeedbackActivity.java @@ -1,10 +1,13 @@ package com.yunbao.main.activity; +import android.app.Dialog; + import com.alibaba.android.arouter.facade.annotation.Route; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.HttpCallbackModel; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -25,17 +28,29 @@ public class FeedbackActivity extends AbsActivity { setTitle(WordUtil.getNewString(R.string.activity_feedback_top_title)); setTitleBold(true); ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.btn_cs), new ViewClicksAntiShake.ViewClicksCallBack() { + Dialog loading; @Override public void onViewClicks() { //TODO 客服 + loading= DialogUitl.loadingDialog(mContext); + loading.show(); MainHttpUtil.getCustomerService(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { + loading.dismiss(); + loading=null; if (info.length == 1) { String url = info[0]; RouteUtil.forwardCustomerService(url); } } + + @Override + public void onError() { + super.onError(); + loading.dismiss(); + loading=null; + } }); } diff --git a/main/src/main/java/com/yunbao/main/activity/FeedbackEditActivity.java b/main/src/main/java/com/yunbao/main/activity/FeedbackEditActivity.java index 60e6a5be9..61a3df228 100644 --- a/main/src/main/java/com/yunbao/main/activity/FeedbackEditActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/FeedbackEditActivity.java @@ -4,6 +4,7 @@ import android.app.Dialog; import android.graphics.Color; import android.text.Editable; import android.text.InputFilter; +import android.text.Spanned; import android.text.TextWatcher; import android.util.SparseArray; import android.view.View; @@ -32,6 +33,8 @@ import com.yunbao.main.R; import java.io.File; import java.util.Locale; +import java.util.regex.Matcher; +import java.util.regex.Pattern; @Route(path = RouteUtil.PATH_FEEDBACK_EDIT_ACTIVITY) public class FeedbackEditActivity extends AbsActivity { @@ -58,8 +61,20 @@ public class FeedbackEditActivity extends AbsActivity { setTitleBold(true); initView(); imageUtil = new ProcessImageUtil(this); - feedbackEdit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(500)}); - ciEdit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(30)}); + feedbackEdit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(501)}); + ciEdit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(30), new InputFilter() { + @Override + public CharSequence filter(CharSequence charSequence, int i, int i1, Spanned spanned, int i2, int i3) { + /* String regex = "[A-Za-z0-9]+"; // 正则表达式 + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(charSequence.toString()); + if (matcher.matches()) { + return null; + } + return "";*/ + return null; + } + }}); feedbackEdit.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { @@ -68,18 +83,22 @@ public class FeedbackEditActivity extends AbsActivity { @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { - if (charSequence.length() == 500) { - ToastUtil.show(R.string.activity_feedback_edit_submit_tip2); + if (charSequence.length() >= 500) { editNumber.setTextColor(Color.parseColor("#FF5656")); } else { editNumber.setTextColor(Color.parseColor("#333333")); } + editNumber.setText(String.format(Locale.getDefault(), "%d", charSequence.length())); } @Override public void afterTextChanged(Editable editable) { - + if (editable.length() > 500) { + ToastUtil.show(R.string.activity_feedback_edit_submit_tip2); + feedbackEdit.setText(editable.toString().substring(0, 500)); + feedbackEdit.setSelection(feedbackEdit.getText().length()); + } } }); ViewClicksAntiShake.clicksAntiShake(img1, () -> { @@ -122,13 +141,13 @@ public class FeedbackEditActivity extends AbsActivity { } JSONArray images = new JSONArray(); if (img1.getTag() != null) { - images.add((String) img1.getTag()); + images.add(((String) img1.getTag()).replace("https://downs.yaoulive.com/" ,"")); } if (img2.getTag() != null) { - images.add((String) img2.getTag()); + images.add(((String) img2.getTag()).replace("https://downs.yaoulive.com/" ,"")); } if (img3.getTag() != null) { - images.add((String) img3.getTag()); + images.add(((String) img3.getTag()).replace("https://downs.yaoulive.com/" ,"")); } LiveNetManager.get(mContext) .feedback(feedbackEdit.getText().toString(), @@ -150,15 +169,15 @@ public class FeedbackEditActivity extends AbsActivity { }); img1.setOnLongClickListener(view -> { - ToastUtil.show("1"); + ToastUtil.showDebug("1"); return true; }); img2.setOnLongClickListener(view -> { - ToastUtil.show("2"); + ToastUtil.showDebug("2"); return true; }); img3.setOnLongClickListener(view -> { - ToastUtil.show("3"); + ToastUtil.showDebug("3"); return true; }); imageUtil.setImageResultCallback(new ImageResultCallback() { @@ -166,7 +185,7 @@ public class FeedbackEditActivity extends AbsActivity { @Override public void onSuccess(File file) { - ToastUtil.show("图片地址:" + file.getAbsolutePath()); + ToastUtil.showDebug("图片地址:" + file.getAbsolutePath()); onSuccessToQiNiuUrl(mContext, file, new OnItemClickListener() { @Override public void onItemClick(String bean, int position) { @@ -177,7 +196,7 @@ public class FeedbackEditActivity extends AbsActivity { switch (clickImage) { case 101: case 112: - setShowImage(img1,img1Del,bean); + setShowImage(img1, img1Del, bean); if (img2.getTag() == null) { setDefImage(img2, img2Del, img2Layout); } else if (img3.getTag() == null) { @@ -186,14 +205,14 @@ public class FeedbackEditActivity extends AbsActivity { break; case 201: case 212: - setShowImage(img2,img2Del,bean); + setShowImage(img2, img2Del, bean); if (img3.getTag() == null) { setDefImage(img3, img3Del, img3Layout); } break; case 301: case 312: - setShowImage(img3,img3Del,bean); + setShowImage(img3, img3Del, bean); break; } } @@ -271,9 +290,22 @@ public class FeedbackEditActivity extends AbsActivity { loadingDialog.dismiss(); loadingDialog = null; } - loadingDialog = DialogUitl.loadingDialog(mContext); - loadingDialog.show(); - imageUtil.getImageByAlumb(false); + SparseArray array = new SparseArray<>(); + array.put(1, WordUtil.getNewString(R.string.activity_feedback_edit_img_select)); + array.put(2, WordUtil.getNewString(R.string.activity_feedback_edit_img_camera)); + DialogUitl.showStringArrayDialog(mContext, array, new DialogUitl.StringArrayDialogCallback() { + @Override + public void onItemClick(String text, int tag) { + loadingDialog = DialogUitl.loadingDialog(mContext); + loadingDialog.show(); + if (tag == 1) { + imageUtil.getImageByAlumb(false); + } else { + imageUtil.getImageByCamera(false); + } + } + }); + } private void deleteImage(int index) { diff --git a/main/src/main/java/com/yunbao/main/activity/SettingActivity.java b/main/src/main/java/com/yunbao/main/activity/SettingActivity.java index 8e3f01053..b1af4fb45 100644 --- a/main/src/main/java/com/yunbao/main/activity/SettingActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/SettingActivity.java @@ -285,9 +285,9 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< } else { ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, studioRideEffects); } - if(IMLoginManager.get(mContext).isLiveNotifySettings()){ + if (IMLoginManager.get(mContext).isLiveNotifySettings()) { ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, liveNotifySettings); - }else{ + } else { ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, liveNotifySettings); } } @@ -316,15 +316,16 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< .show(); } - }else if(bean.getId()==17){ + } else if (bean.getId() == 17 || bean.getId() == 26) { RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); } } else { - if (bean.getId() == 17) {//意见反馈要在url上加版本号和设备号 + if (bean.getId() == 17 || bean.getId() == 26) {//意见反馈要在url上加版本号和设备号 href += "&version=" + android.os.Build.VERSION.RELEASE + "&model=" + android.os.Build.MODEL; + RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); + } else { + WebViewActivity.forward(mContext, href, false); } - // WebViewActivity.forward(mContext, href,false); - RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); } } diff --git a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java index 72ac75dc5..9f06d91fa 100644 --- a/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainMeViewHolder.java @@ -510,7 +510,7 @@ public class MainMeViewHolder extends AbsMainViewHolder implements OnItemClickLi if (bean.getId() == 24) { MobclickAgent.onEvent(mContext, "my_pack", "个人中心点包裹"); } - if (bean.getId() == 17) { + if (bean.getId() == 17 || bean.getId() == 26) { RouteUtil.forwardActivity(RouteUtil.PATH_FEEDBACK_ACTIVITY); } else WebViewActivity.forward(mContext, url, false); diff --git a/main/src/main/res/layout/activity_feedback.xml b/main/src/main/res/layout/activity_feedback.xml index 85e8bdf23..dec5872ba 100644 --- a/main/src/main/res/layout/activity_feedback.xml +++ b/main/src/main/res/layout/activity_feedback.xml @@ -53,6 +53,7 @@ android:layout_width="165dp" android:layout_height="match_parent" android:layout_weight="1" + android:textAllCaps="false" android:background="#F7F7F7" android:text="@string/activity_feedback_feedback" android:textColor="#333333" diff --git a/main/src/main/res/layout/activity_feedback_edit.xml b/main/src/main/res/layout/activity_feedback_edit.xml index 39cb59f66..e75277047 100644 --- a/main/src/main/res/layout/activity_feedback_edit.xml +++ b/main/src/main/res/layout/activity_feedback_edit.xml @@ -239,7 +239,13 @@ android:layout_marginBottom="130dp" android:gravity="center" android:orientation="horizontal"> - + - \ No newline at end of file diff --git a/main/src/main/res/values-zh/strings.xml b/main/src/main/res/values-zh/strings.xml index 34df83c75..ba1b66563 100644 --- a/main/src/main/res/values-zh/strings.xml +++ b/main/src/main/res/values-zh/strings.xml @@ -39,4 +39,6 @@ 請描述您的問題 超過字數要求 今日反饋次數已用完 + 從相冊選取 + 拍照 \ No newline at end of file diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index ea239ee1d..94818d2bb 100644 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -39,4 +39,6 @@ Please describe your problem Exceeding the word count requirement Today\'s feedback count has been used up + Select from album + Photo shoot