Compare commits

..

56 Commits

Author SHA1 Message Date
max
89940edd58 feat:固化混淆配置 2024-06-11 09:42:49 +08:00
max
fb202c1c73 fix:修复公聊厅消息过滤问题 2024-06-07 20:32:19 +08:00
max
840a1243aa fix:修复1v1游戏登录IM问题
fix:修复公聊新消息过滤器问题
2024-06-07 20:03:46 +08:00
max
2019411763 feat:调整部分文案 2024-06-07 18:28:07 +08:00
max
e0e07c718a feat:增加日志输出控制(根据环境) 2024-06-07 17:54:08 +08:00
max
02595f81f7 fix:调整部分翻译 2024-06-07 17:48:41 +08:00
max
95d0527fc9 fix:调整部分场景的时间格式化-时区 2024-06-07 14:27:22 +08:00
max
bc3426c574 fix:修复线上检测异常:Exception java.lang.NullPointerException 2024-06-07 11:21:15 +08:00
max
a2976dbc74 fix;修复线上检测异常:Exception java.util.ConcurrentModificationException 2024-06-07 11:16:06 +08:00
max
e942696e14 fix:修复线上检测空指针异常 2024-06-07 11:05:35 +08:00
max
7c3dee48ae fix:修复空指针异常 2024-06-07 10:45:00 +08:00
max
eabb3a5bd3 fix:修复钱包钻石余额格式化展示问题
fix:修复兑换金币余额格式化展示问题
2024-06-06 16:52:00 +08:00
max
fbc76a0bd3 fix:游戏房增加小时榜(牌照房切换为游戏房需要展示小时榜) 2024-06-06 16:17:36 +08:00
max
d044756bd7 fix:修复游戏麦位布局问题 2024-06-06 16:10:23 +08:00
max
8ad993bb6b fix:修复UI反馈问题 2024-06-06 15:41:57 +08:00
max
f325df4ed0 feat:固化混淆配置 2024-06-06 14:32:57 +08:00
max
19cbd94e98 feat:补充翻译 2024-06-06 11:20:34 +08:00
max
85b9ce903f fix:相亲模式隐藏游戏列表入口 2024-06-06 11:14:29 +08:00
max
408ec3f811 feat:补充文件上传异常时toast具体原因 2024-06-06 11:08:00 +08:00
max
cafeee5305 feat:完善钱包余额更新
feat:调整我的入口UI(钱包、VIP、公会)
2024-06-06 10:53:51 +08:00
max
818acaee8f feat:房间-游戏列表-icon字段调整 2024-06-05 20:07:25 +08:00
max
e72423708e feat:初步完成钱包UI改版(缺少入口icon替换等和兑换跳转联调) 2024-06-05 20:06:01 +08:00
max
5ba98cdb9e fix:调整更新房间接口传参 2024-06-05 15:57:20 +08:00
max
13d87309e1 fix:补充1v1游戏房从后台恢复的状态同步机制 2024-06-05 15:56:45 +08:00
max
dc5d160086 feat:普通房开放跨房PK入口
feat:PK入口迁移到玩法弹窗(待完善,目前注释了关键代码:下个版本的需求)
2024-06-05 14:31:41 +08:00
max
7dca9a1ed5 fix:修复游戏结果状态显示错误问题 2024-06-04 19:49:16 +08:00
max
fc2c2433aa fix:游戏结束后退出云信 2024-06-04 19:29:08 +08:00
max
7aeb80599d fix:游戏结束主动退出游戏 2024-06-04 18:32:57 +08:00
max
53b7bb87f1 fix:修复游戏结果多语言UI适配问题 2024-06-04 18:13:45 +08:00
max
994f0900a7 feat:调整房间标题长度输入限制(改为25) 2024-06-04 17:12:32 +08:00
max
764227edcd feat:调整页面背景主题色资源 2024-06-04 17:07:59 +08:00
max
640d59d4f5 feat:调整转赠相关的翻译文案 2024-06-04 16:55:44 +08:00
max
11bc8068bd feat:调整部分翻译文案 2024-06-04 15:56:56 +08:00
max
bc8f1a6660 feat:游戏退出提示区分状态 2024-06-04 15:19:59 +08:00
max
93fc9d2fef fix:游戏房补充退出房间逻辑 2024-06-04 15:09:52 +08:00
max
2d9c152bd6 feat:调整1v1游戏显示区域 2024-06-04 11:32:46 +08:00
max
0e3d9695f9 feat:完成房间公聊-头条入口调整 2024-06-04 10:52:33 +08:00
max
1acbead001 feat:游戏麦位改为9麦,增加礼物值展示 2024-06-03 19:18:47 +08:00
max
b25276875b feat:完成房间-游戏切换入口调整需求 2024-06-03 19:00:13 +08:00
max
6de2f68106 feat:调整恢复游戏房接口名 2024-06-03 18:18:02 +08:00
max
7ff35b1a50 feat:游戏排行榜入口无需翻译 2024-06-03 16:32:14 +08:00
max
0c4df905e3 feat:补充游戏切换房间逻辑 2024-06-03 16:18:24 +08:00
max
aa0baeccf1 feat:完善游戏翻译
fix:修复结算状态显示bug
2024-06-03 11:54:09 +08:00
max
8a66c4bdb8 feat:补充开始游戏 刷新余额逻辑 2024-06-03 10:19:58 +08:00
max
5c262c93c9 feat:完善游戏断网重连刷新机制
feat:完善部分UI调整
2024-06-03 10:10:29 +08:00
max
2b0e52ac20 feat:恢复游戏dialog禁止空白取消 2024-05-31 20:46:34 +08:00
max
d2d738f618 feat:补充异常退出-恢复游戏策略 2024-05-31 20:28:01 +08:00
max
cdbb895a68 feat:完成游戏SDK加载与游戏状态关联
feat:公屏数据与游戏状态关联
feat:增加轮次ID协议
2024-05-31 19:47:51 +08:00
max
a6f5b24a6d feat:完善提前中端结果展示 2024-05-31 16:13:20 +08:00
max
126215949f feat:游戏房公屏默认添加第一条系统公告 2024-05-31 14:03:01 +08:00
max
92a0e4b408 feat:完成游戏结算 2024-05-31 12:58:38 +08:00
max
5be8ebde3a feat:完善游戏房状态维护 2024-05-30 19:18:05 +08:00
max
2396eb9089 feat:完成部分房间信息获取逻辑对接 2024-05-29 19:31:29 +08:00
max
65ef4810e3 feat:完善游戏房公屏展示与消息发送 2024-05-29 15:26:04 +08:00
max
c72af689e5 feat:初步实现购买游戏接口(待完整联调)
feat:完善游戏房UI
feat:初步实现游戏引擎功能
2024-05-28 19:34:03 +08:00
max
c8f83b4ad8 feat:初步搭建游戏房框架(待完善)
feat:完成游戏首页UI与部分接口联调
feat:完成游戏房部分UI
2024-05-27 19:52:11 +08:00
259 changed files with 13305 additions and 1130 deletions

View File

