From 346b535757356845de2fe16c4ded464b76e6ee65 Mon Sep 17 00:00:00 2001 From: wushaocheng <15876365887@163.com> Date: Thu, 10 Aug 2023 17:32:10 +0800 Subject: [PATCH] =?UTF-8?q?[Modify]=E4=BF=AE=E5=BE=A9=E5=85=AC=E6=9C=83?= =?UTF-8?q?=E6=95=B8=E6=93=9A=E5=92=8Ctrtc=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erban/application/XChatApplication.java | 2 + .../erban/ui/im/chat/MsgViewHolderText.java | 11 ++++ .../main/res/layout/im_customer_msg_text.xml | 32 ++++++++-- app/src/main/res/values/strings.xml | 2 +- .../hall/activity/ModuleHallActivity.java | 2 + .../hall/activity/RoomIncomeActivity.java | 17 ++++-- .../income/adapter/HallIncomeAdapter.java | 2 +- .../income/adapter/IncomeAdapter.java | 18 +----- .../income/adapter/LiveIncomeAdapter.java | 5 +- .../presenter/IncomeStatisticsPresenter.java | 19 ++---- .../res/layout/activity_module_clan.xml | 8 +-- .../res/layout/item_clan_income.xml | 18 +----- .../res/layout/item_hall_income.xml | 14 ++--- .../res/layout/item_live_income.xml | 15 +++-- .../manager/trtc/SDKConfig.java | 2 +- .../interceptor/MyOkHttpRetryInterceptor.java | 60 +++++++++++++++++++ .../net/rxnet/manager/RxNetManager.java | 2 + 17 files changed, 150 insertions(+), 79 deletions(-) create mode 100644 core/src/main/java/com/yizhuan/xchat_android_core/interceptor/MyOkHttpRetryInterceptor.java diff --git a/app/src/main/java/com/yizhuan/erban/application/XChatApplication.java b/app/src/main/java/com/yizhuan/erban/application/XChatApplication.java index fe08059e7..34166741e 100644 --- a/app/src/main/java/com/yizhuan/erban/application/XChatApplication.java +++ b/app/src/main/java/com/yizhuan/erban/application/XChatApplication.java @@ -63,6 +63,7 @@ import com.yizhuan.xchat_android_core.gift.GiftModel; import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment; import com.yizhuan.xchat_android_core.im.custom.bean.OpenSignInAttachment; import com.yizhuan.xchat_android_core.initial.InitialModel; +import com.yizhuan.xchat_android_core.interceptor.MyOkHttpRetryInterceptor; import com.yizhuan.xchat_android_core.interceptor.NoParamsInterceptor; import com.yizhuan.xchat_android_core.interceptor.ParamsInterceptor; import com.yizhuan.xchat_android_core.manager.IMMessageManager; @@ -401,6 +402,7 @@ public class XChatApplication extends BaseApp { .setBaseUrl(url) .addInterceptors(new ParamsInterceptor(httpParams)) .addInterceptors(new NoParamsInterceptor())//注意:拦截器的添加顺序,请求的拦截顺序 +// .addInterceptors(new MyOkHttpRetryInterceptor()) .certificates() .build(); //单例的model 初始化 diff --git a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderText.java b/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderText.java index b5bacd1fb..180bc02b1 100644 --- a/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderText.java +++ b/app/src/main/java/com/yizhuan/erban/ui/im/chat/MsgViewHolderText.java @@ -4,6 +4,7 @@ import static com.yizhuan.xchat_android_core.UriProvider.IM_SERVER_URL; import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_CAR_EXPIRE; import android.text.style.ForegroundColorSpan; +import android.view.View; import android.widget.TextView; import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase; @@ -41,6 +42,7 @@ import java.util.Map; */ public class MsgViewHolderText extends MsgViewHolderBase { private TextView mTvMsg; + private TextView mTvSee; private NobleAttachment mNobleAttachment; private CarAttachment mCarAttachment; private AssistantAttachment awardAttachment; @@ -58,12 +60,21 @@ public class MsgViewHolderText extends MsgViewHolderBase { @Override protected void inflateContentView() { mTvMsg = findViewById(R.id.tv_msg); + mTvSee = findViewById(R.id.tv_see); } @Override protected void bindContentView() { CharSequence text = ""; MsgAttachment attachment = message.getAttachment(); + if(attachment instanceof AssistantAttachment){ + awardAttachment = (AssistantAttachment) attachment; + if(awardAttachment.routerValue != null){ + mTvSee.setVisibility(View.VISIBLE); + } + }else { + mTvSee.setVisibility(View.GONE); + } if (attachment instanceof CarAttachment) { mCarAttachment = (CarAttachment) attachment; text = mCarAttachment.msg; diff --git a/app/src/main/res/layout/im_customer_msg_text.xml b/app/src/main/res/layout/im_customer_msg_text.xml index 1440f8d78..2252c434e 100644 --- a/app/src/main/res/layout/im_customer_msg_text.xml +++ b/app/src/main/res/layout/im_customer_msg_text.xml @@ -1,10 +1,32 @@ - \ No newline at end of file + android:orientation="vertical" + tools:text="@string/layout_im_customer_msg_text_01" > + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 595f1797e..58b928995 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -967,7 +967,7 @@ 充值鉆石 貴族中心 開通立享各項特權 - 我的公會 + 公会·房间 加入公會 個人中心 我的房間 diff --git a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/hall/activity/ModuleHallActivity.java b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/hall/activity/ModuleHallActivity.java index 195e900be..37a370bda 100644 --- a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/hall/activity/ModuleHallActivity.java +++ b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/hall/activity/ModuleHallActivity.java @@ -99,6 +99,8 @@ public class ModuleHallActivity extends BaseMvpActivity tagList = new ArrayList<>(); - tagList.add("按日统计"); - tagList.add("每周统计"); - tagList.add("每月统计"); + tagList.add("按日統計"); + tagList.add("每周統計"); + tagList.add("每月統計"); StatisticsIndicatorAdapter adapter = new StatisticsIndicatorAdapter(tagList, 5); adapter.setOnItemSelectListener(position -> viewPager.setCurrentItem(position)); CommonNavigator navigator = new CommonNavigator(this); diff --git a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/income/adapter/HallIncomeAdapter.java b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/income/adapter/HallIncomeAdapter.java index e0db338f0..3d2be0b3e 100644 --- a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/income/adapter/HallIncomeAdapter.java +++ b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/income/adapter/HallIncomeAdapter.java @@ -24,7 +24,7 @@ public class HallIncomeAdapter extends BaseQuickAdapter { @@ -32,27 +33,14 @@ public class IncomeAdapter extends BaseQuickAdapter helper.setText(R.id.tv_row_num, item.getRowNum()); String nick = item.getNick(); - + DecimalFormat decimalFormat = new DecimalFormat("###################.###########"); if (!TextUtils.isEmpty(nick) && nick.length() > 4) nick = nick.substring(0, 4) + "..."; helper.setText(R.id.tv_name, nick); helper.setText(R.id.tv_num, String.format(mContext.getString(R.string.label_id_format), item.getErbanNo())); - helper.setText(R.id.tv_gold, formatGoldNun(item.getTotalGoldNum())); + helper.setText(R.id.tv_gold, decimalFormat.format(item.getTotalGoldNum())); helper.addOnClickListener(R.id.container); } - private String formatGoldNun(long goldNum) { - - if (goldNum > 10000) { - double d = (double) goldNum; - d = d / 10000; - BigDecimal df = new BigDecimal(d); - return df.setScale(2, RoundingMode.DOWN).toString() + ResUtil.getString(R.string.income_adapter_incomeadapter_01); - - } else - return String.valueOf(goldNum); - - } - } diff --git a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/income/adapter/LiveIncomeAdapter.java b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/income/adapter/LiveIncomeAdapter.java index 6659fe81b..ba341cffa 100644 --- a/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/income/adapter/LiveIncomeAdapter.java +++ b/app/src/module_labour_union/java/com/yizhuan/erban/module_hall/income/adapter/LiveIncomeAdapter.java @@ -13,6 +13,7 @@ import org.jetbrains.annotations.NotNull; import java.math.BigDecimal; import java.math.RoundingMode; +import java.text.DecimalFormat; public class LiveIncomeAdapter extends BaseQuickAdapter { @@ -22,8 +23,8 @@ public class LiveIncomeAdapter extends BaseQuickAdapter 10000) { - double d = (double) total; - d = d / 10000; - BigDecimal df = new BigDecimal(d); - String str = df.setScale(2, RoundingMode.DOWN).toString() + ResUtil.getString(R.string.income_presenter_incomestatisticspresenter_01); + DecimalFormat decimalFormat = new DecimalFormat("###################.###########"); + String str = decimalFormat.format(total) + "鉆石"; - spannableString = new SpannableString(str); - spannableString.setSpan(sizeSpan, str.length() - 3, str.length(), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); - - } else { - String str = String.valueOf(total) + ResUtil.getString(R.string.income_presenter_incomestatisticspresenter_02); - - spannableString = new SpannableString(str); - spannableString.setSpan(sizeSpan, str.length() - 2, str.length(), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); - } + spannableString = new SpannableString(str); + spannableString.setSpan(sizeSpan, str.length() - 2, str.length(), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE); return spannableString; } diff --git a/app/src/module_labour_union/res/layout/activity_module_clan.xml b/app/src/module_labour_union/res/layout/activity_module_clan.xml index 51dda35c1..1b0d9fcfd 100644 --- a/app/src/module_labour_union/res/layout/activity_module_clan.xml +++ b/app/src/module_labour_union/res/layout/activity_module_clan.xml @@ -120,9 +120,7 @@ android:layout_height="wrap_content" android:layout_weight="1" android:background="@drawable/bg_hall_income" - android:paddingStart="10dp" - android:paddingEnd="0dp" - android:paddingTop="15dp" + android:gravity="center" android:text="@string/layout_activity_module_clan_04" android:textColor="@color/white" android:textSize="14sp" /> @@ -149,9 +147,7 @@ android:layout_marginStart="6dp" android:layout_weight="1" android:background="@drawable/bg_hall_admin" - android:paddingStart="10dp" - android:paddingEnd="@dimen/dp_0" - android:paddingTop="15dp" + android:gravity="center" android:text="@string/layout_activity_module_clan_06" android:textColor="@color/white" android:textSize="14sp" /> diff --git a/app/src/module_labour_union/res/layout/item_clan_income.xml b/app/src/module_labour_union/res/layout/item_clan_income.xml index 7bb9bd2bb..290e4e208 100644 --- a/app/src/module_labour_union/res/layout/item_clan_income.xml +++ b/app/src/module_labour_union/res/layout/item_clan_income.xml @@ -49,18 +49,6 @@ app:layout_constraintTop_toTopOf="@+id/iv_hall_avatar" tools:text="@string/layout_item_clan_income_01" /> - - + app:layout_constraintTop_toBottomOf="@+id/iv_hall_avatar"> + app:layout_constraintTop_toBottomOf="@+id/iv_hall_avatar"> + app:layout_constraintTop_toBottomOf="@+id/iv_hall_avatar"> @@ -106,7 +106,7 @@ @@ -136,7 +136,7 @@ @@ -167,7 +167,7 @@ @@ -197,7 +197,7 @@ @@ -227,7 +227,7 @@ diff --git a/app/src/module_labour_union/res/layout/item_live_income.xml b/app/src/module_labour_union/res/layout/item_live_income.xml index 9cb63b64b..8267a2342 100644 --- a/app/src/module_labour_union/res/layout/item_live_income.xml +++ b/app/src/module_labour_union/res/layout/item_live_income.xml @@ -51,7 +51,7 @@ - - + tools:text="房間名稱阿法狗發哈士大夫擊殺敵方" /> diff --git a/core/src/diff_src_erban/java/com/yizhuan/xchat_android_core/manager/trtc/SDKConfig.java b/core/src/diff_src_erban/java/com/yizhuan/xchat_android_core/manager/trtc/SDKConfig.java index 9f902bf24..c0bf56da2 100644 --- a/core/src/diff_src_erban/java/com/yizhuan/xchat_android_core/manager/trtc/SDKConfig.java +++ b/core/src/diff_src_erban/java/com/yizhuan/xchat_android_core/manager/trtc/SDKConfig.java @@ -11,7 +11,7 @@ public class SDKConfig { * 进入腾讯云云通信[控制台](https://console.cloud.tencent.com/avc) 创建应用,即可看到 SDKAppId, * 它是腾讯云用于区分客户的唯一标识。 */ - public static int TX_SDKAPPID = 1400741885;// + public static int TX_SDKAPPID = 1400823228;// /** * 腾讯云 bizid和appid diff --git a/core/src/main/java/com/yizhuan/xchat_android_core/interceptor/MyOkHttpRetryInterceptor.java b/core/src/main/java/com/yizhuan/xchat_android_core/interceptor/MyOkHttpRetryInterceptor.java new file mode 100644 index 000000000..3cb1fcf50 --- /dev/null +++ b/core/src/main/java/com/yizhuan/xchat_android_core/interceptor/MyOkHttpRetryInterceptor.java @@ -0,0 +1,60 @@ +package com.yizhuan.xchat_android_core.interceptor; + +import com.yizhuan.xchat_android_core.utils.Logger; + +import java.io.IOException; +import java.io.InterruptedIOException; + +import lombok.extern.slf4j.Slf4j; +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +/** + * User: Administrator + * Date: 2017/9/19 + * Description: + */ +public class MyOkHttpRetryInterceptor implements Interceptor { + public int executionCount = 3;//最大重试次数 + private long retryInterval = 1000;//重试的间隔 + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + Response response = doRequest(chain, request); + int retryNum = 0; + while ((response == null || !response.isSuccessful()) && retryNum <= executionCount) { + Logger.info("intercept Request is not successful - {}", String.valueOf(retryNum)); + final long nextInterval = getRetryInterval(); + try { + Logger.info("Wait for {}", String.valueOf(nextInterval)); + Thread.sleep(nextInterval); + } catch (final InterruptedException e) { + Thread.currentThread().interrupt(); + throw new InterruptedIOException(); + } + retryNum++; + // retry the request + response = doRequest(chain, request); + } + return response; + } + + private Response doRequest(Chain chain, Request request) { + Response response = null; + try { + response = chain.proceed(request); + } catch (Exception e) { + } + return response; + } + + /** + * retry间隔时间 + */ + public long getRetryInterval() { + return this.retryInterval; + } + +} diff --git a/library/src/main/java/com/yizhuan/xchat_android_library/net/rxnet/manager/RxNetManager.java b/library/src/main/java/com/yizhuan/xchat_android_library/net/rxnet/manager/RxNetManager.java index 506d53343..1af9d662a 100644 --- a/library/src/main/java/com/yizhuan/xchat_android_library/net/rxnet/manager/RxNetManager.java +++ b/library/src/main/java/com/yizhuan/xchat_android_library/net/rxnet/manager/RxNetManager.java @@ -122,6 +122,8 @@ public final class RxNetManager { client.sslSocketFactory(new Tls12SocketFactory(sc.getSocketFactory())); ConnectionSpec cs = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS) +// .allEnabledTlsVersions() +// .allEnabledCipherSuites() .tlsVersions(TlsVersion.TLS_1_2) .build();