Compare commits

..

5 Commits

Author SHA1 Message Date
max
d5aa2f0ae3 feat:调整版本号 2024-07-05 17:04:58 +08:00
max
8ae56821c3 feat:私聊、公聊、房间、支持垃圾字检测 2024-07-05 16:59:34 +08:00
max
4a2b2b4c33 feat:调整启动背景-logo 2024-07-05 10:51:53 +08:00
max
f644db76da feat:配置云信-安全通ID 2024-07-05 10:27:04 +08:00
max
f00b2344d5 feat:修改启动页背景 2024-07-05 10:26:41 +08:00
271 changed files with 1459 additions and 4804 deletions

3
.gitmodules vendored
View File

@@ -1,3 +0,0 @@
[submodule "modules/module_google"]
path = modules/module_google
url = https://e.coding.net/chwllive/peko/peko-android-gms.git

View File

@@ -221,6 +221,7 @@ dependencies {
api "com.jzxiang.pickerview:TimePickerDialog:1.0.1"
api "com.github.zyyoona7:EasyPopup:1.0.2"
api "com.github.donkingliang:LabelsView:1.6.5"
api "com.github.yyued:SVGAPlayer-Android:2.6.1"
api "com.ms-square:expandableTextView:0.1.4"
annotationProcessor 'androidx.annotation:annotation:1.6.0'

View File

@@ -82,8 +82,7 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- 对于 Android 12.0 及以上设备,还需要添加如下权限: -->
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING" />
<application
android:name=".application.App"
android:allowBackup="false"
@@ -877,38 +876,19 @@
<service
android:name="com.netease.nimlib.service.NimService"
android:foregroundServiceType="remoteMessaging"
android:process=":core" />
<service
android:name="com.netease.nimlib.service.NimService$Aux"
android:foregroundServiceType="remoteMessaging"
android:process=":core" />
<service
android:name="com.netease.nimlib.job.NIMJobService"
android:foregroundServiceType="remoteMessaging"
android:permission="android.permission.BIND_JOB_SERVICE"
android:process=":core" />
<service android:name="com.netease.nimlib.service.ResponseService"
android:foregroundServiceType="remoteMessaging"/>
<service android:name="com.netease.nimlib.service.ResponseService" />
<service
android:name=".service.DaemonService"
android:foregroundServiceType="mediaPlayback"
android:enabled="true" />
<!-- Trigger Google Play services to install the backported photo picker module. -->
<service
android:name="com.google.android.gms.metadata.ModuleDependencies"
android:enabled="false"
android:exported="false"
tools:ignore="MissingClass">
<intent-filter>
<action android:name="com.google.android.gms.metadata.MODULE_DEPENDENCIES" />
</intent-filter>
<meta-data
android:name="photopicker_activity:0:required"
android:value="" />
</service>
<activity android:name=".avroom.room_album.RoomAlbumActivity" />
<activity android:name=".ui.language.LanguageActivity" />
@@ -963,14 +943,6 @@
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustNothing" />
<activity
android:windowSoftInputMode="adjustPan"
android:name=".ui.feedback.FeedbackActivity"
android:screenOrientation="portrait" />
<activity android:name=".ui.debug.DebugActivity"
android:screenOrientation="portrait"/>
<activity android:name=".ui.game_team.record.GameTeamRecordActivity"
android:screenOrientation="portrait"/>
</application>
</manifest>

View File

@@ -84,6 +84,7 @@ import com.chwl.library.common.file.FileHelper;
import com.chwl.library.net.rxnet.RxNet;
import com.chwl.library.net.rxnet.converter.GsonConverterPlugins;
import com.chwl.library.utils.AppMetaDataUtil;
import com.chwl.library.utils.AppUtils;
import com.chwl.library.utils.DeviceUuidFactory;
import com.chwl.library.utils.ResUtil;
import com.chwl.library.utils.SingleToastUtil;
@@ -416,7 +417,7 @@ public class App extends BaseApp {
httpParams.put("netType", String.valueOf(SystemUtils.getNetworkType(context)));
httpParams.put("model", SystemUtils.getPhoneModel());
httpParams.put("appVersion", VersionUtil.getLocalName(context));
httpParams.put("appVersionCode", String.valueOf(VersionUtil.getVersionCode(context)));
httpParams.put("appVersionCode", String.valueOf(AppUtils.getVersionCode(context)));
httpParams.put("deviceId", DeviceUuidFactory.getDeviceId(context));
httpParams.put("androidId", MD5Utils.getMD5String(Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID)));
httpParams.put("channel", AppMetaDataUtil.getChannelID());
@@ -483,6 +484,7 @@ public class App extends BaseApp {
ChannelModel.get();
MarketVerifyModel.get();
GiftModel.get();
GiftModel.get().tryLoadGiftList();
// 模厅
HallDataManager.get().application();
//全局处理

View File

@@ -42,7 +42,6 @@ import com.alibaba.fastjson.JSONObject;
import com.chwl.app.notify.RoomNotifyManager;
import com.chwl.app.ui.webview.baishun.BaiShunGameWebFragment;
import com.chwl.app.ui.webview.baishun.IBaiShunGameListener;
import com.chwl.library.widget.SVGAView;
import com.chwl.core.monsterhunting.bean.MonsterDataBean;
import com.chwl.core.room.game.bean.BaiShunGameConfig;
import com.chwl.core.support.room.AudioRoomContext;
@@ -178,15 +177,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
private static final String TAG = "AVRoomActivity";
private static final int SHOW_RED_DIALOG_MAX = 10;
public static boolean isPKModel = false;
private static SVGAView.SVGACache svgaCache;
public static SVGAView.SVGACache getSvgaCache() {
if (svgaCache == null) {
svgaCache = SVGAView.newCache(20);
}
return svgaCache;
}
/**
* 管理限制进房
*/
@@ -909,10 +899,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
GiftModel.get().cancelCountDownTimer();
EventBus.getDefault().unregister(this);
DemoCache.saveBoolean("FirstCharge", false);
if (svgaCache != null) {
svgaCache.clear();
}
svgaCache = null;
super.onDestroy();
}

View File

@@ -15,12 +15,8 @@ import androidx.annotation.Nullable;
import androidx.lifecycle.Observer;
import androidx.recyclerview.widget.RecyclerView;
import com.chwl.app.avroom.activity.AVRoomActivity;
import com.chwl.app.utils.AvatarHelper;
import com.chwl.library.widget.SVGAView;
import com.chwl.core.utils.extension.StringExtensionKt;
import com.coorchice.library.SuperTextView;
import com.example.lib_utils.StringUtils2;
import com.netease.nim.uikit.common.util.string.StringUtil;
import com.opensource.svgaplayer.SVGAImageView;
import com.chwl.app.R;
@@ -149,7 +145,7 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
SVGAImageView ivHalo;
@Nullable
SVGAView ivHeadWear;
ImageView ivHeadWear;
@Nullable
ImageView ivCharmLevelTag;
@@ -175,9 +171,6 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
ivUpImage.setOnClickListener(this);
ivLockImage.setOnClickListener(this);
ivAvatar.setOnClickListener(this);
if (ivHeadWear != null) {
ivHeadWear.bindCache(AVRoomActivity.getSvgaCache());
}
}
public void clear() {
@@ -283,7 +276,6 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
private void clearHeadWear() {
if (ivHeadWear == null) return;
ivHeadWear.clearAnimation();
ivHeadWear.stopAnimation();
ivHeadWear.setImageDrawable(null);
ivHeadWear.setTag(R.id.mic_item_head_wear, null);
ivHeadWear.setVisibility(View.GONE);
@@ -307,13 +299,10 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
private void updateNobleView(MicMemberInfo chatRoomMember) {
if (ivHeadWear == null) return;
String headWear = chatRoomMember.getHeadWearUrl();
int headWearType = chatRoomMember.getHeadWearType();
if (TextUtils.isEmpty(headWear)) {
headWear = NobleUtil.getHeadResource(HeadWearInfo.EFFECT, chatRoomMember) != null ?
NobleUtil.getHeadResource(HeadWearInfo.EFFECT, chatRoomMember) :
NobleUtil.getHeadResource(HeadWearInfo.PIC, chatRoomMember);
String type = NobleUtil.getHeadResource(HeadWearInfo.TYPE, chatRoomMember);
headWearType = StringUtils2.INSTANCE.toInt(type);
}
String nobleHeadWear = (String) NobleUtil.getResource(NobleResourceType.KEY_HEAD_WEAR, chatRoomMember);
if (!TextUtils.isEmpty(headWear)) {
@@ -321,7 +310,7 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
//只有头饰发生改变才更新,防止闪烁
if (!headWear.equals(ivHeadWear.getTag(R.id.mic_item_head_wear))) {
ivHeadWear.setTag(R.id.mic_item_head_wear, headWear);
AvatarHelper.loadAvatarFrame(ivHeadWear, headWear, headWearType);
NobleUtil.loadMicHeadWear(headWear, ivHeadWear, R.id.mic_item_head_wear, headWear);
}
} else if (!TextUtils.isEmpty(nobleHeadWear)) {
// 头饰

View File

@@ -2,6 +2,7 @@ package com.chwl.app.avroom.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -12,6 +13,8 @@ import androidx.recyclerview.widget.RecyclerView;
import com.chwl.app.R;
import com.chwl.core.bean.RoomQueueInfo;
import com.chwl.core.manager.AvRoomDataManager;
import com.chwl.library.utils.ResUtil;
/**
* @author xiaoyu

View File

@@ -4,13 +4,13 @@ import android.annotation.SuppressLint
import android.os.Bundle
import android.view.WindowManager
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogRoomPkFinishBinding
import com.chwl.app.ui.utils.ImageLoadUtils
import com.chwl.core.im.custom.bean.RoomPkBean
import com.chwl.core.utils.extension.subAndReplaceDot
class RoomPkFinishDialog : BaseDialogFragment<DialogRoomPkFinishBinding>() {
class RoomPkFinishDialog : BaseDialog<DialogRoomPkFinishBinding>() {
companion object {
@JvmStatic

View File

@@ -4,13 +4,13 @@ import android.annotation.SuppressLint
import android.os.Bundle
import android.view.WindowManager
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogRoomPkForceFinishBinding
import com.chwl.app.ui.utils.ImageLoadUtils
import com.chwl.core.im.custom.bean.RoomPkBean
import com.chwl.core.utils.extension.subAndReplaceDot
class RoomPkForceFinishDialog : BaseDialogFragment<DialogRoomPkForceFinishBinding>() {
class RoomPkForceFinishDialog : BaseDialog<DialogRoomPkForceFinishBinding>() {
companion object {
@JvmStatic

View File

@@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.os.Bundle
import androidx.core.view.isVisible
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogRoomPkReceivedBinding
import com.chwl.core.im.custom.bean.RoomPkBean
import com.chwl.core.manager.AvRoomDataManager
@@ -16,7 +16,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import java.util.concurrent.TimeUnit
class RoomPkReceivedDialog : BaseDialogFragment<DialogRoomPkReceivedBinding>() {
class RoomPkReceivedDialog : BaseDialog<DialogRoomPkReceivedBinding>() {
companion object {

View File

@@ -1,9 +1,9 @@
package com.chwl.app.avroom.anotherroompk
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogRoomPkRuleBinding
class RoomPkRuleDialog : BaseDialogFragment<DialogRoomPkRuleBinding>() {
class RoomPkRuleDialog : BaseDialog<DialogRoomPkRuleBinding>() {
companion object {

View File

@@ -6,7 +6,7 @@ import android.view.WindowManager
import androidx.recyclerview.widget.GridLayoutManager
import com.chwl.app.avroom.adapter.CreateRoomGameGuideAdapter
import com.chwl.app.base.BaseActivity
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogCreateGameRoomBinding
import com.chwl.app.home.helper.OpenRoomHelper
import com.chwl.app.ui.utils.RVDelegate
@@ -14,7 +14,7 @@ import com.chwl.core.room.bean.RoomInfo
import com.chwl.core.room.game.bean.GameInfo
import com.chwl.core.room.game.GameModel
class CreateGameRoomDialog : BaseDialogFragment<DialogCreateGameRoomBinding>() {
class CreateGameRoomDialog : BaseDialog<DialogCreateGameRoomBinding>() {
private lateinit var rvDelegate: RVDelegate<GameInfo>
private val gameAdapter = CreateRoomGameGuideAdapter()

View File

@@ -9,7 +9,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.chwl.app.R
import com.chwl.app.avroom.adapter.CreateRoomGameAdapter
import com.chwl.app.base.BaseActivity
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogCreateRoomBinding
import com.chwl.app.home.helper.OpenRoomHelper
import com.chwl.app.ui.utils.RVDelegate
@@ -19,7 +19,7 @@ import com.chwl.core.room.game.GameModel
import com.chwl.core.utils.extension.toast
import com.chwl.library.utils.ResUtil
class CreateRoomDialog : BaseDialogFragment<DialogCreateRoomBinding>() {
class CreateRoomDialog : BaseDialog<DialogCreateRoomBinding>() {
private lateinit var rvDelegate: RVDelegate<GameInfo>
private val gameAdapter = CreateRoomGameAdapter()

View File

@@ -1,12 +1,12 @@
package com.chwl.app.avroom.dialog
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogNewUserGiftBinding
import com.chwl.app.ui.utils.load
import com.chwl.core.gift.bean.GiftInfo
class NewUserGiftDialog(val giftInfo: GiftInfo) :
BaseDialogFragment<DialogNewUserGiftBinding>() {
BaseDialog<DialogNewUserGiftBinding>() {
override fun init() {
binding?.ivClose?.setOnClickListener {

View File

@@ -5,7 +5,7 @@ import android.view.WindowManager
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.RoomTeamPkDialogBinding
import com.chwl.app.ui.utils.loadAvatar
import com.chwl.app.ui.widget.dialog.CommonTipDialog
@@ -28,7 +28,7 @@ import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.Locale
class RoomTeamPkDialog : BaseDialogFragment<RoomTeamPkDialogBinding>() {
class RoomTeamPkDialog : BaseDialog<RoomTeamPkDialogBinding>() {
private var compositeDisposable: CompositeDisposable? = null

View File

@@ -9,7 +9,7 @@ import android.view.WindowManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.chwl.app.avroom.adapter.SendBroadcastAdapter
import com.chwl.app.base.BaseActivity
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogSendBroadcastBinding
import com.chwl.app.ui.utils.RVDelegate
import com.chwl.app.utils.SpannableBuilder
@@ -24,7 +24,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import java.util.concurrent.TimeUnit
class SendBroadcastDialog : BaseDialogFragment<DialogSendBroadcastBinding>() {
class SendBroadcastDialog : BaseDialog<DialogSendBroadcastBinding>() {
private lateinit var rvDelegate: RVDelegate<String>
private lateinit var adapter: SendBroadcastAdapter

View File

@@ -2,11 +2,11 @@ package com.chwl.app.avroom.dialog
import android.annotation.SuppressLint
import android.view.WindowManager
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogSingleRoomTipBinding
class SingleRoomTipDialog :
BaseDialogFragment<DialogSingleRoomTipBinding>() {
BaseDialog<DialogSingleRoomTipBinding>() {
@SuppressLint("ClickableViewAccessibility")
override fun init() {
binding?.root?.setOnClickListener {

View File

@@ -2,7 +2,6 @@ package com.chwl.app.avroom.headline
import android.content.Context
import android.util.AttributeSet
import android.view.Gravity
import android.view.LayoutInflater
import androidx.core.view.isVisible
import androidx.databinding.DataBindingUtil
@@ -10,15 +9,12 @@ import com.chwl.app.R
import com.chwl.app.databinding.RoomHeadlineWidgetBinding
import com.chwl.app.public_chat.core.ChatRoomClient
import com.chwl.app.public_chat.core.ChatRoomClientManager
import com.chwl.app.ui.utils.loadAvatar
import com.chwl.core.im.custom.bean.CustomAttachment
import com.chwl.core.im.custom.bean.HeadlineChangedAttachment
import com.chwl.core.public_chat_hall.bean.HeadlineBean
import com.chwl.core.public_chat_hall.model.PublicChatModel
import com.chwl.core.support.room.FrameLayoutRoomWidget
import com.chwl.core.support.room.RoomView
import com.example.lib_utils.AppUtils
import com.example.lib_utils.UiUtils
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum
@@ -48,12 +44,6 @@ class RoomHeadlineWidget : FrameLayoutRoomWidget {
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes)
init {
if (UiUtils.isRtl(AppUtils.getApp())) {
binding.tvHeadlineContent.gravity = Gravity.RIGHT
}
}
override fun onStart(roomView: RoomView) {
super.onStart(roomView)
if (!isInEditMode) {
@@ -99,11 +89,13 @@ class RoomHeadlineWidget : FrameLayoutRoomWidget {
}
private fun updateHeadline(data: HeadlineBean?) {
binding.tvHeadlineContent.text = data?.content ?: ""
binding.ivAvatar.loadAvatar(data?.avatar)
binding.tvName.text = "${data?.nick ?: ""} :"
binding.tvMoney.text = data?.payMoneyNum?.toString() ?: "0"
this.isVisible = data?.isValid() == true && !data.content.isNullOrEmpty()
val content = data?.content
if (data?.isValid() == true && !content.isNullOrEmpty()) {
binding.tvHeadlineContent.text = content
this.isVisible = true
} else {
this.isVisible = false
}
}
override fun onStop() {

View File

@@ -3,13 +3,13 @@ package com.chwl.app.avroom.room_album
import android.annotation.SuppressLint
import android.os.Bundle
import com.hjq.toast.ToastUtils
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogLockRoomAlbumPhotoBinding
import com.chwl.app.ui.utils.ImageLoadUtilsV2
import com.chwl.core.gift.bean.GiftReceiveInfo
import com.chwl.core.manager.AvRoomDataManager
class UnlockRoomAlbumPhotoDialog : BaseDialogFragment<DialogLockRoomAlbumPhotoBinding>(){
class UnlockRoomAlbumPhotoDialog : BaseDialog<DialogLockRoomAlbumPhotoBinding>(){
var onUnlockRoomPhotoListener: OnUnlockRoomPhotoListener? = null

View File

@@ -5,7 +5,7 @@ import android.os.Bundle
import android.view.WindowManager
import androidx.core.view.isVisible
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogSingleRoomPkFinishBinding
import com.chwl.app.ui.utils.load
import com.chwl.core.im.custom.bean.RoomPkBean
@@ -14,7 +14,7 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import java.util.concurrent.TimeUnit
class SingleRoomPkFinishDialog : BaseDialogFragment<DialogSingleRoomPkFinishBinding>() {
class SingleRoomPkFinishDialog : BaseDialog<DialogSingleRoomPkFinishBinding>() {
companion object {
@JvmStatic

View File

@@ -4,13 +4,13 @@ import android.annotation.SuppressLint
import android.os.Bundle
import android.view.WindowManager
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogSingleRoomPkForceFinishBinding
import com.chwl.app.ui.utils.ImageLoadUtils
import com.chwl.core.im.custom.bean.RoomPkBean
import com.chwl.core.utils.extension.subAndReplaceDot
class SingleRoomPkForceFinishDialog : BaseDialogFragment<DialogSingleRoomPkForceFinishBinding>() {
class SingleRoomPkForceFinishDialog : BaseDialog<DialogSingleRoomPkForceFinishBinding>() {
companion object {
@JvmStatic

View File

@@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.os.Bundle
import androidx.core.view.isVisible
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogSingleRoomPkReceivedBinding
import com.chwl.core.im.custom.bean.RoomPkBean
import com.chwl.core.manager.AvRoomDataManager
@@ -17,7 +17,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import java.util.concurrent.TimeUnit
class SingleRoomPkReceivedDialog : BaseDialogFragment<DialogSingleRoomPkReceivedBinding>() {
class SingleRoomPkReceivedDialog : BaseDialog<DialogSingleRoomPkReceivedBinding>() {
companion object {

View File

@@ -1,12 +1,12 @@
package com.chwl.app.avroom.singleroompk
import android.text.method.ScrollingMovementMethod
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogSingleRoomPkRuleBinding
import com.chwl.core.room.anotherroompk.SingleRoomPKModel
import com.chwl.core.utils.extension.toast
class SingleRoomPkRuleDialog : BaseDialogFragment<DialogSingleRoomPkRuleBinding>() {
class SingleRoomPkRuleDialog : BaseDialog<DialogSingleRoomPkRuleBinding>() {
companion object {

View File

@@ -6,6 +6,7 @@ import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
@@ -13,7 +14,7 @@ import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import com.chwl.library.utils.PathHelper;
import com.chwl.core.helper.PathHelper;
import com.chwl.library.download.DownloadException;
import com.chwl.library.download.DownloadManager;
import com.chwl.library.download.DownloadRequest;

View File

@@ -2286,7 +2286,7 @@ public class MessageView extends FrameLayout {
})
.append(ResUtil.getString(R.string.gift_message_01), new ForegroundColorSpan(getResources().getColor(R.color.white)));
text.append(luckyGiftInfo.getFirstGiftName() + ResUtil.getString(R.string.gift_message_02), new ForegroundColorSpan(getResources().getColor(R.color.white)))
text.append(luckyGiftInfo.getGiftName() + ResUtil.getString(R.string.gift_message_02), new ForegroundColorSpan(getResources().getColor(R.color.white)))
.append(luckyGiftInfo.getUser().getNick(), new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {
@@ -2341,7 +2341,7 @@ public class MessageView extends FrameLayout {
})
.append(ResUtil.getString(R.string.gift_message_01), new ForegroundColorSpan(getResources().getColor(R.color.white)));
text.append(luckyGiftInfo.getFirstGiftName() + ResUtil.getString(R.string.gift_message_02), new ForegroundColorSpan(getResources().getColor(R.color.white)))
text.append(luckyGiftInfo.getGiftName() + ResUtil.getString(R.string.gift_message_02), new ForegroundColorSpan(getResources().getColor(R.color.white)))
.append(luckyGiftInfo.getUser().getNick(), new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
@Override
public void onClick(@NonNull View widget) {

View File

@@ -17,7 +17,7 @@ import com.trello.rxlifecycle3.components.support.RxDialogFragment
import kotlinx.coroutines.launch
import java.lang.reflect.ParameterizedType
abstract class BaseDialogFragment<T : ViewBinding> : RxDialogFragment() {
abstract class BaseDialog<T : ViewBinding> : RxDialogFragment() {
val isViewLoaded: Boolean get() = _binding != null
protected var _binding: T? = null

View File

@@ -17,6 +17,7 @@ import com.chwl.app.databinding.PhotoDialogBinding
import com.chwl.app.ui.widget.dialog.CommonTipDialog
import com.chwl.library.common.base.BaseDialogFragment
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.photo.PhotoProviderNew
import com.chwl.library.common.util.PhotoCompressCallback
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.common.util.PhotosCompressCallback
@@ -83,7 +84,7 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
} else {
PhotoProvider.photoProvider(this, resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER)
PhotoProviderNew.photoProvider(this, resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER)
}
}
@@ -117,7 +118,7 @@ class PhotoDialog : BaseDialogFragment<PhotoDialogBinding>(), EasyPermissions.Pe
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
} else {
PhotoProvider.photoCamera(this, REQUEST_CODE_OPEN_CAMERA_PROVIDER)
PhotoProviderNew.photoCamera(this, REQUEST_CODE_OPEN_CAMERA_PROVIDER)
}
}

View File

@@ -0,0 +1,72 @@
package com.chwl.app.decoration.adapter;
import android.view.View;
import com.chwl.app.R;
import com.chwl.app.bindadapter.BaseAdapter;
import com.chwl.app.bindadapter.BindingViewHolder;
import com.chwl.app.databinding.ItemHeadWearBinding;
import com.chwl.core.decoration.headwear.bean.HeadWearInfo;
import com.chwl.core.noble.NobleUtil;
import com.chwl.library.utils.ListUtils;
/**
* Created by huangmeng1 on 2018/5/10.
*/
public class HeadWearShopAdapter extends BaseAdapter<HeadWearInfo> {
private int selectPosition;
public int getSelectPosition() {
return selectPosition;
}
public void setSelectPosition(int selectPosition) {
notifyItemChanged(this.selectPosition);
this.selectPosition = selectPosition;
notifyItemChanged(this.selectPosition);
}
public HeadWearShopAdapter(int layoutResId, int brid) {
super(layoutResId, brid);
}
@Override
protected void convert(BindingViewHolder helper, HeadWearInfo item) {
super.convert(helper, item);
ItemHeadWearBinding binding = (ItemHeadWearBinding) helper.getBinding();
binding.llRoot.setSelected(selectPosition == helper.getAdapterPosition());
NobleUtil.loadHeadWears(item.getPic(), binding.ivHeadWear);
binding.setSelectPosition(selectPosition == helper.getAdapterPosition());
if (item.getLabelType() == HeadWearInfo.LABEL_TYPE_NORMAL) {
binding.ivTag.setVisibility(View.GONE);
} else if (HeadWearInfo.LABEL_TYPE_NEW == item.getLabelType()) {
binding.ivTag.setVisibility(View.VISIBLE);
binding.ivTag.setImageResource(R.drawable.ic_mark_new);
} else if (HeadWearInfo.LABEL_TYPE_DISCOUNT == item.getLabelType()) {
binding.ivTag.setVisibility(View.VISIBLE);
binding.ivTag.setImageResource(R.drawable.ic_mark_discount);
} else if (HeadWearInfo.LABEL_TYPE_LIMIT == item.getLabelType()) {
binding.ivTag.setVisibility(View.VISIBLE);
binding.ivTag.setImageResource(R.drawable.ic_mark_limit);
} else if (HeadWearInfo.LABEL_TYPE_EXCLUSIVE == item.getLabelType()) {
binding.ivTag.setVisibility(View.VISIBLE);
binding.ivTag.setImageResource(R.drawable.ic_mark_exclusive);
}
binding.tvHeadName.setText(item.getName() + "");
}
public void setCarInfoHasBeenBought(HeadWearInfo carInfo) {
if (carInfo.getHeadwearId() <= 0 || ListUtils.isListEmpty(mData)) return;
int index = mData.indexOf(carInfo);
if (index == -1) return;
mData.get(index).setStatus(HeadWearInfo.STATUS_IN_USED);
notifyItemChanged(index);
}
}

View File

@@ -6,11 +6,9 @@ import com.chwl.app.R;
import com.chwl.app.bindadapter.BaseAdapter;
import com.chwl.app.bindadapter.BindingViewHolder;
import com.chwl.app.databinding.ItemMyHeadWearBinding;
import com.chwl.app.utils.AvatarHelper;
import com.chwl.core.decoration.headwear.bean.HeadWearInfo;
import com.chwl.core.noble.NobleUtil;
import com.chwl.library.utils.ResUtil;
import com.chwl.library.widget.SVGAView;
/**
* Created by huangmeng1 on 2018/5/11.
@@ -22,14 +20,11 @@ public class MyHeadWearAdapter extends BaseAdapter<HeadWearInfo> {
super(layoutResId, brid);
}
private SVGAView.SVGACache svgaCache = SVGAView.newCache(10);
@Override
protected void convert(BindingViewHolder helper, HeadWearInfo item) {
super.convert(helper, item);
ItemMyHeadWearBinding binding = (ItemMyHeadWearBinding) helper.getBinding();
binding.ivCarCover.bindCache(svgaCache);
AvatarHelper.loadAvatarFrame(binding.ivCarCover, item.getFirstUrl(), item.getType());
NobleUtil.loadHeadWears(item.getPic(), binding.ivCarCover);
helper.addOnClickListener(R.id.tv_used);
if (item.getLabelType() == HeadWearInfo.LABEL_TYPE_NORMAL) {

View File

@@ -39,8 +39,8 @@ public class HomeIndicatorAdapter extends CommonNavigatorAdapter {
@Override
public IPagerTitleView getTitleView(Context context, final int i) {
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, true);
scaleTransitionPagerTitleView.setNormalColor(ContextCompat.getColor(context, R.color.color_990C1D18));
scaleTransitionPagerTitleView.setSelectedColor(ContextCompat.getColor(context, R.color.color_0C1D18));
scaleTransitionPagerTitleView.setNormalColor(ContextCompat.getColor(context, R.color.white_transparent_60));
scaleTransitionPagerTitleView.setSelectedColor(ContextCompat.getColor(context, R.color.color_FFFFFF));
scaleTransitionPagerTitleView.setMinScale(minScale);
scaleTransitionPagerTitleView.setTextSize(textSize);
int padding = UIUtil.dip2px(context, 13);
@@ -59,10 +59,10 @@ public class HomeIndicatorAdapter extends CommonNavigatorAdapter {
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator indicator = new LinePagerIndicator(context);
indicator.setMode(LinePagerIndicator.MODE_EXACTLY);
indicator.setLineHeight(context.getResources().getDimensionPixelOffset(R.dimen.dp_4));
indicator.setRoundRadius(context.getResources().getDimensionPixelOffset(R.dimen.dp_2));
indicator.setLineWidth(context.getResources().getDimensionPixelOffset(R.dimen.dp_13));
indicator.setColors(context.getResources().getColor(R.color.color_002512));
indicator.setLineHeight(UIUtil.dip2px(mContext, 2.5));
indicator.setRoundRadius(UIUtil.dip2px(mContext, 1.5));
indicator.setLineWidth(UIUtil.dip2px(mContext, 10));
indicator.setColors(context.getResources().getColor(R.color.color_10ECD6));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
// lp.bottomMargin = mBottomMargin;
indicator.setLayoutParams(lp);

View File

@@ -1,13 +1,9 @@
package com.chwl.app.home.adapter
import android.graphics.Rect
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.RecycledViewPool
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
@@ -15,54 +11,14 @@ import com.chwl.app.ui.utils.ImageLoadUtils
import com.chwl.app.ui.utils.load
import com.chwl.app.ui.utils.loadFromAssets
import com.chwl.core.home.bean.HomeRoomInfo
import com.example.lib_utils.AppUtils
import com.example.lib_utils.UiUtils
import com.opensource.svgaplayer.SVGADrawable
import com.opensource.svgaplayer.SVGAImageView
/**
* create by lvzebiao @2019/11/13
*/
class HomeRoomAdapter : BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.home_item_room) {
private var micUserItemViewPool = RecycledViewPool().apply {
setMaxRecycledViews(0, 50)
}
private val isRTL = UiUtils.isRtl(AppUtils.getApp())
override fun onCreateDefViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
return super.onCreateDefViewHolder(parent, viewType).apply {
val micUserRecyclerView = this.getView<RecyclerView>(R.id.recycler_view_users)
micUserRecyclerView.setOnTouchListener { v, event -> true }
micUserRecyclerView.setRecycledViewPool(micUserItemViewPool)
micUserRecyclerView.setHasFixedSize(true)
micUserRecyclerView.layoutManager =
LinearLayoutManager(parent.context, RecyclerView.HORIZONTAL, false).apply {
this.recycleChildrenOnDetach = true
this.isSmoothScrollbarEnabled
}
micUserRecyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
val offset = AppUtils.getApp().resources.getDimensionPixelOffset(R.dimen.dp_4) * -1
override fun getItemOffsets(
outRect: Rect,
view: View,
parent: RecyclerView,
state: RecyclerView.State
) {
super.getItemOffsets(outRect, view, parent, state)
val position = parent.getChildAdapterPosition(view)
if (position != 0) {
if (isRTL) {
outRect.right = offset
} else {
outRect.left = offset
}
}
}
})
micUserRecyclerView.adapter = HomeRoomUserAdapter()
}
}
class HomeRoomAdapter :
BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.home_item_room) {
override fun convert(helper: BaseViewHolder, item: HomeRoomInfo) {
helper.apply {
@@ -72,10 +28,18 @@ class HomeRoomAdapter : BaseQuickAdapter<HomeRoomInfo, BaseViewHolder>(R.layout.
setText(R.id.tv_desc, item.roomDesc)
}
val micUserRecyclerView = helper.getView<RecyclerView>(R.id.recycler_view_users)
val userAdapter = micUserRecyclerView.adapter as HomeRoomUserAdapter
userAdapter.setNewData(item.micUsers)
val avatars: Array<ImageView> = arrayOf(
helper.getView(R.id.iv_avatar_0),
helper.getView(R.id.iv_avatar_1),
helper.getView(R.id.iv_avatar_2),
helper.getView(R.id.iv_avatar_3),
helper.getView(R.id.iv_avatar_4)
)
for (i in avatars.indices) {
val avatarUrl = item.micUsers?.getOrNull(i)?.avatar
avatars[i].isInvisible = avatarUrl.isNullOrBlank()
avatars[i].load(avatarUrl)
}
val topView = helper.getView<ImageView>(R.id.iv_top)
if (item.isHourTop1 == 1) {
topView.setImageResource(R.drawable.home_room_bg_hour_top)

View File

@@ -1,16 +0,0 @@
package com.chwl.app.home.adapter
import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.chwl.app.ui.utils.loadAvatar
import com.chwl.core.home.bean.MicUsersBean
class HomeRoomUserAdapter :
BaseQuickAdapter<MicUsersBean, BaseViewHolder>(R.layout.home_item_room_user) {
override fun convert(helper: BaseViewHolder, item: MicUsersBean?) {
val avatarView = helper.getView<ImageView>(R.id.iv_avatar)
avatarView.loadAvatar(item?.avatar)
}
}

View File

@@ -7,14 +7,14 @@ import android.view.WindowManager
import android.widget.ImageView
import androidx.core.view.isGone
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogHelloMessageBinding
import com.chwl.app.ui.utils.load
import com.chwl.app.room_chat.activity.RoomMsgActivity
import com.chwl.core.channel_page.bean.HelloMessageInfo
import com.chwl.library.utils.ResUtil
class HelloMessageDialog : BaseDialogFragment<DialogHelloMessageBinding>() {
class HelloMessageDialog : BaseDialog<DialogHelloMessageBinding>() {
companion object {

View File

@@ -4,13 +4,13 @@ import android.annotation.SuppressLint
import android.os.Bundle
import android.view.WindowManager
import com.chwl.app.avroom.activity.AVRoomActivity
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogNewUserHelloBinding
import com.chwl.app.ui.utils.load
import com.chwl.core.channel_page.bean.NewUserHelloInfo
import com.chwl.core.utils.extension.subAndReplaceDot
class NewUserHelloDialog : BaseDialogFragment<DialogNewUserHelloBinding>() {
class NewUserHelloDialog : BaseDialog<DialogNewUserHelloBinding>() {
companion object {

View File

@@ -3,12 +3,12 @@ package com.chwl.app.home.dialog
import android.annotation.SuppressLint
import android.os.Bundle
import com.chwl.app.avroom.activity.AVRoomActivity
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogRecommendRoomBinding
import com.chwl.app.ui.utils.ImageLoadUtils
import com.chwl.core.home.bean.HomeRoomInfo
class RecommendRoomDialog : BaseDialogFragment<DialogRecommendRoomBinding>() {
class RecommendRoomDialog : BaseDialog<DialogRecommendRoomBinding>() {
companion object {

View File

@@ -139,7 +139,7 @@ class ContactsListFragment : BaseViewBindingFragment<FragmentContactListBinding>
}
override fun onScroll(
e1: MotionEvent?,
e1: MotionEvent,
e2: MotionEvent,
distanceX: Float,
distanceY: Float
@@ -151,7 +151,7 @@ class ContactsListFragment : BaseViewBindingFragment<FragmentContactListBinding>
}
override fun onFling(
e1: MotionEvent?,
e1: MotionEvent,
e2: MotionEvent,
velocityX: Float,
velocityY: Float

View File

@@ -198,7 +198,7 @@ class HomeRecommendFragment : BaseViewBindingFragment<FragmentHomeRecommendBindi
override fun createFragment(position: Int): Fragment {
val itemId = getItemId(position)
return HomeTabRoomFragment.newInstance(itemId.toInt()).apply {
this.autoRefreshOnVisible = true
autoRefreshOnVisible = true
}
}

View File

@@ -1,6 +1,7 @@
package com.chwl.app.home.fragment
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager

View File

@@ -15,12 +15,7 @@ import androidx.databinding.DataBindingUtil;
import com.bumptech.glide.request.RequestOptions;
import com.chwl.app.ui.login.LoginPasswordActivity;
import com.chwl.core.auth.AuthModel;
import com.chwl.core.bean.response.result.TicketResult;
import com.chwl.core.gift.GiftModel;
import com.chwl.library.language.LanguageHelper;
import com.chwl.library.utils.SingleToastUtil;
import com.example.lib_utils.log.LogUtil;
import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nim.uikit.support.glide.GlideApp;
import com.chwl.app.MainActivity;
@@ -37,10 +32,6 @@ import com.chwl.core.utils.OaidUtil;
import com.chwl.core.utils.SharedPreferenceUtils;
import com.chwl.library.common.util.DeviceUtil;
import io.reactivex.SingleObserver;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
/**
* @author xiaoyu
* @date 2017/12/30
@@ -52,15 +43,8 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
private ActivitySplashBinding mBinding;
private SplashComponent mLocalSplashVo;
private CompositeDisposable disposable = new CompositeDisposable();
// ticket状态 -1:加载失败、0:加载中、1:加载成功
private int ticketState = 0;
private volatile boolean needJump = false;
private Runnable jumpRunnable;
public static void start(Context context) {
Intent starter = new Intent(context, SplashActivity.class);
context.startActivity(starter);
@@ -88,10 +72,9 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
// 从堆栈恢复不再重复解析之前的intent
setIntent(new Intent());
}
initiate();
StatusBarUtil.transparencyBar(this);
StatusBarUtil.StatusBarLightMode(this);
initTicket();
initiate();
}
@Override
@@ -162,12 +145,8 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
}
public void jumpActivity(Intent intent) {
jumpRunnable = () -> jumpActivityImpl(intent);
next();
}
public void jumpActivityImpl(Intent intent) {
if (!AuthModel.get().isLogin()) {
AccountInfo currentAccountInfo = DemoCache.readCurrentAccountInfo();
if (currentAccountInfo == null || TextUtils.isEmpty(currentAccountInfo.getAccess_token())) {
NimMiddleActivity.openCommunity = false;
LoginPasswordActivity.start(this);
finish();
@@ -211,53 +190,4 @@ public class SplashActivity extends AppCompatActivity implements View.OnClickLis
}
private void initTicket() {
ticketState = 0;
if (!AuthModel.get().isLogin()) {
ticketState = -1;
next();
return;
}
AuthModel.get().refreshTicket().subscribe(new SingleObserver<TicketResult>() {
@Override
public void onSubscribe(Disposable d) {
disposable.add(d);
}
@Override
public void onSuccess(TicketResult ticketResult) {
LogUtil.d("SplashActivity", "initTicket onSuccess", false);
onTicketSuccess();
ticketState = 1;
next();
}
@Override
public void onError(Throwable throwable) {
LogUtil.d("SplashActivity", "initTicket throwable:" + throwable.getMessage(), false);
SingleToastUtil.showToast(throwable.getMessage());
AuthModel.get().reset();
ticketState = -1;
next();
}
});
}
private void onTicketSuccess() {
GiftModel.get().tryLoadGiftList();
}
private void next() {
if (ticketState != 0 && jumpRunnable != null) {
jumpRunnable.run();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (disposable != null && !disposable.isDisposed()) {
disposable.dispose();
}
}
}

View File

@@ -3,7 +3,7 @@ package com.chwl.app.support
import androidx.lifecycle.viewModelScope
import com.chwl.app.BuildConfig
import com.chwl.app.base.BaseViewModel
import com.chwl.library.utils.PathHelper
import com.chwl.core.helper.PathHelper
import com.chwl.core.home.model.HomeModel
import com.chwl.library.common.util.SPUtils
import com.chwl.library.download.DownloadException

View File

@@ -1,50 +0,0 @@
package com.chwl.app.ui.debug
import com.chwl.app.base.BaseViewBindingActivity
import com.chwl.app.databinding.DebugActivityBinding
import com.netease.nim.uikit.StatusBarUtil
class DebugActivity : BaseViewBindingActivity<DebugActivityBinding>() {
override fun init() {
initWhiteTitleBar("调试")
initSVGAList()
}
private fun initSVGAList() {
val adapter = DebugAdapter()
binding.recyclerView.adapter = adapter
// binding.recyclerView.setItemViewCacheSize(-1)
val svgaList = listOf(
"https://image.pekolive.com/花和玫瑰.svga",
"https://image.pekolive.com/firecrown.svga",
"https://image.pekolive.com/ningtangchengbaoqietu.svga",
"https://image.pekolive.com/xunmengfengche.svga",
"https://image.pekolive.com/tonghuaqiyuan1334.svga",
"https://image.pekolive.com/mengquyinhe.svga",
"https://image.pekolive.com/duqinghuashu.svga",
"https://image.pekolive.com/juzhijingling.svga",
"https://image.pekolive.com/3121_aixintouwei.svga",
"https://image.pekolive.com/4051_langmanyewan.svga"
)
val list = ArrayList<String>()
list.addAll(svgaList)
list.addAll(svgaList)
adapter.setNewData(list)
binding.btnRefreshAll.setOnClickListener {
adapter.notifyDataSetChanged()
}
binding.btnRefresh.setOnClickListener {
adapter.notifyItemChanged(5, true)
}
}
override fun needSteepStateBar(): Boolean {
return true
}
override fun setStatusBar() {
super.setStatusBar()
StatusBarUtil.transparencyBar(this)
StatusBarUtil.StatusBarLightMode(this)
}
}

View File

@@ -1,47 +0,0 @@
package com.chwl.app.ui.debug
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.chwl.library.widget.SVGAView
import com.example.lib_utils.log.ILog
class DebugAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.debug_item_svga), ILog {
private val svgaCache = SVGAView.newCache(10)
override fun convertPayloads(
helper: BaseViewHolder,
item: String?,
payloads: MutableList<Any>
) {
super.convertPayloads(helper, item, payloads)
logD("convertPayloads holder:${helper.absoluteAdapterPosition} #${helper.hashCode()} SVGAView")
val svgaView = helper.getView<SVGAView>(R.id.svga_view)
svgaView.loadUrl(item)
}
override fun convert(helper: BaseViewHolder, item: String?) {
logD("convert holder:${helper.absoluteAdapterPosition} #${helper.hashCode()} SVGAView")
helper.setText(R.id.tv_name, helper.absoluteAdapterPosition.toString())
val item = getItem(helper.bindingAdapterPosition)
val svgaView = helper.getView<SVGAView>(R.id.svga_view)
svgaView.bindCache(svgaCache)
svgaView.setLogTag(helper.absoluteAdapterPosition.toString())
svgaView.loadUrl(item)
}
override fun onViewAttachedToWindow(holder: BaseViewHolder) {
super.onViewAttachedToWindow(holder)
logD("onViewAttachedToWindow holder:${holder.absoluteAdapterPosition} #${holder.hashCode()} SVGAView")
// val item = getItem(holder.bindingAdapterPosition)
// val svgaView = holder.getView<SVGAView>(R.id.svga_view)
// svgaView.bindCache(SVGAView.newCache(10))
// svgaView.setLogTag(holder.absoluteAdapterPosition.toString())
// svgaView.loadUrl(item)
}
override fun onViewDetachedFromWindow(holder: BaseViewHolder) {
super.onViewDetachedFromWindow(holder)
logD("onViewDetachedFromWindow holder:${holder.absoluteAdapterPosition} #${holder.hashCode()} SVGAView")
}
}

View File

@@ -1,61 +0,0 @@
package com.chwl.app.ui.feedback
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.view.WindowManager
import com.chwl.app.R
import com.chwl.app.base.BaseBindingDialog
import com.chwl.app.databinding.FeedbackCustomerServiceDialogBinding
import com.chwl.app.ui.widget.recyclerview.decoration.SpacingDecoration
import com.chwl.library.annatation.ActLayoutRes
import com.chwl.library.utils.SingleToastUtil
@ActLayoutRes(R.layout.feedback_customer_service_dialog)
class CustomerServiceDialog(context: Context, val map: Map<String, String?>) :
BaseBindingDialog<FeedbackCustomerServiceDialogBinding>(context, R.style.dialog) {
private val adapter = CustomerServiceItemAdapter()
override fun onStart() {
width = WindowManager.LayoutParams.MATCH_PARENT
super.onStart()
}
override fun init() {
binding.layoutRoot.setOnClickListener {
dismiss()
}
binding.tvNext.setOnClickListener {
dismiss()
}
binding.recyclerView.addItemDecoration(
SpacingDecoration(
0,
context.resources.getDimensionPixelOffset(R.dimen.dp_10),
false
)
)
binding.recyclerView.adapter = adapter
val list = map.map {
it
}
adapter.setNewData(list)
adapter.setOnItemChildClickListener { adapter, view, position ->
val text = this.adapter.getItem(position)?.value
if (text != null) {
copyText(text)
}
}
}
private fun copyText(text: String) {
try {
val cm =
context?.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
cm.setPrimaryClip(ClipData.newPlainText("text", text))
SingleToastUtil.showToast(R.string.have_copy)
} catch (e: Exception) {
SingleToastUtil.showToast(e.toString())
}
}
}

View File

@@ -1,34 +0,0 @@
package com.chwl.app.ui.feedback
import android.annotation.SuppressLint
import android.view.Gravity
import android.view.ViewGroup
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.example.lib_utils.AppUtils
import com.example.lib_utils.UiUtils
class CustomerServiceItemAdapter :
BaseQuickAdapter<Map.Entry<String, String?>, BaseViewHolder>(R.layout.feedback_customer_service_item) {
private var isRTL = UiUtils.isRtl(AppUtils.getApp())
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
return super.onCreateViewHolder(parent, viewType).apply {
this.addOnClickListener(R.id.layout_copy)
val textView = getView<TextView>(R.id.tv_content)
if (isRTL) {
textView.gravity = Gravity.RIGHT
}
}
}
@SuppressLint("SetTextI18n")
override fun convert(helper: BaseViewHolder, item: Map.Entry<String, String?>) {
val textView = helper.getView<TextView>(R.id.tv_content)
textView.text = "${item.key}: ${item.value ?: ""}"
}
}

View File

@@ -1,353 +0,0 @@
package com.chwl.app.ui.feedback
import android.Manifest
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Build
import android.widget.ImageView.ScaleType
import androidx.activity.viewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.chwl.app.R
import com.chwl.app.base.BaseViewBindingActivity
import com.chwl.app.databinding.FeedbackActivityBinding
import com.chwl.app.ui.utils.load
import com.chwl.app.ui.widget.dialog.CommonTipDialog
import com.chwl.core.file.FileModel
import com.chwl.core.home.bean.FeedbackTypeBean
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.photo.PhotoProvider.photoProvider
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.common.util.PhotosCompressCallback
import com.chwl.library.easypermisssion.EasyPermissions
import com.chwl.library.easyphoto.utils.settings.SettingsUtils
import com.chwl.library.utils.ResUtil
import com.chwl.library.utils.SingleToastUtil
import com.example.lib_utils.SolveEditTextScrollClash
import com.example.lib_utils.ktx.getColorById
import com.example.lib_utils.ktx.setOnInputChangedListener
import com.example.lib_utils.ktx.singleClick
import com.example.lib_utils.spannable.SpannableTextBuilder
import com.google.android.flexbox.FlexDirection
import com.google.android.flexbox.FlexWrap
import com.google.android.flexbox.FlexboxLayoutManager
import com.google.android.flexbox.JustifyContent
import com.hjq.toast.ToastUtils
import com.netease.nim.uikit.StatusBarUtil
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
class FeedbackActivity : BaseViewBindingActivity<FeedbackActivityBinding>(),
EasyPermissions.PermissionCallbacks {
private val PERMISSION_CODE_STORAGE = 12
private val REQUEST_CODE_OPEN_PHOTO_PROVIDER = 111 // 从相册中选择
private val viewModel: FeedbackViewModel by viewModels()
private val adapter = FeedbackTypeAdapter()
private var compressJob: Job? = null
private var wantShowCustomerService = false
private var imagePath: String? = null
private var imageUrl: String? = null
override fun init() {
initWhiteTitleBar(ResUtil.getString(R.string.feedback_title))
initView()
initEvent()
initObserve()
refreshSubmitState()
}
private fun initView() {
val flexBoxLayoutManager = FlexboxLayoutManager(context)
flexBoxLayoutManager.flexDirection = FlexDirection.ROW
flexBoxLayoutManager.flexWrap = FlexWrap.WRAP
flexBoxLayoutManager.justifyContent = JustifyContent.FLEX_START
binding.recyclerViewType.layoutManager = flexBoxLayoutManager
binding.recyclerViewType.adapter = adapter
binding.etContent.setOnTouchListener(SolveEditTextScrollClash(binding.etContent))
}
private fun initEvent() {
adapter.setOnItemClickListener { adapter, view, position ->
this.adapter.selectItem(this.adapter.getItem(position))
refreshSubmitState()
}
binding.tvSubmit.singleClick {
dialogManager.showProgressDialog(this)
submit()
}
binding.ivImage.singleClick {
checkStoragePermission()
}
binding.ivCustomerService.singleClick {
showCustomerServiceDialog()
}
binding.etContent.setOnInputChangedListener {
updateContentInputTips(this)
refreshSubmitState()
true
}
binding.etContact.setOnInputChangedListener {
refreshSubmitState()
true
}
}
private fun initObserve() {
viewModel.loadingLiveData.observe(this) {
if (it) dialogManager.showProgressDialog(this)
else dialogManager.dismissDialog()
}
viewModel.configLiveData.observe(this) {
if (it?.isSuccess == true) {
loadTypeList(it.data?.typeEnumList)
if (wantShowCustomerService) {
showCustomerServiceDialog(it.data?.customContactMap)
}
} else if (it?.message != null) {
toast(it.message ?: "")
}
wantShowCustomerService = false
}
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
viewModel.submitStateFlow.collectLatest {
dialogManager.dismissDialog()
if (it.isSuccess) {
toast(R.string.home_model_homemodel_01)
finish()
} else if (it.message != null) {
toast(it.message)
}
}
}
}
}
private fun updateContentInputTips(length: Int) {
if (length > 0) {
SpannableTextBuilder(binding.tvContentCount)
.appendText(
text = length.toString(),
textColor = getColorById(R.color.color_3FDDAC)
)
.appendText(text = "/300")
.apply()
} else {
binding.tvContentCount.text = "${length}/300"
}
}
private fun showCustomerServiceDialog() {
val config = viewModel.configLiveData.value?.data
if (config == null) {
wantShowCustomerService = true
viewModel.getConfig()
return
}
showCustomerServiceDialog(config.customContactMap)
}
private fun showCustomerServiceDialog(info: Map<String, String>?) {
if (info.isNullOrEmpty()) {
return
}
CustomerServiceDialog(this, info).show()
}
private fun loadTypeList(type: List<FeedbackTypeBean>?) {
adapter.setNewData(type)
}
private fun onAddImage(path: String?) {
if (path.isNullOrEmpty()) {
imagePath = null
imageUrl = null
binding.ivImage.scaleType = ScaleType.CENTER_INSIDE
binding.ivImage.setImageResource(R.drawable.feedback_ic_add)
} else {
imagePath = path
imageUrl = null
binding.ivImage.load(path)
binding.ivImage.scaleType = ScaleType.CENTER_CROP
}
refreshSubmitState()
}
private fun refreshSubmitState() {
binding.tvSubmit.isEnabled = canSubmit()
}
private fun canSubmit(): Boolean {
if (binding.etContent.text.isNullOrEmpty()) {
return false
}
if (binding.etContact.text.isNullOrEmpty()) {
return false
}
if (adapter.getSelectItem() == null) {
return false
}
return true
}
private fun submit() {
val content = binding.etContent.text.trim().toString()
val contact = binding.etContact.text.trim().toString()
val type = adapter.getSelectItem()?.type ?: ""
val imagePath = imagePath
if (imagePath != null && imageUrl == null) {
uploadImage(imagePath, {
imageUrl = it
submit()
}, {
if (it != null) {
toast(ResUtil.getString(R.string.ui_user_userinfomodifyactivity_08) + ":${it.message}")
}
dialogManager.dismissDialog()
})
} else {
viewModel.submitFeedback(
type = type,
content = content,
image = imageUrl ?: "",
contact = contact
)
}
}
@SuppressLint("CheckResult")
private fun uploadImage(path: String, success: (String) -> Unit, failed: (Throwable?) -> Unit) {
FileModel.get()
.uploadFile(path)
.compose(bindToLifecycle())
.subscribe { url: String?, throwable: Throwable? ->
if (url != null) {
success.invoke(url)
} else {
failed.invoke(throwable)
}
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_CODE_OPEN_PHOTO_PROVIDER) {
if (data == null) {
return
}
PhotoProvider.getResultPathListAsync(data) { list ->
if (list.isNullOrEmpty()) {
SingleToastUtil.showToastShort(com.netease.nim.uikit.R.string.picker_image_error)
return@getResultPathListAsync
}
val paths = list.map { it.path }.toMutableList()
compressPhotos(paths)
}
}
}
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String?>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this)
}
private fun checkStoragePermission() {
if (!EasyPermissions.hasPermissions(
this,
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
) {
EasyPermissions.requestPermissions(
this,
getString(R.string.permission_storage_rationale),
PERMISSION_CODE_STORAGE,
if (Build.VERSION.SDK_INT >= 33) Manifest.permission.READ_MEDIA_IMAGES else Manifest.permission.READ_EXTERNAL_STORAGE
)
} else {
photoProvider(
this,
1,
true,
REQUEST_CODE_OPEN_PHOTO_PROVIDER,
true,
true
)
}
}
private fun compressPhotos(paths: MutableList<String>) {
compressJob?.cancel(null)
compressJob = PhotoCompressUtil.compress(
this, paths,
PhotoCompressUtil.getCompressCachePath(),
object : PhotosCompressCallback {
override fun onSuccess(compressedImgList: ArrayList<String>) {
val firstItem = compressedImgList.firstOrNull() ?: return
onAddImage(firstItem)
}
override fun onFail(e: Throwable) {
ToastUtils.show(getString(R.string.picker_image_error))
}
}
)
}
override fun needSteepStateBar(): Boolean {
return true
}
override fun setStatusBar() {
super.setStatusBar()
StatusBarUtil.transparencyBar(this)
StatusBarUtil.StatusBarLightMode(this)
}
override fun onPermissionsGranted(requestCode: Int, perms: MutableList<String>) {
if (requestCode == PERMISSION_CODE_STORAGE) {
checkStoragePermission()
}
}
override fun onPermissionsDenied(requestCode: Int, perms: MutableList<String>) {
if (requestCode == PERMISSION_CODE_STORAGE) {
val requestTip = getString(R.string.permission_storage_denied)
val mPrivacyDialog = CommonTipDialog(context)
mPrivacyDialog.setTipMsg(requestTip)
mPrivacyDialog.setOkText(getString(R.string.room_perform_go_update))
mPrivacyDialog.setOnActionListener(object : CommonTipDialog.OnActionListener {
override fun onOk() {
//同意跳到应用详情页面
SettingsUtils.startMyApplicationDetailsForResult(
this@FeedbackActivity,
packageName
)
}
override fun onCancel() {
super.onCancel()
//取消跳到应用详情页面
ToastUtils.show(getString(R.string.permission_storage_refused))
}
})
mPrivacyDialog.show()
}
}
override fun onResume() {
super.onResume()
if (viewModel.configLiveData.value?.data == null) {
viewModel.getConfig()
}
}
}

View File

@@ -1,42 +0,0 @@
package com.chwl.app.ui.feedback
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.chwl.core.home.bean.FeedbackTypeBean
class FeedbackTypeAdapter : BaseQuickAdapter<FeedbackTypeBean, BaseViewHolder>(R.layout.feedback_item_type) {
private var selectItem: FeedbackTypeBean? = null
override fun convertPayloads(
helper: BaseViewHolder,
item: FeedbackTypeBean?,
payloads: MutableList<Any>
) {
super.convertPayloads(helper, item, payloads)
convertState(helper, item)
}
override fun convert(helper: BaseViewHolder, item: FeedbackTypeBean?) {
helper.setText(R.id.tv_name, item?.desc ?: "")
convertState(helper, item)
}
private fun convertState(helper: BaseViewHolder, item: FeedbackTypeBean?) {
if (selectItem == item) {
helper.setBackgroundRes(R.id.tv_name, R.drawable.shape_85f6d3_15dp)
} else {
helper.setBackgroundRes(R.id.tv_name, R.drawable.shape_f3f5fa_15dp)
}
}
fun selectItem(item: FeedbackTypeBean?) {
this.selectItem = item
notifyItemRangeChanged(0, itemCount, true)
}
fun getSelectItem(): FeedbackTypeBean? {
return selectItem
}
}

View File

@@ -1,36 +0,0 @@
package com.chwl.app.ui.feedback
import androidx.lifecycle.MutableLiveData
import com.chwl.app.base.BaseViewModel
import com.chwl.core.bean.response.BeanResult
import com.chwl.core.home.bean.FeedbackConfigBean
import com.chwl.core.home.model.HomeModel
import kotlinx.coroutines.flow.MutableSharedFlow
class FeedbackViewModel : BaseViewModel() {
val configLiveData = MutableLiveData<BeanResult<FeedbackConfigBean>?>()
val submitStateFlow = MutableSharedFlow<BeanResult<Any?>>()
fun getConfig() {
safeLaunch(
needLoading = true,
onError = {
configLiveData.postValue(BeanResult.failed(it))
}) {
val value = HomeModel.getFeedbackConfig()
configLiveData.postValue(BeanResult.success(value))
}
}
fun submitFeedback(type: String, content: String, image: String, contact: String) {
safeLaunch(
needLoading = true,
onError = {
submitStateFlow.emit(BeanResult.failed(it))
}) {
val value = HomeModel.commitFeedback(contact, content, image, type)
submitStateFlow.emit(BeanResult.success(value))
}
}
}

View File

@@ -1,202 +0,0 @@
package com.chwl.app.ui.game_team.invite
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import androidx.fragment.app.viewModels
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.common.widget.dialog.DialogManager
import com.chwl.app.databinding.GameTeamInviteDialogBinding
import com.chwl.app.ui.pay.ChargeActivity
import com.chwl.app.ui.utils.load
import com.chwl.core.game_team.UserGameTeamInfo
import com.chwl.core.pay.PayModel
import com.chwl.core.pay.bean.WalletInfo
import com.chwl.core.utils.net.BalanceNotEnoughExeption
import com.chwl.library.utils.ResUtil
import com.chwl.library.utils.SingleToastUtil
import com.example.lib_utils.ktx.singleClick
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import java.math.BigDecimal
import java.math.RoundingMode
class GameTeamInviteDialog : BaseDialogFragment<GameTeamInviteDialogBinding>() {
private val viewModel: GameTeamInviteViewModel by viewModels()
override var width = WindowManager.LayoutParams.MATCH_PARENT
override var gravity = Gravity.CENTER
private var gameId: Long = 0
private var gameUid: Long = 0
private var gameBackground: String? = null
private var gamePrice: Long = 0
private var gameInning: Long = 1
private var dialogManager: DialogManager? = null
var successListener: (() -> Unit)? = null
companion object {
fun newInstance(info: UserGameTeamInfo): GameTeamInviteDialog {
return newInstance(info.uid ?: 0, info.gameId ?: 0, info.pic, info.price ?: 0, 1)
}
fun newInstance(
targetUid: Long,
gameId: Long,
gameBackground: String?,
gamePrice: Long,
gameInning: Long,
): GameTeamInviteDialog {
return GameTeamInviteDialog().apply {
arguments = Bundle().apply {
putLong("targetUid", targetUid)
putLong("gameId", gameId)
putSerializable("gameBackground", gameBackground)
putLong("gamePrice", gamePrice)
putLong("gameInning", gameInning)
}
}
}
}
override fun init() {
gameUid = arguments?.getLong("targetUid") ?: 0
gameId = arguments?.getLong("gameId") ?: 0
gameBackground = arguments?.getString("gameBackground")
gamePrice = arguments?.getLong("gamePrice") ?: 0
gameInning = arguments?.getLong("gameInning") ?: 1
dialogManager = DialogManager(requireContext())
initView()
initEvent()
initObserve()
}
override fun onResume() {
super.onResume()
updateBalance()
}
private fun initView() {
binding.ivGameImage.load(gameBackground)
updateInning(0)
requestBalance()
}
private fun initEvent() {
binding.ivClose.setOnClickListener {
safeDismiss()
}
binding.tvPay.singleClick {
pay()
}
binding.layoutRecharge.setOnClickListener {
ChargeActivity.start(context)
}
binding.ivCountAdd.setOnClickListener {
updateInning(1)
}
binding.ivCountSubtract.setOnClickListener {
updateInning(-1)
}
}
private fun initObserve() {
viewLifecycleOwner.lifecycleScope.launch {
viewLifecycleOwner.lifecycle.repeatOnLifecycle(Lifecycle.State.STARTED) {
viewModel.payResultFlow.collectLatest {
dialogManager?.dismissDialog()
if (it.isSuccess) {
successListener?.invoke()
SingleToastUtil.showToast(R.string.game_team_19)
safeDismiss()
} else if (it.code == BalanceNotEnoughExeption.code) {
showBalanceNotEnoughDialog()
} else {
it.message?.let { msg ->
SingleToastUtil.showToast(msg)
}
}
}
}
}
}
private fun showBalanceNotEnoughDialog() {
dialogManager?.showOkCancelDialog(
ResUtil.getString(R.string.widget_dialog_dialoguihelper_04),
ResUtil.getString(R.string.treasure_to_charge)
) {
ChargeActivity.start(context)
}
}
private fun pay() {
dialogManager?.showProgressDialog(requireContext())
viewModel.pay(gameId, gameUid, gameInning)
}
private fun updateInning(add: Int) {
var newInning = gameInning + add
if (newInning <= 0) {
newInning = 1
}
gameInning = newInning
if (gameInning <= 1L) {
binding.ivCountSubtract.setImageResource(R.drawable.game_team_invite_ic_subtract_disabled)
binding.ivCountSubtract.isEnabled = false
} else {
binding.ivCountSubtract.setImageResource(R.drawable.game_team_invite_ic_subtract)
binding.ivCountSubtract.isEnabled = true
}
binding.tvCount.text = gameInning.toString()
updateMoney()
}
private fun updateMoney() {
val total = gamePrice * gameInning
binding.tvMoney.text = total.toString()
}
@SuppressLint("SetTextI18n")
private fun updateBalance() {
if (_binding == null) {
return
}
val balanceTitle = getString(R.string.gift_wallet_overage)
val balanceValue = PayModel.get().currentWalletInfo?.diamondNum ?: 0.0
var balanceBigDecimal = BigDecimal.valueOf(balanceValue)
balanceBigDecimal = balanceBigDecimal.setScale(0, RoundingMode.DOWN)
binding.tvBalance.text = "$balanceTitle${balanceBigDecimal.toPlainString()}"
}
@SuppressLint("CheckResult")
private fun requestBalance() {
PayModel.get().myRemoteWalletInfo.compose<WalletInfo>(bindToLifecycle())
.subscribe { info: WalletInfo ->
updateBalance()
}
}
override fun onDestroyView() {
super.onDestroyView()
dialogManager?.dismissDialog()
dialogManager = null
}
override fun onDestroy() {
super.onDestroy()
successListener = null
}
}

View File

@@ -1,22 +0,0 @@
package com.chwl.app.ui.game_team.invite
import com.chwl.app.base.BaseViewModel
import com.chwl.core.auth.AuthModel
import com.chwl.core.bean.response.BeanResult
import com.chwl.core.room.game.GameModel
import kotlinx.coroutines.flow.MutableSharedFlow
class GameTeamInviteViewModel : BaseViewModel() {
var payResultFlow = MutableSharedFlow<BeanResult<Any>>()
fun pay(gameId: Long, gameUid: Long, inning: Long) {
safeLaunch(onError = {
payResultFlow.emit(BeanResult.failed(it))
}) {
val result =
GameModel.startGameTeam(gameId, gameUid, inning, AuthModel.get().currentUid)
payResultFlow.emit(BeanResult.success(result))
}
}
}

View File

@@ -1,63 +0,0 @@
package com.chwl.app.ui.game_team.record
import android.content.Context
import android.content.Intent
import android.widget.TextView
import androidx.fragment.app.Fragment
import com.chwl.app.R
import com.chwl.app.avroom.adapter.CommonVPAdapter
import com.chwl.app.base.BaseViewBindingActivity
import com.chwl.app.databinding.GameTeamRecordActivityBinding
import com.chwl.app.ui.widget.magicindicator.ViewPagerHelper
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
import com.chwl.library.utils.ResUtil
import com.netease.nim.uikit.StatusBarUtil
class GameTeamRecordActivity : BaseViewBindingActivity<GameTeamRecordActivityBinding>() {
companion object {
fun start(context: Context) {
context.startActivity(Intent(context, GameTeamRecordActivity::class.java))
}
}
override fun init() {
initWhiteTitleBar(ResUtil.getString(R.string.game_team_09))
initTab()
}
private fun initTab() {
val fragmentList = ArrayList<Fragment>()
fragmentList.add(GameTeamRecordFragment.newInstance(GameTeamRecordFragment.TYPE_INITIATOR))
fragmentList.add(GameTeamRecordFragment.newInstance(GameTeamRecordFragment.TYPE_RECEIVER))
val titleList = ArrayList<String>()
titleList.add(getString(R.string.game_team_10))
titleList.add(getString(R.string.game_team_11))
val commonNavigator = CommonNavigator(context)
commonNavigator.setTitleWrapContent(false)
val magicIndicatorAdapter = GameTeamRecordIndicatorAdapter(context, titleList)
magicIndicatorAdapter.setOnItemSelectListener { position: Int, view: TextView? ->
binding.viewPager.currentItem = position
}
commonNavigator.adapter = magicIndicatorAdapter
binding.magicIndicator.navigator = commonNavigator
binding.viewPager.offscreenPageLimit = 2
binding.viewPager.adapter = CommonVPAdapter(
supportFragmentManager,
lifecycle,
fragmentList
)
binding.viewPager.isUserInputEnabled = false
ViewPagerHelper.bind(binding.magicIndicator, binding.viewPager)
}
override fun needSteepStateBar(): Boolean {
return true
}
override fun setStatusBar() {
super.setStatusBar()
StatusBarUtil.transparencyBar(this)
StatusBarUtil.StatusBarLightMode(this)
}
}

View File

@@ -1,38 +0,0 @@
package com.chwl.app.ui.game_team.record
import android.view.View
import android.widget.ImageView
import androidx.core.view.isVisible
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.chwl.app.ui.utils.load
import com.chwl.app.ui.utils.loadAvatar
import com.chwl.core.game_team.GameTeamRecordBean
class GameTeamRecordAdapter :
BaseQuickAdapter<GameTeamRecordBean, BaseViewHolder>(R.layout.game_team_record_item) {
var isInitiator = false
override fun convert(helper: BaseViewHolder, item: GameTeamRecordBean?) {
helper.addOnClickListener(R.id.tv_repurchase, R.id.tv_chat, R.id.iv_order_id_copy)
val userAvatarView = helper.getView<ImageView>(R.id.iv_user_avatar)
val repurchaseView = helper.getView<View>(R.id.tv_repurchase)
if (isInitiator) {
repurchaseView.isVisible = true
helper.setText(R.id.tv_user_name, item?.toNick ?: "")
helper.setText(R.id.tv_user_id, item?.toErBanNo?.toString() ?: "")
userAvatarView.load(item?.toAvatar)
} else {
repurchaseView.isVisible = false
helper.setText(R.id.tv_user_name, item?.fromNick ?: "")
helper.setText(R.id.tv_user_id, item?.fromErBanNo?.toString() ?: "")
userAvatarView.load(item?.fromAvatar)
}
helper.setText(R.id.tv_game_name, item?.gameName ?: "")
helper.setText(R.id.tv_order_money, item?.amount?.toString())
helper.setText(R.id.tv_order_time, item?.orderTime)
helper.setText(R.id.tv_order_id, item?.orderNo)
}
}

View File

@@ -1,154 +0,0 @@
package com.chwl.app.ui.game_team.record
import android.os.Bundle
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.chwl.app.R
import com.chwl.app.base.BaseViewBindingFragment
import com.chwl.app.common.EmptyViewHelper
import com.chwl.app.databinding.GameTemaRecordFragmentBinding
import com.chwl.app.ui.game_team.invite.GameTeamInviteDialog
import com.chwl.app.ui.im.avtivity.NimP2PMessageActivity
import com.chwl.app.ui.utils.RVDelegate
import com.chwl.app.utils.ClipboardUtils
import com.chwl.core.game_team.GameTeamRecordBean
import com.chwl.library.utils.SingleToastUtil
class GameTeamRecordFragment : BaseViewBindingFragment<GameTemaRecordFragmentBinding>() {
companion object {
const val TYPE_INITIATOR = 0
const val TYPE_RECEIVER = 1
fun newInstance(type: Int): GameTeamRecordFragment {
return GameTeamRecordFragment().apply {
arguments = Bundle().apply {
putInt("type", type)
}
}
}
}
private val viewModel: GameTeamRecordViewModel by viewModels()
private val adapter = GameTeamRecordAdapter()
private var type: Int = TYPE_INITIATOR
private var rvDelegate: RVDelegate<GameTeamRecordBean>? = null
private var pageNum = 1
private val pageSize = 20
override fun init() {
type = arguments?.getInt("type", TYPE_INITIATOR) ?: TYPE_INITIATOR
initView()
initEvent()
initObserve()
binding.swipeRefresh.isRefreshing = true
loadData(true)
}
private fun initView() {
adapter.isInitiator = type == TYPE_INITIATOR
binding.recyclerView.adapter = adapter
rvDelegate = RVDelegate.Builder<GameTeamRecordBean>()
.setPageSize(pageSize)
.setAdapter(adapter)
.setRecyclerView(binding.recyclerView)
.setEmptyView(
EmptyViewHelper.createEmptyTextViewHeight(
context,
getString(R.string.data_empty)
)
)
.setLayoutManager(LinearLayoutManager(mContext))
.build()
}
private fun initEvent() {
adapter.setOnItemChildClickListener { adapter, view, position ->
val item = (adapter.getItem(position) as? GameTeamRecordBean)
?: return@setOnItemChildClickListener
when (view.id) {
R.id.tv_repurchase -> {
jumpRepurchase(item)
}
R.id.tv_chat -> {
jumpChat(item)
}
R.id.iv_order_id_copy -> {
ClipboardUtils.copyText(item.orderNo ?: "")
toast(getString(R.string.have_copy))
}
}
}
binding.swipeRefresh.setOnRefreshListener {
loadData(true)
}
adapter.setOnLoadMoreListener({
loadData(false)
}, binding.recyclerView)
}
private fun initObserve() {
viewModel.listLiveData.observe(this) {
binding.swipeRefresh.isRefreshing = false
rvDelegate?.loadData(it)
if (!it.isSuccess && it.message != null) {
toast(it.message)
}
}
}
private fun jumpRepurchase(item: GameTeamRecordBean) {
val uid = getTargetUidByItem(item)
val gameId = item.gameId
val gameBackground = item.gamePic
val gamePrice = item.price ?: 0
val gameInning = item.inning ?: 1
if (uid == null || gameId == null) {
toast(R.string.data_parsing_exception)
return
}
GameTeamInviteDialog.newInstance(
targetUid = uid,
gameId = gameId,
gameBackground = gameBackground,
gamePrice = gamePrice,
gameInning = gameInning
).apply {
this.successListener = {
loadData(true)
}
}.safeShow(requireActivity().supportFragmentManager, requireActivity())
}
private fun jumpChat(item: GameTeamRecordBean) {
val targetUid = getTargetUidByItem(item)?.toString()
if (targetUid.isNullOrEmpty()) {
return
}
NimP2PMessageActivity.start(requireContext(), targetUid)
}
private fun getTargetUidByItem(item: GameTeamRecordBean): Long? {
val targetUid = if (type == TYPE_INITIATOR) {
item.toUid
} else {
item.fromUid
}
return targetUid
}
private fun loadData(isRefresh: Boolean) {
if (isRefresh) {
pageNum = 1
} else {
pageNum++
}
viewModel.getRecordList(type, pageNum, pageSize)
}
}

View File

@@ -1,103 +0,0 @@
package com.chwl.app.ui.game_team.record;
import android.content.Context;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.chwl.app.R;
import com.chwl.app.ui.widget.XRecyclerView.ScaleTransitionPagerTitleView;
import com.chwl.app.ui.widget.magicindicator.buildins.UIUtil;
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
import java.util.List;
public class GameTeamRecordIndicatorAdapter extends CommonNavigatorAdapter {
private final Context mContext;
private final List<? extends CharSequence> mTitleList;
private int textSize = 14;
private float minScale = 1f;
private boolean showIndicator = true;
private OnItemSelectListener mOnItemSelectListener;
public GameTeamRecordIndicatorAdapter(Context context, List<? extends CharSequence> charSequences) {
this.mContext = context;
this.mTitleList = charSequences;
}
@Override
public int getCount() {
return mTitleList == null ? 0 : mTitleList.size();
}
@Override
public IPagerTitleView getTitleView(Context context, final int i) {
ScaleTransitionPagerTitleView scaleTransitionPagerTitleView = new ScaleTransitionPagerTitleView(context, true);
scaleTransitionPagerTitleView.setNormalColor(ContextCompat.getColor(context, R.color.color_66000000));
scaleTransitionPagerTitleView.setSelectedColor(ContextCompat.getColor(context, R.color.color_000000));
scaleTransitionPagerTitleView.setMinScale(minScale);
scaleTransitionPagerTitleView.setTextSize(textSize);
int padding = UIUtil.dip2px(context, 13);
scaleTransitionPagerTitleView.setPadding(padding, 0, padding, 0);
scaleTransitionPagerTitleView.setText(mTitleList.get(i));
scaleTransitionPagerTitleView.setOnClickListener(view -> {
if (mOnItemSelectListener != null) {
mOnItemSelectListener.onItemSelect(i, scaleTransitionPagerTitleView);
}
});
return scaleTransitionPagerTitleView;
}
@Override
public IPagerIndicator getIndicator(Context context) {
LinePagerIndicator indicator = new LinePagerIndicator(context);
indicator.setMode(LinePagerIndicator.MODE_EXACTLY);
indicator.setLineHeight(context.getResources().getDimensionPixelOffset(R.dimen.dp_3));
indicator.setRoundRadius(context.getResources().getDimensionPixelOffset(R.dimen.dp_2));
indicator.setLineWidth(context.getResources().getDimensionPixelOffset(R.dimen.dp_13));
indicator.setColors(context.getResources().getColor(R.color.color_0FCA81));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
// lp.bottomMargin = mBottomMargin;
indicator.setLayoutParams(lp);
return indicator;
}
public int getTextSize() {
return textSize;
}
public void setTextSize(int textSize) {
this.textSize = textSize;
}
public float getMinScale() {
return minScale;
}
public void setMinScale(float minScale) {
this.minScale = minScale;
}
public boolean isShowIndicator() {
return showIndicator;
}
public void setShowIndicator(boolean showIndicator) {
this.showIndicator = showIndicator;
}
public void setOnItemSelectListener(OnItemSelectListener onItemSelectListener) {
mOnItemSelectListener = onItemSelectListener;
}
public interface OnItemSelectListener {
void onItemSelect(int position, TextView view);
}
}

View File

@@ -1,23 +0,0 @@
package com.chwl.app.ui.game_team.record
import androidx.lifecycle.MutableLiveData
import com.chwl.app.base.BaseViewModel
import com.chwl.core.auth.AuthModel
import com.chwl.core.bean.response.ListResult
import com.chwl.core.game_team.GameTeamRecordBean
import com.chwl.core.room.game.GameModel
class GameTeamRecordViewModel : BaseViewModel() {
val listLiveData = MutableLiveData<ListResult<GameTeamRecordBean>>()
fun getRecordList(type: Int, pageNum: Int, pageSize: Int) {
safeLaunch(onError = {
listLiveData.postValue(ListResult.failed(pageNum, it))
}) {
val list =
GameModel.getGameTeamRecordList(type, pageNum, pageSize, AuthModel.get().currentUid)
listLiveData.postValue(ListResult.success(list, pageNum))
}
}
}

View File

@@ -71,11 +71,6 @@ public class GiftInfoVm extends BaseItem<GiftInfo> {
*/
public boolean isSuperLuckyGift;
/**
* 礼物名称
*/
public String giftName;
public GiftInfoVm(Context context, GiftInfo data, boolean select, boolean isKnap) {
super(context, data);
this.isSelect.set(select);
@@ -115,7 +110,6 @@ public class GiftInfoVm extends BaseItem<GiftInfo> {
SimpleVipInfo vipInfo = data.getGiftVipInfo();
isLocked = vipInfo != null && VipHelper.getMyVipLevel() < vipInfo.getVipLevel();
vipIcon = vipInfo == null ? "" : vipInfo.getVipIcon();
giftName = data.getFirstGiftName();
}
@Override

View File

@@ -5,10 +5,8 @@ import android.content.Context;
import com.chwl.app.community.holder.DynamicSysHolder;
import com.chwl.app.community.im.WorldDynamicShareViewHolder;
import com.chwl.app.module_hall.im.msgholder.FamilyMsgViewHolder;
import com.chwl.app.ui.im.chat.GameTeamInviteViewHolder;
import com.chwl.core.community.attachment.DynamicSysAttachment;
import com.chwl.core.community.im.WorldDynamicAttachment;
import com.chwl.core.im.custom.bean.GameTeamInviteAttachment;
import com.chwl.core.module_hall.im.FamilyAttachment;
import com.netease.nim.uikit.api.NimUIKit;
import com.netease.nim.uikit.api.model.contact.ContactEventListener;
@@ -171,9 +169,6 @@ public class ImInitHelper {
// 客服充值
NimUIKit.registerMsgItemViewHolder(P2PContactRechargeAttachment.class, MsgViewHolderP2PContactRecharge.class);
// 游戏组队 - 邀请
NimUIKit.registerMsgItemViewHolder(GameTeamInviteAttachment.class, GameTeamInviteViewHolder.class);
NimUIKit.setSessionListener(listener);
NimUIKit.setContactEventListener(listener1);
}

View File

@@ -2,13 +2,10 @@ package com.chwl.app.ui.im;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import com.chwl.app.decoration.view.DecorationStoreActivity;
import com.chwl.app.earn.activity.EarnRecordActivity;
import com.chwl.app.pay.activity.GiveGoldActivity;
import com.chwl.app.ui.feedback.FeedbackActivity;
import com.chwl.app.ui.game_team.record.GameTeamRecordActivity;
import com.chwl.core.module_hall.hall.bean.H5FamilyInfo;
import com.chwl.core.module_hall.hall.bean.UserClanInfo;
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
@@ -35,11 +32,13 @@ import com.chwl.app.team.view.NimTeamMessageActivity;
import com.chwl.app.ui.login.BindPhoneActivity;
import com.chwl.app.ui.login.ShowBindPhoneActivity;
import com.chwl.app.ui.pay.ChargeActivity;
import com.chwl.app.ui.setting.FeedbackActivity;
import com.chwl.app.ui.setting.ModifyPwdActivity;
import com.chwl.app.ui.user.activity.UserInfoActivity;
import com.chwl.app.ui.webview.CommonWebViewActivity;
import com.chwl.app.vip.VipMainActivity;
import com.chwl.core.DemoCache;
import com.chwl.core.UriProvider;
import com.chwl.core.auth.AuthModel;
import com.chwl.core.community.event.SquareTaskEvent;
import com.chwl.core.im.custom.bean.RouterType;
@@ -210,7 +209,7 @@ public class RouterHandler {
break;
case RouterType.FEED_BACK:
context.startActivity(new Intent(context, FeedbackActivity.class));
FeedbackActivity.start(context);
break;
case RouterType.SET_PASSWORD:
ModifyPwdActivity.start(context, ModifyPwdActivity.LOGIN_PWD);
@@ -294,9 +293,6 @@ public class RouterHandler {
case RouterType.MY_DONATION:
GiveGoldActivity.Companion.start(context);
break;
case RouterType.GAME_TEAM_RECORD:
GameTeamRecordActivity.Companion.start(context);
break;
default:
SingleToastUtil.showToast(ResUtil.getString(R.string.ui_im_routerhandler_07));
return false;

View File

@@ -1,118 +0,0 @@
package com.chwl.app.ui.im.chat
import android.content.Context
import android.graphics.Color
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.Keep
import com.chwl.app.R
import com.chwl.app.ui.utils.load
import com.chwl.core.im.custom.bean.GameTeamInviteAttachment
import com.example.lib_utils.AppUtils
import com.example.lib_utils.UiUtils
import com.google.android.material.imageview.ShapeableImageView
import com.google.android.material.shape.CornerFamily
import com.google.android.material.shape.ShapeAppearanceModel
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter
@Keep
class GameTeamInviteViewHolder(adapter: BaseMultiItemFetchLoadAdapter<*, *>) :
MsgViewHolderBase(adapter) {
private val isRTL = UiUtils.isRtl(AppUtils.getApp())
private val leftShapeAppearance: ShapeAppearanceModel by lazy(LazyThreadSafetyMode.NONE) {
buildBackgroundShapeAppearance(context ?: AppUtils.getApp(), true)
}
private val rightShapeAppearance: ShapeAppearanceModel by lazy(LazyThreadSafetyMode.NONE) {
buildBackgroundShapeAppearance(context ?: AppUtils.getApp(), false)
}
override fun getContentResId(): Int {
return R.layout.layout_msg_view_holder_game_team_invite
}
override fun inflateContentView() {
}
override fun leftBackground(): Int {
return R.color.transparent
}
override fun rightBackground(): Int {
return R.color.transparent
}
override fun bindContentView() {
val attachment = message?.attachment as? GameTeamInviteAttachment
val data = attachment?.msgData
val gameNameView = findViewById<TextView>(R.id.tv_game_name)
val gameInningView = findViewById<TextView>(R.id.tv_game_inning)
val gameIconView = findViewById<ImageView>(R.id.iv_icon)
val gameBackgroundView = findViewById<ShapeableImageView>(R.id.iv_image)
val gameBackgroundMaskView = findViewById<ShapeableImageView>(R.id.iv_image_mask)
val shapeAppearance = getBackgroundShapeAppearance()
gameBackgroundView.shapeAppearanceModel = shapeAppearance
gameBackgroundMaskView.shapeAppearanceModel = shapeAppearance
gameNameView.text = data?.gameName ?: ""
gameInningView.text =
context?.getString(R.string.game_team_18)?.format(data?.inning?.toString() ?: "0") ?: ""
gameIconView.load(data?.gameLogo)
gameBackgroundView.load(data?.gamePic, defaultRes = R.color.color_33000000)
}
private fun getBackgroundShapeAppearance(): ShapeAppearanceModel {
return if (isReceivedMessage) {
if (isRTL) {
rightShapeAppearance
} else {
leftShapeAppearance
}
} else {
if (isRTL) {
leftShapeAppearance
} else {
rightShapeAppearance
}
}
}
private fun buildBackgroundShapeAppearance(
context: Context,
isLeft: Boolean
): ShapeAppearanceModel {
val cornerA = context.resources.getDimension(R.dimen.dp_12)
val cornerB = context.resources.getDimension(R.dimen.dp_2)
val topLeftCorner: Float
val topRightCorner: Float
if (isLeft) {
topLeftCorner = cornerB
topRightCorner = cornerA
} else {
topLeftCorner = cornerA
topRightCorner = cornerB
}
return ShapeAppearanceModel.Builder().apply {
this.setTopLeftCorner(
CornerFamily.ROUNDED,
topLeftCorner
)
this.setTopRightCorner(
CornerFamily.ROUNDED,
topRightCorner
)
this.setBottomLeftCorner(
CornerFamily.ROUNDED,
cornerA
)
this.setBottomRightCorner(
CornerFamily.ROUNDED,
cornerA
)
}.build()
}
}

View File

@@ -27,7 +27,6 @@ import androidx.core.content.ContextCompat;
import com.chwl.app.BuildConfig;
import com.chwl.app.common.widget.OriginalDrawStatusClickSpan;
import com.chwl.app.ui.feedback.FeedbackActivity;
import com.chwl.app.ui.setting.LabActivity;
import com.chwl.app.ui.webview.CommonWebViewActivity;
import com.chwl.core.UriProvider;
@@ -276,9 +275,7 @@ public class LoginPasswordActivity extends BaseActivity {
});
setProtocol();
findViewById(R.id.layout_google).setOnClickListener(v -> googleLogin());
findViewById(R.id.tv_feedback).setOnClickListener(v -> {
startActivity(new Intent(this, FeedbackActivity.class));
});
if (BuildConfig.DEBUG) {
findViewById(R.id.iv_logo).setOnClickListener(v -> {
startActivity(new Intent(this, LabActivity.class));

View File

@@ -64,7 +64,7 @@ public class LogoutHelper {
String text = ResUtil.getString(R.string.login_helper_logouthelper_09) + simpleDateFormat.format(new Date(exception.getCancelDate()));
int end = text.length();
text += ResUtil.getString(R.string.login_helper_logouthelper_010);
text += ResUtil.getString(R.string.login_helper_logouthelper_010);
SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(activity, R.color.appColor)),
0, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);

View File

@@ -0,0 +1,100 @@
package com.chwl.app.ui.setting;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import com.netease.nim.uikit.StatusBarUtil;
import com.trello.rxlifecycle3.android.ActivityEvent;
import com.chwl.app.R;
import com.chwl.app.base.BaseActivity;
import com.chwl.core.auth.AuthModel;
import com.chwl.core.home.model.HomeModel;
import com.chwl.library.utils.ResUtil;
import io.reactivex.SingleObserver;
import io.reactivex.disposables.Disposable;
public class FeedbackActivity extends BaseActivity {
private EditText edtContent;
private EditText edtContact;
private Button btnCommit;
public static void start(Context context) {
Intent intent = new Intent(context, FeedbackActivity.class);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
initWhiteTitleBar(ResUtil.getString(R.string.ui_setting_feedbackactivity_01));
initView();
initData();
SetListener();
}
private void SetListener() {
btnCommit.setOnClickListener(v ->
HomeModel.INSTANCE.commitFeedback(AuthModel.get().getCurrentUid(),
edtContent.getText().toString(),
edtContact.getText().toString()
)
.compose(bindUntilEvent(ActivityEvent.DESTROY))
.subscribe(new SingleObserver<String>() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onSuccess(String s) {
onCommitFeedback();
}
@Override
public void onError(Throwable e) {
onCommitFeedbackFail(e.getMessage());
}
})
);
}
private void initData() {
}
private void initView() {
edtContent = findViewById(R.id.edt_content);
edtContact = findViewById(R.id.edt_contact);
btnCommit = findViewById(R.id.btn_commit);
}
public void onCommitFeedback(){
getDialogManager().showProgressDialog(FeedbackActivity.this, ResUtil.getString(R.string.ui_setting_feedbackactivity_02));
toast(ResUtil.getString(R.string.ui_setting_feedbackactivity_03));
finish();
}
public void onCommitFeedbackFail(String error){
// toast(error);
}
@Override
protected boolean needSteepStateBar() {
return true;
}
@Override
protected void setStatusBar() {
super.setStatusBar();
StatusBarUtil.transparencyBar(this);
StatusBarUtil.StatusBarLightMode(this);
}
}

View File

@@ -13,8 +13,6 @@ import com.chwl.app.base.BaseViewBindingActivity
import com.chwl.app.common.widget.dialog.DialogManager.OkCancelDialogListener
import com.chwl.app.databinding.ActivitySettingBinding
import com.chwl.app.notify.RoomNotifyManager
import com.chwl.app.ui.debug.DebugActivity
import com.chwl.app.ui.game_team.record.GameTeamRecordActivity
import com.chwl.app.ui.im.avtivity.BlackListManageActivity
import com.chwl.app.ui.language.LanguageActivity
import com.chwl.app.ui.login.BindPhoneActivity
@@ -223,8 +221,7 @@ class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.
}
private fun debug() {
startActivity(Intent(this, GameTeamRecordActivity::class.java))
// CommonWebViewActivity.start(this,"http://beta.api.molistar.xyz/molistar/modules/order/index.html")
// CommonWebViewActivity.start(this,"https://api.molistar.xyz/molistar/activity/2024-invitationFission/index.html")
// PublicChatRoomMessageActivity.start(this)
// MyDecorationActivity.start(this,0)
}

View File

@@ -25,9 +25,8 @@ import com.chwl.app.ui.user.adapter.UserInfoTopAlbumAdapter;
import com.chwl.app.ui.user.fragment.UserInfoDataFragment;
import com.chwl.app.ui.user.fragment.UserInfoDynamicFragment;
import com.chwl.app.utils.AppBarStateChangeListener;
import com.chwl.app.utils.AvatarHelper;
import com.chwl.library.widget.SVGAView;
import com.chwl.core.decoration.headwear.bean.HeadWearInfo;
import com.chwl.core.noble.NobleUtil;
import com.example.lib_utils.UiUtils;
import com.google.android.material.appbar.AppBarLayout;
import com.netease.nim.uikit.StatusBarUtil;
@@ -255,7 +254,6 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
mBinding.tbUserInfo.setTitle("");
ivOfficialMask = mBinding.inOfficialMask.findViewById(R.id.iv_official_mask);
tvOfficialMask = mBinding.inOfficialMask.findViewById(R.id.tv_official_mask);
mBinding.ivHeadWear.bindCache(SVGAView.newCache(1));
}
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -271,7 +269,8 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
ImageLoadUtilsV2.loadImage(mBinding.ivUserHead, userInfo.getAvatar());
HeadWearInfo headWearInfo = userInfo.getUserHeadwear();
if (headWearInfo != null && headWearInfo.getFirstUrl() != null) {
AvatarHelper.loadAvatarFrame(mBinding.ivHeadWear, headWearInfo.getFirstUrl(), headWearInfo.getType());
NobleUtil.loadHeadWear(headWearInfo.getFirstUrl(), mBinding.ivHeadWear);
mBinding.ivHeadWear.setVisibility(View.VISIBLE);
mBinding.ivUserHead.setPadding(0, 0, 0, 0);
mBinding.ivUserHead.setStrokeWidth(0);
} else {

View File

@@ -40,7 +40,7 @@ import com.chwl.core.user.bean.UserInfo
import com.chwl.core.user.bean.UserPhoto
import com.chwl.core.utils.CoreLogger
import com.chwl.library.common.file.FileHelper
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.photo.PhotoProviderNew
import com.chwl.library.common.util.PhotoCompressCallback
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.easypermisssion.EasyPermissions
@@ -371,7 +371,7 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
)
} else {
mUri = Uri.parse("file://${FileHelper.getRootCacheDir()?.path}/${getNowTime()}.jpg")
PhotoProvider.photoProvider(
PhotoProviderNew.photoProvider(
this,
resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER
)
@@ -429,7 +429,7 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
}
}
REQUEST_CODE_OPEN_PHOTO_PROVIDER -> data?.let {
val photos = PhotoProvider.getResultPhotoList(it)
val photos = PhotoProviderNew.getResultPhotoList(it)
if (!photos.isNullOrEmpty()) {
val photo = photos[0]
crop(photo.uri, photo.size, mUri)

View File

@@ -32,7 +32,7 @@ import com.chwl.core.user.bean.UserPhoto
import com.chwl.core.utils.CoreLogger
import com.chwl.core.utils.net.BeanObserver
import com.chwl.library.common.file.FileHelper
import com.chwl.library.common.photo.PhotoProvider
import com.chwl.library.common.photo.PhotoProviderNew
import com.chwl.library.common.util.PhotoCompressCallback
import com.chwl.library.common.util.PhotoCompressUtil
import com.chwl.library.easypermisssion.EasyPermissions
@@ -232,7 +232,7 @@ class UserModifyPhotosActivity : TakePhotoActivity(), PhotoItemClickListener,
)
} else {
mUri = Uri.parse("file://${FileHelper.getRootCacheDir()?.path}/${getNowTime()}.jpg")
PhotoProvider.photoProvider(
PhotoProviderNew.photoProvider(
this,
resultCode = REQUEST_CODE_OPEN_PHOTO_PROVIDER
)
@@ -252,7 +252,7 @@ class UserModifyPhotosActivity : TakePhotoActivity(), PhotoItemClickListener,
} else if (resultCode == RESULT_OK) {
when (requestCode) {
REQUEST_CODE_OPEN_PHOTO_PROVIDER -> data?.let {
val photos = PhotoProvider.getResultPhotoList(data) ?: return
val photos = PhotoProviderNew.getResultPhotoList(data) ?: return
if (photos.isNotEmpty()) {
val photo = photos[0]
crop(photo.uri, photo.size, mUri)

View File

@@ -57,8 +57,8 @@ public class ContactsIndicatorAdapter extends CommonNavigatorAdapter {
if (!showIndicator) return null;
DrawableIndicator indicator = new DrawableIndicator(context);
indicator.setMode(DrawableIndicator.MODE_EXACTLY);
indicator.setDrawableWidth(context.getResources().getDimensionPixelOffset(R.dimen.dp_24));
indicator.setDrawableHeight(context.getResources().getDimensionPixelOffset(R.dimen.dp_7));
indicator.setDrawableWidth(UIUtil.dip2px(context, 24));
indicator.setDrawableHeight(UIUtil.dip2px(context, 8));
indicator.setIndicatorDrawable(context.getResources().getDrawable(R.drawable.base_ic_indicator));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.END;

View File

@@ -63,8 +63,8 @@ public class HomeRecommendIndicatorAdapter extends CommonNavigatorAdapter {
if (!showIndicator) return null;
DrawableIndicator indicator = new DrawableIndicator(context);
indicator.setMode(DrawableIndicator.MODE_EXACTLY);
indicator.setDrawableWidth(context.getResources().getDimensionPixelOffset(R.dimen.dp_24));
indicator.setDrawableHeight(context.getResources().getDimensionPixelOffset(R.dimen.dp_7));
indicator.setDrawableWidth(UIUtil.dip2px(context, 24));
indicator.setDrawableHeight(UIUtil.dip2px(context, 8));
indicator.setIndicatorDrawable(context.getResources().getDrawable(R.drawable.base_ic_indicator));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lp.gravity = Gravity.END;

View File

@@ -1,31 +0,0 @@
package com.chwl.app.ui.user.adapter
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.core.view.isVisible
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.chwl.app.ui.utils.load
import com.chwl.core.game_team.UserGameTeamInfo
class UserInfoGameTeamAdapter(private val isMe: Boolean) :
BaseQuickAdapter<UserGameTeamInfo, BaseViewHolder>(R.layout.user_info_item_game_team) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
return super.onCreateViewHolder(parent, viewType).apply {
addOnClickListener(R.id.layout_play)
getView<View>(R.id.layout_play).isVisible = !isMe
}
}
override fun convert(helper: BaseViewHolder, item: UserGameTeamInfo) {
helper.setText(R.id.tv_name, item.gameName)
helper.setText(R.id.tv_level, item.proficiency)
helper.setText(R.id.tv_price, item.price?.toString() ?: "")
helper.getView<ImageView>(R.id.iv_icon).load(item.logo)
helper.getView<ImageView>(R.id.iv_bg)
.load(item.background, defaultRes = R.color.color_66000000)
}
}

View File

@@ -3,7 +3,7 @@ package com.chwl.app.ui.user.dialog
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogUserAreaPickerBinding
import com.chwl.app.ui.user.adapter.ArrayWheelAdapter
import java.io.Serializable
@@ -15,7 +15,7 @@ import java.io.Serializable
* desc: 用户地区
*/
class UserAreaDialog :
BaseDialogFragment<DialogUserAreaPickerBinding>() {
BaseDialog<DialogUserAreaPickerBinding>() {
private var mOptionsItems: List<String>? = null

View File

@@ -9,26 +9,22 @@ import com.chwl.app.R
import com.chwl.app.base.BaseViewBindingFragment
import com.chwl.app.databinding.UserInfoDataFragmentBinding
import com.chwl.app.support.FragmentVisibleStateHelper
import com.chwl.app.ui.game_team.invite.GameTeamInviteDialog
import com.chwl.app.ui.user.activity.ShowPhotoActivity
import com.chwl.app.ui.user.activity.UserInfoModifyActivity
import com.chwl.app.ui.user.activity.UserModifyPhotosActivity
import com.chwl.app.ui.user.adapter.UserInfoAlbumAdapter
import com.chwl.app.ui.user.adapter.UserInfoGameTeamAdapter
import com.chwl.app.ui.user.adapter.UserInfoGiftAdapter
import com.chwl.app.ui.user.adapter.UserInfoMedalAdapter
import com.chwl.app.ui.user.viewmodel.UserInfoViewModel
import com.chwl.app.ui.widget.recyclerview.decoration.GridSpacingItemNewDecoration
import com.chwl.app.ui.widget.recyclerview.decoration.SpacingDecoration
import com.chwl.core.game_team.UserGameTeamInfo
import com.chwl.core.user.bean.UserPhoto
import com.example.lib_utils.UiUtils
class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding>() {
private val viewModel: UserInfoViewModel by activityViewModels()
override fun init() {
initGameTeam()
initAlbum()
initMedal()
initGift()
@@ -40,29 +36,6 @@ class UserInfoDataFragment : BaseViewBindingFragment<UserInfoDataFragmentBinding
}
}
private fun initGameTeam() {
val adapter = UserInfoGameTeamAdapter(viewModel.isMe)
binding.recyclerViewGameTeam.addItemDecoration(
SpacingDecoration(
0,
resources.getDimensionPixelOffset(R.dimen.dp_10),
false
)
)
binding.recyclerViewGameTeam.adapter = adapter
adapter.setOnItemChildClickListener { adapter, view, position ->
activity?.let {
val item = (adapter.getItem(position) as? UserGameTeamInfo)
?: return@setOnItemChildClickListener
GameTeamInviteDialog.newInstance(item).safeShow(it.supportFragmentManager, it)
}
}
viewModel.userInfoDetailData.observe(this) {
adapter.setNewData(it.userGamePartner ?: emptyList())
binding.layoutGameTeam.isVisible = !it.userGamePartner.isNullOrEmpty()
}
}
private fun initAlbum() {
val albumAdapter = UserInfoAlbumAdapter()
binding.ivAlbumMore.isVisible = viewModel.isMe

View File

@@ -1,285 +0,0 @@
package com.chwl.app.ui.wallet.payment
import android.app.Activity
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import com.chwl.app.R
import com.chwl.app.common.widget.dialog.DialogManager
import com.chwl.core.pay.PayModel
import com.chwl.core.pay.bean.PayRecordId
import com.chwl.library.utils.SingleToastUtil
import com.example.lib_utils.log.ILog
import com.example.module_base.support.billing.IBillingResult
import com.example.module_base.support.billing.IBillingService2
import com.example.module_base.support.billing.IProductDetails
import com.example.module_base.support.billing.IPurchase
import com.example.module_base.support.billing.OnBillingClientStateListener
import com.example.module_base.support.billing.OnConsumeResponseListener
import com.example.module_base.support.billing.OnProductDetailsResponseListener
import com.example.module_base.support.billing.OnPurchasesResponseListener
import com.example.module_base.support.google.IGoogleService
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
class GPaymentClient(val activity: Activity) : IPaymentClient, IBillingService2.Listener,
OnProductDetailsResponseListener, LifecycleEventObserver, ILog, OnBillingClientStateListener {
private var compositeDisposable: CompositeDisposable? = null
private var _billingService: IBillingService2? = null
private val dialogManager = DialogManager(activity)
private var paymentIntent: PaymentIntent? = null
private var productItem: IProductDetails? = null
private var orderId: String? = null
init {
dialogManager.setCanceledOnClickOutside(false)
dialogManager.setCanceledOnClickBackKey(false)
(activity as? LifecycleOwner)?.lifecycle?.addObserver(this)
}
private fun getBillingService(): IBillingService2? {
if (_billingService == null) {
_billingService = IGoogleService.newBillingService2(activity, this)
_billingService?.setLogEnabled(true)
_billingService?.startConnection(this)
}
return _billingService
}
override fun launchPayment(intent: PaymentIntent) {
logD("launchPayment() intent:${intent.productId}")
if (paymentIntent != null) {
SingleToastUtil.showToast(R.string.avroom_activity_roomblacklistactivity_015)
return
}
dialogManager.showProgressDialog(activity)
this.paymentIntent = intent
tryLaunch()
}
private fun tryLaunch() {
val billingService = getBillingService()
if (billingService == null) {
callFailed(
IPaymentClient.CODE_NONSUPPORT,
PaymentException(activity.getString(R.string.bean_response_serviceresult_015))
)
return
}
val productId = paymentIntent?.productId
val productItem = productItem
logD("tryLaunch() productId:$productId productItem:$productItem")
if (productId == null) {
return
}
if (getBillingService()?.isServiceConnected() != true) {
logD("tryLaunch() isServiceConnected = false")
return
}
if (productItem == null) {
getBillingService()?.querySkuDetailsAsync(listOf(productId), this)
} else {
placeOrder(productItem)
}
}
private fun placeOrder(productItem: IProductDetails) {
logD("placeOrder() productItem:${productItem.getProductId()}")
addDisposable(PayModel.get().placeOrder(productItem.getProductId())
.subscribe(
{ recordId: PayRecordId ->
if (paymentIntent?.productId == productItem.getProductId()) {
orderId = recordId.recordId
getBillingService()?.launchBillingFlow(
productItem,
recordId.recordId
)
} else {
logE("placeOrder() 意图发生改变")
}
}
) { throwable: Throwable ->
callFailed(IPaymentClient.CODE_PLACE_ORDER_FAILED, throwable)
})
}
override fun onBillingSetupFinished(billingResult: IBillingResult) {
if (billingResult.isResponseOk()) {
logD("onBillingClientSetupFinished()")
getBillingService()?.queryPurchases(object : OnPurchasesResponseListener {
override fun onQueryPurchasesResponse(
billingResult: IBillingResult,
purchases: List<IPurchase>
) {
if (billingResult.isResponseOk() && purchases.isNotEmpty()) {
purchases.forEach {
handlePurchases(false, it)
}
}
}
})
tryLaunch()
} else {
callFailed(
IPaymentClient.CODE_UNAVAILABLE, billingResult
)
}
}
override fun onPurchasesUpdated(billingResult: IBillingResult, purchases: List<IPurchase>?) {
logD("onPurchasesUpdated() billingResult:${billingResult.getResponseCode()} purchases:${purchases?.size}")
if (billingResult.isResponseOk() && !purchases.isNullOrEmpty()) {
purchases.forEach {
handlePurchases(true, it)
}
} else {
callFailed(IPaymentClient.CODE_PURCHASE_FAILED, billingResult)
}
}
private fun handlePurchases(isCurrentPaying: Boolean, purchases: IPurchase) {
logD("handlePurchases isCurrentPaying:${isCurrentPaying} state:${purchases.getPurchaseState()}")
val identifiers = purchases.getAccountIdentifiers()
if (purchases.isPurchasedState() && identifiers != null) {
logD("handlePurchases() verifyOrder")
addDisposable(
PayModel.get().verifyOrder(
identifiers.getObfuscatedAccountId(),
purchases.getProducts().firstOrNull(),
purchases.getPackageName(),
purchases.getPurchaseToken()
).subscribe({
logD("handlePurchases() verifyOrder consumeAsync")
consumeAsync(isCurrentPaying, it)
}, {
logD("handlePurchases() error:${it.message}")
if (isCurrentPaying) {
callFailed(IPaymentClient.CODE_VERIFY_ORDER_FAILED, it)
}
})
)
}
}
private fun consumeAsync(isCurrentPaying: Boolean, token: String) {
logD("consumeAsync() isCurrentPaying:${isCurrentPaying} token:$token")
getBillingService()?.consumeAsync(token, object : OnConsumeResponseListener {
override fun onConsumeResponse(billingResult: IBillingResult, purchaseToken: String) {
logD("consumeAsync() onConsumeResponse billingResult:${billingResult} purchaseToken:$purchaseToken")
if (isCurrentPaying) {
if (billingResult.isResponseOk()) {
val orderId = orderId
if (orderId != null) {
callSuccess(orderId)
}
} else {
callFailed(IPaymentClient.CODE_CONSUME_ORDER_FAILED, billingResult)
}
}
}
})
}
override fun onProductDetailsResponse(
billingResult: IBillingResult,
productDetails: List<IProductDetails>
) {
logD("onProductDetailsResponse() billingResult:${billingResult.getResponseCode()} productDetails:${productDetails.size}")
if (billingResult.isResponseOk()) {
val item = productDetails.firstOrNull {
it.getProductId() == paymentIntent?.productId
}
productItem = item
if (item != null) {
tryLaunch()
} else {
callFailed(IPaymentClient.CODE_PRODUCT_NOT_FOUND, billingResult)
}
} else {
callFailed(IPaymentClient.CODE_PRODUCT_NOT_FOUND, billingResult)
}
}
private fun callSuccess(orderRecordId: String) {
logD("callSuccess() orderRecordId:${orderRecordId} productId:${paymentIntent?.productId}")
paymentIntent?.let {
it.listener.onResponse(PaymentResult.PaymentSuccess(it.productId, orderRecordId))
}
paymentIntent = null
dialogManager.dismissDialog()
}
private fun callFailed(code: Int) {
callFailed(
code,
PaymentException(
code,
message = activity.getString(R.string.common_operation_prompt_format).format(code)
)
)
}
private fun callFailed(code: Int, billingResult: IBillingResult) {
callFailed(
code,
PaymentException(
code,
message = activity.getString(R.string.common_operation_prompt_format)
.format("$code-${billingResult.getResponseCode()}")
)
)
}
private fun callFailed(code: Int, throwable: Throwable) {
throwable.printStackTrace()
logD("callFailed() code:${code} throwable:${throwable.message}")
throwable.let {
SingleToastUtil.showToast(
it.message
)
}
paymentIntent?.let {
it.listener.onResponse(PaymentResult.PaymentFailed(it.productId, code, throwable))
}
paymentIntent = null
dialogManager.dismissDialog()
}
private fun getCompositeDisposable(): CompositeDisposable {
var disposable = compositeDisposable
if (disposable == null) {
disposable = CompositeDisposable()
compositeDisposable = disposable
}
return disposable
}
private fun addDisposable(disposable: Disposable) {
getCompositeDisposable().add(disposable)
}
override fun onCleared() {
logD("onCleared()")
_billingService?.destroy()
paymentIntent = null
compositeDisposable?.dispose()
compositeDisposable = null
dialogManager.dismissDialog()
}
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
logD("onStateChanged() event:$event")
when (event) {
Lifecycle.Event.ON_DESTROY -> {
(activity as? LifecycleOwner)?.lifecycle?.removeObserver(this)
onCleared()
}
else -> {
}
}
}
}

View File

@@ -1,42 +0,0 @@
package com.chwl.app.ui.wallet.payment
import com.example.lib_utils.ICleared
interface IPaymentClient : ICleared {
companion object {
// 支付成功
const val CODE_SUCCESS = 200
// 未知异常原因
const val CODE_OTHER = 0
// 不支持该功能
const val CODE_NONSUPPORT = 1
// 服务暂不可用
const val CODE_UNAVAILABLE = 2
// 未查询到购买信息
const val CODE_PRODUCT_NOT_FOUND = 3
// 预下单失败
const val CODE_PLACE_ORDER_FAILED = 4
// 购买失败
const val CODE_PURCHASE_FAILED = 5
// 验证订单失败
const val CODE_VERIFY_ORDER_FAILED = 6
// 核消订单失败
const val CODE_CONSUME_ORDER_FAILED = 7
}
fun launchPayment(intent: PaymentIntent)
override fun onCleared()
interface Listener {
fun onResponse(result: PaymentResult)
}
}

View File

@@ -1,13 +0,0 @@
package com.chwl.app.ui.wallet.payment
import androidx.annotation.Keep
@Keep
class PaymentException : Exception {
var code = 0
constructor(message: String) : super(message)
constructor(code: Int, message: String) : super(message) {
this.code = code
}
}

View File

@@ -1,4 +0,0 @@
package com.chwl.app.ui.wallet.payment
class PaymentIntent(val productId: String, val listener: IPaymentClient.Listener) {
}

View File

@@ -1,12 +0,0 @@
package com.chwl.app.ui.wallet.payment
sealed class PaymentResult {
data class PaymentSuccess(val productId: String, val orderId: String) : PaymentResult()
data class PaymentFailed(
val productId: String,
val code: Int,
val exception: Throwable? = null
) : PaymentResult()
}

View File

@@ -91,8 +91,6 @@ public class CommonWebViewActivity extends BaseActivity {
private static final String POSITION = "position";
private int mPosition;
private JSInterface jsInterface;
public static void start(Context context, String url) {
Intent intent = new Intent(context, CommonWebViewActivity.class);
intent.putExtra("url", url);
@@ -196,7 +194,7 @@ public class CommonWebViewActivity extends BaseActivity {
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
}
webView.getSettings().setTextZoom(100);
jsInterface = new JSInterface(webView, this);
JSInterface jsInterface = new JSInterface(webView, this);
jsInterface.setPosition(mPosition);
webView.addJavascriptInterface(jsInterface, "androidJsObj");
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
@@ -443,9 +441,6 @@ public class CommonWebViewActivity extends BaseActivity {
@Override
protected void onDestroy() {
if (jsInterface != null) {
jsInterface.onCleared();
}
EventBus.getDefault().unregister(this);
if (webViewCallBack != null) {

View File

@@ -1,6 +1,8 @@
package com.chwl.app.ui.webview;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.text.TextUtils;
@@ -14,6 +16,7 @@ import androidx.appcompat.app.AlertDialog;
import com.orhanobut.logger.Logger;
import com.chwl.app.R;
import com.chwl.app.base.BaseBindingFragment;
import com.chwl.app.common.widget.dialog.BaseAlertDialogBuilder;
import com.chwl.app.databinding.FragmentCommonWebViewBinding;
import com.chwl.library.annatation.ActLayoutRes;
import com.chwl.library.utils.ResUtil;
@@ -23,7 +26,6 @@ public class CommonWebViewFragment extends BaseBindingFragment<FragmentCommonWeb
private WebView webView;
protected String url;
private JSInterface jsInterface;
@Override
public void initiate() {
@@ -35,7 +37,7 @@ public class CommonWebViewFragment extends BaseBindingFragment<FragmentCommonWeb
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
}
webView.getSettings().setTextZoom(100);
jsInterface = new JSInterface(webView, getActivity());
JSInterface jsInterface = new JSInterface(webView, getActivity());
webView.addJavascriptInterface(jsInterface, "androidJsObj");
webView.setWebViewClient(new WebViewClient() {
@@ -111,12 +113,4 @@ public class CommonWebViewFragment extends BaseBindingFragment<FragmentCommonWeb
ShowWebView(url);
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (jsInterface != null) {
jsInterface.onCleared();
}
}
}

View File

@@ -14,21 +14,13 @@ import android.util.Log;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chwl.app.earn.activity.EarnRecordActivity;
import com.chwl.app.ui.invite.InviteImageHelper;
import com.chwl.app.ui.invite.ShareInviteDialog;
import com.chwl.app.ui.invite.ShareInviteInfo;
import com.chwl.app.ui.wallet.payment.GPaymentClient;
import com.chwl.app.ui.wallet.payment.IPaymentClient;
import com.chwl.app.ui.wallet.payment.PaymentIntent;
import com.chwl.app.ui.wallet.payment.PaymentResult;
import com.chwl.library.language.LanguageHelper;
import com.chwl.library.utils.json.JsonUtils;
import com.example.lib_utils.ICleared;
import com.google.gson.Gson;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.orhanobut.logger.Logger;
@@ -59,6 +51,7 @@ import com.chwl.library.record.AuditRecorderConfiguration;
import com.chwl.library.record.ExtAudioRecorder;
import com.chwl.library.rxbus.RxBus;
import com.chwl.library.utils.AppMetaDataUtil;
import com.chwl.library.utils.AppUtils;
import com.chwl.library.utils.DeviceUuidFactory;
import com.chwl.library.utils.SystemUtils;
import com.chwl.library.utils.VersionUtil;
@@ -73,7 +66,7 @@ import java.util.HashMap;
* <p> html js 与webview 交互接口</p>
* Created by ${user} on 2017/11/6.
*/
public class JSInterface implements ICleared {
public class JSInterface {
private static final String TAG = JSInterface.class.getSimpleName();
private WebView mWebView;
private CommonWebViewActivity mActivity;
@@ -82,7 +75,6 @@ public class JSInterface implements ICleared {
private MediaRecorder recorder;
private File myRecAudioFile;
private ExtAudioRecorder extAudioRecorder;
private GPaymentClient paymentClient;
public JSInterface(WebView webView, CommonWebViewActivity activity) {
mWebView = webView;
@@ -95,68 +87,6 @@ public class JSInterface implements ICleared {
this.context = context;
}
private void loadUrl(String url) {
com.example.lib_utils.log.LogUtil.d("JSInterface", "loadUrl url:" + url, false);
if (Looper.myLooper() == Looper.getMainLooper()) {
if (mWebView != null) {
mWebView.loadUrl(url);
}
} else {
if (mActivity != null) {
mActivity.runOnUiThread(() -> {
if (mWebView != null) {
mWebView.loadUrl(url);
}
});
}
}
}
private void callJsWithJson(String name, Object params) {
if (name == null) {
return;
}
if (params != null) {
String jsonStr = JsonUtils.toJson(params);
loadUrl("javascript:" + name + "(" + jsonStr + ")");
} else {
loadUrl("javascript:" + name + "()");
}
}
/**
* 拉起本地支付
*/
@JavascriptInterface
public void openPayment(String productId) {
com.example.lib_utils.log.LogUtil.d("JSInterface", "openPayment productId:" + productId, false);
if (mActivity == null || TextUtils.isEmpty(productId)) {
return;
}
mActivity.runOnUiThread(() -> {
if (paymentClient == null) {
paymentClient = new GPaymentClient(mActivity);
}
PaymentIntent paymentIntent = new PaymentIntent(productId, new IPaymentClient.Listener() {
@Override
public void onResponse(@NonNull PaymentResult result) {
HashMap<String, Object> map = new HashMap<>();
if (result instanceof PaymentResult.PaymentSuccess) {
map.put("orderId", ((PaymentResult.PaymentSuccess) result).getOrderId());
map.put("productId", ((PaymentResult.PaymentSuccess) result).getProductId());
map.put("code", 200);
} else if (result instanceof PaymentResult.PaymentFailed) {
map.put("code", ((PaymentResult.PaymentFailed) result).getCode());
map.put("productId", ((PaymentResult.PaymentFailed) result).getProductId());
}
callJsWithJson("openPaymentCallback", map);
}
});
paymentClient.launchPayment(paymentIntent);
});
}
/**
* 调转个人主页
*
@@ -192,7 +122,7 @@ public class JSInterface implements ICleared {
map.put(IReportConstants.MODULE, IReportConstants.MOLISTAR_PAY);
ReportManager.get().reportEvent(IReportConstants.PAYPAGE_SHOW, map);
// if (AppMetaDataUtil.getChannelID().equals(Constants.GOOGLE)) {
ChargeActivity.start(context);
ChargeActivity.start(context);
// } else {
// CommonWebViewActivity.start(
// context, UriProvider.getOfficialPay(
@@ -245,7 +175,7 @@ public class JSInterface implements ICleared {
if (activity == null) {
return;
}
ShareInviteInfo info = new Gson().fromJson(json, ShareInviteInfo.class);
ShareInviteInfo info = new Gson().fromJson(json,ShareInviteInfo.class);
if (info.getType() != null) {
if (info.getType() == 1) {
activity.runOnUiThread(() -> {
@@ -544,7 +474,7 @@ public class JSInterface implements ICleared {
jsonObject.put("netType", String.valueOf(SystemUtils.getNetworkType(context)));
jsonObject.put("model", SystemUtils.getPhoneModel());
jsonObject.put("appVersion", VersionUtil.getLocalName(context));
jsonObject.put("appVersionCode", String.valueOf(VersionUtil.getVersionCode(context)));
jsonObject.put("appVersionCode", String.valueOf(AppUtils.getVersionCode(context)));
jsonObject.put("deviceId", DeviceUtil.getDeviceId(context));
jsonObject.put("channel", AppMetaDataUtil.getChannelID());
jsonObject.put("Accept-Language", LanguageHelper.INSTANCE.getCurrentLanguageType());
@@ -626,11 +556,4 @@ public class JSInterface implements ICleared {
PraiseModel.get().praise(Long.parseLong(uid), true).subscribe();
NimP2PMessageActivity.start(context, uid);
}
@Override
public void onCleared() {
if (paymentClient != null) {
paymentClient.onCleared();
}
}
}

View File

@@ -12,6 +12,7 @@ import com.tencent.vasdolly.helper.ChannelReaderUtil;
import com.chwl.app.application.App;
import com.chwl.core.XConstants;
import com.chwl.core.Constants;
import com.chwl.library.utils.AppUtils;
import com.chwl.library.utils.VersionUtil;
/**
@@ -107,7 +108,7 @@ public class SimpleJSInterface {
jsonObject.put("os", "android");
jsonObject.put("app", XConstants.APP_MARK);
jsonObject.put("appVersion", VersionUtil.getLocalName(context));
jsonObject.put("appVersionCode", String.valueOf(VersionUtil.getVersionCode(context)));
jsonObject.put("appVersionCode", String.valueOf(AppUtils.getVersionCode(context)));
jsonObject.put("channel", getChannel());
Log.e(TAG, "getDeviceInfo: " + jsonObject);
return jsonObject.toJSONString();

View File

@@ -2,13 +2,13 @@ package com.chwl.app.ui.widget
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogDatingSelectBinding
import com.chwl.core.room.event.DatingSelectUserEvent
import com.chwl.library.utils.ResUtil
import org.greenrobot.eventbus.EventBus
class DatingSelectDialog(val position: Int, val uid: Long, private val myUid: Long, val roomUid: Long) : BaseDialogFragment<DialogDatingSelectBinding>() {
class DatingSelectDialog(val position: Int, val uid: Long, private val myUid: Long, val roomUid: Long) : BaseDialog<DialogDatingSelectBinding>() {
override fun init() {
width = ScreenUtil.dip2px(200f)

View File

@@ -59,7 +59,7 @@ class SideBarView : View {
this.textSizeFocus = focusTextSize
}
override fun onDraw(canvas: Canvas) {
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
paintText(canvas)
}

View File

@@ -27,8 +27,6 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chwl.app.utils.AvatarHelper;
import com.chwl.library.widget.SVGAView;
import com.google.android.flexbox.FlexboxLayout;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
@@ -121,7 +119,7 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
private UserInfo userInfo;
private ImageView closeImage;
private FrameLayout avatarLayout;
private SVGAView ivAvatarHeadWear;
private ImageView ivAvatarHeadWear;
private ImageView avatar;
/**
* 头像高斯模糊背景
@@ -248,7 +246,6 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
inNamePlate = findViewById(R.id.in_nameplate);
ivAvatarHeadWear = findViewById(R.id.iv_avatar_head_wear);
ivAvatarHeadWear.bindCache(AVRoomActivity.getSvgaCache());
ivBadge = findViewById(R.id.iv_badge);
ivBadge.setVisibility(View.GONE);
ivOfficialView = findViewById(R.id.iv_user_official);
@@ -681,12 +678,9 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
HeadWearInfo userHeadwear = userInfo.getUserHeadwear();
boolean havaHead = false;
// 设置普通人
if (userHeadwear != null) {
String avatarFrame = userHeadwear.getFirstUrl();
if (!TextUtils.isEmpty(avatarFrame)) {
havaHead = true;
AvatarHelper.loadAvatarFrame(ivAvatarHeadWear, avatarFrame, userHeadwear.getType());
}
if (userHeadwear != null && !TextUtils.isEmpty(userHeadwear.getPic())) {
havaHead = true;
NobleUtil.loadHeadWear(userHeadwear.getEffect() != null ? userHeadwear.getEffect() : userHeadwear.getPic(), ivAvatarHeadWear);
}
if (nobleInfo == null || TextUtils.isEmpty(nobleInfo.getCardBg())) {

View File

@@ -1,42 +0,0 @@
package com.chwl.app.utils
import androidx.core.view.isVisible
import com.chwl.app.R
import com.chwl.library.widget.SVGAView
import com.chwl.core.decoration.headwear.bean.HeadWearInfo
import com.chwl.core.noble.NobleUtil
object AvatarHelper {
/**
* 加载头饰
*/
@JvmStatic
fun loadAvatarFrame(view: SVGAView, headWearInfo: HeadWearInfo?) {
loadAvatarFrame(view, headWearInfo?.firstUrl, headWearInfo?.type ?: 0)
}
/**
* 加载头饰
* @param type 头饰类型 0:图片、1:SVGA
*/
@JvmStatic
fun loadAvatarFrame(view: SVGAView, url: String?, type: Int) {
view.setTag(R.id.head_wear, url)
if (url.isNullOrEmpty()) {
view.clearAnimation()
view.stopAnimation()
view.setImageDrawable(null)
return
}
if (type == 1) {
view.clearAnimation()
view.loadUrl(url)
view.isVisible = true
} else {
view.stopAnimation()
NobleUtil.loadHeadWear(url, view, R.id.head_wear, url)
view.isVisible = true
}
}
}

View File

@@ -21,7 +21,7 @@ class AutoMirroredAnimView : AnimView {
defStyleAttr
)
override fun dispatchDraw(canvas: Canvas) {
override fun dispatchDraw(canvas: Canvas?) {
if (layoutDirection == LAYOUT_DIRECTION_RTL) {
canvas?.scale(-1f, 1f, width / 2f, height / 2f)
}

View File

@@ -21,7 +21,7 @@ class AutoMirroredImageView : ImageView {
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes)
override fun onDraw(canvas: Canvas) {
override fun onDraw(canvas: Canvas?) {
if (layoutDirection == LAYOUT_DIRECTION_RTL) {
canvas?.scale(-1f, 1f, width / 2f, height / 2f)
}

View File

@@ -1,23 +0,0 @@
package com.chwl.app.view
import android.content.Context
import android.graphics.Canvas
import android.util.AttributeSet
import com.google.android.material.imageview.ShapeableImageView
class AutoMirroredShapeableImageView : ShapeableImageView {
constructor(context: Context?) : super(context)
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
)
override fun onDraw(canvas: Canvas) {
if (layoutDirection == LAYOUT_DIRECTION_RTL) {
canvas?.scale(-1f, 1f, width / 2f, height / 2f)
}
super.onDraw(canvas)
}
}

View File

@@ -5,7 +5,7 @@ import android.view.Gravity
import android.view.WindowManager
import androidx.recyclerview.widget.LinearLayoutManager
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogPaymentBinding
import com.chwl.app.ui.utils.RVDelegate
import com.chwl.app.vip.adapter.PayAdapter
@@ -15,7 +15,7 @@ import com.chwl.library.utils.ResUtil
/**
* 支付选择弹窗
*/
class PaymentDialog : BaseDialogFragment<DialogPaymentBinding>() {
class PaymentDialog : BaseDialog<DialogPaymentBinding>() {
private lateinit var rvDelegate: RVDelegate<PayInfo>

View File

@@ -10,7 +10,7 @@ import android.view.WindowManager
import androidx.core.graphics.toColorInt
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import com.chwl.app.R
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogSelectPayTypeBinding
import com.chwl.app.ui.widget.dialog.CommonTipDialog
import com.chwl.app.utils.SpannableBuilder
@@ -24,7 +24,7 @@ import com.chwl.library.utils.SingleToastUtil
/**
* 充值方式选择弹窗
*/
class SelectPayTypeDialog : BaseDialogFragment<DialogSelectPayTypeBinding>() {
class SelectPayTypeDialog : BaseDialog<DialogSelectPayTypeBinding>() {
private val descText by lazy { requireArguments().getString("descText", "") }
private val coins by lazy { requireArguments().getLong("coins", 0) }

View File

@@ -1,11 +1,11 @@
package com.chwl.app.vip.dialog
import android.os.Bundle
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogVipAuthDetailsBinding
import com.chwl.app.ui.utils.load
class VipAuthDetailsDialog : BaseDialogFragment<DialogVipAuthDetailsBinding>() {
class VipAuthDetailsDialog : BaseDialog<DialogVipAuthDetailsBinding>() {
companion object {
@JvmStatic

View File

@@ -6,7 +6,7 @@ import androidx.core.view.isVisible
import androidx.fragment.app.viewModels
import com.chwl.app.R
import com.chwl.app.base.BaseActivity
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogVipBroadcastBinding
import com.chwl.app.vip.VipViewModel
import com.chwl.core.utils.CurrentTimeUtils
@@ -17,7 +17,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import java.util.concurrent.TimeUnit
class VipBroadcastDialog : BaseDialogFragment<DialogVipBroadcastBinding>() {
class VipBroadcastDialog : BaseDialog<DialogVipBroadcastBinding>() {
companion object {
@JvmStatic

View File

@@ -1,10 +1,10 @@
package com.chwl.app.vip.dialog
import android.os.Bundle
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogVipRemainTimeBinding
class VipRemainTimeDialog : BaseDialogFragment<DialogVipRemainTimeBinding>() {
class VipRemainTimeDialog : BaseDialog<DialogVipRemainTimeBinding>() {
companion object {
@JvmStatic

View File

@@ -8,14 +8,14 @@ import com.opensource.svgaplayer.SVGADrawable
import com.opensource.svgaplayer.SVGAParser
import com.opensource.svgaplayer.SVGAVideoEntity
import com.chwl.app.base.BaseActivity
import com.chwl.app.base.BaseDialogFragment
import com.chwl.app.base.BaseDialog
import com.chwl.app.databinding.DialogVipUpgradeBinding
import com.chwl.app.vip.VipViewModel
import com.chwl.core.vip.bean.VipInfo
import java.net.MalformedURLException
import java.net.URL
class VipUpgradeDialog : BaseDialogFragment<DialogVipUpgradeBinding>() {
class VipUpgradeDialog : BaseDialog<DialogVipUpgradeBinding>() {
companion object {
@JvmStatic

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="180"
android:endColor="#FFFE4EB4"
android:startColor="#FFFF1ED7"
android:type="linear"
android:useLevel="true" />
<corners
android:bottomLeftRadius="100dp"
android:topLeftRadius="100dp" />
</shape>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="0"
android:startColor="#4C1A1A1A"
android:centerColor="#CC1F1F1F"
android:endColor="#E5161616" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 890 B

Some files were not shown because too many files have changed in this diff Show More