@@ -116,6 +116,7 @@ android {
'src/module_album/java',
'src/module_treasure_box/java',
'src/module_public_chat/java',
'src/module_game/java',
]
@@ -131,6 +132,7 @@ android {
'src/module_album/res',
'src/module_treasure_box/res',
'src/module_public_chat/res',
'src/module_game/res',
]
@@ -272,8 +274,6 @@ dependencies {
if (!isolationMode && file("../modules/module_google/build.gradle").exists()) {
implementation project(':modules:module_google')
}
implementation 'tech.sud.mgp:SudMGP-static:1.3.3.1158'
}
channel {
@@ -337,6 +337,11 @@ xmlClassGuard {
"com.chwl.core": "com.hhchu.core",
"com.chwl.library": "com.hhchu.library"]
moveDir = [
"com.chwl.app.avroom.headline" : "eefce.eecad",
"com.chwl.core.bean.game" : "caeccd.fdedac",
"com.chwl.core.bean.room" : "afceec.aaafbc",
"com.chwl.app.game" : "fcbfeb.ebfceac",
"com.chwl.core.sud" : "baecf.deccfc",
"com.chwl.library.download" : "aeacf.cecdd",
"com.chwl.app.pay.activity" : "abbe.faaca",
"com.chwl.app.pay.adapter" : "daddd.dcadd",

View File

@@ -320,6 +320,9 @@
android:name=".ui.pay.ChargeActivity"
android:label="@string/main_androidmanifest_018"
android:screenOrientation="portrait" />
<activity
android:name=".ui.wallet.WalletActivity"
android:screenOrientation="portrait" />
<activity
android:name=".home.activity.CollectionRoomActivity"
android:label="@string/main_androidmanifest_019"
@@ -922,6 +925,12 @@
android:name=".pay.activity.GiveGoldSearchActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".game.ui.game.GameActivity"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
</application>
</manifest>

View File

@@ -24,11 +24,22 @@ import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider;
import com.chwl.app.base.GlobalViewModelOwner;
import com.chwl.app.common.widget.dialog.DialogManager;
import com.chwl.app.game.core.GameStateAbility;
import com.chwl.app.game.data.GameModel2;
import com.chwl.app.game.ui.game.GameActivity;
import com.chwl.app.game.ui.game.GameIntent;
import com.chwl.app.game.ui.home.GameHomeFragment;
import com.chwl.app.game.ui.home.GameHomeViewModel;
import com.chwl.app.star.StarFragment;
import com.chwl.app.support.PreloadResourceViewModel;
import com.chwl.app.ui.login.LoginPasswordActivity;
import com.chwl.core.bean.game.GameRoomInfo;
import com.chwl.core.home.bean.MainTabInfo;
import com.chwl.core.settings.SettingsModel;
import com.chwl.library.utils.JavaUtil;
import com.chwl.library.utils.StringUtils;
import com.example.lib_utils.StringUtils2;
import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nim.uikit.common.util.log.LogUtil;
import com.netease.nim.uikit.common.util.string.StringUtil;
@@ -126,6 +137,7 @@ import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
/**
* @author Administrator
@@ -157,12 +169,14 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
private boolean mResumed = false;
@Nullable
private Fragment tempFragment = null;
private DialogManager resumeGameDialogManager;
@Nullable
private Runnable touchRunnable;
{
fragmentArray.put(MainTabType.TAB_TYPE_STAR, new StarFragment());
fragmentArray.put(MainTabType.TAB_TYPE_GAME, new GameHomeFragment());
fragmentArray.put(MainTabType.TAB_TYPE_HOME, new HomeFragment());
fragmentArray.put(MainTabType.TAB_TYPE_MSG, new ContactsListFragment());
fragmentArray.put(MainTabType.TAB_TYPE_ME, new MeFragment());
@@ -222,7 +236,8 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
homeViewModel = new ViewModelProvider(this).get(HomeViewModel.class);
ViewModelProvider viewModelProvider = new ViewModelProvider(this);
homeViewModel = viewModelProvider.get(HomeViewModel.class);
NimMiddleActivity.firstEnter = false;
if (savedInstanceState != null) {
mCurrentTabType = savedInstanceState.getInt(Constants.KEY_MAIN_POSITION);
@@ -256,7 +271,9 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
DemoCache.saveAnchorCardView(2);
}
});
checkResumeGame();
}
private void otherModelInit() {
PwdCodeMgr.get().onCreateInit();
//初始化线程池
@@ -267,7 +284,41 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
initPreloadResource();
}
private void initPreloadResource(){
@SuppressLint("CheckResult")
private void checkResumeGame() {
GameModel2.INSTANCE.getResumeGameRoomInfo().compose(bindToLifecycle()).subscribe(gameRoomInfo -> {
if (gameRoomInfo != null && gameRoomInfo.getData() != null) {
Integer state = gameRoomInfo.getData().getMatchStatus();
if (state != null && (state == GameStateAbility.STATE_MATCH_SUCCESS || state == GameStateAbility.STATE_MATCHING)) {
if (resumeGameDialogManager == null) {
resumeGameDialogManager = new DialogManager(this);
}
resumeGameDialogManager.showOkCancelDialog(getString(R.string.resume_game_tips), getString(R.string.join_organization_ok), getString(R.string.join_organization_no), false, new DialogManager.OkCancelDialogListener() {
@Override
public void onOk() {
long gameId = JavaUtil.str2long(gameRoomInfo.getData().getMgId());
int gameMode = 0;
GameActivity.Companion.start(context, new GameIntent(gameId, gameMode));
}
@Override
public void onCancel() {
DialogManager.OkCancelDialogListener.super.onCancel();
Long roomId = gameRoomInfo.getRoomId();
if (roomId != null) {
GameModel2.INSTANCE.closeGameRx(roomId).compose(bindToLifecycle()).subscribe(s -> {
}, throwable -> {
});
}
}
});
}
}
}, throwable -> {
});
}
private void initPreloadResource() {
PreloadResourceViewModel viewModel = new ViewModelProvider(
GlobalViewModelOwner.Companion.getInstance()
).get(PreloadResourceViewModel.class);
@@ -404,6 +455,9 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
protected void onDestroy() {
CleanLeakUtils.fixInputMethodManagerLeak(MainActivity.this);
super.onDestroy();
if (resumeGameDialogManager != null) {
resumeGameDialogManager.dismissDialog();
}
ImInitHelper.get().unInit();
EventBus.getDefault().unregister(this);
stopRoomMinAnim();

View File

@@ -325,6 +325,7 @@ public class App extends BaseApp {
BasicConfig.INSTANCE.setVoiceDir(Constants.VOICE_DIR);
BasicConfig.INSTANCE.setCacheDir(Constants.CACHE_DIR);
BasicConfig.INSTANCE.setImageDir(Constants.IMAGE_CACHE_DIR);
com.example.lib_utils.log.LogUtil.INSTANCE.setConsolePrinterEnabled(BuildConfig.DEBUG);
}
/**

View File

@@ -11,6 +11,7 @@ import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog;
import android.app.FragmentManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
@@ -33,6 +34,7 @@ import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LiveData;
import androidx.viewpager2.widget.ViewPager2;
import com.alibaba.fastjson.JSON;
@@ -42,6 +44,7 @@ import com.chwl.app.ui.webview.baishun.BaiShunGameWebFragment;
import com.chwl.app.ui.webview.baishun.IBaiShunGameListener;
import com.chwl.core.monsterhunting.bean.MonsterDataBean;
import com.chwl.core.room.game.bean.BaiShunGameConfig;
import com.chwl.core.support.room.AudioRoomContext;
import com.chwl.core.support.room.RoomWidget;
import com.netease.nim.uikit.StatusBarUtil;
import com.netease.nimlib.sdk.NIMSDK;
@@ -1356,10 +1359,21 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
return this;
}
@Override
public FragmentManager getFragmentManager() {
return super.getFragmentManager();
}
@Nullable
@Override
public RoomContext getRoomContext() {
return RoomContext.Companion.get();
return AudioRoomContext.Companion.get();
}
@NonNull
@Override
public LiveData<? extends RoomContext> getRoomContextLiveData() {
return AudioRoomContext.Companion.getContextLiveData();
}
@NonNull
@@ -1368,12 +1382,19 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
return this;
}
@NonNull
@Override
public androidx.fragment.app.FragmentManager getViewFragmentManager() {
return getSupportFragmentManager();
}
@Nullable
@Override
public RoomWidget findWidget(@NonNull String name) {
return null;
}
private static class GiftBroadcastObserver implements Observer<BroadcastMessage> {
private WeakReference<AVRoomActivity> mReference;

View File

@@ -54,7 +54,7 @@ class GameMicroViewAdapter(context: Context?) : BaseMicroViewAdapter(context) {
width = when (itemCount) {
6 -> ScreenUtil.screenWidth / 6
7 -> ScreenUtil.screenWidth / 7
else -> (ScreenUtil.screenWidth / 7.5f).toInt()
else -> (ScreenUtil.screenWidth / 6f).toInt()
}
}
super.bind(info, position)

View File

@@ -0,0 +1,18 @@
package com.chwl.app.avroom.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.load
import com.chwl.core.room.bean.RoomIcon
import com.chwl.core.room.game.bean.GameInfo
class RoomGameListAdapter :
BaseQuickAdapter<GameInfo, BaseViewHolder>(R.layout.room_gameplay_item2) {
override fun convert(helper: BaseViewHolder, item: GameInfo?) {
helper.setText(R.id.tv_name, item?.name)
val iconView = helper.getView<ImageView>(R.id.iv_icon)
iconView.load(item?.pic2)
}
}

View File

@@ -4,14 +4,20 @@ 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.avroom.bean.RoomGameplayItem
import com.chwl.app.ui.utils.load
import com.chwl.core.room.bean.RoomIcon
class RoomGameplayAdapter :
BaseQuickAdapter<RoomIcon, BaseViewHolder>(R.layout.room_gameplay_item2) {
override fun convert(helper: BaseViewHolder, item: RoomIcon?) {
helper.setText(R.id.tv_name, item?.name)
BaseQuickAdapter<RoomGameplayItem, BaseViewHolder>(R.layout.room_gameplay_item2) {
override fun convert(helper: BaseViewHolder, item: RoomGameplayItem?) {
helper.setText(R.id.tv_name, item?.getName())
val iconView = helper.getView<ImageView>(R.id.iv_icon)
iconView.load(item?.icon)
val iconRes = item?.getIconRes()
if (iconRes != null) {
iconView.setImageResource(iconRes)
} else {
val iconUrl = item?.getIconUrl()
iconView.load(iconUrl ?: "")
}
}
}

View File

@@ -1,15 +0,0 @@
package com.chwl.app.avroom.adapter
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.chwl.app.R
import com.chwl.core.room.game.bean.GameInfo
class SelectGameAdapter :
BaseQuickAdapter<GameInfo, BaseViewHolder>(R.layout.item_room_select_game) {
override fun convert(helper: BaseViewHolder, item: GameInfo) {
helper.setText(R.id.tv_name,item.name)
}
}

View File

@@ -0,0 +1,63 @@
package com.chwl.app.avroom.bean
import androidx.annotation.Keep
import com.chwl.app.avroom.dialog.RoomGameplayDialog
import com.chwl.core.room.bean.RoomIcon
import java.io.Serializable
@Keep
interface RoomGameplayItem : Serializable {
fun getName(): String?
fun getIconUrl(): String?
fun getIconRes(): Int?
fun onItemClick(dialog: RoomGameplayDialog)
@Keep
class RoomIconItem(
private val roomIcon: RoomIcon,
private val onClick: (RoomGameplayDialog, RoomIcon) -> Unit
) : RoomGameplayItem {
override fun getName(): String? {
return roomIcon.name
}
override fun getIconUrl(): String? {
return roomIcon.icon
}
override fun getIconRes(): Int? {
return null
}
override fun onItemClick(dialog: RoomGameplayDialog) {
onClick.invoke(dialog, roomIcon)
}
}
@Keep
class CustomItem(
private val name: String,
private val iconRes: Int,
private val onClick: (RoomGameplayDialog, CustomItem) -> Unit
) : RoomGameplayItem {
override fun getName(): String {
return name
}
override fun getIconUrl(): String? {
return null
}
override fun getIconRes(): Int {
return iconRes
}
override fun onItemClick(dialog: RoomGameplayDialog) {
onClick.invoke(dialog, this)
}
}
}

View File

@@ -1,16 +0,0 @@
package com.chwl.app.avroom.core
import com.chwl.core.support.room.RoomAbility
import com.chwl.core.support.room.RoomContext
/**
* Created by Max on 2023/10/26 15:41
* Desc:语音房
* @param roomId roomUid
**/
class AudioRoomContext(roomId: Long) : RoomContext(roomId) {
override fun loadAbility(list: MutableMap<String, RoomAbility>) {
super.loadAbility(list)
}
}

View File

@@ -44,7 +44,7 @@ class CreateGameRoomDialog : BaseDialog<DialogCreateGameRoomBinding>() {
dismissAllowingStateLoss()
}
GameModel.getGameList()
GameModel.getGameList(null)
.compose(bindToLifecycle())
.subscribe(
{

View File

@@ -88,7 +88,7 @@ class CreateRoomDialog : BaseDialog<DialogCreateRoomBinding>() {
dismissAllowingStateLoss()
}
GameModel.getGameList()
GameModel.getGameList(null)
.compose(bindToLifecycle())
.subscribe(
{

View File

@@ -0,0 +1,223 @@
package com.chwl.app.avroom.dialog
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import com.chwl.app.R
import com.chwl.app.avroom.adapter.RoomGameListAdapter
import com.chwl.app.base.BaseActivity
import com.chwl.app.common.widget.dialog.DialogManager
import com.chwl.app.databinding.RoomGameplayDialogBinding
import com.chwl.app.home.helper.OpenRoomHelper
import com.chwl.core.manager.AvRoomDataManager
import com.chwl.core.room.bean.RoomInfo
import com.chwl.core.room.bean.RoomModeType
import com.chwl.core.room.core.RoomDataService
import com.chwl.core.room.game.GameModel.getGameList
import com.chwl.core.room.game.bean.GameInfo
import com.chwl.core.support.room.AudioRoomContext
import com.chwl.library.utils.JavaUtil
import com.chwl.library.utils.ResUtil
import com.chwl.library.utils.SingleToastUtil
import com.example.lib_utils.ktx.asLifecycle
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.unity3d.splash.services.core.lifecycle.LifecycleEvent
import io.reactivex.disposables.CompositeDisposable
class RoomGameListDialog :
BottomSheetDialogFragment(), LifecycleObserver {
private var binding: RoomGameplayDialogBinding? = null
private var compositeDisposable: CompositeDisposable? = null
private val adapter = RoomGameListAdapter()
private var dialogManager: DialogManager? = null
override fun getTheme(): Int {
return R.style.ErbanBottomSheetDialogDimFalse
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = RoomGameplayDialogBinding.inflate(LayoutInflater.from(context))
return binding?.root
}
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return super.onCreateDialog(savedInstanceState).apply {
this.setCanceledOnTouchOutside(true)
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initView()
switchStatus(0)
requestData()
}
override fun onAttach(context: Context) {
super.onAttach(context)
val lifecycleObserver = object : LifecycleEventObserver {
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
if (event == Lifecycle.Event.ON_DESTROY) {
context.asLifecycle()?.removeObserver(this)
try {
this@RoomGameListDialog.dismissAllowingStateLoss()
} catch (e: Exception) {
}
}
}
}
context.asLifecycle()?.addObserver(lifecycleObserver)
}
private fun initView() {
adapter.setOnItemClickListener { _, view, position ->
val item = adapter.getItem(position) as GameInfo
switchGame(item)
}
binding?.recyclerView?.adapter = adapter
}
private fun requestData() {
val dataService =
AudioRoomContext.get()
?.findAbility<RoomDataService>(RoomDataService::class.java.simpleName)
val cacheKey = "game_list#${parentFragment.hashCode()}"
val list = dataService?.getData(cacheKey) as? List<GameInfo>
if (!list.isNullOrEmpty()) {
loadData(list)
return
}
val disposable = getGameList(AvRoomDataManager.get().roomUid)
.doOnError {
SingleToastUtil.showToast(it.message)
switchStatus(-2)
}
.subscribe { it: List<GameInfo> ->
dataService?.putData(cacheKey, it)
loadData(it)
}
getCompositeDisposable().add(disposable)
}
private fun loadData(list: List<GameInfo>?) {
if (list.isNullOrEmpty()) {
switchStatus(-1)
} else {
adapter.setNewData(list)
switchStatus(1)
}
}
private fun switchStatus(status: Int) {
when (status) {
// loading
0 -> {
binding?.recyclerView?.isVisible = false
binding?.layoutStatus?.isVisible = true
binding?.groupStatusLoading?.isVisible = true
binding?.groupStatusText?.isVisible = false
}
// 有数据
1 -> {
binding?.recyclerView?.isVisible = true
binding?.layoutStatus?.isVisible = false
}
// 空数据
-1 -> {
binding?.recyclerView?.isVisible = false
binding?.layoutStatus?.isVisible = true
binding?.groupStatusLoading?.isVisible = false
binding?.groupStatusText?.isVisible = true
binding?.tvStatus?.setText(R.string.avroom_presenter_roomnewbiehellowwordpresenter_01)
}
// 失败
else -> {
binding?.recyclerView?.isVisible = false
binding?.layoutStatus?.isVisible = true
binding?.groupStatusLoading?.isVisible = false
binding?.groupStatusText?.isVisible = true
binding?.tvStatus?.setText(R.string.request_failed_again_later)
}
}
}
private fun switchGame(gameInfo: GameInfo) {
if (AvRoomDataManager.get().isGamePlaying) {
SingleToastUtil.showToast(ResUtil.getString(R.string.room_switch_game_failed_in_game))
return
}
if (!isShowChangeGame()) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_fragment_homepartyfragment_04))
return
}
if (dialogManager == null) {
dialogManager = DialogManager(context)
}
dialogManager?.showOkCancelDialog(
getString(R.string.room_switch_game_tips)
) {
if (gameInfo.isStandardRoom()) {
OpenRoomHelper.updateRoomInfo(
activity as BaseActivity,
AvRoomDataManager.get().mCurrentRoomInfo,
RoomInfo.ROOMTYPE_HOME_PARTY,
0,
false
)
} else {
OpenRoomHelper.updateRoomInfo(
activity as BaseActivity,
AvRoomDataManager.get().mCurrentRoomInfo,
RoomInfo.ROOMTYPE_GAME,
JavaUtil.str2long(gameInfo.mgId),
false
)
}
dismissAllowingStateLoss()
}
}
override fun onDestroy() {
super.onDestroy()
onUnbindContext()
dialogManager?.dismissDialog()
dialogManager = null
}
private fun getCompositeDisposable(): CompositeDisposable {
var disposable = compositeDisposable
if (disposable == null) {
disposable = CompositeDisposable()
compositeDisposable = disposable
}
return disposable
}
private fun onUnbindContext() {
compositeDisposable?.dispose()
compositeDisposable = null
}
//这里的2和4是服务端定义的错误状态 关闭排麦模式和关闭PK模式!
private fun isShowChangeGame(): Boolean {
val currentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo
return currentRoomInfo != null && currentRoomInfo.type != RoomInfo.ROOM_TYPE_SINGLE &&
(currentRoomInfo.roomModeType == RoomModeType.NORMAL_MODE || currentRoomInfo.roomModeType == 2 || currentRoomInfo.roomModeType == 4)
}
}

View File

@@ -1,25 +1,39 @@
package com.chwl.app.avroom.dialog
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import com.chwl.app.R
import com.chwl.app.avroom.activity.CreatePKActivity
import com.chwl.app.avroom.adapter.RoomGameplayAdapter
import com.chwl.app.avroom.anotherroompk.RoomPKCreateActivity
import com.chwl.app.avroom.bean.RoomGameplayItem
import com.chwl.app.avroom.singleroompk.SingleRoomPKCreateActivity
import com.chwl.app.databinding.RoomGameplayDialogBinding
import com.chwl.app.treasure_box.widget.GoldBoxHelper
import com.chwl.app.ui.webview.CommonWebViewActivity
import com.chwl.app.ui.webview.baishun.BaiShunGameWebActivity
import com.chwl.app.ui.webview.room_banner.RoomWebDialogActivity
import com.chwl.app.utils.CommonJumpHelper
import com.chwl.core.auth.AuthModel
import com.chwl.core.manager.AvRoomDataManager
import com.chwl.core.room.anotherroompk.SingleRoomPKModel
import com.chwl.core.room.bean.RoomIcon
import com.chwl.core.room.core.RoomDataService
import com.chwl.core.room.game.bean.BaiShunGameConfig
import com.chwl.core.room.model.AvRoomModel
import com.chwl.core.support.room.RoomContext
import com.chwl.core.super_admin.util.SuperAdminUtil
import com.chwl.core.support.room.AudioRoomContext
import com.chwl.core.utils.CurrentTimeUtils
import com.chwl.library.utils.ResUtil
import com.chwl.library.utils.SingleToastUtil
import com.example.lib_utils.ktx.asLifecycle
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.gson.Gson
import io.reactivex.disposables.CompositeDisposable
@@ -60,38 +74,72 @@ class RoomGameplayDialog :
private fun initView() {
adapter.setOnItemClickListener { _, view, position ->
val item = adapter.getItem(position) as RoomIcon
jump(item)
adapter.getItem(position)?.onItemClick(this)
}
binding?.recyclerView?.adapter = adapter
}
override fun onAttach(context: Context) {
super.onAttach(context)
val lifecycleObserver = object : LifecycleEventObserver {
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
if (event == Lifecycle.Event.ON_DESTROY) {
context.asLifecycle()?.removeObserver(this)
try {
this@RoomGameplayDialog.dismissAllowingStateLoss()
} catch (e: Exception) {
}
}
}
}
context.asLifecycle()?.addObserver(lifecycleObserver)
}
private fun requestData() {
val dataService =
RoomContext.get()?.findAbility<RoomDataService>(RoomDataService::class.java.simpleName)
AudioRoomContext.get()
?.findAbility<RoomDataService>(RoomDataService::class.java.simpleName)
val cacheKey = "gameplay_list#${parentFragment.hashCode()}"
val list = dataService?.getData(cacheKey) as? List<RoomIcon>
if (!list.isNullOrEmpty()) {
loadData(list)
loadSuccess(list)
return
}
val disposable = AvRoomModel.get().roomGamePlayList
.doOnError {
SingleToastUtil.showToast(it.message)
switchStatus(-2)
loadFail(it)
}
.subscribe { it: List<RoomIcon> ->
dataService?.putData(cacheKey, it)
loadData(it)
loadSuccess(it)
}
getCompositeDisposable().add(disposable)
}
private fun loadData(list: List<RoomIcon>?) {
if (list.isNullOrEmpty()) {
private fun loadSuccess(list: List<RoomIcon>?) {
val finalList = getLocalList()
list?.let {
finalList.addAll(list.map {
RoomGameplayItem.RoomIconItem(it) { dialog, item ->
jump(item)
}
})
}
if (finalList.isEmpty()) {
switchStatus(-1)
} else {
adapter.setNewData(list)
adapter.setNewData(finalList)
switchStatus(1)
}
}
private fun loadFail(throwable: Throwable) {
SingleToastUtil.showToast(throwable.message)
val finalList = getLocalList()
if (finalList.isEmpty()) {
switchStatus(-2)
} else {
adapter.setNewData(finalList)
switchStatus(1)
}
}
@@ -194,6 +242,157 @@ class RoomGameplayDialog :
}
}
private fun getLocalList(): MutableList<RoomGameplayItem> {
val list = ArrayList<RoomGameplayItem>()
// getPkItem()?.let {
// list.add(it)
// }
// getRoomPkItem()?.let {
// list.add(it)
// }
// getSingleRoomPkItem()?.let {
// list.add(it)
// }
return list
}
private fun getPkItem(): RoomGameplayItem? {
val context = context ?: return null
if (SuperAdminUtil.isSuperAdmin()) {
return null
}
if (AvRoomDataManager.get().isOpenGame) {
return null
}
if (AvRoomDataManager.get().isSingleRoom) {
return null
}
val roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
if (roomInfo == null) {
return null
}
if (AvRoomDataManager.get().isManager && !AvRoomDataManager.get().isCpRoom) {
val str =
if (AvRoomDataManager.get().isOpenPKMode) context.resources.getString(R.string.room_was_in_PK) else context.resources.getString(
R.string.room_PK_mode
)
val icon =
if (AvRoomDataManager.get().isOpenPKMode) R.drawable.ic_room_opt_op_pk else R.drawable.ic_room_opt_in_pk
return RoomGameplayItem.CustomItem(str, icon) { dialog, item ->
if (AvRoomDataManager.get().isDatingMode) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_01))
return@CustomItem
}
if (AvRoomDataManager.get().isOpenAnotherPKMode) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_02))
return@CustomItem
}
dialog.dismissAllowingStateLoss()
CreatePKActivity.start(context)
}
}
return null
}
private fun getRoomPkItem(): RoomGameplayItem? {
val context = context ?: return null
if (SuperAdminUtil.isSuperAdmin()) {
return null
}
if (AvRoomDataManager.get().isOpenGame) {
return null
}
if (AvRoomDataManager.get().isSingleRoom) {
return null
}
val roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
if (roomInfo == null) {
return null
}
if ((AvRoomDataManager.get().isRoomOwner || AvRoomDataManager.get().isSuperAdmin) &&
!AvRoomDataManager.get().isCpRoom
) {
val str =
if (AvRoomDataManager.get().isOpenAnotherPKMode) ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_03) else ResUtil.getString(
R.string.avroom_dialog_roomoperationdialog_04
)
val icon =
if (AvRoomDataManager.get().isOpenAnotherPKMode) R.drawable.ic_room_opt_another_pk_in else R.drawable.ic_room_opt_another_pk_open
return RoomGameplayItem.CustomItem(str, icon) { dialog, item ->
if (AvRoomDataManager.get().isDatingMode) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_05))
return@CustomItem
}
if (AvRoomDataManager.get().isOpenPKMode) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_06))
return@CustomItem
}
if (AvRoomDataManager.get().isOpenAnotherPKMode) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_07))
return@CustomItem
}
dismissAllowingStateLoss()
RoomPKCreateActivity.start(context)
}
}
return null
}
private fun getSingleRoomPkItem(): RoomGameplayItem? {
val context = context ?: return null
if (SuperAdminUtil.isSuperAdmin()) {
return null
}
if (AvRoomDataManager.get().isOpenGame) {
return null
}
if (!AvRoomDataManager.get().isSingleRoom) {
return null
}
val pkBean = AvRoomDataManager.get().roomPkLiveData.value
if (AvRoomDataManager.get().isRoomOwner && !AvRoomDataManager.get().isCpRoom) {
var str =
if (AvRoomDataManager.get().isOpenAnotherPKMode) ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_08) else ResUtil.getString(
R.string.avroom_dialog_roomoperationdialog_09
)
if (pkBean != null) {
if (pkBean.pkState == 2 &&
(pkBean.winUid == 0L || pkBean.winUid == AuthModel.get().currentUid || pkBean.penaltyEndTime < CurrentTimeUtils.getCurrentTime())
) {
str = ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_010)
}
}
val icon =
if (AvRoomDataManager.get().isOpenAnotherPKMode) R.drawable.ic_room_opt_single_pk_open else R.drawable.ic_room_opt_single_pk_in
val finalStr = str
return RoomGameplayItem.CustomItem(str, icon) { dialog, item ->
if (pkBean != null && ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_011) == finalStr) {
SingleRoomPKModel.endSingleRoomPk(pkBean.roundId)
.doOnSuccess { s: String? ->
SingleToastUtil.showToast(
ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_012)
)
}
.doOnError { throwable: Throwable ->
SingleToastUtil.showToast(
throwable.message
)
}
.subscribe()
dismissAllowingStateLoss()
return@CustomItem
}
if (AvRoomDataManager.get().isOpenAnotherPKMode) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_dialog_roomoperationdialog_013))
return@CustomItem
}
dismissAllowingStateLoss()
SingleRoomPKCreateActivity.start(context)
}
}
return null
}
interface GameplayDialogListener {
fun onShowBaiShunGame(url: String, config: BaiShunGameConfig)
}

View File

@@ -191,7 +191,7 @@ public class RoomOperationDialog extends BottomSheetDialog {
return;
}
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo == null || roomInfo.getIsPermitRoom() != 1) {
if (roomInfo == null) {
return;
}
if ((AvRoomDataManager.get().isRoomOwner() || AvRoomDataManager.get().isSuperAdmin()) &&

View File

@@ -23,8 +23,10 @@ import android.widget.TextView
import androidx.annotation.CallSuper
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.activityViewModels
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LiveData
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.withResumed
import androidx.recyclerview.widget.RecyclerView
@@ -42,6 +44,7 @@ import com.chwl.app.avroom.adapter.OnMicroItemClickListener
import com.chwl.app.avroom.adapter.RoomMessageIndicatorAdapter
import com.chwl.app.avroom.dialog.AttentionHintDialog
import com.chwl.app.avroom.dialog.DatingVipRuleDialog
import com.chwl.app.avroom.dialog.RoomGameListDialog
import com.chwl.app.avroom.dialog.RoomGameplayDialog
import com.chwl.app.avroom.dialog.RoomOperationDialog
import com.chwl.app.avroom.presenter.BaseRoomPresenter
@@ -106,6 +109,8 @@ import com.chwl.core.share.bean.SessionType
import com.chwl.core.super_admin.SaConstant
import com.chwl.core.super_admin.model.SuperAdminModel
import com.chwl.core.super_admin.util.SuperAdminUtil
import com.chwl.core.support.room.AudioRoomContext
import com.chwl.core.support.room.RoomContext
import com.chwl.core.support.room.RoomView
import com.chwl.core.support.room.RoomWidget
import com.chwl.core.user.UserModel
@@ -786,6 +791,9 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
override fun onClick(v: View) {
if (mClickLimit.checkForTime(500)) return
when (v.id) {
R.id.iv_game -> {
RoomGameListDialog().show(childFragmentManager, "GAME_LIST")
}
R.id.input_send -> {
sendMsg()
}
@@ -1458,10 +1466,22 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
return this
}
override fun getViewFragmentManager(): FragmentManager {
return activity?.supportFragmentManager ?: childFragmentManager
}
override fun findWidget(name: String): RoomWidget? {
return widgets[name]
}
override fun getRoomContext(): RoomContext? {
return AudioRoomContext.get()
}
override fun getRoomContextLiveData(): LiveData<out RoomContext?> {
return AudioRoomContext.contextLiveData
}
open fun initWidget() {
publicChatMessageWidget?.let {
registerWidget(PublicChatRoomMessageWidget::class.java.simpleName, it)

View File

@@ -15,15 +15,22 @@ import com.chwl.app.avroom.adapter.GameMiniMicroViewAdapter
import com.chwl.app.avroom.adapter.OnMicroItemClickListener
import com.chwl.app.avroom.game.GameDelegate
import com.chwl.app.avroom.game.OnGameStatusChangeListener
import com.chwl.app.avroom.headline.RoomHeadlineWidget
import com.chwl.app.avroom.online.RoomOnlineWidget
import com.chwl.app.avroom.presenter.GameRoomPresenter
import com.chwl.app.avroom.view.IGameRoomView
import com.chwl.app.databinding.FragmentGameRoomBinding
import com.chwl.app.home.helper.OpenRoomHelper
import com.chwl.app.ui.webview.DialogWebViewActivity
import com.chwl.app.ui.widget.GiftDialog.OnGiftDialogBtnClickListener
import com.chwl.core.UriProvider
import com.chwl.core.manager.AvRoomDataManager
import com.chwl.core.music.model.PlayerModel
import com.chwl.core.room.bean.RoomInfo
import com.chwl.core.room.event.FinishAvRoomEvent
import com.chwl.core.sud.model.GameViewInfoModel
import com.chwl.library.base.factory.CreatePresenter
import com.chwl.library.utils.SingleToastUtil
import com.netease.nim.uikit.common.util.sys.ScreenUtil
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@@ -74,12 +81,16 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
@SuppressLint("CheckResult")
override fun initiate() {
gameBinding.microView.bindAdapter(GameMicroViewAdapter(context))
resetGameViewRect()
super.initiate()
//游戏模式暂时不需要这个
PlayerModel.get().stop()
gameBinding.roomInfo = AvRoomDataManager.get().mCurrentRoomInfo
gameBinding.tvShowMiniMic.setOnClickListener { showMiniMic() }
gameBinding.ivShowMic.setOnClickListener { showMic() }
gameBinding.headlineWidget.setOnClickListener {
switchMessageLayoutHeight()
}
}
@SuppressLint("ClickableViewAccessibility")
@@ -93,23 +104,57 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
}
}
override fun onClick(v: View) {
super.onClick(v)
when (v.id) {
R.id.iv_back_room -> {
if (AvRoomDataManager.get().isGamePlaying) {
SingleToastUtil.showToast(getString(R.string.avroom_fragment_homepartyfragment_03))
return
}
dialogManager.showOkCancelDialog(
getString(R.string.room_switch_standard_room_tips)
) {
OpenRoomHelper.updateRoomInfo(
baseActivity,
AvRoomDataManager.get().mCurrentRoomInfo,
RoomInfo.ROOMTYPE_HOME_PARTY,
0,
false
)
}
}
R.id.layout_hour_rank -> {
DialogWebViewActivity.start(
mContext,
UriProvider.getRoomHourRankUrl(AvRoomDataManager.get().roomUid)
)
}
}
}
@SuppressLint("ClickableViewAccessibility")
private fun setMessagePagerAutoHeight(recyclerView: RecyclerView){
private fun setMessagePagerAutoHeight(recyclerView: RecyclerView) {
recyclerView.setOnTouchListener(OnTouchListener { v: View?, event: MotionEvent ->
if (recyclerView.scrollState == RecyclerView.SCROLL_STATE_IDLE
&& event.action == MotionEvent.ACTION_UP
) {
val layoutParams: ViewGroup.LayoutParams = messagePager.layoutParams
val bigHeight = ScreenUtil.dip2px(200f)
val littleHeight = ScreenUtil.dip2px(80f)
layoutParams.height =
if (layoutParams.height == littleHeight) bigHeight else littleHeight
messagePager.layoutParams = layoutParams
switchMessageLayoutHeight()
}
false
})
}
private fun switchMessageLayoutHeight() {
val view = gameBinding.layoutMessage
val layoutParams: ViewGroup.LayoutParams = view.layoutParams
val bigHeight = ScreenUtil.dip2px(200f)
val littleHeight = ScreenUtil.dip2px(80f)
layoutParams.height =
if (layoutParams.height == littleHeight) bigHeight else littleHeight
view.layoutParams = layoutParams
}
private fun showMiniMic() {
if (isShowMiniMic) return
isShowMiniMic = true
@@ -150,11 +195,25 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
// gameBinding.ivShowMic.isVisible = false
// }
gameBinding.microView.adapter.notifyDataSetChanged()
if (AvRoomDataManager.get().mCurrentRoomInfo?.isPermitRoom == 1) {
gameBinding.layoutHourRank.visibility = View.VISIBLE
} else {
gameBinding.layoutHourRank.visibility = View.GONE
}
}
private fun resetGameViewRect(){
gameBinding.vGameRect.post {
gameDelegate.gameViewRect = GameViewInfoModel.GameViewRectModel().apply {
top = gameBinding.vGameRect.top
bottom = gameBinding.layoutRoot.height - gameBinding.vGameRect.bottom
}
}
}
override fun onGameStart() {
if (isSixMic()) {
showMiniMic()
// showMiniMic()
}
}
@@ -211,5 +270,6 @@ class GameRoomFragment : BaseRoomFragment<IGameRoomView?, GameRoomPresenter?>(),
override fun initWidget() {
super.initWidget()
registerWidget(RoomOnlineWidget::class.java.simpleName, gameBinding.onlineWidget)
registerWidget(RoomHeadlineWidget::class.java.simpleName, gameBinding.headlineWidget)
}
}

View File

@@ -16,17 +16,10 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.chwl.app.avroom.adapter.SelectGameAdapter;
import com.chwl.app.home.helper.OpenRoomHelper;
import com.chwl.app.ui.utils.ImageLoadUtils;
import com.chwl.app.ui.utils.ImageLoadUtilsV2;
import com.chwl.app.ui.widget.GiftDialog;
import com.chwl.app.ui.widget.UserInfoDialog;
import com.chwl.core.room.bean.RoomModeType;
import com.chwl.core.room.game.GameModel;
import com.chwl.core.room.game.bean.GameInfo;
import com.chwl.library.utils.JavaUtil;
import com.example.lib_utils.UiUtils;
import com.netease.nim.uikit.common.util.string.StringUtil;
@@ -105,7 +98,6 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
//收藏房间
private String FOLLOW_ROOM_TYPE = "";
private SelectGameAdapter gameAdapter;
public static HomePartyFragment newInstance() {
HomePartyFragment homePartyFragment = new HomePartyFragment();
@@ -224,73 +216,6 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
}
}
private void initRvGame() {
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
if (roomInfo == null || gameAdapter != null) return;
gameMainBinding.rvGame.setLayoutManager(new LinearLayoutManager(mContext));
gameMainBinding.rvGame.setAdapter(gameAdapter = new SelectGameAdapter());
gameMainBinding.llSelectGame.setOnClickListener(v -> {
if (gameMainBinding.rvGame.getVisibility() == View.VISIBLE) {
gameMainBinding.rvGame.setVisibility(View.GONE);
gameMainBinding.ivChangeGameArrow.setImageResource(R.drawable.ic_room_arrow_type_below);
} else {
if (!isShowChangeGame()) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_fragment_homepartyfragment_01));
return;
}
if (AvRoomDataManager.get().isGamePlaying()) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_fragment_homepartyfragment_02));
} else {
gameMainBinding.rvGame.setVisibility(View.VISIBLE);
gameMainBinding.ivChangeGameArrow.setImageResource(R.drawable.ic_room_arrow_type);
}
}
});
gameAdapter.setOnItemClickListener((adapter, view, position) -> {
if (AvRoomDataManager.get().isGamePlaying()) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_fragment_homepartyfragment_03));
}
if (!isShowChangeGame()) {
SingleToastUtil.showToast(ResUtil.getString(R.string.avroom_fragment_homepartyfragment_04));
return;
}
GameInfo gameInfo = gameAdapter.getItem(position);
if (gameInfo != null) {
gameMainBinding.rvGame.setVisibility(View.GONE);
gameMainBinding.ivChangeGameArrow.setImageResource(R.drawable.ic_room_arrow_type_below);
if (gameInfo.isStandardRoom()) {
OpenRoomHelper.updateRoomInfo(
getBaseActivity(),
AvRoomDataManager.get().mCurrentRoomInfo,
RoomInfo.ROOMTYPE_HOME_PARTY,
0,
false);
} else {
OpenRoomHelper.updateRoomInfo(
getBaseActivity(),
AvRoomDataManager.get().mCurrentRoomInfo,
RoomInfo.ROOMTYPE_GAME,
JavaUtil.str2long(gameInfo.getMgId()),
false);
}
}
});
}
//这里的2和4是服务端定义的错误状态 关闭排麦模式和关闭PK模式!
private boolean isShowChangeGame() {
RoomInfo currentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
return currentRoomInfo != null &&
AvRoomDataManager.get().isRoomOwner() &&
currentRoomInfo.getIsPermitRoom() != 1 &&
currentRoomInfo.getType() != RoomInfo.ROOM_TYPE_SINGLE &&
(currentRoomInfo.getRoomModeType() == RoomModeType.NORMAL_MODE ||
currentRoomInfo.getRoomModeType() == 2 ||
currentRoomInfo.getRoomModeType() == 4);
}
public void setRoomBg(RoomInfo roomInfo) {
if (svgaRoomBg == null) return;
AVRoomActivity.setBackBg(mContext, roomInfo, svgaRoomBg, bgPicture);
@@ -465,36 +390,6 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
ivFollowRoom.setImageResource(AvRoomDataManager.get().isRoomFans ? R.drawable.room_ic_collect_yes : R.drawable.room_ic_collect_no);
setIdOnlineData();
if (isShowChangeGame()) {
initRvGame();
gameMainBinding.llChangeGame.setVisibility(View.VISIBLE);
if (AvRoomDataManager.get().isOpenGame()) {
gameMainBinding.tvCurrGame.setText(currentRoomInfo.getMgName());
} else {
gameMainBinding.tvCurrGame.setText(ResUtil.getString(R.string.avroom_fragment_homepartyfragment_08));
}
GameModel.INSTANCE.getGameList()
.compose(bindToLifecycle())
.subscribe(gameInfos -> {
if (AvRoomDataManager.get().isOpenGame()) {
for (int i = 0; i < gameInfos.size(); i++) {
GameInfo gameInfo = gameInfos.get(i);
if (JavaUtil.str2long(gameInfo.getMgId()) == currentRoomInfo.getMgId()) {
gameInfos.remove(i);
break;
}
}
GameInfo gameInfo = new GameInfo();
gameInfo.asStandardRoom();
gameInfo.setName(ResUtil.getString(R.string.avroom_fragment_homepartyfragment_09));
gameInfos.add(gameInfo);
}
gameAdapter.setNewData(gameInfos);
});
} else {
gameMainBinding.llChangeGame.setVisibility(View.GONE);
}
}
}

View File

@@ -8,6 +8,7 @@ import android.view.View;
import androidx.annotation.NonNull;
import androidx.databinding.DataBindingUtil;
import com.chwl.app.avroom.headline.RoomHeadlineWidget;
import com.chwl.app.avroom.online.RoomOnlineWidget;
import com.chwl.app.music.widget.MusicPlayerView;
import com.chwl.app.ui.webview.DialogWebViewActivity;
@@ -134,6 +135,7 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
public void initWidget() {
super.initWidget();
registerWidget(RoomOnlineWidget.class.getSimpleName(), gameBinding.onlineWidget);
registerWidget(RoomHeadlineWidget.class.getSimpleName(), gameBinding.headlineWidget);
}
@SuppressLint("CheckResult")
@@ -457,6 +459,11 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
}
changeModelShowView();
refreshDatingNextStatus();
if (AvRoomDataManager.get().isDatingMode()) {
gameBinding.ivGame.setVisibility(View.GONE);
} else {
gameBinding.ivGame.setVisibility(View.VISIBLE);
}
}

View File

@@ -13,6 +13,7 @@ import com.chwl.app.avroom.adapter.OnMicroItemClickListener
import com.chwl.app.avroom.adapter.SingleAnchorMicroViewAdapter
import com.chwl.app.avroom.adapter.SingleRoomPKMicroViewAdapter
import com.chwl.app.avroom.dialog.RequestUpMicDialog
import com.chwl.app.avroom.headline.RoomHeadlineWidget
import com.chwl.app.avroom.online.RoomOnlineWidget
import com.chwl.app.avroom.presenter.SingleRoomPresenter
import com.chwl.app.avroom.singleroompk.SingleRoomPkFinishDialog
@@ -236,6 +237,7 @@ class SingleRoomFragment : BaseRoomFragment<ISingleRoomView?, SingleRoomPresente
override fun initWidget() {
super.initWidget()
registerWidget(RoomOnlineWidget::class.java.simpleName, gameBinding.onlineWidget)
registerWidget(RoomHeadlineWidget::class.java.simpleName, gameBinding.headlineWidget)
}
override fun onInitMusicPlayerView(view: MusicPlayerView) {

View File

@@ -9,8 +9,8 @@ import com.chwl.app.BuildConfig;
public class AppConfig {
protected static final String APP_ID = "1578948593831571457";
protected static final String APP_KEY = "J9lHOXvFWkAZiTfl4SK7IGt0wDnW3fWd";
protected static boolean isTestEnv = BuildConfig.DEBUG;
public static final String APP_ID = "1578948593831571457";
public static final String APP_KEY = "J9lHOXvFWkAZiTfl4SK7IGt0wDnW3fWd";
public static boolean isTestEnv = BuildConfig.DEBUG;
}

View File

@@ -18,11 +18,15 @@ import com.chwl.core.room.game.bean.GameCfg
import com.chwl.core.room.game.GameModel
import com.chwl.core.room.game.GameStatus
import com.chwl.core.room.model.HomePartyModel
import com.chwl.core.sud.model.GameViewInfoModel.GameViewRectModel
import com.chwl.core.sud.state.SudMGPAPPState
import com.chwl.core.sud.state.SudMGPMGState
import com.chwl.core.user.UserModel
import com.chwl.core.utils.LogUtils
import com.chwl.core.utils.net.RxHelper
import com.chwl.library.language.LanguageHelper
import com.chwl.library.net.rxnet.callback.CallBack
import com.chwl.library.utils.ResUtil
import com.chwl.library.utils.SingleToastUtil
import okhttp3.*
import org.json.JSONException
@@ -54,6 +58,8 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
private var onGameStatusChangeListener: OnGameStatusChangeListener? = null
var gameViewRect: GameViewRectModel? = null
fun setOnGameStatusChangeListener(onGameStatusChangeListener: OnGameStatusChangeListener) {
this.onGameStatusChangeListener = onGameStatusChangeListener
}
@@ -340,12 +346,26 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
//遊戲安全操作區域
val viewGameRect = JSONObject()
viewGameRect.put("left", 0)
viewGameRect.put("top", container.context.resources.getDimensionPixelOffset(R.dimen.dp_180))
viewGameRect.put("right", 0)
viewGameRect.put("bottom", container.context.resources.getDimensionPixelOffset(R.dimen.dp_150))
val viewRect = gameViewRect
if (viewRect != null) {
Log.d(TAG,"notifyGameViewInfo top:${viewRect.top} viewRect:${viewRect.bottom}")
viewGameRect.put("left", viewRect.left)
viewGameRect.put("top", viewRect.top)
viewGameRect.put("right", viewRect.right)
viewGameRect.put("bottom", viewRect.bottom)
} else {
viewGameRect.put("left", 0)
viewGameRect.put(
"top",
container.context.resources.getDimensionPixelOffset(R.dimen.dp_185)
)
viewGameRect.put("right", 0)
viewGameRect.put(
"bottom",
container.context.resources.getDimensionPixelOffset(R.dimen.dp_180)
)
}
jsonObject.put("view_game_rect", viewGameRect)
//通知遊戲
val json = jsonObject.toString()
Log.d(TAG, "notifyGameViewInfo:$json")
@@ -386,7 +406,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
}
}
}
SudMGPMGState.APP_COMMON_SELF_CLICK_JOIN_BTN -> {
SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN -> {
try {
val jsonObject = JSONObject(dataJson)
@@ -397,7 +417,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
}
}
SudMGPMGState.APP_COMMON_SELF_CLICK_START_BTN -> {
SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN -> {
notifySelfPlayingState(true)
}
SudMGPMGState.MG_COMMON_GAME_STATE -> handleGameState(dataJson)
@@ -469,7 +489,7 @@ class GameDelegate(val activity: Activity, val container: FrameLayout, var mgId:
} else if (isJoin) {
val upPosition = AvRoomDataManager.get().findGamePosition()
if (upPosition == Int.MIN_VALUE) {
showToast("當前遊戲人數已滿!")
showToast(ResUtil.getString(R.string.room_game_number_full))
} else {
UserModel.get().cacheLoginUserInfo?.gameStatus = 1
homePartyModel.upMicroPhone(upPosition,

View File

@@ -1,61 +0,0 @@
/*
Copyright © Sud.Tech
https://sud.tech
*/
package com.chwl.app.avroom.game;
/**
* Time:2021/10/19
* Description: APP to MG 的状态定义
*/
public class SudMGPAPPState {
// region 通用状态
/**
* 加入状态
* 最低版本: v1.1.30.xx
*/
public static final String APP_COMMON_SELF_IN = "app_common_self_in";
/**
* 准备状态
* 最低版本: v1.1.30.xx
*/
public static final String APP_COMMON_SELF_READY = "app_common_self_ready";
/**
* 游戏状态
* 最低版本: v1.1.30.xx
*/
public static final String APP_COMMON_SELF_PLAYING = "app_common_self_playing";
/**
* 队长状态
* 最低版本: v1.1.30.xx
*/
public static final String APP_COMMON_SELF_CAPTAIN = "app_common_self_captain";
/**
* 踢人
* v1.1.30.xx
*/
public static final String APP_COMMON_SELF_KICK = "app_common_self_kick";
/**
* 结束游戏
* v1.1.30.xx
*/
public static final String APP_COMMON_SELF_END = "app_common_self_end";
/**
* 麦克风状态
*/
public static final String APP_COMMON_SELF_MICROPHONE = "app_common_self_microphone";
/**
* 文字命中状态
*/
public static final String APP_COMMON_SELF_TEXT_HIT = "app_common_self_text_hit";
}

View File

@@ -1,125 +0,0 @@
/*
Copyright © Sud.Tech
https://sud.tech
*/
package com.chwl.app.avroom.game;
/**
* Time:2021/10/19
* Description: MG to APP 的状态定义
*/
public class SudMGPMGState {
// region 通用状态-游戏
/**
* 公屏消息 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PUBLIC_MESSAGE = "mg_common_public_message";
/**
* 关键词状态
*/
public static final String MG_COMMON_KEY_WORD_TO_HIT = "mg_common_key_word_to_hit";
// endregion 通用状态-游戏
// region 通用状态-玩家
/**
* 加入状态 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PLAYER_IN = "mg_common_player_in";
/**
* 准备状态 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PLAYER_READY = "mg_common_player_ready";
/**
* 队长状态 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PLAYER_CAPTAIN = "mg_common_player_captain";
/**
* 游戏状态 (已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_PLAYER_PLAYING = "mg_common_player_playing";
/**
* 游戏状态(已修改)
* 最低版本: v1.1.30.xx
*/
public static final String MG_COMMON_GAME_STATE = "mg_common_game_state";
// endregion 通用状态-玩家
// region 碰碰我最强
// endregion 碰碰我最强
// region 飞刀达人
// endregion 飞刀达人
// region 你画我猜
/**
* 选词中
*/
public static final String MG_DG_SELECTING = "mg_dg_selecting";
/**
* 作画中
*/
public static final String MG_DG_PAINTING = "mg_dg_painting";
/**
* 错误答案
*/
public static final String MG_DG_ERRORANSWER = "mg_dg_erroranswer";
/**
* 总积分
*/
public static final String MG_DG_TOTALSCORE = "mg_dg_totalscore";
/**
* 本次积分
*/
public static final String MG_DG_SCORE = "mg_dg_score";
// endregion 你画我猜
/**
* 加入游戏按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_JOIN_BTN = "mg_common_self_click_join_btn";
/**
* 取消加入游戏按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_CANCEL_JOIN_BTN = "mg_common_self_click_cancel_join_btn";
/**
* 准备按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_READY_BTN = "mg_common_self_click_ready_btn";
/**
* 取消准备按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_CANCEL_READY_BTN = "mg_common_self_click_cancel_ready_btn";
/**
* 开始游戏按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_START_BTN = "mg_common_self_click_start_btn";
/**
* 分享按钮点击状态
*/
public static final String APP_COMMON_SELF_CLICK_SHARE_BTN = "mg_common_self_click_share_btn";
}

View File

@@ -0,0 +1,105 @@
package com.chwl.app.avroom.headline
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.core.view.isVisible
import androidx.databinding.DataBindingUtil
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.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.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum
class RoomHeadlineWidget : FrameLayoutRoomWidget {
private val binding: RoomHeadlineWidgetBinding =
DataBindingUtil.inflate(
LayoutInflater.from(
context
), R.layout.room_headline_widget, this, true
)
private var chatRoomClient: ChatRoomClient? = null
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
)
constructor(
context: Context,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes)
override fun onStart(roomView: RoomView) {
super.onStart(roomView)
if (!isInEditMode) {
updateHeadline(null)
}
chatRoomClient = ChatRoomClientManager.getPublicChatClient()
chatRoomClient?.let {
initChatRoom(it)
}
requestCurrentHeadline()
}
private fun onReceiveMessage(message: ChatRoomMessage) {
if (message.msgType == MsgTypeEnum.custom) {
val attachment: CustomAttachment = (message.attachment as? CustomAttachment) ?: return
when (attachment.first) {
CustomAttachment.CUSTOM_MSG_HEADLINE_CHANGED -> {
when (attachment.second) {
CustomAttachment.CUSTOM_MSG_HEADLINE_CHANGED_SUB -> {
val data = (attachment as? HeadlineChangedAttachment) ?: return
updateHeadline(data.headlineData)
}
}
}
}
}
}
private fun initChatRoom(chatRoomClient: ChatRoomClient) {
// 登录流程在PublicChatRoomMessageWidget中已经执行了
getCompositeDisposable().add(chatRoomClient.messageObservable.subscribe {
it.forEach { message ->
onReceiveMessage(message)
}
})
}
private fun requestCurrentHeadline() {
safeLaunch {
val data = PublicChatModel.getCurrentHeadline()
updateHeadline(data)
}
}
private fun updateHeadline(data: HeadlineBean?) {
val content = data?.content
if (data?.isValid() == true && !content.isNullOrEmpty()) {
binding.tvHeadlineContent.text = content
this.isVisible = true
} else {
this.isVisible = false
}
}
override fun onStop() {
super.onStop()
chatRoomClient = null
}
}

View File

@@ -68,41 +68,43 @@ class RoomOnlineWidget : FrameLayoutRoomWidget, RoomWidget {
) : super(context, attrs, defStyleAttr, defStyleRes)
init {
this.singleClick {
RoomOnlineUserActivity.start(context)
}
adapter.setOnItemClickListener { adapter, view, position ->
RoomOnlineUserActivity.start(context)
}
binding.recyclerView.adapter = adapter
binding.recyclerView.addItemDecoration(
VerticalDecoration(
UIUtil.dip2px(context, 4.5),
false,
false
if (!isInEditMode) {
this.singleClick {
RoomOnlineUserActivity.start(context)
}
adapter.setOnItemClickListener { adapter, view, position ->
RoomOnlineUserActivity.start(context)
}
binding.recyclerView.adapter = adapter
binding.recyclerView.addItemDecoration(
VerticalDecoration(
UIUtil.dip2px(context, 4.5),
false,
false
)
)
)
val isRTL = UiUtils.isRtl(context)
binding.recyclerView.outlineProvider = object : ViewOutlineProvider() {
override fun getOutline(view: View?, outline: Outline?) {
if (isRTL) {
outline?.setRect(
UiUtils.dip2px(9f),
0,
(view?.width ?: 0),
(view?.height ?: 0),
)
} else {
outline?.setRect(
0,
0,
(view?.width ?: 0) - UiUtils.dip2px(9f),
(view?.height ?: 0),
)
val isRTL = UiUtils.isRtl(context)
binding.recyclerView.outlineProvider = object : ViewOutlineProvider() {
override fun getOutline(view: View?, outline: Outline?) {
if (isRTL) {
outline?.setRect(
UiUtils.dip2px(9f),
0,
(view?.width ?: 0),
(view?.height ?: 0),
)
} else {
outline?.setRect(
0,
0,
(view?.width ?: 0) - UiUtils.dip2px(9f),
(view?.height ?: 0),
)
}
}
}
binding.recyclerView.clipToOutline = true
}
binding.recyclerView.clipToOutline = true
}
override fun onInitialize(roomView: RoomView, roomContext: RoomContext) {

View File

@@ -9,6 +9,7 @@ import android.util.SparseArray;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.chwl.core.support.room.AudioRoomContext;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -20,8 +21,6 @@ import com.netease.nimlib.sdk.chatroom.model.EnterChatRoomResultData;
import com.netease.nimlib.sdk.util.Entry;
import com.chwl.app.R;
import com.chwl.app.avroom.activity.AVRoomActivity;
import com.chwl.app.avroom.core.AudioRoomContext;
import com.chwl.core.support.room.RoomContext;
import com.chwl.app.avroom.view.IAvRoomView;
import com.chwl.app.base.BaseMvpPresenter;
import com.chwl.core.Constants;

View File

@@ -565,13 +565,12 @@ public class BaseRoomPresenter<V extends IBaseRoomView> extends BaseMvpPresenter
@SuppressLint("CheckResult")
public void sendPublicChatTextMessage(String message) {
if (TextUtils.isEmpty(message)) return;
String sessionId = InitialModel.get().getPublicChatSessionId();
if (sessionId == null) {
ChatRoomClient client = ChatRoomClientManager.INSTANCE.getPublicChatClient();
if (client == null) {
SingleToastUtil.showToast(R.string.public_chat_not_found);
return;
}
ChatRoomClient client = ChatRoomClientManager.INSTANCE.getClient(sessionId);
ChatRoomMessage textMessage = ChatRoomMessageBuilder.createChatRoomTextMessage(sessionId, message);
ChatRoomMessage textMessage = ChatRoomMessageBuilder.createChatRoomTextMessage(client.getSessionId(), message);
client.sendMessage(textMessage).compose(bindToLifecycle()).subscribe(new BiConsumer<Object, Throwable>() {
@Override
public void accept(Object o, Throwable throwable) throws Exception {

View File

@@ -388,9 +388,6 @@ public class PublicChatMessageView extends FrameLayout {
}
return;
}
if (mMessageAdapter.getItemCount() > 0) {
messageListView.smoothScrollToPosition(mMessageAdapter.getItemCount() - 1);
}
}
public void release() {

View File

@@ -2,18 +2,10 @@ package com.chwl.app.avroom.public_chat
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.core.view.isVisible
import androidx.databinding.DataBindingUtil
import com.chwl.app.R
import com.chwl.app.databinding.RoomPublicChatMessageWidgetBinding
import com.chwl.app.public_chat.core.ChatRoomClient
import com.chwl.app.public_chat.core.ChatRoomClientManager
import com.chwl.core.im.custom.bean.CustomAttachment
import com.chwl.core.im.custom.bean.HeadlineChangedAttachment
import com.chwl.core.initial.InitialModel
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.chwl.library.utils.SingleToastUtil
@@ -24,12 +16,7 @@ import com.netease.nimlib.sdk.msg.model.QueryDirectionEnum
class PublicChatRoomMessageWidget : FrameLayoutRoomWidget {
private val binding: RoomPublicChatMessageWidgetBinding =
DataBindingUtil.inflate(
LayoutInflater.from(
context
), R.layout.room_public_chat_message_widget, this, true
)
private val messageView: PublicChatMessageView = PublicChatMessageView(context)
private var chatRoomClient: ChatRoomClient? = null
@@ -48,36 +35,24 @@ class PublicChatRoomMessageWidget : FrameLayoutRoomWidget {
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes)
init {
addView(messageView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
}
override fun onStart(roomView: RoomView) {
super.onStart(roomView)
val sessionId = InitialModel.get().publicChatSessionId
if (sessionId != null) {
chatRoomClient = ChatRoomClientManager.getClient(sessionId);
} else {
chatRoomClient = ChatRoomClientManager.getPublicChatClient()
if (chatRoomClient == null) {
SingleToastUtil.showToast(R.string.public_chat_not_found)
}
chatRoomClient?.let {
initChatRoom(it)
}
requestCurrentHeadline()
}
private fun onReceiveMessage(message: ChatRoomMessage) {
if (!filterMessageForMessageList(message)) {
binding.messageView.addMessages(message)
}
if (message.msgType == MsgTypeEnum.custom) {
val attachment: CustomAttachment = (message.attachment as? CustomAttachment) ?: return
when (attachment.first) {
CustomAttachment.CUSTOM_MSG_HEADLINE_CHANGED -> {
when (attachment.second) {
CustomAttachment.CUSTOM_MSG_HEADLINE_CHANGED_SUB -> {
val data = (attachment as? HeadlineChangedAttachment) ?: return
updateHeadline(data.headlineData)
}
}
}
}
messageView.addMessages(message)
}
}
@@ -110,30 +85,13 @@ class PublicChatRoomMessageWidget : FrameLayoutRoomWidget {
QueryDirectionEnum.QUERY_OLD,
typeEnums
).subscribe({
binding.messageView.addHistoryMessages(it.reversed())
messageView.addHistoryMessages(it.reversed())
}, {
it.printStackTrace()
})
)
}
private fun requestCurrentHeadline() {
safeLaunch {
val data = PublicChatModel.getCurrentHeadline()
updateHeadline(data)
}
}
private fun updateHeadline(data: HeadlineBean?) {
val content = data?.content
if (data?.isValid() == true && !content.isNullOrEmpty()) {
binding.tvHeadlineContent.text = content
binding.tvHeadlineContent.isVisible = true
} else {
binding.tvHeadlineContent.isVisible = false
}
}
private fun filterMessageForMessageList(message: ChatRoomMessage): Boolean {
if (message.msgType == MsgTypeEnum.custom && message.attachment is HeadlineChangedAttachment) {
val data = (message.attachment as HeadlineChangedAttachment).headlineData
@@ -144,7 +102,7 @@ class PublicChatRoomMessageWidget : FrameLayoutRoomWidget {
return false
}
fun getMessageView() = binding.messageView
fun getMessageView() = messageView
override fun onStop() {
super.onStop()

View File

@@ -109,7 +109,7 @@ public class EditRoomTitleDialog extends AppCompatDialog {
tvTitle.setText(ResUtil.getString(R.string.avroom_widget_editroomtitledialog_03));
tvLimit.setVisibility(View.VISIBLE);
etContent.setHint(ResUtil.getString(R.string.avroom_widget_editroomtitledialog_04));
maxLength = 15;
maxLength = 25;
etContent.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
setLimtText();
} else if (dialogType == TYPE_EDIT_DESC) {

View File

@@ -84,7 +84,9 @@ public class PKBoardView extends RelativeLayout implements View.OnClickListener
private void init() {
inflate(getContext(), R.layout.layout_pk_board_view, this);
if (isInEditMode()) {
return;
}
llPkScoreBoard = findViewById(R.id.root_view);
rlRedTeamAddPeople = findViewById(R.id.fl_left);
tvRedTeamScore = this.findViewById(R.id.tv_red_team_score);

View File

@@ -59,6 +59,8 @@ public abstract class BaseFragment extends RxFragment implements KeyEvent.Callba
private boolean isLoaded = false;
public Consumer<Boolean> onHiddenChangedListener;
private DialogManager dialogManager;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -93,6 +95,10 @@ public abstract class BaseFragment extends RxFragment implements KeyEvent.Callba
mIsViewCreated = false;
isDestroyView = true;
isLoaded = false;
if (dialogManager != null) {
dialogManager.dismissDialog();
}
dialogManager = null;
super.onDestroyView();
}
@@ -582,8 +588,14 @@ public abstract class BaseFragment extends RxFragment implements KeyEvent.Callba
FragmentActivity activity = getActivity();
if (activity instanceof BaseMvpActivity) {
return ((BaseMvpActivity) activity).getDialogManager();
} else
return getBaseActivity().getDialogManager();
} else if (activity instanceof BaseActivity) {
return ((BaseActivity) activity).getDialogManager();
} else {
if (dialogManager == null) {
dialogManager = new DialogManager(activity);
}
return dialogManager;
}
}
public BaseActivity getBaseActivity() {

View File

@@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData
import com.chwl.app.base.BaseViewModel
import com.chwl.core.earn.bean.*
import com.chwl.core.earn.model.EarnModel
import com.chwl.core.pay.PayModel
import com.chwl.library.utils.TimeUtils
import java.util.*
@@ -145,6 +146,7 @@ class EarnRecordViewModel : BaseViewModel() {
block = {
_exchangeConfirmLiveData.value =
EarnModel.exchangeConfirm(goldNum, diamondNum, currency)
PayModel.get().refreshWalletInfo(true)
}
)
}

View File

@@ -43,10 +43,8 @@ class ConvertDiamondActivity : BaseViewBindingActivity<ActivityConvertDiamondBin
initTitleBar(getString(R.string.convert_diamond))
val bean = intent.getSerializableExtra(BEAN) as? GoldToDiamondInfo
bean?.let {
binding.tvMyGold.text = getString(R.string.my_gold, it.golds.toString())
binding.tvMyDiamond.text = getString(R.string.my_diamond, it.diamonds.toString())
binding.edGold.hint = it.minGolds.toString()
binding.edDiamond.hint = it.minDiamonds.toString()
binding.tvMyGold.text = getString(R.string.my_gold, it.golds?.toPlainString())
binding.tvMyDiamond.text = getString(R.string.my_diamond, it.diamonds?.toPlainString())
binding.edGold.setOnFocusChangeListener { view, b ->
isGold = b
}

View File

@@ -81,13 +81,13 @@ class MeViewModel : BaseViewModel() {
skipType = RouterType.DECORATION_STORE
)
)
add(
MeCenterInfo(
icon = R.drawable.me_ic_menu_revenue,
centerName = ResUtil.getString(R.string.me_gain_recording),
skipType = RouterType.MY_REVENUE
)
)
// add(
// MeCenterInfo(
// icon = R.drawable.me_ic_menu_revenue,
// centerName = ResUtil.getString(R.string.me_gain_recording),
// skipType = RouterType.MY_REVENUE
// )
// )
if (donationMenuVisible) {
add(donationMenu)
}

View File

@@ -33,6 +33,7 @@ import com.chwl.app.ui.pay.ChargeActivity
import com.chwl.app.ui.relation.AttentionListActivity
import com.chwl.app.ui.relation.FansListActivity
import com.chwl.app.ui.utils.ImageLoadUtils
import com.chwl.app.ui.wallet.WalletActivity
import com.chwl.app.ui.webview.CommonWebViewActivity
import com.chwl.app.view.GenderAgeTextView
import com.chwl.app.vip.VipMainActivity
@@ -289,12 +290,12 @@ class MeFragment : BaseFragment(), View.OnClickListener {
private fun updateHallInfo(clanAndHallInfo: ClanAndHallInfo?) {
if ((clanAndHallInfo?.clan?.elderUid ?: 0L) > 0) {
mBinding.ivGuild.setImageResource(R.drawable.me_bg_my_guild)
mBinding.tvGuild.setText(R.string.me_my_guild)
mBinding.ivGuild.singleClick {
ModuleClanActivity.start(context, clanAndHallInfo?.clan?.elderUid ?: 0L)
}
} else if ((clanAndHallInfo?.hall?.ownerUid ?: 0L) > 0) {
mBinding.ivGuild.setImageResource(R.drawable.me_bg_my_guild)
mBinding.tvGuild.setText(R.string.me_my_guild)
mBinding.ivGuild.singleClick {
ModuleHallActivity.start(
context,
@@ -303,7 +304,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
)
}
} else {
mBinding.ivGuild.setImageResource(R.drawable.me_bg_guild)
mBinding.tvGuild.setText(R.string.me_join_guild)
mBinding.ivGuild.singleClick {
//公會周榜
context?.let { it1 -> AssociationActivity.start(it1) }
@@ -313,12 +314,12 @@ class MeFragment : BaseFragment(), View.OnClickListener {
private fun updateHallInfo(familyInfo: H5FamilyInfo) {
if (familyInfo.familyId != null && familyInfo.familyId != 0L) {
mBinding.ivGuild.setImageResource(R.drawable.me_bg_my_guild)
mBinding.tvGuild.setText(R.string.me_my_guild)
mBinding.ivGuild.singleClick {
CommonWebViewActivity.start(context, familyInfo.getFullMyFamilyUrl())
}
} else {
mBinding.ivGuild.setImageResource(R.drawable.me_bg_guild)
mBinding.tvGuild.setText(R.string.me_join_guild)
mBinding.ivGuild.singleClick {
CommonWebViewActivity.start(context, familyInfo.getFullFamilyListUrl())
}
@@ -372,7 +373,7 @@ class MeFragment : BaseFragment(), View.OnClickListener {
map[IReportConstants.MODULE] = IReportConstants.MOLISTAR_PAY
ReportManager.get().reportEvent(IReportConstants.PAYPAGE_SHOW, map)
jumpChargePage()
WalletActivity.start(requireContext())
}
R.id.iv_vip -> {
@@ -392,11 +393,6 @@ class MeFragment : BaseFragment(), View.OnClickListener {
}
}
@SuppressLint("CheckResult")
private fun jumpChargePage() {
ChargeActivity.start(mContext)
}
private fun loadVipInfo(data: VipInfo?) {
}

View File

@@ -144,7 +144,7 @@ public class OpenRoomHelper {
roomInfo.roomPwd,
roomInfo.getRoomTypeLable(),
roomInfo.tagId,
AuthModel.get().getCurrentUid(),
roomInfo.getUid(),
AuthModel.get().getTicket(),
roomInfo.isHasAnimationEffect(),
roomInfo.getAudioQuality(),

View File

@@ -306,7 +306,7 @@ class StarFragment : BaseViewBindingFragment<StarFragmentBinding>(), MainTabCont
private fun showBalanceNotEnoughDialog() {
dialogManager.showOkCancelDialog(
ResUtil.getString(R.string.star_send_gift_balance),
ResUtil.getString(R.string.widget_dialog_dialoguihelper_04),
ResUtil.getString(R.string.treasure_to_charge)
) {
ChargeActivity.start(context)

View File

@@ -1,6 +1,7 @@
package com.chwl.app.support
import androidx.lifecycle.viewModelScope
import com.chwl.app.BuildConfig
import com.chwl.app.base.BaseViewModel
import com.chwl.core.helper.PathHelper
import com.chwl.core.home.model.HomeModel
@@ -27,6 +28,10 @@ class PreloadResourceViewModel : BaseViewModel(), DownloadListener, ILog {
private var isStarted = false
fun start() {
if (BuildConfig.DEBUG) {
// 太多请求了,影响查看控制台日志
return
}
if (isStarted) {
return
}

View File

@@ -77,7 +77,7 @@ public class GiftInfoVm extends BaseItem<GiftInfo> {
if (data.getConsumeType() == GiftInfo.CONSUME_TYPE_GOLD) {
radishDrawable = null;
radishDrawableSelected = null;
goldText.set(context.getResources().getString(R.string.how_much_gold, data.getGoldPrice()));
goldText.set(String.valueOf(data.getGoldPrice()));
} else if (data.getConsumeType() == GiftInfo.CONSUME_TYPE_FREE_GIFT) {
radishDrawable = null;
radishDrawableSelected = null;

View File

@@ -22,6 +22,7 @@ import java.net.SocketTimeoutException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import retrofit2.HttpException;
@@ -48,7 +49,8 @@ public class LogoutHelper {
BanAccountException exception = (BanAccountException) e;
String text = ResUtil.getString(R.string.login_helper_logouthelper_02) + exception.getMessage() + ResUtil.getString(R.string.login_helper_logouthelper_03);
int start = text.length();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ResUtil.getString(R.string.login_helper_logouthelper_04), Locale.getDefault());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ResUtil.getString(R.string.login_helper_logouthelper_04), Locale.ENGLISH);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+08"));
text += simpleDateFormat.format(new Date(exception.getDate()));
SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(activity, R.color.appColor)),
@@ -57,7 +59,8 @@ public class LogoutHelper {
spannableString, ResUtil.getString(R.string.login_helper_logouthelper_06), ResUtil.getString(R.string.login_helper_logouthelper_07), null);
} else if (e instanceof AccountCancelException) {
AccountCancelException exception = (AccountCancelException) e;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ResUtil.getString(R.string.login_helper_logouthelper_08), Locale.getDefault());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(ResUtil.getString(R.string.login_helper_logouthelper_08), Locale.ENGLISH);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT+08"));
String text = ResUtil.getString(R.string.login_helper_logouthelper_09) + simpleDateFormat.format(new Date(exception.getCancelDate()));
int end = text.length();

View File

@@ -52,6 +52,7 @@ import com.chwl.core.utils.net.IgnoreException;
import com.chwl.library.base.factory.CreatePresenter;
import com.chwl.library.utils.FormatUtils;
import com.chwl.library.utils.SingleToastUtil;
import com.netease.nim.uikit.common.util.C;
import org.greenrobot.eventbus.EventBus;
@@ -119,8 +120,8 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
SpannableString ss = new SpannableString(privacyAgreementDescTip);
int privacyAgreementTipIndex = privacyAgreementDescTip.indexOf(privacyAgreementTip);
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_8E9094)), privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_1E1E1F)) {
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_8E8E8E)), privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_AD89FF)) {
@Override
public void onClick(@NonNull View widget) {
if (widget instanceof TextView)
@@ -377,9 +378,9 @@ public class ChargeActivity extends BaseMvpActivity<IChargeView, ChargePresenter
public void initTitleBar() {
mTitleBar = findViewById(R.id.title_bar);
if (mTitleBar != null) {
mTitleBar.setTitle(getString(R.string.charge_my));
mTitleBar.setTitle(getString(R.string.label_my_radish));
mTitleBar.setImmersive(false);
mTitleBar.setTitleColor(getResources().getColor(R.color.color_1E1E1F));
mTitleBar.setTitleColor(getResources().getColor(R.color.color_000000));
mTitleBar.setLeftImageResource(R.drawable.arrow_left);
mTitleBar.setBackgroundResource(R.color.transparent);
mTitleBar.setLeftClickListener(v -> finish());

View File

@@ -1,5 +1,7 @@
package com.chwl.app.ui.pay;
import android.view.View;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chwl.app.R;
@@ -19,8 +21,8 @@ public class ChargeAdapter extends BaseQuickAdapter<ChargeBean, BaseViewHolder>
@Override
protected void convert(@NotNull BaseViewHolder baseViewHolder, ChargeBean chargeBean) {
if (chargeBean == null) return;
baseViewHolder.getView(R.id.ll_bg).setSelected(chargeBean.isSelected);
baseViewHolder.setText(R.id.tv_title, chargeBean.getProdName());
baseViewHolder.getView(R.id.iv_selected).setVisibility(chargeBean.isSelected ? View.VISIBLE : View.GONE);
baseViewHolder.setText(R.id.tv_currency_value, chargeBean.getProdName());
if (chargeBean.getProductDetails() != null && chargeBean.getProductDetails().getOneTimePurchaseOfferDetails() != null) {
baseViewHolder.setText(R.id.item_charge_money, chargeBean.getProductDetails().getOneTimePurchaseOfferDetails().getFormattedPrice());
} else {

View File

@@ -35,6 +35,7 @@ import com.chwl.app.ui.widget.dialog.CommonTipDialog
import com.chwl.app.utils.RegexUtil
import com.chwl.core.auth.AuthModel
import com.chwl.core.file.FileModel
import com.chwl.core.file.cos.CosException
import com.chwl.core.user.UserModel
import com.chwl.core.user.bean.UserInfo
import com.chwl.core.user.bean.UserPhoto
@@ -429,10 +430,12 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
}
}
REQUEST_CODE_OPEN_PHOTO_PROVIDER -> data?.let {
val photos = PhotoProviderNew.getResultPhotoList(it) ?: return
if (photos.isNotEmpty()) {
val photos = PhotoProviderNew.getResultPhotoList(it)
if (!photos.isNullOrEmpty()) {
val photo = photos[0]
crop(photo.uri, photo.size, mUri)
} else {
toast(R.string.empty_data)
}
}
UCrop.REQUEST_CROP -> mUri?.path?.let {
@@ -454,7 +457,7 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
.compose(bindToLifecycle())
.subscribe { url: String?, throwable: Throwable? ->
if (throwable != null) {
onUploadFail()
onUploadFail(throwable)
} else {
onUpload(url)
}
@@ -534,8 +537,8 @@ class UserInfoModifyActivity : BaseViewBindingActivity<ActivityUserInfoModifyBin
}
}
private fun onUploadFail() {
toast(ResUtil.getString(R.string.ui_user_userinfomodifyactivity_08))
private fun onUploadFail(throwable: Throwable) {
toast(ResUtil.getString(R.string.ui_user_userinfomodifyactivity_08) + ":${throwable.message}")
dialogManager.dismissDialog()
}

View File

@@ -85,6 +85,14 @@ fun ImageView.loadAvatar(url: String?) {
.into(this)
}
fun ImageView.loadImage(url: String? = "") {
if (context.isDestroyed()) return
GlideApp.with(context).load(url)
.dontAnimate()
.into(this)
}
fun Context.isDestroyed(): Boolean {
return (getActivityContext(this) as? Activity)?.isDestroyed == true
}

View File

@@ -114,6 +114,9 @@ public class ImageLoadUtils {
* 加载头像通用方法
*/
public static void loadAvatar(String avatar, ImageView imageView, int defaultRes, int customSize) {
if (avatar == null) {
avatar = "";
}
StringBuilder sb = new StringBuilder(avatar);
if (avatar.contains(ACCESS_URL)) {
if (!avatar.contains("?")) {

View File

@@ -0,0 +1,111 @@
package com.chwl.app.ui.wallet
import android.content.Context
import android.content.Intent
import android.widget.LinearLayout
import android.widget.TextView
import androidx.activity.viewModels
import androidx.fragment.app.Fragment
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
import com.chwl.app.R
import com.chwl.app.avroom.adapter.CommonVPAdapter
import com.chwl.app.base.BaseViewBindingActivity
import com.chwl.app.databinding.WalletActivityBinding
import com.chwl.app.ui.widget.magicindicator.buildins.commonnavigator.CommonNavigator
import com.chwl.library.utils.ResUtil
import com.netease.nim.uikit.StatusBarUtil
import org.greenrobot.eventbus.EventBus
class WalletActivity : BaseViewBindingActivity<WalletActivityBinding>() {
private val viewModel: WalletViewModel by viewModels()
companion object {
fun start(context: Context) {
context.startActivity(Intent(context, WalletActivity::class.java))
}
}
override fun init() {
EventBus.getDefault().register(this)
initWhiteTitleBar(ResUtil.getString(R.string.wallet))
initViewPager()
initObserve()
dialogManager.showProgressDialog(this)
viewModel.getWalletInfo()
}
private fun initObserve() {
viewModel.walletInfoLiveData.observe(this) {
dialogManager.dismissDialog()
if (!it.isSuccess && it.message != null) {
toast(it.message)
}
}
}
private fun initViewPager() {
val fragmentList: MutableList<Fragment> = ArrayList(2)
fragmentList.add(WalletCoinsFragment())
fragmentList.add(WalletDiamondFragment())
val tagList: MutableList<String> = ArrayList(2)
tagList.add(getString(R.string.diamond))
tagList.add(getString(R.string.gold))
val commonNavigator = CommonNavigator(context)
commonNavigator.setTitleWrapContent(true)
val magicIndicatorAdapter = WalletIndicatorAdapter(context, tagList)
magicIndicatorAdapter.setOnItemSelectListener { position: Int, view: TextView? ->
binding.viewPager.currentItem = position
}
commonNavigator.adapter = magicIndicatorAdapter
binding.magicIndicator.navigator = commonNavigator
commonNavigator.titleContainer.showDividers = LinearLayout.SHOW_DIVIDER_MIDDLE
binding.viewPager.offscreenPageLimit = 2
binding.viewPager.adapter = CommonVPAdapter(
supportFragmentManager,
lifecycle,
fragmentList
)
binding.viewPager.registerOnPageChangeCallback(object : OnPageChangeCallback() {
override fun onPageScrolled(
position: Int,
positionOffset: Float,
positionOffsetPixels: Int
) {
binding.magicIndicator.onPageScrolled(
position,
positionOffset,
positionOffsetPixels
)
}
override fun onPageSelected(position: Int) {
binding.magicIndicator.onPageSelected(position)
if (position == 0) {
binding.ivTop.setImageResource(R.drawable.wallet_bg_coins_top)
} else {
binding.ivTop.setImageResource(R.drawable.wallet_bg_diamond_top)
}
}
override fun onPageScrollStateChanged(state: Int) {
binding.magicIndicator.onPageScrollStateChanged(state)
}
})
}
override fun needSteepStateBar(): Boolean {
return true
}
override fun setStatusBar() {
super.setStatusBar()
StatusBarUtil.transparencyBar(this)
StatusBarUtil.StatusBarLightMode(this)
}
override fun onDestroy() {
super.onDestroy()
EventBus.getDefault().unregister(this)
}
}

View File

@@ -0,0 +1,35 @@
package com.chwl.app.ui.wallet
import androidx.fragment.app.activityViewModels
import com.chwl.app.R
import com.chwl.app.base.BaseBindingFragment
import com.chwl.app.databinding.WalletCoinsFragmentBinding
import com.chwl.app.ui.pay.ChargeActivity
import com.chwl.app.ui.webview.CommonWebViewActivity
import com.chwl.core.UriProvider
import com.chwl.library.annatation.ActLayoutRes
import com.chwl.library.utils.FormatUtils
import com.example.lib_utils.ktx.singleClick
@ActLayoutRes(R.layout.wallet_coins_fragment)
class WalletCoinsFragment : BaseBindingFragment<WalletCoinsFragmentBinding>() {
val viewModel: WalletViewModel by activityViewModels()
override fun initiate() {
mBinding.layoutDetails.singleClick {
CommonWebViewActivity.start(context, UriProvider.getDiamondDetail())
}
mBinding.tvNext.singleClick {
ChargeActivity.start(requireContext())
}
viewModel.walletInfoLiveData.observe(this) {
if (it.isSuccess) {
updateValue(it.data?.diamondNum ?: 0.0)
}
}
}
private fun updateValue(number: Double) {
mBinding.tvCurrencyValue.text = FormatUtils.formatBigInteger(number)
}
}

View File

@@ -0,0 +1,63 @@
package com.chwl.app.ui.wallet
import androidx.fragment.app.activityViewModels
import com.chwl.app.R
import com.chwl.app.base.BaseBindingFragment
import com.chwl.app.databinding.WalletDiamondFragmentBinding
import com.chwl.app.earn.activity.ConvertDiamondActivity
import com.chwl.app.ui.webview.CommonWebViewActivity
import com.chwl.core.UriProvider
import com.chwl.library.annatation.ActLayoutRes
import com.chwl.library.utils.FormatUtils
import com.example.lib_utils.ktx.singleClick
@ActLayoutRes(R.layout.wallet_diamond_fragment)
class WalletDiamondFragment : BaseBindingFragment<WalletDiamondFragmentBinding>() {
val viewModel: WalletViewModel by activityViewModels()
private var wantToConvert = false
override fun initiate() {
mBinding.layoutDetails.singleClick {
CommonWebViewActivity.start(context, UriProvider.getGoldDetail())
}
mBinding.tvNext.singleClick {
jumpConvert()
}
viewModel.walletInfoLiveData.observe(this) {
if (it.isSuccess) {
updateValue(it.data?.goldNum ?: 0.0)
}
}
viewModel.convertInfoLiveData.observe(this) {
if (it.isSuccess) {
if (wantToConvert) {
it?.data?.let {
ConvertDiamondActivity.start(requireContext(), it)
}
}
} else if (it.message != null) {
toast(it.message)
}
wantToConvert = false
}
}
private fun jumpConvert() {
val result = viewModel.convertInfoLiveData.value
val data = result?.data
if (result != null && result.isSuccess && data != null) {
ConvertDiamondActivity.start(requireContext(), data)
} else {
wantToConvert = true
viewModel.getConvertInfo()
}
}
private fun updateValue(number: Double) {
mBinding.tvCurrencyValue.text = FormatUtils.formatBigDecimal(number)
}
}

View File

@@ -0,0 +1,105 @@
package com.chwl.app.ui.wallet;
import android.content.Context;
import android.view.Gravity;
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 WalletIndicatorAdapter extends CommonNavigatorAdapter {
private final Context mContext;
private final List<? extends CharSequence> mTitleList;
private int textSize = 16;
private float minScale = 1f;
private boolean showIndicator = true;
private OnItemSelectListener mOnItemSelectListener;
public WalletIndicatorAdapter(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_7E8373));
scaleTransitionPagerTitleView.setSelectedColor(ContextCompat.getColor(context, R.color.color_4E390A));
scaleTransitionPagerTitleView.setMinScale(minScale);
scaleTransitionPagerTitleView.setTextSize(textSize);
int padding = UIUtil.dip2px(context, 37);
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(UIUtil.dip2px(mContext, 1.5));
indicator.setRoundRadius(UIUtil.dip2px(mContext, 1));
indicator.setLineWidth(UIUtil.dip2px(mContext, 11));
indicator.setColors(context.getResources().getColor(R.color.color_AA7400));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
// lp.bottomMargin = mBottomMargin;
lp.gravity = Gravity.BOTTOM;
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

@@ -0,0 +1,75 @@
package com.chwl.app.ui.wallet
import androidx.lifecycle.MutableLiveData
import com.chwl.app.base.BaseViewModel
import com.chwl.core.bean.response.BeanResult
import com.chwl.core.earn.bean.GoldToDiamondInfo
import com.chwl.core.earn.model.EarnModel
import com.chwl.core.pay.PayModel
import com.chwl.core.pay.bean.WalletInfo
import com.chwl.core.pay.event.GetWalletInfoEvent
import com.chwl.core.pay.event.UpdateWalletInfoEvent
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
class WalletViewModel : BaseViewModel() {
val walletInfoLiveData = MutableLiveData<BeanResult<WalletInfo>>()
val convertInfoLiveData = MutableLiveData<BeanResult<GoldToDiamondInfo>>()
init {
EventBus.getDefault().register(this)
}
fun getWalletInfo() {
addDisposable(
PayModel.get().walletInfo
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer<WalletInfo> { walletInfo: WalletInfo? ->
walletInfoLiveData.postValue(BeanResult.success(walletInfo))
}) {
walletInfoLiveData.postValue(BeanResult.failed(it))
}
)
}
fun getConvertInfo() {
safeLaunch(
true,
onError = {
convertInfoLiveData.value = BeanResult.failed(it)
},
block = {
val data = EarnModel.getGoldToDiamond()
convertInfoLiveData.value = BeanResult.success(data)
}
)
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onWalletInfoUpdate(event: UpdateWalletInfoEvent?) {
loadLocalWalletInfo()
}
@Subscribe(threadMode = ThreadMode.MAIN)
fun onGetWalletInfoEvent(event: GetWalletInfoEvent?) {
loadLocalWalletInfo()
}
private fun loadLocalWalletInfo() {
val info = PayModel.get().currentWalletInfo
if (info != null) {
walletInfoLiveData.value = BeanResult.success(info)
}
}
override fun onCleared() {
super.onCleared()
EventBus.getDefault().unregister(this)
}
}

View File

@@ -142,6 +142,9 @@ public class MainRedPointTab extends RelativeLayout {
case MainTabType.TAB_TYPE_STAR:
resId = select ? R.drawable.ic_main_tab_star_pressed : R.drawable.ic_main_tab_star;
break;
case MainTabType.TAB_TYPE_GAME:
resId = select ? R.drawable.ic_main_tab_game_pressed : R.drawable.ic_main_tab_game;
break;
case MainTabType.TAB_TYPE_MSG:
resId = select ? R.drawable.ic_main_tab_msg_pressed : R.drawable.ic_main_tab_msg;
break;

View File

@@ -26,6 +26,7 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
private final List<MainRedPointTab> tabViewList = new ArrayList<>(4);
private MainRedPointTab homeTab;
private MainRedPointTab starTab;
private MainRedPointTab gameTab;
private MainRedPointTab msgTab;
private MainRedPointTab meTab;
private int mLastPosition = -1;
@@ -57,15 +58,18 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
msgTab = findViewById(R.id.main_msg_tab);
starTab = findViewById(R.id.main_star_tab);
gameTab = findViewById(R.id.main_game_tab);
homeTab = findViewById(R.id.main_home_tab);
meTab = findViewById(R.id.main_me_tab);
homeTab.setOnClickListener(this);
meTab.setOnClickListener(this);
starTab.setOnClickListener(this);
gameTab.setOnClickListener(this);
msgTab.setOnClickListener(this);
tabViewList.add(starTab);
tabViewList.add(gameTab);
tabViewList.add(homeTab);
tabViewList.add(msgTab);
tabViewList.add(meTab);
@@ -105,6 +109,9 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
case R.id.main_star_tab:
select(MainTabType.TAB_TYPE_STAR);
break;
case R.id.main_game_tab:
select(MainTabType.TAB_TYPE_GAME);
break;
case R.id.main_msg_tab:
select(MainTabType.TAB_TYPE_MSG);
break;
@@ -115,10 +122,11 @@ public class MainTabLayout extends LinearLayout implements View.OnClickListener
}
private void select(int tabType) {
if (tabType == 0) tabType = MainTabType.TAB_TYPE_HOME;
if (tabType == 0) tabType = MainTabType.TAB_TYPE_STAR;
if (mLastPosition == tabType) return;
msgTab.select(tabType == MainTabType.TAB_TYPE_MSG);
starTab.select(tabType == MainTabType.TAB_TYPE_STAR);
gameTab.select(tabType == MainTabType.TAB_TYPE_GAME);
homeTab.select(tabType == MainTabType.TAB_TYPE_HOME);
meTab.select(tabType == MainTabType.TAB_TYPE_ME);
if (mOnTabClickListener != null) {

View File

@@ -7,6 +7,8 @@ import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.example.lib_utils.UiUtils;
/**
* User: wukai
* Date: 2017/03/26
@@ -18,6 +20,7 @@ public class GridSpacingItemNewDecoration extends RecyclerView.ItemDecoration {
private int mHorSpacing;
private boolean mIncludeEdge;
private boolean mHasHeaderView;
private Boolean isRTL;
public GridSpacingItemNewDecoration(int spacing, boolean includeEdge) {
this(spacing, spacing, includeEdge);
@@ -59,6 +62,9 @@ public class GridSpacingItemNewDecoration extends RecyclerView.ItemDecoration {
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
if (isRTL == null) {
isRTL = UiUtils.INSTANCE.isRtl(parent.getContext());
}
int spanCount = getSpanCount(parent);
int position = parent.getChildAdapterPosition(view); // item position
int spanIndex = getSpanIndex(view, parent);
@@ -83,6 +89,11 @@ public class GridSpacingItemNewDecoration extends RecyclerView.ItemDecoration {
outRect.top = mVerSpacing; // item top
}
}
if (isRTL) {
int right = outRect.right;
outRect.right = outRect.left;
outRect.left = right;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/base_shape_f7f7f7_b_1e1e1f_w1dp_8dp" android:state_selected="true" />
<item android:drawable="@drawable/base_shape_f7f7f7_8dp" android:state_selected="false" />
</selector>

View File

@@ -1,13 +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="#DCE6FD"
android:startColor="#D8E3FE"
android:type="linear"
android:useLevel="true" />
<corners android:radius="@dimen/dp_8" />
</shape>

View File

@@ -1,13 +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="#FEECD2"
android:startColor="#FFDE90"
android:type="linear"
android:useLevel="true" />
<corners android:radius="@dimen/dp_8" />
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F3F0E6" />
<corners android:radius="@dimen/dp_9" />
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="@dimen/dp_1"
android:color="#FFB05E" />
<corners android:radius="@dimen/dp_9" />
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FFF09C" />
<corners
android:bottomLeftRadius="@dimen/dp_9"
android:bottomRightRadius="@dimen/dp_9"
android:topLeftRadius="0px"
android:topRightRadius="0px" />
</shape>

View File

@@ -6,122 +6,95 @@
android:layout_height="match_parent"
android:background="@color/color_F7F7F7">
<View
<ImageView
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/bg_theme_top"
app:layout_constraintDimensionRatio="375:178"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/wallet_bg_coins_top"
app:layout_constraintTop_toTopOf="parent" />
<com.chwl.app.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_44"
android:layout_marginTop="@dimen/dp_30"
app:layout_constraintTop_toTopOf="parent"
tools:layout_height="50dp" />
<View
android:id="@+id/iv_translate_bg"
<com.chwl.app.view.AutoMirroredImageView
android:id="@+id/iv_balance_bg"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12"
android:background="@drawable/charge_bg_balance"
app:layout_constraintDimensionRatio="343:92"
android:layout_marginHorizontal="@dimen/dp_18"
android:layout_marginTop="@dimen/dp_25"
android:src="@drawable/charge_bg_balance"
app:layout_constraintDimensionRatio="339:115"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_bar" />
<ImageView
android:id="@+id/iv_diamond"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_marginEnd="@dimen/dp_4"
android:src="@drawable/ic_charge_diamond"
app:layout_constraintBottom_toBottomOf="@+id/tv_title_diamond"
app:layout_constraintEnd_toStartOf="@+id/tv_title_diamond"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_title_diamond" />
<TextView
android:id="@+id/tv_title_diamond"
android:id="@+id/tv_balance_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_33"
android:gravity="center"
android:text="@string/charge_my_diamond"
android:textColor="@color/color_FFFFFF"
android:textSize="@dimen/text_size_14"
android:textColor="#9F4805"
android:textSize="@dimen/dp_15"
app:layout_constraintBottom_toTopOf="@id/tv_gold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_diamond"
app:layout_constraintTop_toTopOf="@+id/iv_translate_bg"
app:layout_constraintStart_toStartOf="@id/iv_balance_bg"
app:layout_constraintTop_toTopOf="@+id/iv_balance_bg"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/tv_gold"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:layout_marginTop="@dimen/dp_6"
android:fontFamily="sans-serif-medium"
android:includeFontPadding="false"
android:maxLines="1"
android:text="0.0"
android:textColor="@color/color_FFFFFF"
android:textSize="@dimen/dp_28"
app:layout_constraintBottom_toBottomOf="@id/iv_translate_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_title_diamond"
android:textColor="#FFFBD5"
android:textSize="@dimen/dp_24"
app:autoSizeMaxTextSize="@dimen/dp_24"
app:autoSizeMinTextSize="@dimen/dp_10"
app:autoSizeStepGranularity="1px"
app:autoSizeTextType="uniform"
app:layout_constraintBottom_toBottomOf="@id/iv_balance_bg"
app:layout_constraintEnd_toEndOf="@id/iv_balance_bg"
app:layout_constraintStart_toStartOf="@id/tv_balance_title"
app:layout_constraintTop_toBottomOf="@+id/tv_balance_title"
tools:text="1960.00" />
<View
android:id="@+id/v_bg"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/base_shape_ffffff_top_16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/iv_translate_bg" />
<TextView
android:id="@+id/tv_buy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_24"
android:layout_marginTop="@dimen/dp_24"
android:text="@string/buy"
android:textColor="@color/color_333333"
android:textSize="@dimen/dp_16"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/v_bg" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="@dimen/dp_19"
android:layout_marginTop="@dimen/dp_4"
android:layout_marginHorizontal="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginBottom="@dimen/dp_4"
android:orientation="vertical"
android:visibility="visible"
tools:listitem="@layout/list_item_charge"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toTopOf="@id/tv_charge"
app:layout_constraintTop_toBottomOf="@id/tv_buy"
app:spanCount="2" />
app:layout_constraintTop_toBottomOf="@id/iv_balance_bg"
app:spanCount="3" />
<TextView
android:id="@+id/tv_charge"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_48"
android:layout_marginHorizontal="@dimen/dp_36"
android:layout_marginTop="@dimen/dp_28"
android:layout_marginBottom="@dimen/dp_40"
android:background="@drawable/base_shape_theme_26dp"
android:background="@drawable/base_shape_theme_24dp"
android:gravity="center"
android:text="@string/charge_confirm_charge"
android:textColor="@color/color_1E1E1F"
android:textSize="@dimen/sp_16"
android:textColor="@color/white"
android:textSize="@dimen/dp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@id/tv_protocol" />

View File

@@ -4,180 +4,148 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F3F5FA"
android:background="#F4F5FA"
tools:context=".earn.activity.ConvertDiamondActivity">
<ImageView
android:id="@+id/iv_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/wallet_bg_diamond_top"
app:layout_constraintTop_toTopOf="parent" />
<com.chwl.app.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_30"
android:background="@color/color_white"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/csConvertDetail"
android:layout_width="0dp"
<TextView
android:id="@+id/tvMyGold"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_15"
android:background="@drawable/bg_ffffff_14"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title_bar">
android:layout_marginHorizontal="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_30"
android:includeFontPadding="false"
android:text="@string/my_gold"
android:textColor="#00223D"
android:textSize="@dimen/dp_15"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/title_bar" />
<TextView
android:id="@+id/tvMyGold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_15"
android:includeFontPadding="false"
android:text="@string/my_gold"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_16"
android:textStyle="bold"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/csMyGold"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/convert_bg_diamond"
app:layout_constraintDimensionRatio="345:48"
app:layout_constraintTop_toBottomOf="@+id/tvMyGold">
<ImageView
android:id="@+id/iv_diamond"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_9"
android:src="@drawable/convert_ic_diamond"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHeight_percent="0.58"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/csMyGold"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_marginStart="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_14"
android:background="@drawable/bg_gradient_dce6fd_d8e3fe_r8"
app:layout_constraintTop_toBottomOf="@+id/tvMyGold">
<EditText
android:id="@+id/edGold"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_8"
android:layout_marginEnd="@dimen/dp_8"
android:background="@null"
android:digits="1234567890"
android:focusable="true"
android:gravity="center_vertical|end"
android:hint="@string/please_enter"
android:inputType="number"
android:textColor="@color/white"
android:textColorHint="#99FFFFFF"
android:textSize="@dimen/dp_15"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv_diamond" />
<View
android:id="@+id/viewGold"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="@dimen/dp_10"
android:background="@drawable/bg_ffffff_r360"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_gold"
app:layout_constraintBottom_toBottomOf="@+id/viewGold"
app:layout_constraintEnd_toEndOf="@+id/viewGold"
app:layout_constraintStart_toStartOf="@+id/viewGold"
app:layout_constraintTop_toTopOf="@+id/viewGold" />
<TextView
android:id="@+id/tvMyDiamond"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_28"
android:includeFontPadding="false"
android:text="@string/my_diamond"
android:textColor="#00223D"
android:textSize="@dimen/dp_15"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/csMyGold" />
<EditText
android:id="@+id/edGold"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/dp_12"
android:background="@null"
android:digits="1234567890"
android:focusable="true"
android:gravity="center_vertical|end"
android:hint="1000"
android:inputType="number"
android:textColor="@color/color_1F1A4E"
android:textColorHint="@color/color_ACB8D9"
android:textSize="@dimen/sp_16"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/viewGold" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tvMyDiamond"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_25"
android:includeFontPadding="false"
android:text="@string/my_diamond"
android:textColor="@color/color_1F1A4E"
android:textSize="@dimen/sp_16"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/csMyGold" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/csMyDiamond"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginHorizontal="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/convert_bg_coins"
app:layout_constraintDimensionRatio="345:48"
app:layout_constraintTop_toBottomOf="@id/tvMyDiamond">
<ImageView
android:src="@drawable/ic_diamond_arrow_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_38"
android:id="@+id/iv_coins"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_9"
android:src="@drawable/convert_ic_coins"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintHeight_percent="0.58"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/edDiamond"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_8"
android:layout_marginEnd="@dimen/dp_8"
android:background="@null"
android:digits="1234567890"
android:focusable="true"
android:gravity="center_vertical|end"
android:hint="@string/please_enter"
android:inputType="number"
android:maxLength="18"
android:textColor="@color/white"
android:textColorHint="#99FFFFFF"
android:textSize="@dimen/dp_15"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/csMyGold"
app:layout_constraintBottom_toTopOf="@+id/csMyDiamond"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/csMyDiamond"
android:layout_width="match_parent"
android:layout_height="52dp"
android:layout_marginStart="@dimen/dp_14"
android:layout_marginTop="@dimen/dp_12"
android:layout_marginEnd="@dimen/dp_14"
android:layout_marginBottom="@dimen/dp_22"
android:background="@drawable/bg_gradient_feecd2_ffde90_r8"
app:layout_constraintTop_toBottomOf="@+id/tvMyDiamond"
app:layout_constraintBottom_toBottomOf="parent">
<View
android:id="@+id/viewDiamond"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginStart="@dimen/dp_10"
android:background="@drawable/bg_ffffff_r360"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_diamond"
app:layout_constraintBottom_toBottomOf="@+id/viewDiamond"
app:layout_constraintEnd_toEndOf="@+id/viewDiamond"
app:layout_constraintStart_toStartOf="@+id/viewDiamond"
app:layout_constraintTop_toTopOf="@+id/viewDiamond" />
<EditText
android:id="@+id/edDiamond"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginEnd="@dimen/dp_12"
android:background="@null"
android:digits="1234567890"
android:focusable="true"
android:gravity="center_vertical|end"
android:hint="1000"
android:inputType="number"
android:textColor="@color/color_1F1A4E"
android:textColorHint="@color/color_CBB788"
android:textSize="@dimen/sp_16"
android:maxLength="18"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/viewDiamond" />
</androidx.constraintlayout.widget.ConstraintLayout>
app:layout_constraintStart_toEndOf="@+id/iv_coins" />
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/tvConvert"
android:text="@string/confirm_exchange"
android:textSize="16sp"
android:textColor="@color/base_selector_color_theme_btn"
android:layout_width="match_parent"
android:layout_height="46dp"
android:gravity="center"
android:layout_marginStart="@dimen/dp_15"
android:layout_marginEnd="@dimen/dp_15"
android:layout_marginTop="@dimen/dp_50"
android:layout_height="@dimen/dp_48"
android:layout_marginHorizontal="@dimen/dp_36"
android:layout_marginTop="@dimen/dp_33"
android:background="@drawable/base_selector_theme_30dp"
android:enabled="false"
app:layout_constraintTop_toBottomOf="@+id/csConvertDetail"/>
android:gravity="center"
android:text="@string/confirm_exchange"
android:textColor="@color/base_selector_color_theme_btn"
android:textSize="@dimen/dp_16"
app:layout_constraintTop_toBottomOf="@id/csMyDiamond" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<merge
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.chwl.app.base.TitleBar
android:id="@+id/title_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/common_toolbar_height" />
<com.chwl.app.ui.widget.magicindicator.MagicIndicator
android:id="@+id/magic_indicator2"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="@dimen/common_toolbar_height"
android:background="@color/white" />
<androidx.viewpager.widget.ViewPager
android:id="@+id/vPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="88dp"
android:flipInterval="30"
android:background="@color/color_F5F5F5"
android:persistentDrawingCache="animation" />
</merge>
</layout>

View File

@@ -22,6 +22,7 @@
android:layout_marginStart="19dp"
android:layout_marginEnd="19dp"
android:layout_height="40dp"
android:gravity="start|center_vertical"
android:layout_centerHorizontal="true"
android:background="@drawable/shape_f5f5f5_corner"
android:textColorHint="@color/color_999999"

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