1:羽声新版本
45
.run/app.run.xml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="app" type="AndroidRunConfigurationType" factoryName="Android App" activateToolWindowBeforeRun="false">
|
||||||
|
<module name="羽声.app" />
|
||||||
|
<option name="ANDROID_RUN_CONFIGURATION_SCHEMA_VERSION" value="1" />
|
||||||
|
<option name="DEPLOY" value="true" />
|
||||||
|
<option name="DEPLOY_APK_FROM_BUNDLE" value="true" />
|
||||||
|
<option name="DEPLOY_AS_INSTANT" value="false" />
|
||||||
|
<option name="ARTIFACT_NAME" value="" />
|
||||||
|
<option name="PM_INSTALL_OPTIONS" value="" />
|
||||||
|
<option name="ALL_USERS" value="false" />
|
||||||
|
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
|
||||||
|
<option name="ALLOW_ASSUME_VERIFIED" value="false" />
|
||||||
|
<option name="CLEAR_APP_STORAGE" value="false" />
|
||||||
|
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
|
||||||
|
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
|
||||||
|
<option name="MODE" value="default_activity" />
|
||||||
|
<option name="RESTORE_ENABLED" value="false" />
|
||||||
|
<option name="RESTORE_FILE" value="" />
|
||||||
|
<option name="RESTORE_FRESH_INSTALL_ONLY" value="true" />
|
||||||
|
<option name="CLEAR_LOGCAT" value="true" />
|
||||||
|
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
|
||||||
|
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
|
||||||
|
<option name="DEBUGGER_TYPE" value="Java" />
|
||||||
|
<Java>
|
||||||
|
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
|
||||||
|
<option name="DEBUG_SANDBOX_SDK" value="false" />
|
||||||
|
</Java>
|
||||||
|
<Profilers>
|
||||||
|
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
|
||||||
|
<option name="STARTUP_PROFILING_ENABLED" value="false" />
|
||||||
|
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
|
||||||
|
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
|
||||||
|
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
|
||||||
|
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
|
||||||
|
</Profilers>
|
||||||
|
<option name="DEEP_LINK" value="" />
|
||||||
|
<option name="ACTIVITY" value="" />
|
||||||
|
<option name="ACTIVITY_CLASS" value="" />
|
||||||
|
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
|
||||||
|
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
BIN
app/my-release-key.jks
Normal file
37
app/releas/release/output-metadata.json
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"artifactType": {
|
||||||
|
"type": "APK",
|
||||||
|
"kind": "Directory"
|
||||||
|
},
|
||||||
|
"applicationId": "com.qxcm.qxlive",
|
||||||
|
"variantName": "releasRelease",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"type": "SINGLE",
|
||||||
|
"filters": [],
|
||||||
|
"attributes": [],
|
||||||
|
"versionCode": 1,
|
||||||
|
"versionName": "1.0.0.0",
|
||||||
|
"outputFile": "羽声_1.0.0.0_1.apk"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"elementType": "File",
|
||||||
|
"baselineProfiles": [
|
||||||
|
{
|
||||||
|
"minApi": 28,
|
||||||
|
"maxApi": 30,
|
||||||
|
"baselineProfiles": [
|
||||||
|
"baselineProfiles/1/羽声_1.0.0.0_1.dm"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"minApi": 31,
|
||||||
|
"maxApi": 2147483647,
|
||||||
|
"baselineProfiles": [
|
||||||
|
"baselineProfiles/0/羽声_1.0.0.0_1.dm"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"minSdkVersionForDexing": 24
|
||||||
|
}
|
||||||
103
app/src/main/java/com/qxcm/qxlive/AppContext.java
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
package com.qxcm.qxlive;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by cxf on 2017/8/3.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AppContext extends CommonAppContext {
|
||||||
|
|
||||||
|
private boolean mBeautyInited;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
ToastUtils.init(this);
|
||||||
|
ARouter.init(this);
|
||||||
|
|
||||||
|
/* mqttClient = MyMQTTClient.getInstance(this);
|
||||||
|
mqttClient.initialize("tcp://81.70.45.221:1883");
|
||||||
|
new Thread(() -> {
|
||||||
|
boolean connected = mqttClient.connect();
|
||||||
|
runOnUiThread(() -> {
|
||||||
|
if (connected) {
|
||||||
|
} else {
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("MQTT连接失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}).start();*/
|
||||||
|
|
||||||
|
// ToastUtils.setInterceptor(new IToastInterceptor() {
|
||||||
|
// @Override
|
||||||
|
// public boolean intercept(CharSequence charSequence) {
|
||||||
|
// return !CommonAppContext.getInstance().isFront();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// L.setDeBug(BuildConfig.DEBUG);
|
||||||
|
}
|
||||||
|
public static void initSdk() {
|
||||||
|
// CommonAppContext context = CommonAppContext.getInstance();
|
||||||
|
|
||||||
|
// if (BuildConfig.DEBUG) {
|
||||||
|
// L.e("应用签名:" + context.getAppSignature());
|
||||||
|
// //L.e("facebook散列秘钥------>" + context.getFacebookHashKey());
|
||||||
|
// }
|
||||||
|
// //腾讯云直播鉴权url
|
||||||
|
// String liveLicenceUrl = "https://license.vod2.myqcloud.com/license/v2/1346816652_1/v_cube.license";
|
||||||
|
// //腾讯云直播鉴权key
|
||||||
|
// String liveKey = "c30f209835056ba00f738a014ca4448a";
|
||||||
|
// //腾讯云视频鉴权url
|
||||||
|
// String ugcLicenceUrl = "https://license.vod2.myqcloud.com/license/v2/1346816652_1/v_cube.license";
|
||||||
|
// //腾讯云视频鉴权key
|
||||||
|
// String ugcKey = "c30f209835056ba00f738a014ca4448a";
|
||||||
|
// TXLiveBase.getInstance().setDebug(BuildConfig.DEBUG);
|
||||||
|
// TXLiveBase.getInstance().setLicence(context, liveLicenceUrl, liveKey, ugcLicenceUrl, ugcKey);
|
||||||
|
// //初始化腾讯bugly
|
||||||
|
// CrashReport.initCrashReport(context);
|
||||||
|
// CrashReport.setAppVersion(context, CommonAppConfig.getInstance().getVersion());
|
||||||
|
// //初始化ShareSdk
|
||||||
|
// MobSDK.init(context);
|
||||||
|
// MobSDK.submitPolicyGrantResult(true);
|
||||||
|
// //初始化IM
|
||||||
|
// ImMessageUtil.getInstance().init();
|
||||||
|
// //初始化腾讯TPNS 移动推送
|
||||||
|
// TpnsUtil.register(BuildConfig.DEBUG);
|
||||||
|
// //初始化友盟统计
|
||||||
|
// UmengUtil.init(context, BuildConfig.DEBUG);
|
||||||
|
// //OpenInstall
|
||||||
|
// OpenInstall.init(context);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化美狐
|
||||||
|
*/
|
||||||
|
public void initBeautySdk(String beautyAppId, String beautyKey) {
|
||||||
|
// if (!TextUtils.isEmpty(beautyAppId) && !TextUtils.isEmpty(beautyKey)) {
|
||||||
|
// if (!mBeautyInited) {
|
||||||
|
// mBeautyInited = true;
|
||||||
|
// if (CommonAppConfig.isYunBaoApp()) {
|
||||||
|
// beautyAppId = DecryptUtil.decrypt(beautyAppId);
|
||||||
|
// beautyKey = DecryptUtil.decrypt(beautyKey);
|
||||||
|
// }
|
||||||
|
// MHSDK.init(this, beautyAppId, beautyKey);
|
||||||
|
// CommonAppConfig.getInstance().setMhBeautyEnable(true);
|
||||||
|
// L.e("美狐初始化----AppId--->" + beautyAppId + "---AppKey--->" + beautyKey);
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// CommonAppConfig.getInstance().setMhBeautyEnable(false);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startInitSdk() {
|
||||||
|
initSdk();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
20
app/src/main/java/com/qxcm/qxlive/LaunchContacter.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xscm.midi;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
import com.xscm.moduleutil.activity.IPresenter;
|
||||||
|
import com.xscm.moduleutil.activity.IView;
|
||||||
|
|
||||||
|
public final class LaunchContacter {
|
||||||
|
|
||||||
|
public interface View extends IView<Activity> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ILoginPre extends IPresenter {
|
||||||
|
|
||||||
|
void oauthLogin(String login_token);
|
||||||
|
|
||||||
|
void address_ip(String address_ip);
|
||||||
|
}
|
||||||
|
}
|
||||||
191
app/src/main/java/com/qxcm/qxlive/LaunchPageActivity.java
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
package com.qxcm.qxlive;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.PersistableBundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
|
import com.qxcm.qxlive.databinding.ActivityLaunchPageBinding;
|
||||||
|
import com.xscm.modulelogin.activity.ImproveInfoActivity;
|
||||||
|
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
|
||||||
|
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||||
|
import com.xscm.moduleutil.base.AppStateListener;
|
||||||
|
import com.xscm.moduleutil.base.AppStateManager;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.dialog.PolicyDialog;
|
||||||
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
|
/**
|
||||||
|
APP准备启动
|
||||||
|
*
|
||||||
|
* _oo0oo_
|
||||||
|
* o8888888o
|
||||||
|
* 88" . "88
|
||||||
|
* (| -_- |)
|
||||||
|
* 0\ = /0
|
||||||
|
* ___/`---'\___
|
||||||
|
* .' \\| |// '.
|
||||||
|
* / \\||| : |||// \
|
||||||
|
* / _||||| -卍-|||||- \
|
||||||
|
* | | \\\ - /// | |
|
||||||
|
* | \_| ''\---/'' |_/ |
|
||||||
|
* \ .-\__ '-' ___/-. /
|
||||||
|
* ___'. .' /--.--\ `. .'___
|
||||||
|
* ."" '< `.___\_<|>_/___.' >' "".
|
||||||
|
* | | : `- \`.;`\ _ /`;.`/ - ` : | |
|
||||||
|
* \ \ `_. \_ __\ /__ _/ .-` / /
|
||||||
|
*=====`-.____`.___ \_____/___.-`___.-'=====
|
||||||
|
* `=---='
|
||||||
|
*
|
||||||
|
* 佛祖保佑 永无BUG
|
||||||
|
* 佛曰:
|
||||||
|
* 写字楼里写字间,写字间里程序员;
|
||||||
|
* 程序人员写程序,又拿程序换酒钱。
|
||||||
|
* 酒醒只在网上坐,酒醉还来网下眠;
|
||||||
|
* 酒醉酒醒日复日,网上网下年复年。
|
||||||
|
* 但愿老死电脑间,不愿鞠躬老板前;
|
||||||
|
* 奔驰宝马贵者趣,公交自行程序员。
|
||||||
|
* 别人笑我忒疯癫,我笑自己命太贱;
|
||||||
|
* 不见满街漂亮妹,哪个归得程序员?
|
||||||
|
*/
|
||||||
|
public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPageBinding> {
|
||||||
|
private Handler handler;
|
||||||
|
private PolicyDialog policyDialog;
|
||||||
|
private AppStateListener appStateListener;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
|
||||||
|
super.onCreate(savedInstanceState, persistentState);
|
||||||
|
|
||||||
|
// 获取Application实例并设置监听器
|
||||||
|
CommonAppContext app = (CommonAppContext) getApplication();
|
||||||
|
appStateListener = AppStateManager.getInstance();
|
||||||
|
app.setAppStateListener(appStateListener);
|
||||||
|
|
||||||
|
if (!isTaskRoot()) {
|
||||||
|
|
||||||
|
if (SpUtil.getUnderagePassword() != null && !SpUtil.getUnderagePassword().isEmpty()) {
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
|
||||||
|
// .withString("type", "1").navigation();//type==1:青少年模式
|
||||||
|
|
||||||
|
Intent intent = new Intent(this, WebViewActivity.class);
|
||||||
|
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken());
|
||||||
|
intent.putExtra("title", "1");
|
||||||
|
startActivity(intent);
|
||||||
|
} else {
|
||||||
|
// 如果没有设置青少年模式,应该导航到首页
|
||||||
|
try {
|
||||||
|
ARouter.getInstance().build(ARouteConstants.ME).navigation();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("LaunchPageActivity", "导航到首页失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// if (shouldRestoreRoom()) {
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean shouldRestoreRoom() {
|
||||||
|
// 检查是否应该恢复房间:
|
||||||
|
// 1. 应用有正在播放的房间
|
||||||
|
// 2. 应用应该显示房间
|
||||||
|
// 3. 应用是从后台恢复的(通过检查 CommonAppContext 状态)
|
||||||
|
return CommonAppContext.getInstance().isPlaying
|
||||||
|
&& CommonAppContext.getInstance().isShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
handler = new Handler();
|
||||||
|
// 定义一个Runnable
|
||||||
|
Runnable runnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
initLogin();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (SpUtil.isAgreePolicy()) {
|
||||||
|
initLogin();
|
||||||
|
// //延迟1.5秒执行
|
||||||
|
// handler.postDelayed(runnable, 2500);
|
||||||
|
} else {
|
||||||
|
policyDialog = new PolicyDialog(this);
|
||||||
|
policyDialog.setCancelable(false);
|
||||||
|
policyDialog.setCanceledOnTouchOutside(false);
|
||||||
|
policyDialog.setPolicyClickListener(new PolicyDialog.PolicyClickListener() {
|
||||||
|
@Override
|
||||||
|
public void policyAgree() {
|
||||||
|
SpUtil.completeAgreePolicy();
|
||||||
|
// CommonAppContext.getInstance().initialization();
|
||||||
|
initLogin();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void policyExit() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
policyDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
// 如果 PolicyDialog 仍在显示,则 dismiss 它
|
||||||
|
if (policyDialog != null && policyDialog.isShowing()) {
|
||||||
|
policyDialog.dismiss();
|
||||||
|
policyDialog = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 移除所有待处理的回调以防止内存泄漏
|
||||||
|
if (handler != null) {
|
||||||
|
handler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initLogin() {
|
||||||
|
// 在启动新 Activity 前先关闭对话框
|
||||||
|
if (policyDialog != null && policyDialog.isShowing()) {
|
||||||
|
policyDialog.dismiss();
|
||||||
|
policyDialog = null;
|
||||||
|
}
|
||||||
|
startActivity(new Intent(this, PasswordLoginActivity.class));
|
||||||
|
finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.activity_launch_page;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (!isTaskRoot()) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
99
app/src/main/java/com/qxcm/qxlive/LaunchPresenter.java
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
package com.xscm.midi;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
|
import com.xscm.modulelogin.activity.ImproveInfoActivity;
|
||||||
|
import com.xscm.modulelogin.activity.SwitchAccountsActivity;
|
||||||
|
import com.xscm.modulemain.activity.MainActivity;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.bean.UserBean;
|
||||||
|
import com.xscm.moduleutil.http.BaseObserver;
|
||||||
|
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
|
public class LaunchPresenter extends BasePresenter<LaunchContacter.View> implements LaunchContacter.ILoginPre {
|
||||||
|
|
||||||
|
public LaunchPresenter(LaunchContacter.View view, Context context) {
|
||||||
|
super(view, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void oauthLogin(String login_token) {
|
||||||
|
api.oauthLogin(login_token, new BaseObserver<List<UserBean>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
addDisposable(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(List<UserBean> userBeans) {
|
||||||
|
loginSuccess(userBeans);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void address_ip(String address_ip) {
|
||||||
|
api.address_ip(address_ip, new BaseObserver<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
// addDisposable(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(String s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loginSuccess(List<UserBean> userBean) {
|
||||||
|
if (userBean==null) {
|
||||||
|
ToastUtils.showShort("登录失败请重试");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (userBean.size()==1) {
|
||||||
|
|
||||||
|
CommonAppContext.getInstance().setUser(userBean.get(0));
|
||||||
|
|
||||||
|
// PreferencesUtils.putString( CommonAppContext.getInstance(), "mobile", userBean.get());
|
||||||
|
|
||||||
|
if (isViewAttach()) {
|
||||||
|
// MvpRef.get().disLoadings();
|
||||||
|
}
|
||||||
|
if (userBean.get(0).getSex() == 0) {
|
||||||
|
try {
|
||||||
|
Intent intent = new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), ImproveInfoActivity.class);
|
||||||
|
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("userBean", userBean.get(0));
|
||||||
|
intent.putExtras(bundle);
|
||||||
|
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
com.blankj.utilcode.util.ActivityUtils.startActivity(MainActivity.class);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
Intent intent=new Intent(com.blankj.utilcode.util.ActivityUtils.getTopActivity(), SwitchAccountsActivity.class);
|
||||||
|
Bundle bundle=new Bundle();
|
||||||
|
bundle.putSerializable("userBean", userBean.get(0));
|
||||||
|
intent.putExtras(bundle);
|
||||||
|
com.blankj.utilcode.util.ActivityUtils.startActivity(intent);
|
||||||
|
|
||||||
|
}
|
||||||
|
EventBus.getDefault().post(userBean);
|
||||||
|
// EventBus.getDefault().post(new SplashFinishEvent());
|
||||||
|
// AppLog.setUserUniqueID(userBean.getUser_id()); // 设置您自己的账号体系ID, 并保证其唯一性 !
|
||||||
|
}
|
||||||
|
}
|
||||||
662
app/src/main/java/com/qxcm/qxlive/PasswordLoginActivity.java
Normal file
@@ -0,0 +1,662 @@
|
|||||||
|
package com.qxcm.qxlive;
|
||||||
|
|
||||||
|
import static android.view.View.VISIBLE;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.CountDownTimer;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextWatcher;
|
||||||
|
import android.text.method.PasswordTransformationMethod;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alipay.sdk.app.AuthTask;
|
||||||
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
|
import com.blankj.utilcode.util.ThreadUtils;
|
||||||
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import com.mobile.auth.gatewayauth.AuthUIConfig;
|
||||||
|
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
|
||||||
|
import com.mobile.auth.gatewayauth.PreLoginResultListener;
|
||||||
|
import com.mobile.auth.gatewayauth.TokenResultListener;
|
||||||
|
import com.mobile.auth.gatewayauth.model.TokenRet;
|
||||||
|
import com.qxcm.qxlive.databinding.ActivityPasswordLoginBinding;
|
||||||
|
import com.xscm.modulelogin.activity.ImproveInfoActivity;
|
||||||
|
import com.xscm.modulelogin.even.LoginFinishEvent;
|
||||||
|
import com.xscm.modulelogin.present.LoginContacter;
|
||||||
|
import com.xscm.modulelogin.present.LoginPresenter;
|
||||||
|
import com.xscm.modulemain.activity.MainActivity;
|
||||||
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.bean.ThemeBean;
|
||||||
|
import com.xscm.moduleutil.bean.UserBean;
|
||||||
|
import com.xscm.moduleutil.utils.BarUtils;
|
||||||
|
import com.xscm.moduleutil.utils.PreferencesUtils;
|
||||||
|
import com.xscm.moduleutil.utils.logger.Logger;
|
||||||
|
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||||
|
import com.tencent.mm.opensdk.modelmsg.SendAuth;
|
||||||
|
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||||
|
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, ActivityPasswordLoginBinding> implements LoginContacter.View, View.OnClickListener {
|
||||||
|
|
||||||
|
private CountDownTimer mTimer;
|
||||||
|
public String mobile;
|
||||||
|
private int type;//1:验证码登录2:密码登录
|
||||||
|
boolean isPasswordVisible = false;
|
||||||
|
public PhoneNumberAuthHelper phoneNumberAuthHelper;
|
||||||
|
private TokenResultListener tokenResultListener;
|
||||||
|
private boolean canOnePass;
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.activity_password_login;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
// 检查是否已经创建过该Activity
|
||||||
|
if (!isTaskRoot()) {
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent != null) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
// 如果是从Launcher启动的,并且Activity已经存在,则finish当前实例
|
||||||
|
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 新增版本检查逻辑
|
||||||
|
checkAppVersion();
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
// EventBus.getDefault().register(this);
|
||||||
|
// AppLogUtil.reportAppLog(AppLogEvent.A0101);
|
||||||
|
}
|
||||||
|
private void checkAppVersion() {
|
||||||
|
// 获取当前版本号
|
||||||
|
int currentVersionCode = 0;
|
||||||
|
try {
|
||||||
|
currentVersionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从SharedPreferences中获取上次运行的版本号
|
||||||
|
int lastVersionCode = PreferencesUtils.getInt(CommonAppContext.getInstance(), "last_version_code", 0);
|
||||||
|
|
||||||
|
// 如果版本号不同,说明应用已更新
|
||||||
|
if (currentVersionCode != lastVersionCode) {
|
||||||
|
// 保存当前版本号
|
||||||
|
PreferencesUtils.putInt(CommonAppContext.getInstance(), "last_version_code", currentVersionCode);
|
||||||
|
|
||||||
|
// 如果不是首次安装,则需要清理任务栈
|
||||||
|
if (lastVersionCode != 0) {
|
||||||
|
clearTaskAndRestart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearTaskAndRestart() {
|
||||||
|
// 清理所有Activity并重启应用
|
||||||
|
Intent intent = new Intent(this, PasswordLoginActivity.class);
|
||||||
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
if (phoneNumberAuthHelper!=null) {
|
||||||
|
phoneNumberAuthHelper.hideLoginLoading();
|
||||||
|
//获取成功 dimiss就去登录、登录成功
|
||||||
|
phoneNumberAuthHelper.quitLoginPage();
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void finishEvent(LoginFinishEvent event) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
super.initView();
|
||||||
|
MvpPre.getThemeData();
|
||||||
|
initQuickLogin();
|
||||||
|
checkOnePass();
|
||||||
|
|
||||||
|
BarUtils.setStatusBarAlpha(this, 0);
|
||||||
|
mBinding.edPhone.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
setUpLoginBtn();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBinding.edPhone.setOnFocusChangeListener(new View.
|
||||||
|
OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
if (mBinding.edPhone == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (hasFocus) {
|
||||||
|
mBinding.relPhone.setSelected(true);
|
||||||
|
} else {
|
||||||
|
// 此处为失去焦点时的处理内容
|
||||||
|
mBinding.relPhone.setSelected(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBinding.edPhone.setText(PreferencesUtils.getString(CommonAppContext.getInstance(), "mobile"));
|
||||||
|
if (!TextUtils.isEmpty(mobile)) {
|
||||||
|
mBinding.edPhone.setText(mobile);
|
||||||
|
}
|
||||||
|
mBinding.tvCodeText.setOnClickListener(this::onClick);
|
||||||
|
mBinding.flLogin.setOnClickListener(this::onClick);
|
||||||
|
mBinding.tvYhxy.setOnClickListener(this::onClick);
|
||||||
|
mBinding.tvYsxy.setOnClickListener(this::onClick);
|
||||||
|
mBinding.ivZfb.setOnClickListener(this::onClick);
|
||||||
|
mBinding.ivWeixin.setOnClickListener(this::onClick);
|
||||||
|
mBinding.tvSendCode.setOnClickListener(this::onClick);
|
||||||
|
mBinding.ivEye.setOnClickListener(this::onClick);
|
||||||
|
|
||||||
|
if (mBinding.tvCodeText.getText().equals("切换密码登录")){
|
||||||
|
type=1;
|
||||||
|
}else {
|
||||||
|
type=2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initQuickLogin() {
|
||||||
|
tokenResultListener = new TokenResultListener() {
|
||||||
|
@Override
|
||||||
|
public void onTokenSuccess(String s) {
|
||||||
|
Logger.e("onTokenSuccess", s);
|
||||||
|
ThreadUtils.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
TokenRet tokenRet = null;
|
||||||
|
try {
|
||||||
|
tokenRet = JSON.parseObject(s, TokenRet.class);
|
||||||
|
if (tokenRet != null && ("600000").equals(tokenRet.getCode())) {
|
||||||
|
|
||||||
|
LogUtils.e("@@@",tokenRet.getToken());
|
||||||
|
MvpPre.oauthLoginLogin(tokenRet.getToken());
|
||||||
|
// phoneNumberAuthHelper.hideLoginLoading();
|
||||||
|
// //获取成功 dimiss就去登录、登录成功
|
||||||
|
// phoneNumberAuthHelper.quitLoginPage();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTokenFailed(String s) {
|
||||||
|
Logger.e("onTokenFailed", s);
|
||||||
|
ThreadUtils.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
phoneNumberAuthHelper.hideLoginLoading();
|
||||||
|
phoneNumberAuthHelper.quitLoginPage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
phoneNumberAuthHelper = PhoneNumberAuthHelper.getInstance(getApplicationContext(), null);
|
||||||
|
phoneNumberAuthHelper.getReporter().setLoggerEnable(true);
|
||||||
|
// phoneNumberAuthHelper.setAuthSDKInfo("6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=");
|
||||||
|
phoneNumberAuthHelper.setAuthSDKInfo(((CommonAppContext) getApplication()).getCurrentEnvironment().getALI_AUTH_KEY());
|
||||||
|
phoneNumberAuthHelper.checkEnvAvailable(2);
|
||||||
|
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
Logger.e("initAuthSDK", ignored);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private void checkOnePass() {
|
||||||
|
if (!TextUtils.isEmpty(CommonAppContext.getInstance().getToken()) && !TextUtils.isEmpty(CommonAppContext.getInstance().getUser().getTencent_im())) {
|
||||||
|
isRoot();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
showLoadings();
|
||||||
|
if (phoneNumberAuthHelper != null) {
|
||||||
|
phoneNumberAuthHelper.accelerateLoginPage(3 * 1000, new PreLoginResultListener() {
|
||||||
|
@Override
|
||||||
|
public void onTokenSuccess(String s) {
|
||||||
|
Logger.e("onTokenSuccess", s);
|
||||||
|
canOnePass = true;
|
||||||
|
isRoot();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTokenFailed(String s, String s1) {
|
||||||
|
Logger.e("onTokenFailed", "错误信息" + s, s1);
|
||||||
|
isRoot();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
canOnePass = false;
|
||||||
|
isRoot();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void isRoot() {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
disLoadings();
|
||||||
|
if (!PasswordLoginActivity.this.isTaskRoot()) {
|
||||||
|
Intent intent = getIntent();
|
||||||
|
if (intent != null) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
goNextActivity();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
goNextActivity();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
goNextActivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void goNextActivity() {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||||
|
if (isFinishing() || isDestroyed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(CommonAppContext.getInstance().getToken()) || TextUtils.isEmpty(CommonAppContext.getInstance().getUser().getTencent_im())) {
|
||||||
|
Logger.e("SplashEnd", "ARouters.CODE_LOGIN");
|
||||||
|
if (canOnePass) {
|
||||||
|
phoneNumberAuthHelper.setAuthListener(tokenResultListener);
|
||||||
|
doOnePass();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Logger.e("SplashEnd", "ARouters.MAIN");
|
||||||
|
|
||||||
|
UserBean userBean = CommonAppContext.getInstance().getUser();
|
||||||
|
|
||||||
|
// TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), "u"+userBean.getUser_id(), userBean.getTencent_im(), new TUICallback() {
|
||||||
|
// @Override
|
||||||
|
// public void onError(final int code, final String desc) {
|
||||||
|
// LogUtils.e("@@@",code,"描述:",desc);
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess() {
|
||||||
|
// LogUtils.e("@@@","成功");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
if (userBean.getSex() == 0) {
|
||||||
|
Intent intent = new Intent(this, ImproveInfoActivity.class);
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putSerializable("userBean", userBean);
|
||||||
|
intent.putExtras(bundle);
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
EventBus.getDefault().post(userBean);
|
||||||
|
startActivity(new Intent(this, MainActivity.class));
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
// finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doOnePass() {
|
||||||
|
AuthUIConfig authUIConfig = new AuthUIConfig.Builder()
|
||||||
|
//导航栏
|
||||||
|
.setNavColor(Color.TRANSPARENT)
|
||||||
|
.setNavReturnHidden(true)
|
||||||
|
.setNavHidden(true)
|
||||||
|
.setNavText("")
|
||||||
|
.setNavTextColor(Color.BLACK)
|
||||||
|
.setWebNavColor(Color.TRANSPARENT)
|
||||||
|
.setWebNavTextColor(Color.BLACK)
|
||||||
|
.setWebNavReturnImgPath("ic_topbar_back_dark")
|
||||||
|
//状态栏区
|
||||||
|
.setStatusBarColor(Color.TRANSPARENT)
|
||||||
|
.setLightColor(false)
|
||||||
|
.setWebViewStatusBarColor(Color.TRANSPARENT)
|
||||||
|
.setStatusBarUIFlag(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
|
||||||
|
//logo区
|
||||||
|
.setLogoImgPath("login_log")
|
||||||
|
.setLogoWidth(142)
|
||||||
|
.setLogoHeight(142)
|
||||||
|
.setLogoOffsetY(54)
|
||||||
|
.setLogoHidden(false)
|
||||||
|
.setLogoScaleType(ImageView.ScaleType.FIT_XY)
|
||||||
|
//Slogan
|
||||||
|
.setSloganText("本机号码")
|
||||||
|
.setSloganTextColor(Color.parseColor("#A8A8A8"))
|
||||||
|
.setSloganTextSize(12)
|
||||||
|
.setSloganOffsetY(236)
|
||||||
|
//掩码栏
|
||||||
|
.setNumberColor(Color.BLACK)
|
||||||
|
.setNumberSize(30)
|
||||||
|
.setNumFieldOffsetY(263)
|
||||||
|
.setNumberLayoutGravity(Gravity.CENTER_HORIZONTAL)
|
||||||
|
//登录按钮
|
||||||
|
.setLogBtnText("一键登录")
|
||||||
|
.setLogBtnWidth(300)
|
||||||
|
.setLogBtnHeight(42)
|
||||||
|
.setLogBtnOffsetY(325)
|
||||||
|
.setLogBtnTextSize(14)
|
||||||
|
.setLogBtnTextColor(getResources().getColor(R.color.white))
|
||||||
|
// .setLogBtnBackgroundPath("theme_bg")
|
||||||
|
.setLogBtnBackgroundDrawable(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.login_btn_bg))
|
||||||
|
//切换到其他方式
|
||||||
|
.setSwitchAccText("其他登录方式")
|
||||||
|
.setSwitchAccTextColor(Color.parseColor("#333333"))
|
||||||
|
.setSwitchAccTextSize(12)
|
||||||
|
.setSwitchOffsetY(390)
|
||||||
|
//协议栏
|
||||||
|
.setAppPrivacyOne("《用户协议》", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6")
|
||||||
|
.setAppPrivacyTwo("《隐私协议》", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4")
|
||||||
|
.setAppPrivacyColor(Color.parseColor("#000000"), Color.parseColor("#22BB79"))
|
||||||
|
.setPrivacyBefore("登录即代表同意")
|
||||||
|
.setPrivacyEnd("并授权获得号码")
|
||||||
|
.setPrivacyTextSize(11)
|
||||||
|
.setPrivacyAlertContentVerticalMargin(20)
|
||||||
|
.setPrivacyMargin(39)
|
||||||
|
.setPrivacyState(true)
|
||||||
|
.setCheckboxHidden(false)
|
||||||
|
.setCheckedImgPath("ic_agreement_selected")
|
||||||
|
.setUncheckedImgPath("ic_agreement_unselect")
|
||||||
|
.setPrivacyOffsetX(2)
|
||||||
|
.setVendorPrivacyPrefix("《")
|
||||||
|
.setVendorPrivacySuffix("》")
|
||||||
|
.setProtocolAction("com.qxcm.qxlive.PROTOCOL_WEBVIEW")//跳转到自定义的页面展示隐私协议
|
||||||
|
.setPackageName("com.qxcm.qxlive")
|
||||||
|
//全页面属性
|
||||||
|
.setAuthPageActIn("in_activity", "out_activity")
|
||||||
|
.setAuthPageActOut("in_activity", "out_activity")
|
||||||
|
// .setPageBackgroundPath("log_bj")
|
||||||
|
.setPageBackgroundDrawable(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.log_bj))
|
||||||
|
.create();
|
||||||
|
phoneNumberAuthHelper.setAuthUIConfig(authUIConfig);
|
||||||
|
phoneNumberAuthHelper.getLoginToken(getApplicationContext(), 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected LoginPresenter bindPresenter() {
|
||||||
|
return new LoginPresenter(this, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showLoadings() {
|
||||||
|
showLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disLoadings() {
|
||||||
|
disLoading();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUpLoginBtn() {
|
||||||
|
String text = mBinding.edPhone.getText().toString();
|
||||||
|
if (text.length() == 11) {
|
||||||
|
mBinding.flLogin.setEnabled(true);
|
||||||
|
mBinding.ivLoginBg.setAlpha(1f);
|
||||||
|
} else {
|
||||||
|
mBinding.ivLoginBg.setAlpha(0.3f);
|
||||||
|
mBinding.flLogin.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int id = v.getId();
|
||||||
|
if (id == R.id.tv_code_text) {
|
||||||
|
// Intent intent = new Intent(this, LoginActivity.class);
|
||||||
|
// intent.putExtra("mobile", mBinding.edPhone.getText().toString());
|
||||||
|
// startActivity(intent);
|
||||||
|
// finish();
|
||||||
|
|
||||||
|
if (mBinding.tvCodeText.getText().equals("切换密码登录")){
|
||||||
|
mBinding.rlPassCode.setVisibility(VISIBLE);
|
||||||
|
mBinding.rlCode.setVisibility(View.GONE);
|
||||||
|
mBinding.tvCodeText.setText("切换验证码登录");
|
||||||
|
mBinding.tvLoginText.setText("密码登录");
|
||||||
|
type=2;
|
||||||
|
}else {
|
||||||
|
mBinding.rlPassCode.setVisibility(View.GONE);
|
||||||
|
mBinding.rlCode.setVisibility(VISIBLE);
|
||||||
|
mBinding.tvCodeText.setText("切换密码登录");
|
||||||
|
mBinding.tvLoginText.setText("验证码登录");
|
||||||
|
type=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (id == R.id.fl_login) {
|
||||||
|
if (!mBinding.cbPrivacy.isChecked()) {
|
||||||
|
ToastUtils.show("请先勾选服务条款");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String phone = mBinding.edPhone.getText().toString().trim();
|
||||||
|
if (TextUtils.isEmpty(phone)) {
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (type==1) {
|
||||||
|
String code = mBinding.edPassword.getText().toString().trim();
|
||||||
|
if (TextUtils.isEmpty(code)) {
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("请输入验证码");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MvpPre.login(phone, "", code, 1);
|
||||||
|
}else if (type==2) {
|
||||||
|
String password = mBinding.edPasswordCode.getText().toString().trim();
|
||||||
|
if (TextUtils.isEmpty(password)) {
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("请输入密码");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MvpPre.login(phone, password, "", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (id == R.id.tv_yhxy) {
|
||||||
|
MvpPre.ysxl();
|
||||||
|
} else if (id == R.id.tv_ysxy) {
|
||||||
|
MvpPre.yhxy();
|
||||||
|
} else if (id == R.id.iv_zfb) {
|
||||||
|
if (!mBinding.cbPrivacy.isChecked()) {
|
||||||
|
ToastUtils.show("请先勾选服务条款");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MvpPre.authorization("zfb");
|
||||||
|
// MvpPre.authorization(SHARE_MEDIA.QQ);
|
||||||
|
} else if (id == R.id.iv_weixin) {
|
||||||
|
if (!mBinding.cbPrivacy.isChecked()) {
|
||||||
|
ToastUtils.show("请先勾选服务条款");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// MvpPre.authorization("wx");
|
||||||
|
wcLogin();
|
||||||
|
} else if (id == R.id.tv_send_code) {
|
||||||
|
String phone = mBinding.edPhone.getText().toString().trim();
|
||||||
|
if (TextUtils.isEmpty(phone)) {
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sendCodeSuccess(phone);
|
||||||
|
MvpPre.sendCode(phone, 1);
|
||||||
|
}else if (id == R.id.iv_eye) {
|
||||||
|
|
||||||
|
if (!isPasswordVisible) {
|
||||||
|
mBinding.edPassword.setInputType(android.text.InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
|
||||||
|
mBinding.ivEye.setImageResource(com.xscm.moduleutil.R.mipmap.eye_visible); // 设置按钮文本为隐藏密码
|
||||||
|
} else {
|
||||||
|
mBinding.edPassword.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||||
|
mBinding.edPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||||
|
mBinding.ivEye.setImageResource(com.xscm.moduleutil.R.mipmap.eye_close); // 设置按钮文本为显示密码
|
||||||
|
}
|
||||||
|
mBinding.edPassword.setSelection(mBinding.edPassword.getText().length()); // 将光标移动到文字末尾
|
||||||
|
isPasswordVisible = !isPasswordVisible; // 切换状态
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void wcLogin() {
|
||||||
|
//发起登陆请求前先注册微信api
|
||||||
|
IWXAPI api = WXAPIFactory.createWXAPI(this,CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(),true);
|
||||||
|
api.registerApp(CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId());
|
||||||
|
if (!api.isWXAppInstalled()){
|
||||||
|
//todo 提醒未安装微信
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("请安装微信客户端");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//开始发起登陆请求
|
||||||
|
final SendAuth.Req req = new SendAuth.Req();
|
||||||
|
req.scope = "snsapi_userinfo";
|
||||||
|
req.state = "wechat_sdk_demo_test";
|
||||||
|
api.sendReq(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void loginEvent(BaseResp event) {
|
||||||
|
if (event.errCode ==BaseResp.ErrCode.ERR_OK){
|
||||||
|
SendAuth.Resp authResp = (SendAuth.Resp)event;
|
||||||
|
LogUtils.e("@@@",authResp.code);
|
||||||
|
MvpPre.oauthLogin(authResp.code,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void releaseTimer() {
|
||||||
|
if (mTimer != null) {
|
||||||
|
mTimer.cancel();
|
||||||
|
mTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendCodeSuccess(String phoneNumber) {
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("短信验证码发送成功请注意查收");
|
||||||
|
mBinding.tvSendCode.setEnabled(false);
|
||||||
|
mBinding.tvSendCode.setAlpha(0.5f);
|
||||||
|
releaseTimer();
|
||||||
|
if (mTimer != null) {
|
||||||
|
mTimer.cancel();
|
||||||
|
}
|
||||||
|
mTimer = new CountDownTimer(60000L, 1000L) {
|
||||||
|
@Override
|
||||||
|
public void onTick(long millisUntilFinished) {
|
||||||
|
if (mBinding.tvSendCode != null) {
|
||||||
|
mBinding.tvSendCode.setText(String.format("重新发送(%s)", millisUntilFinished / 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinish() {
|
||||||
|
mBinding.tvSendCode.setAlpha(1f);
|
||||||
|
mBinding.tvSendCode.setEnabled(true);
|
||||||
|
mBinding.tvSendCode.setText("重新发送");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mTimer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendCodeSuccess1(String s) {
|
||||||
|
LogUtils.e(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loginSuccess(UserBean userBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void authorizationSuccess(String s) {
|
||||||
|
zfbLogin(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ysxlSuccess(String s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getThemeData(ThemeBean themeBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void zfbLogin(String s) {
|
||||||
|
LogUtils.e("@@@",s);
|
||||||
|
CommonAppContext.getInstance();
|
||||||
|
if (!CommonAppContext.isAlipayInstalled(this)){
|
||||||
|
com.blankj.utilcode.util.ToastUtils.showShort("请安装支付宝客户端");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String authInfo = s;
|
||||||
|
// String authInfo = "apiname=com.alipay.account.auth&app_id=2021005152631691&app_name=yusheng&auth_type=AUTHACCOUNT&biz_type=openservice&method=alipay.open.auth.sdk.code.get&pid=2088170624624316&product_id=APP_FAST_LOGIN&scope=kuaijie&sign_type=RSA2&target_id=20141225xxxx&sign=fMcp4GtiM6rxSIeFnJCVePJKV43eXrUP86CQgiLhDHH2u%2FdN75eEvmywc2ulkm7qKRetkU9fbVZtJIqFdMJcJ9Yp%2BJI%2FF%2FpESafFR6rB2fRjiQQLGXvxmDGVMjPSxHxVtIqpZy5FDoKUSjQ2%2FILDKpu3%2F%2BtAtm2jRw1rUoMhgt0%3D";
|
||||||
|
Runnable authRunnable = new Runnable() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// 构造AuthTask 对象
|
||||||
|
AuthTask authTask = new AuthTask(PasswordLoginActivity.this);
|
||||||
|
// 调用授权接口,获取授权结果
|
||||||
|
Map<String, String> result = authTask.authV2(authInfo, true);
|
||||||
|
LogUtils.e(result);
|
||||||
|
if (result.get("resultStatus").equals("9000")){
|
||||||
|
Pattern pattern = Pattern.compile("auth_code=([^&]*)");
|
||||||
|
Matcher matcher = pattern.matcher(result.get("result"));
|
||||||
|
|
||||||
|
if (matcher.find()) {
|
||||||
|
String authCode = matcher.group(1);
|
||||||
|
LogUtils.e("AuthCode", authCode);
|
||||||
|
MvpPre.oauthLogin(authCode,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Thread authThread = new Thread(authRunnable);
|
||||||
|
authThread.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
110
app/src/main/java/com/qxcm/qxlive/presenter/BasePresenter.java
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
package com.xscm.midi.presenter;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xscm.moduleutil.activity.IPresenter;
|
||||||
|
import com.xscm.moduleutil.activity.IView;
|
||||||
|
|
||||||
|
import java.lang.ref.Reference;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
|
public abstract class BasePresenter<V extends IView> implements IPresenter {
|
||||||
|
protected CompositeDisposable mDisposables = new CompositeDisposable();
|
||||||
|
// private RemoteDataSource api;
|
||||||
|
protected Reference<V> MvpRef;
|
||||||
|
protected Context mContext;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public BasePresenter(V view) {
|
||||||
|
attachView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BasePresenter(V view, Context context) {
|
||||||
|
attachView(view);
|
||||||
|
mContext = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void attachView(V view) {
|
||||||
|
MvpRef = new WeakReference<V>(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected V getView() {
|
||||||
|
if (MvpRef != null) {
|
||||||
|
return MvpRef.get();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// protected RemoteDataSource getApi() {
|
||||||
|
// if (api == null) {
|
||||||
|
// api = RemoteDataSource.getInstance();
|
||||||
|
// }
|
||||||
|
// return api;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主要用于判断IView的生命周期是否结束,防止出现内存泄露状况
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isViewAttach() {
|
||||||
|
return MvpRef != null && MvpRef.get() != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void detachView() {
|
||||||
|
cancelRequest();
|
||||||
|
if (MvpRef != null) {
|
||||||
|
MvpRef.clear();
|
||||||
|
MvpRef = null;
|
||||||
|
}
|
||||||
|
// if (api != null) {
|
||||||
|
// api = null;
|
||||||
|
// }
|
||||||
|
unBindView();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void unBindView() {
|
||||||
|
if (MvpRef != null) {
|
||||||
|
MvpRef.clear();
|
||||||
|
}
|
||||||
|
mContext=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加入订阅对象
|
||||||
|
*
|
||||||
|
* @param disposable
|
||||||
|
*/
|
||||||
|
public void addDisposable(Disposable disposable) {
|
||||||
|
mDisposables.add(disposable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除订阅对象
|
||||||
|
*
|
||||||
|
* @param disposable
|
||||||
|
*/
|
||||||
|
public void removeDisposable(Disposable disposable) {
|
||||||
|
mDisposables.remove(disposable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消所有请求
|
||||||
|
*/
|
||||||
|
public void cancelRequest() {
|
||||||
|
if (mDisposables != null) {
|
||||||
|
mDisposables.clear(); // clear时网络请求会随即cancel
|
||||||
|
mDisposables = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
233
app/src/main/java/com/qxcm/qxlive/wxapi/WXEntryActivity.java
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
package com.xscm.midi.wxapi;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||||
|
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||||
|
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||||
|
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
|
||||||
|
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
|
||||||
|
// private static String TAG = "MicroMsg.WXEntryActivity";
|
||||||
|
//
|
||||||
|
// private IWXAPI api;
|
||||||
|
// private MyHandler handler;
|
||||||
|
//
|
||||||
|
// private static class MyHandler extends Handler {
|
||||||
|
// private final WeakReference<WXEntryActivity> wxEntryActivityWeakReference;
|
||||||
|
//
|
||||||
|
// public MyHandler(WXEntryActivity wxEntryActivity){
|
||||||
|
// wxEntryActivityWeakReference = new WeakReference<WXEntryActivity>(wxEntryActivity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void handleMessage(Message msg) {
|
||||||
|
// int tag = msg.what;
|
||||||
|
// switch (tag) {
|
||||||
|
// case 0: {
|
||||||
|
// Bundle data = msg.getData();
|
||||||
|
// JSONObject json = null;
|
||||||
|
// try {
|
||||||
|
// json = new JSONObject(data.getString("result"));
|
||||||
|
// String openId, accessToken, refreshToken, scope;
|
||||||
|
// openId = json.getString("openid");
|
||||||
|
// accessToken = json.getString("access_token");
|
||||||
|
// refreshToken = json.getString("refresh_token");
|
||||||
|
// scope = json.getString("scope");
|
||||||
|
//// Intent intent = new Intent(wxEntryActivityWeakReference.get(), SendToWXActivity.class);
|
||||||
|
//// intent.putExtra("openId", openId);
|
||||||
|
//// intent.putExtra("accessToken", accessToken);
|
||||||
|
//// intent.putExtra("refreshToken", refreshToken);
|
||||||
|
//// intent.putExtra("scope", scope);
|
||||||
|
//// wxEntryActivityWeakReference.get().startActivity(intent);
|
||||||
|
// } catch (JSONException e) {
|
||||||
|
// Log.e(TAG, e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onCreate(Bundle savedInstanceState) {
|
||||||
|
// super.onCreate(savedInstanceState);
|
||||||
|
//
|
||||||
|
// api = WXAPIFactory.createWXAPI(this, CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(), false);
|
||||||
|
// handler = new MyHandler(this);
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// Intent intent = getIntent();
|
||||||
|
// api.handleIntent(intent, this);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// protected void onNewIntent(Intent intent) {
|
||||||
|
// super.onNewIntent(intent);
|
||||||
|
//
|
||||||
|
// setIntent(intent);
|
||||||
|
// api.handleIntent(intent, this);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onReq(BaseReq req) {
|
||||||
|
// switch (req.getType()) {
|
||||||
|
// case ConstantsAPI.COMMAND_GETMESSAGE_FROM_WX:
|
||||||
|
//// goToGetMsg();
|
||||||
|
// break;
|
||||||
|
// case ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX:
|
||||||
|
//// goToShowMsg((ShowMessageFromWX.Req) req);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// finish();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onResp(BaseResp resp) {
|
||||||
|
// int result = 0;
|
||||||
|
//
|
||||||
|
// switch (resp.errCode) {
|
||||||
|
// case BaseResp.ErrCode.ERR_OK:
|
||||||
|
//// result = com.qxcm.moduleutil.R.string.errcode_success;
|
||||||
|
// break;
|
||||||
|
// case BaseResp.ErrCode.ERR_USER_CANCEL:
|
||||||
|
//// result = R.string.errcode_cancel;
|
||||||
|
// break;
|
||||||
|
// case BaseResp.ErrCode.ERR_AUTH_DENIED:
|
||||||
|
//// result = R.string.errcode_deny;
|
||||||
|
// break;
|
||||||
|
// case BaseResp.ErrCode.ERR_UNSUPPORT:
|
||||||
|
//// result = R.string.errcode_unsupported;
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
//// result = R.string.errcode_unknown;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Toast.makeText(this, getString(result) + ", type=" + resp.getType(), Toast.LENGTH_SHORT).show();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// if (resp.getType() == ConstantsAPI.COMMAND_SUBSCRIBE_MESSAGE) {
|
||||||
|
// SubscribeMessage.Resp subscribeMsgResp = (SubscribeMessage.Resp) resp;
|
||||||
|
// String text = String.format("openid=%s\ntemplate_id=%s\nscene=%d\naction=%s\nreserved=%s",
|
||||||
|
// subscribeMsgResp.openId, subscribeMsgResp.templateID, subscribeMsgResp.scene, subscribeMsgResp.action, subscribeMsgResp.reserved);
|
||||||
|
//
|
||||||
|
// Toast.makeText(this, text, Toast.LENGTH_LONG).show();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (resp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) {
|
||||||
|
// WXLaunchMiniProgram.Resp launchMiniProgramResp = (WXLaunchMiniProgram.Resp) resp;
|
||||||
|
// String text = String.format("openid=%s\nextMsg=%s\nerrStr=%s",
|
||||||
|
// launchMiniProgramResp.openId, launchMiniProgramResp.extMsg,launchMiniProgramResp.errStr);
|
||||||
|
//
|
||||||
|
// Toast.makeText(this, text, Toast.LENGTH_LONG).show();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (resp.getType() == ConstantsAPI.COMMAND_OPEN_BUSINESS_VIEW) {
|
||||||
|
// WXOpenBusinessView.Resp launchMiniProgramResp = (WXOpenBusinessView.Resp) resp;
|
||||||
|
// String text = String.format("openid=%s\nextMsg=%s\nerrStr=%s\nbusinessType=%s",
|
||||||
|
// launchMiniProgramResp.openId, launchMiniProgramResp.extMsg,launchMiniProgramResp.errStr,launchMiniProgramResp.businessType);
|
||||||
|
//
|
||||||
|
// Toast.makeText(this, text, Toast.LENGTH_LONG).show();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (resp.getType() == ConstantsAPI.COMMAND_OPEN_BUSINESS_WEBVIEW) {
|
||||||
|
// WXOpenBusinessWebview.Resp response = (WXOpenBusinessWebview.Resp) resp;
|
||||||
|
// String text = String.format("businessType=%d\nresultInfo=%s\nret=%d",response.businessType,response.resultInfo,response.errCode);
|
||||||
|
//
|
||||||
|
// Toast.makeText(this, text, Toast.LENGTH_LONG).show();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (resp.getType() == ConstantsAPI.COMMAND_SENDAUTH) {
|
||||||
|
// SendAuth.Resp authResp = (SendAuth.Resp)resp;
|
||||||
|
// final String code = authResp.code;
|
||||||
|
//// NetworkUtil.sendWxAPI(handler, String.format("https://api.weixin.qq.com/sns/oauth2/access_token?" +
|
||||||
|
//// "appid=%s&secret=%s&code=%s&grant_type=authorization_code", "wxd930ea5d5a258f4f",
|
||||||
|
//// "1d6d1d57a3dd063b36d917bc0b44d964", code), NetworkUtil.GET_TOKEN);
|
||||||
|
// }
|
||||||
|
// finish();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// private void goToGetMsg() {
|
||||||
|
//// Intent intent = new Intent(this, GetFromWXActivity.class);
|
||||||
|
//// intent.putExtras(getIntent());
|
||||||
|
//// startActivity(intent);
|
||||||
|
//// finish();
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// private void goToShowMsg(ShowMessageFromWX.Req showReq) {
|
||||||
|
//// WXMediaMessage wxMsg = showReq.message;
|
||||||
|
//// WXAppExtendObject obj = (WXAppExtendObject) wxMsg.mediaObject;
|
||||||
|
////
|
||||||
|
//// StringBuffer msg = new StringBuffer();
|
||||||
|
//// msg.append("description: ");
|
||||||
|
//// msg.append(wxMsg.description);
|
||||||
|
//// msg.append("\n");
|
||||||
|
//// msg.append("extInfo: ");
|
||||||
|
//// msg.append(obj.extInfo);
|
||||||
|
//// msg.append("\n");
|
||||||
|
//// msg.append("filePath: ");
|
||||||
|
//// msg.append(obj.filePath);
|
||||||
|
////
|
||||||
|
//// Intent intent = new Intent(this, ShowFromWXActivity.class);
|
||||||
|
//// intent.putExtra(Constants.ShowMsgActivity.STitle, wxMsg.title);
|
||||||
|
//// intent.putExtra(Constants.ShowMsgActivity.SMessage, msg.toString());
|
||||||
|
//// intent.putExtra(Constants.ShowMsgActivity.BAThumbData, wxMsg.thumbData);
|
||||||
|
//// startActivity(intent);
|
||||||
|
//// finish();
|
||||||
|
//// }
|
||||||
|
|
||||||
|
|
||||||
|
private final String TAG = this.getClass().getSimpleName();
|
||||||
|
public static final String APP_ID = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId();
|
||||||
|
public static final String APP_SECRET = "请自己填写";
|
||||||
|
private IWXAPI mApi;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
mApi = WXAPIFactory.createWXAPI(this, APP_ID, true);
|
||||||
|
mApi.handleIntent(this.getIntent(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//微信发送的请求将回调到onReq方法
|
||||||
|
@Override
|
||||||
|
public void onReq(BaseReq baseReq) {
|
||||||
|
}
|
||||||
|
|
||||||
|
//发送到微信请求的响应结果
|
||||||
|
@Override
|
||||||
|
public void onResp(BaseResp resp) {
|
||||||
|
switch (resp.errCode) {
|
||||||
|
case BaseResp.ErrCode.ERR_OK:
|
||||||
|
//发送成功
|
||||||
|
ToastUtils.showShort("发送成功",resp.transaction);
|
||||||
|
EventBus.getDefault().post(resp);
|
||||||
|
break;
|
||||||
|
case BaseResp.ErrCode.ERR_USER_CANCEL:
|
||||||
|
//发送取消
|
||||||
|
ToastUtils.showShort("发送取消",resp);
|
||||||
|
break;
|
||||||
|
case BaseResp.ErrCode.ERR_AUTH_DENIED:
|
||||||
|
ToastUtils.showShort("发送被拒绝",resp);
|
||||||
|
//发送被拒绝
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//发送返回
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.xscm.midi.wxapi;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
|
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||||
|
import com.tencent.mm.opensdk.modelbase.BaseReq;
|
||||||
|
import com.tencent.mm.opensdk.modelbase.BaseResp;
|
||||||
|
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||||
|
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;
|
||||||
|
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.event.PayEvent;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
public class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
|
||||||
|
private IWXAPI api;
|
||||||
|
public static final String APP_ID = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
api = WXAPIFactory.createWXAPI(this, APP_ID);
|
||||||
|
api.handleIntent(getIntent(), this); // 必须调用,否则无法接收回调
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
setIntent(intent);
|
||||||
|
api.handleIntent(intent, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReq(BaseReq baseReq) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResp(BaseResp resp) {
|
||||||
|
// 支付结果回调(resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX)
|
||||||
|
if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
|
||||||
|
switch (resp.errCode) {
|
||||||
|
case BaseResp.ErrCode.ERR_OK:
|
||||||
|
// 支付成功:这里需要调用后台接口确认支付状态(避免本地判断不可靠)
|
||||||
|
|
||||||
|
break;
|
||||||
|
case BaseResp.ErrCode.ERR_USER_CANCEL:
|
||||||
|
checkPayResultFromServer();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 支付失败
|
||||||
|
checkPayResultFromServer();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
finish(); // 处理完后关闭页面
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关键:必须从后台确认支付状态(不能仅依赖前端回调)
|
||||||
|
private void checkPayResultFromServer() {
|
||||||
|
// 调用后台接口,传入订单号查询实际支付状态
|
||||||
|
// 用户取消支付
|
||||||
|
ToastUtils.showShort("支付取消");
|
||||||
|
PayEvent messageEvent = new PayEvent(-2, "支付取消");
|
||||||
|
EventBus.getDefault().post(messageEvent);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
app/src/main/res/drawable/bg_launcher_ad_tip.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<corners android:radius="20dp"/>
|
||||||
|
<solid android:color="#80000000"/>
|
||||||
|
</shape>
|
||||||
4
app/src/main/res/drawable/bg_launcher_skip.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape android:shape="oval" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#80000000"/>
|
||||||
|
</shape>
|
||||||
6
app/src/main/res/drawable/bg_launcher_skip_2.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<corners android:radius="12sp"/>
|
||||||
|
<stroke android:color="@color/white" android:width="1dp"/>
|
||||||
|
<solid android:color="#80000000"/>
|
||||||
|
</shape>
|
||||||
BIN
app/src/main/res/drawable/ic_topbar_back_dark.png
Normal file
|
After Width: | Height: | Size: 705 B |
BIN
app/src/main/res/drawable/login_log.webp
Normal file
|
After Width: | Height: | Size: 15 KiB |
102
app/src/main/res/layout/activity_launch_page.xml
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
|
<data></data>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/transparent">
|
||||||
|
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="#000" />
|
||||||
|
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/btn_skip_img"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:layout_marginTop="37dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:background="@drawable/bg_launcher_skip"
|
||||||
|
android:visibility="invisible">
|
||||||
|
|
||||||
|
<com.xscm.moduleutil.custon.CircleProgress
|
||||||
|
android:id="@+id/progress"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:cp_bg_color="@color/white"
|
||||||
|
app:cp_cur_progress="0"
|
||||||
|
app:cp_fg_color="#ff7200"
|
||||||
|
app:cp_stroke_width="2dp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/recommend_skip"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btn_skip_video"
|
||||||
|
android:layout_width="44dp"
|
||||||
|
android:layout_height="26dp"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:layout_marginTop="37dp"
|
||||||
|
android:layout_marginRight="15dp"
|
||||||
|
android:background="@drawable/bg_launcher_skip_2"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/recommend_skip"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ad_tip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="bottom|center_horizontal"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:background="@drawable/bg_launcher_ad_tip"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:visibility="invisible">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/a_067"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="13sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="13dp"
|
||||||
|
android:layout_height="13dp"
|
||||||
|
android:src="@mipmap/icon_arrow_right_3" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/cover"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clickable="true"
|
||||||
|
android:src="@mipmap/screen"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
</layout>
|
||||||
383
app/src/main/res/layout/activity_password_login.xml
Normal file
@@ -0,0 +1,383 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<data>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@mipmap/log_bj" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="left|top|center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:layout_marginTop="@dimen/dp_67"
|
||||||
|
android:gravity="left|center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/login_title" />
|
||||||
|
|
||||||
|
<!-- <TextView-->
|
||||||
|
<!-- android:layout_width="wrap_content"-->
|
||||||
|
<!-- android:layout_height="@dimen/dp_30"-->
|
||||||
|
<!-- android:text="@string/login_web_title"-->
|
||||||
|
<!-- android:textColor="@color/color_FF333333"-->
|
||||||
|
<!-- android:textSize="20sp"-->
|
||||||
|
<!-- android:textStyle="bold" />-->
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_20"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_16">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_login_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="@dimen/dp_27"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:text="@string/login_title"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="18sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/rel_phone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_44"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginLeft="@dimen/dp_16"
|
||||||
|
android:layout_marginTop="@dimen/dp_17"
|
||||||
|
android:layout_marginRight="@dimen/dp_16"
|
||||||
|
android:background="@drawable/bg_r16_ffeff2f8">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_user"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:src="@mipmap/icon_login_user_new" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/ed_phone"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_28"
|
||||||
|
android:layout_marginLeft="13dp"
|
||||||
|
android:layout_marginRight="25dp"
|
||||||
|
android:layout_toRightOf="@+id/iv_user"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:hint="@string/login_hint_phion"
|
||||||
|
android:inputType="phone"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:maxLength="11"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textColorHint="@color/color_FFCCCCCC"
|
||||||
|
android:textSize="@dimen/sp_17" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/rl_code"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_44"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:background="@drawable/bg_r16_ffeff2f8">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_code"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:src="@mipmap/icon_login_code" />
|
||||||
|
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/ed_password"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_28"
|
||||||
|
android:layout_marginLeft="13dp"
|
||||||
|
android:layout_marginRight="25dp"
|
||||||
|
android:layout_toRightOf="@+id/iv_code"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:hint="@string/login_hint_code"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLength="20"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textColorHint="@color/color_FFCCCCCC"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:gravity="center"
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_send_code"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="@dimen/dp_13"
|
||||||
|
android:gravity="right"
|
||||||
|
android:text="@string/login_send_code"
|
||||||
|
android:textColor="#22BB79"
|
||||||
|
android:textSize="@dimen/sp_16"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/rl_pass_code"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_44"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:background="@drawable/bg_r16_ffeff2f8">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_pass_code"
|
||||||
|
android:layout_width="@dimen/dp_20"
|
||||||
|
android:layout_height="@dimen/dp_20"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:src="@mipmap/icon_login_lick" />
|
||||||
|
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/ed_password_code"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_28"
|
||||||
|
android:layout_marginLeft="13dp"
|
||||||
|
android:layout_marginRight="25dp"
|
||||||
|
android:layout_toRightOf="@+id/iv_pass_code"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:background="@android:color/transparent"
|
||||||
|
android:hint="@string/login_hint_pass"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLength="20"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textColorHint="@color/color_FFCCCCCC"
|
||||||
|
android:textSize="@dimen/sp_16" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_eye"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/eye_close"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_10">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_code_text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginRight="16dp"
|
||||||
|
android:drawableLeft="@mipmap/common_switch_login_icon"
|
||||||
|
android:drawablePadding="@dimen/dp_3"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/login_btn_switch"
|
||||||
|
android:textColor="#666666"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fl_login"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/dp_38"
|
||||||
|
android:layout_marginTop="@dimen/dp_23"
|
||||||
|
android:layout_marginBottom="@dimen/dp_150"
|
||||||
|
android:layout_marginRight="@dimen/dp_38"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_login_bg"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_42"
|
||||||
|
android:src="@drawable/theme_bg" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:enabled="false"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/login_btn_login"
|
||||||
|
android:textColor="@color/color_white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:paddingBottom="@dimen/dp_7"
|
||||||
|
|
||||||
|
>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_login_error"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_marginBottom="@dimen/dp_7"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/login_btn_qt"
|
||||||
|
android:textColor="@color/color_666666"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_other_login"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/tv_login_error"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:layout_marginBottom="@dimen/dp_55"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="visible"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_weixin"
|
||||||
|
android:layout_width="@dimen/dp_44"
|
||||||
|
android:layout_height="44dp"
|
||||||
|
android:src="@mipmap/sign_icon_wechat" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_zfb"
|
||||||
|
android:layout_width="@dimen/dp_44"
|
||||||
|
android:layout_height="@dimen/dp_44"
|
||||||
|
android:layout_marginLeft="@dimen/dp_33"
|
||||||
|
android:src="@mipmap/sign_icon_zfb"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_agreement"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@+id/ll_other_login"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginBottom="@dimen/dp_25"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cb_privacy"
|
||||||
|
android:layout_width="@dimen/dp_15"
|
||||||
|
android:layout_height="@dimen/dp_15"
|
||||||
|
android:layout_marginEnd="@dimen/dp_5"
|
||||||
|
android:background="@drawable/selector_login_agreement"
|
||||||
|
android:button="@null" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="我已阅读并同意"
|
||||||
|
android:textColor="@color/color_FFA8A8A8"
|
||||||
|
android:textSize="@dimen/sp_11"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_ysxy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="《用户协议》"
|
||||||
|
android:textColor="#22BB79"
|
||||||
|
android:textSize="@dimen/sp_11"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="和"
|
||||||
|
android:textColor="@color/color_FFA8A8A8"
|
||||||
|
android:textSize="@dimen/sp_11"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_yhxy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="《隐私协议》"
|
||||||
|
android:textColor="#22BB79"
|
||||||
|
android:textSize="@dimen/sp_11"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
</LinearLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
</FrameLayout>
|
||||||
|
</layout>
|
||||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@color/ic_launcher_background"/>
|
||||||
|
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||||
|
</adaptive-icon>
|
||||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_app.webp
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_app.webp
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_app.webp
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/mipmap-xhdpi/screen.webp
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_app.webp
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/screen.webp
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_app.webp
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/screen.webp
Normal file
|
After Width: | Height: | Size: 24 KiB |
5
app/src/main/res/values-en-rUs/strings.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||||
|
|
||||||
|
<string name="recommend_skip">Skip</string>
|
||||||
|
<string name="a_067">Click to jump to third-party applications</string>
|
||||||
|
</resources>
|
||||||
16
app/src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="Theme.QxLive" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
|
||||||
|
<!-- Primary brand color. -->
|
||||||
|
<item name="colorPrimary">@color/purple_200</item>
|
||||||
|
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||||
|
<item name="colorOnPrimary">@color/black</item>
|
||||||
|
<!-- Secondary brand color. -->
|
||||||
|
<item name="colorSecondary">@color/teal_200</item>
|
||||||
|
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||||
|
<item name="colorOnSecondary">@color/black</item>
|
||||||
|
<!-- Status bar color. -->
|
||||||
|
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
32
app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="purple_200">#FFBB86FC</color>
|
||||||
|
<color name="purple_500">#FF6200EE</color>
|
||||||
|
<color name="purple_700">#FF3700B3</color>
|
||||||
|
<color name="teal_200">#FF03DAC5</color>
|
||||||
|
<color name="teal_700">#FF018786</color>
|
||||||
|
<color name="black">#FF000000</color>
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
|
||||||
|
<color name="global">#ff5878</color>
|
||||||
|
<color name="background">@color/gray2</color>
|
||||||
|
<color name="transparent">#00000000</color>
|
||||||
|
<color name="textColor">#282828</color>
|
||||||
|
<color name="gray1">#969696</color>
|
||||||
|
<color name="gray2">#f5f5f5</color>
|
||||||
|
<color name="gray3">#c8c8c8</color>
|
||||||
|
<color name="gray4">#B4B4B4</color>
|
||||||
|
<color name="gray5">#dcdcdc</color>
|
||||||
|
<color name="yellow">#fffa37</color>
|
||||||
|
<color name="yellow2">#f0cd08</color>
|
||||||
|
<color name="yellow3">#FFF34D</color>
|
||||||
|
<color name="yellow4">#ffdd00</color>
|
||||||
|
<color name="textColor2">#646464</color>
|
||||||
|
<color name="red">#ff0000</color>
|
||||||
|
<color name="pk_red">#FF205E</color>
|
||||||
|
<color name="pk_blue">#169AFF</color>
|
||||||
|
<color name="black1">#e6323232</color>
|
||||||
|
<color name="blue1">#1FC8F8</color>
|
||||||
|
<color name="blue2">#4998F7</color>
|
||||||
|
<color name="blue3">#32A0FF</color>
|
||||||
|
</resources>
|
||||||
4
app/src/main/res/values/ic_launcher_background.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#FFFFFF</color>
|
||||||
|
</resources>
|
||||||
5
app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<string name="recommend_skip">跳过</string>
|
||||||
|
<string name="a_067">点击跳转第三方应用</string>
|
||||||
|
</resources>
|
||||||
113
app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
<item name="android:colorBackground">@color/background</item>
|
||||||
|
<item name="android:textColor">@color/color_1F1C1F</item>
|
||||||
|
<item name="android:textColorHint">@color/color_FF999999</item>
|
||||||
|
<item name="android:windowBackground">@color/color_F9FAFA</item>
|
||||||
|
<item name="android:windowTranslucentStatus">false</item>
|
||||||
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="main_SplashThemeImage" parent="AppTheme.NoActionBar">
|
||||||
|
<item name="android:windowFullscreen">true</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
</style>
|
||||||
|
<!--StartActivity Style 冷启动效果-->
|
||||||
|
<style name="AppTheme.NoActionBar">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
<item name="android:windowBackground">@mipmap/screen</item>
|
||||||
|
</style>
|
||||||
|
<!-- 在 styles.xml 中添加透明主题 -->
|
||||||
|
<style name="TransparentTheme" parent="AppTheme">
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowIsFloating">true</item>
|
||||||
|
<item name="android:backgroundDimEnabled">false</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="LauncherAppTheme" parent="AppTheme">
|
||||||
|
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppthemeActivity" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="android:windowEnableSplitTouch">false</item>
|
||||||
|
<item name="android:windowAllowReturnTransitionOverlap">false</item>
|
||||||
|
<item name="android:windowEnterTransition">@null</item>
|
||||||
|
<item name="android:windowExitTransition">@null</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
|
<item name="android:windowTranslucentStatus">false</item>
|
||||||
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="dialog" parent="AppTheme">
|
||||||
|
<item name="android:windowFrame">@null</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowIsFloating">true</item>
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowBackground">@color/transparent</item>
|
||||||
|
<item name="android:backgroundDimAmount">0.5</item>
|
||||||
|
<!--显示区域以外是否使用黑色半透明背景-->
|
||||||
|
<item name="android:backgroundDimEnabled">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="dialog2" parent="AppTheme">
|
||||||
|
<item name="android:windowFrame">@null</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowIsFloating">true</item>
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowBackground">@color/transparent</item>
|
||||||
|
<!--显示区域以外是否使用黑色半透明背景-->
|
||||||
|
<item name="android:backgroundDimEnabled">false</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="bottomToTopAnim" parent="android:Animation">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/bottomview_anim_enter</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/bottomview_anim_exit</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="bottomToTopAnim2" parent="android:Animation">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/bottomview_anim_enter_2</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/bottomview_anim_exit_2</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="leftToRightAnim" parent="android:Animation">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/left_anim_enter</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/left_anim_exit</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="animCenter" parent="android:Animation">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/anim_center_enter</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/anim_center_exit</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="groupLast" parent="AppTheme">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">1dp</item>
|
||||||
|
<item name="android:layout_marginLeft">15dp</item>
|
||||||
|
<item name="android:layout_marginRight">15dp</item>
|
||||||
|
<item name="android:background">@color/gray2</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="line2" parent="AppTheme">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">1dp</item>
|
||||||
|
<item name="android:background">@color/gray2</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="edit_profile_group" parent="AppTheme">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">60dp</item>
|
||||||
|
<item name="android:paddingLeft">15dp</item>
|
||||||
|
<item name="android:paddingRight">15dp</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
13
app/src/main/res/xml/backup_rules.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample backup rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/guide/topics/data/autobackup
|
||||||
|
for details.
|
||||||
|
Note: This file is ignored for devices older that API 31
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore
|
||||||
|
-->
|
||||||
|
<full-backup-content>
|
||||||
|
<!--
|
||||||
|
<include domain="sharedpref" path="."/>
|
||||||
|
<exclude domain="sharedpref" path="device.xml"/>
|
||||||
|
-->
|
||||||
|
</full-backup-content>
|
||||||
19
app/src/main/res/xml/data_extraction_rules.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
Sample data extraction rules file; uncomment and customize as necessary.
|
||||||
|
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||||
|
for details.
|
||||||
|
-->
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
-->
|
||||||
|
</cloud-backup>
|
||||||
|
<!--
|
||||||
|
<device-transfer>
|
||||||
|
<include .../>
|
||||||
|
<exclude .../>
|
||||||
|
</device-transfer>
|
||||||
|
-->
|
||||||
|
</data-extraction-rules>
|
||||||
1
lombok.config
Normal file
@@ -0,0 +1 @@
|
|||||||
|
lombok.anyConstructor.suppressConstructorProperties=true
|
||||||
BIN
moduleUtil/src/main/assets/draw_music.mp3
Normal file
BIN
moduleUtil/src/main/assets/heart_line_31.svga
Normal file
BIN
moduleUtil/src/main/assets/xuanz.mp3
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package com.xscm.moduleutil.base;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/20
|
||||||
|
*@description: 模块之间的通讯接口
|
||||||
|
*/
|
||||||
|
public interface AppStateListener {
|
||||||
|
void onAppForeground();
|
||||||
|
void onAppBackground();
|
||||||
|
void onRoomActivityCreated(Activity roomActivity);
|
||||||
|
void onRoomActivityDestroyed();
|
||||||
|
boolean isRoomActivityActive();
|
||||||
|
void setFloatingWindowVisible(boolean visible);
|
||||||
|
boolean isFloatingWindowVisible();
|
||||||
|
|
||||||
|
// 新增方法
|
||||||
|
boolean shouldShowSplash();
|
||||||
|
void setShouldShowSplash(boolean shouldShow);
|
||||||
|
boolean isAppInBackground();
|
||||||
|
void setAppInBackground(boolean inBackground);
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package com.xscm.moduleutil.base;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/20
|
||||||
|
*@description: 应用状态管理的单例类
|
||||||
|
*/
|
||||||
|
// 在 common 模块中
|
||||||
|
public class AppStateManager implements AppStateListener {
|
||||||
|
private static AppStateManager instance;
|
||||||
|
private boolean isAppInBackground = true;
|
||||||
|
private boolean shouldShowSplash = true;
|
||||||
|
private WeakReference<Activity> roomActivityRef;
|
||||||
|
private boolean isFloatingWindowVisible = false;
|
||||||
|
private boolean isRoomActivityMinimized = false;
|
||||||
|
private AppStateManager() {
|
||||||
|
// 私有构造函数
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized AppStateManager getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new AppStateManager();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldShowSplash() {
|
||||||
|
return shouldShowSplash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setShouldShowSplash(boolean shouldShow) {
|
||||||
|
this.shouldShowSplash = shouldShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAppInBackground() {
|
||||||
|
return isAppInBackground;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAppInBackground(boolean inBackground) {
|
||||||
|
this.isAppInBackground = inBackground;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRoomActivityCreated(Activity roomActivity) {
|
||||||
|
roomActivityRef = new WeakReference<>(roomActivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRoomActivityDestroyed() {
|
||||||
|
roomActivityRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRoomActivityActive() {
|
||||||
|
Activity activity = getRoomActivity();
|
||||||
|
return activity != null && !activity.isFinishing();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Activity getRoomActivity() {
|
||||||
|
return roomActivityRef != null ? roomActivityRef.get() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFloatingWindowVisible(boolean visible) {
|
||||||
|
this.isFloatingWindowVisible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFloatingWindowVisible() {
|
||||||
|
return isFloatingWindowVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAppForeground() {
|
||||||
|
// 应用进入前台时的处理
|
||||||
|
setAppInBackground(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAppBackground() {
|
||||||
|
// 应用进入后台时的处理
|
||||||
|
setAppInBackground(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增方法:设置RoomActivity为最小化状态
|
||||||
|
public void setRoomActivityMinimized(boolean minimized) {
|
||||||
|
this.isRoomActivityMinimized = minimized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增方法:检查RoomActivity是否处于最小化状态
|
||||||
|
public boolean isRoomActivityMinimized() {
|
||||||
|
return isRoomActivityMinimized;
|
||||||
|
}
|
||||||
|
private RoomInfoResp roomInfoResp;
|
||||||
|
public void setRoomInfo(RoomInfoResp roomInfoResp) {
|
||||||
|
// 处理RoomInfoResp对象
|
||||||
|
this.roomInfoResp = roomInfoResp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoomInfoResp getRoomInfo() {
|
||||||
|
return roomInfoResp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,543 @@
|
|||||||
|
package com.xscm.moduleutil.base;
|
||||||
|
|
||||||
|
import static android.app.PendingIntent.getActivity;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
|
import com.blankj.utilcode.util.ActivityUtils;
|
||||||
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||||
|
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||||
|
import com.xscm.moduleutil.http.BaseObserver;
|
||||||
|
import com.xscm.moduleutil.http.RetrofitClient;
|
||||||
|
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||||
|
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||||
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
|
import com.xscm.moduleutil.utils.logger.Logger;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间管理器
|
||||||
|
* 统一处理房间数据获取、进入房间和退出房间的逻辑
|
||||||
|
*/
|
||||||
|
public class RoomManager {
|
||||||
|
private static final String TAG = "RoomManager";
|
||||||
|
|
||||||
|
private static RoomManager instance;
|
||||||
|
|
||||||
|
// 房间数据缓存
|
||||||
|
private Map<String, RoomInfoResp> roomDataCache = new ConcurrentHashMap<>();
|
||||||
|
private Map<String, Long> cacheTimestamps = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
// 缓存有效期(5分钟)
|
||||||
|
private static final long CACHE_DURATION = 5 * 60 * 1000;
|
||||||
|
|
||||||
|
private RoomManager() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized RoomManager getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new RoomManager();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入房间 - 自动获取房间数据
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
*/
|
||||||
|
public void enterRoom(Context context, String roomId) {
|
||||||
|
enterRoom(context, roomId, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入房间 - 使用密码
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
*/
|
||||||
|
public void enterRoom(Context context, String roomId, String password) {
|
||||||
|
enterRoom(context, roomId, password, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入房间 - 使用缓存数据
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
* @param cachedData 缓存的房间数据
|
||||||
|
*/
|
||||||
|
public void enterRoom(Context context, String roomId, String password, RoomInfoResp cachedData) {
|
||||||
|
if (TextUtils.isEmpty(roomId)) {
|
||||||
|
ToastUtils.showShort("房间ID不能为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有有效的缓存数据
|
||||||
|
RoomInfoResp roomInfo = cachedData != null ? cachedData : getCachedRoomData(roomId);
|
||||||
|
|
||||||
|
if (roomInfo != null) {
|
||||||
|
// 使用缓存数据直接进入房间
|
||||||
|
navigateToRoom(context, roomId, password, roomInfo, false);
|
||||||
|
} else {
|
||||||
|
// 获取房间数据后进入房间
|
||||||
|
fetchRoomDataAndEnter(context, roomId, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取房间数据并进入房间
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
*/
|
||||||
|
public void fetchRoomDataAndEnter(Context context, String roomId, String password) {
|
||||||
|
// 显示加载提示
|
||||||
|
// 这里可以根据需要添加加载对话框
|
||||||
|
if (CommonAppContext.getInstance().isRoomJoininj){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CommonAppContext.getInstance().isRoomJoininj=true;
|
||||||
|
// 检查是否有有效的缓存数据
|
||||||
|
// RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
||||||
|
// 检查是否是当前房间且用户在线
|
||||||
|
// boolean isCurrentRoom = isCurrentRoom(roomId);
|
||||||
|
if (CommonAppContext.getInstance().playId == null) {
|
||||||
|
fetchAndJoinRoom(context, roomId, password);
|
||||||
|
} else {
|
||||||
|
if (!CommonAppContext.getInstance().playId.equals(roomId)) {
|
||||||
|
MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||||
|
exitRoom(CommonAppContext.getInstance().playId);
|
||||||
|
CommonAppContext.getInstance().isShow = false;
|
||||||
|
CommonAppContext.getInstance().isPlaying = false;
|
||||||
|
CommonAppContext.getInstance().isRoomJoininj=false;
|
||||||
|
EventBus.getDefault().post(new RoomOutEvent());
|
||||||
|
} else if (CommonAppContext.getInstance().lable_id.equals("6")) {
|
||||||
|
upInfo(context, roomId, password, true, null, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isUserOnline(context, roomId, password, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(1000);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 如果是当前房间且用户在线,直接跳转到房间页面,仅更新数据
|
||||||
|
|
||||||
|
|
||||||
|
// // 获取房间数据
|
||||||
|
// MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||||
|
// // 等待一段时间确保退出完成
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(500);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// }
|
||||||
|
// RetrofitClient.getInstance().roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSubscribe(Disposable d) {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onNext(RoomInfoResp resp) {
|
||||||
|
// String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||||
|
// String token = resp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||||
|
// String roomId = resp.getRoom_info().getRoom_id(); // 房间 ID
|
||||||
|
// String rtm_token=resp.getUser_info().getAgora_rtm_token();
|
||||||
|
// SpUtil.setRtmToken(rtm_token);
|
||||||
|
// int uid = SpUtil.getUserId(); // 0 表示由 Agora 自动生成 UID
|
||||||
|
// boolean enableMic = false; // 是否开启麦克风
|
||||||
|
// boolean enableJs=false; // 是否开启角色
|
||||||
|
// if (resp.getUser_info().getPit_number()!=0){
|
||||||
|
// enableJs=true;
|
||||||
|
// }
|
||||||
|
// LogUtils.e("token",token);
|
||||||
|
// LogUtils.e("roomId:",roomId);
|
||||||
|
//// 初始化 Agora 并加入房间
|
||||||
|
// AgoraManager.getInstance(context)
|
||||||
|
// .joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||||
|
// cacheRoomData(roomId, resp);
|
||||||
|
// navigateToRoom(context, roomId, password, resp);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// 临时实现 - 直接跳转(因为缺少具体的网络请求代码)
|
||||||
|
// navigateToRoom(context, roomId, password, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void upInfo(Context context, String roomId, String password, boolean isOnline, RoomInfoResp roomInfo, boolean isCurrentRoom) {
|
||||||
|
|
||||||
|
|
||||||
|
if (isOnline) {
|
||||||
|
navigateToRoom(context, roomId, password, roomInfo, isOnline);
|
||||||
|
} else {
|
||||||
|
// CommonAppContext.getInstance().isShow = false;
|
||||||
|
// CommonAppContext.getInstance().isPlaying = false;
|
||||||
|
// EventBus.getDefault().post(new RoomOutEvent());
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(300);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// }
|
||||||
|
fetchAndJoinRoom(context, roomId, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if (isCurrentRoom&& isOnline) {
|
||||||
|
// if (roomInfo != null) {
|
||||||
|
// navigateToRoom(context, roomId, password, roomInfo);
|
||||||
|
// } else {
|
||||||
|
// // 即使在线,如果没有缓存数据,也需要获取数据
|
||||||
|
// fetchAndJoinRoom(context, roomId, password);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// 如果有缓存数据且用户在线,使用缓存数据进入房间
|
||||||
|
// if (roomInfo != null && isOnline) {
|
||||||
|
// RetrofitClient.getInstance().postRoomInfo(roomId, new BaseObserver<RoomInfoResp>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSubscribe(Disposable d) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onNext(RoomInfoResp roomInfoResp) {
|
||||||
|
//// cacheRoomData(roomId, roomInfo);
|
||||||
|
// navigateToRoom(context, roomId, password, roomInfoResp);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// cacheRoomData(roomId, roomInfo);
|
||||||
|
// navigateToRoom(context, roomId, password, roomInfo);
|
||||||
|
return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 其他情况,获取新的房间数据并加入房间
|
||||||
|
// fetchAndJoinRoom(context, roomId, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新的房间数据并加入房间
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
*/
|
||||||
|
private void fetchAndJoinRoom(Context context, String roomId, String password) {
|
||||||
|
// 获取房间数据
|
||||||
|
|
||||||
|
// 等待一段时间确保退出完成
|
||||||
|
try {
|
||||||
|
Thread.sleep(300);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
navigateToRoom(context, roomId, password, null, false);
|
||||||
|
|
||||||
|
// RetrofitClient.getInstance().roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSubscribe(Disposable d) {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onNext(RoomInfoResp resp) {
|
||||||
|
// String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||||
|
// String token = resp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||||
|
// String roomId = resp.getRoom_info().getRoom_id(); // 房间 ID
|
||||||
|
// String rtm_token=resp.getUser_info().getAgora_rtm_token();
|
||||||
|
// SpUtil.setRtmToken(rtm_token);
|
||||||
|
// int uid = SpUtil.getUserId(); // 0 表示由 Agora 自动生成 UID
|
||||||
|
// boolean enableMic = false; // 是否开启麦克风
|
||||||
|
// boolean enableJs=false; // 是否开启角色
|
||||||
|
// if (resp.getUser_info().getPit_number()!=0){
|
||||||
|
// enableJs=true;
|
||||||
|
// }
|
||||||
|
// LogUtils.e("token",token);
|
||||||
|
// LogUtils.e("roomId:",roomId);
|
||||||
|
//// 初始化 Agora 并加入房间
|
||||||
|
// AgoraManager.getInstance(context)
|
||||||
|
// .joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||||
|
// cacheRoomData(roomId, resp);
|
||||||
|
// navigateToRoom(context, roomId, password, resp);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否是当前房间
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @return true表示是当前房间,false表示不是
|
||||||
|
*/
|
||||||
|
private boolean isCurrentRoom(String roomId) {
|
||||||
|
// 这里应该实现检查是否是当前房间的逻辑
|
||||||
|
// 可以通过检查当前Activity或者通过全局变量等方式实现
|
||||||
|
// 目前返回false,需要根据实际需求实现具体逻辑
|
||||||
|
|
||||||
|
RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
||||||
|
if (roomInfo != null) {
|
||||||
|
if (roomInfo.getRoom_info().getRoom_id().equals(roomId)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转到房间页面
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
* @param roomInfo 房间信息
|
||||||
|
*/
|
||||||
|
private void navigateToRoom(Context context, String roomId, String password, RoomInfoResp roomInfo, boolean isOnline) {
|
||||||
|
try {
|
||||||
|
// 构建跳转参数
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString("roomId", roomId);
|
||||||
|
bundle.putBoolean("isOnline", isOnline);
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(password)) {
|
||||||
|
bundle.putString("password", password);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roomInfo != null) {
|
||||||
|
// bundle.putSerializable("roomInfo", roomInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用ARouter跳转到房间页面
|
||||||
|
ARouter.getInstance()
|
||||||
|
.build(ARouteConstants.ROOM_DETAILS)
|
||||||
|
.with(bundle)
|
||||||
|
.navigation(context);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.e(TAG, "跳转房间页面失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存房间数据
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param roomInfo 房间信息
|
||||||
|
*/
|
||||||
|
public void cacheRoomData(String roomId, RoomInfoResp roomInfo) {
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(roomId) || roomInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 清除所有现有的缓存数据
|
||||||
|
roomDataCache.clear();
|
||||||
|
cacheTimestamps.clear();
|
||||||
|
roomDataCache.put(roomId, roomInfo);
|
||||||
|
cacheTimestamps.put(roomId, System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缓存的房间数据
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @return 房间信息,如果缓存无效则返回null
|
||||||
|
*/
|
||||||
|
public RoomInfoResp getCachedRoomData(String roomId) {
|
||||||
|
if (TextUtils.isEmpty(roomId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long timestamp = cacheTimestamps.get(roomId);
|
||||||
|
if (timestamp == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查缓存是否过期
|
||||||
|
if (System.currentTimeMillis() - timestamp > CACHE_DURATION) {
|
||||||
|
// 缓存过期,清除数据
|
||||||
|
roomDataCache.remove(roomId);
|
||||||
|
cacheTimestamps.remove(roomId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return roomDataCache.get(roomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查用户是否在线
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @return true表示用户在线,false表示不在线
|
||||||
|
*/
|
||||||
|
private boolean isUserOnline(Context context, String roomId, String password, RoomInfoResp roomInfo) {
|
||||||
|
// 这里应该实现检查用户是否在线的逻辑
|
||||||
|
// 可以通过检查Agora是否还在房间中,或者通过服务端接口查询用户状态等方式实现
|
||||||
|
// 目前返回false,需要根据实际需求实现具体逻辑
|
||||||
|
// boolean isCurrentRoom=isCurrentRoom(roomId);
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(300);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// }
|
||||||
|
final boolean[] isOnline = {false};
|
||||||
|
RetrofitClient.getInstance().getRoomOnline(roomId, "1", "50", new BaseObserver<RoomOnline>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(RoomOnline roomOnline) {
|
||||||
|
try {
|
||||||
|
if (roomOnline != null) {
|
||||||
|
if (roomOnline.getOn_pit() != null) {
|
||||||
|
for (RoomOnlineBean roomOnlineBean : roomOnline.getOn_pit()) {
|
||||||
|
if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
|
||||||
|
isOnline[0] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (roomOnline.getOff_pit() != null) {
|
||||||
|
for (RoomOnlineBean roomOnlineBean : roomOnline.getOff_pit()) {
|
||||||
|
if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
|
||||||
|
isOnline[0] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upInfo(context, roomId, password, isOnline[0], roomInfo, true);
|
||||||
|
} else {
|
||||||
|
isOnline[0] = false;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 捕获所有可能的异常,避免崩溃
|
||||||
|
e.printStackTrace();
|
||||||
|
isOnline[0] = false;
|
||||||
|
// 即使出现异常也继续执行
|
||||||
|
upInfo(context, roomId, password, isOnline[0], roomInfo, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return isOnline[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除指定房间的缓存数据
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID
|
||||||
|
*/
|
||||||
|
public void clearRoomCache(String roomId) {
|
||||||
|
if (!TextUtils.isEmpty(roomId)) {
|
||||||
|
roomDataCache.remove(roomId);
|
||||||
|
cacheTimestamps.remove(roomId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除所有房间缓存数据
|
||||||
|
*/
|
||||||
|
public void clearAllRoomCache() {
|
||||||
|
roomDataCache.clear();
|
||||||
|
cacheTimestamps.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出房间
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID
|
||||||
|
*/
|
||||||
|
public void exitRoom(String roomId) {
|
||||||
|
// 清除该房间的缓存数据
|
||||||
|
clearRoomCache(roomId);
|
||||||
|
|
||||||
|
// 可以在这里添加其他退出房间的逻辑
|
||||||
|
// 例如:通知服务器用户已退出、清理房间相关资源等
|
||||||
|
|
||||||
|
RetrofitClient.getInstance().quitRoom(roomId, SpUtil.getUserId() + "", new BaseObserver<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(String s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Logger.d(TAG, "退出房间: " + roomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量退出房间
|
||||||
|
*
|
||||||
|
* @param roomIds 房间ID列表
|
||||||
|
*/
|
||||||
|
public void exitRooms(String... roomIds) {
|
||||||
|
if (roomIds != null) {
|
||||||
|
for (String roomId : roomIds) {
|
||||||
|
exitRoom(roomId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取房间缓存状态
|
||||||
|
*
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @return 缓存状态信息
|
||||||
|
*/
|
||||||
|
public String getRoomCacheStatus(String roomId) {
|
||||||
|
if (TextUtils.isEmpty(roomId)) {
|
||||||
|
return "无效的房间ID";
|
||||||
|
}
|
||||||
|
|
||||||
|
Long timestamp = cacheTimestamps.get(roomId);
|
||||||
|
if (timestamp == null) {
|
||||||
|
return "未缓存";
|
||||||
|
}
|
||||||
|
|
||||||
|
long elapsed = System.currentTimeMillis() - timestamp;
|
||||||
|
if (elapsed > CACHE_DURATION) {
|
||||||
|
return "缓存已过期";
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomInfoResp data = roomDataCache.get(roomId);
|
||||||
|
if (data == null) {
|
||||||
|
return "缓存数据为空";
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("已缓存 (%d秒前)", elapsed / 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
/**
|
||||||
|
* @Description: 首页活动弹窗权限
|
||||||
|
* @Author: xscm
|
||||||
|
* @Date: 2021/9/27 14:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ActivitiesPermission {
|
||||||
|
private int first_charge_permission;//首充权限 1:有 0:无
|
||||||
|
private int day_drop_permission;//天降好礼权限 1:有 0:无
|
||||||
|
private int n_people_permission;//新人好礼权限 1:有 0:无
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/25
|
||||||
|
*@description: 绑定详情
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BindDetail {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String alipay_name;//支付宝姓名
|
||||||
|
private String alipay_account;//支付宝账户
|
||||||
|
|
||||||
|
private String bank_card_number;//银行卡号
|
||||||
|
|
||||||
|
private String bank_user_name;//姓名
|
||||||
|
private String bank_card;//所属行
|
||||||
|
private String open_bank;//开户行
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
public class GiftAvatarBean {
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GiftPackEvent {
|
||||||
|
private String bdid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/15
|
||||||
|
*@description: 背包礼物总价值
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GiftPackListCount {
|
||||||
|
private String count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MqttXlhEnd implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String message;
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import com.stx.xhb.xbanner.entity.SimpleBannerInfo;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class PermissionPicBean extends SimpleBannerInfo {
|
||||||
|
private int picId;
|
||||||
|
private int type;//类型 1:首充、2:天降 ;3:新人
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getXBannerUrl() {
|
||||||
|
return picId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RedPackGrab {
|
||||||
|
private int code;//1:正常抢 2:已经抢过了 3:手慢了
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 红包推送的对象
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RedPacketInfo {
|
||||||
|
private int id;
|
||||||
|
private String remark;// 备注
|
||||||
|
private String password;// 口令
|
||||||
|
private int countdown;//0:立即开抢,其他:倒计时抢
|
||||||
|
private String conditions;//条件
|
||||||
|
private String total_amount;//红包总金额
|
||||||
|
private int room_id;//房间ID
|
||||||
|
private int type;//红包类型
|
||||||
|
private int total_count;//红包数量
|
||||||
|
private int coin_type;//币种
|
||||||
|
private int user_id;//用户ID
|
||||||
|
private String nickname;// 昵称
|
||||||
|
private String redpacket_id;//红包ID
|
||||||
|
|
||||||
|
private String avatar;//头像
|
||||||
|
private String redpacket_time;//红包消失的时间
|
||||||
|
private long start_time;
|
||||||
|
|
||||||
|
private boolean isAvailable;//是否可以领取
|
||||||
|
|
||||||
|
private String left_amount;//33.00",
|
||||||
|
private int left_count;
|
||||||
|
private long end_time;
|
||||||
|
private long createtime;
|
||||||
|
private String updatetime;
|
||||||
|
private int is_qiang;
|
||||||
|
|
||||||
|
// 获取剩余时间
|
||||||
|
public long remainingTime() {
|
||||||
|
long needTime = 0;
|
||||||
|
// 获取当前时间戳(毫秒)
|
||||||
|
long currentTimeMillis = System.currentTimeMillis() / 1000;
|
||||||
|
// 计算剩余时间
|
||||||
|
needTime = start_time - currentTimeMillis;
|
||||||
|
return needTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断红包是否可以领取
|
||||||
|
public boolean canOpenNow() {
|
||||||
|
return remainingTime() <= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RedpacketDetail {
|
||||||
|
private RedPacketInfo redpacket_info;
|
||||||
|
|
||||||
|
private List<Records> records;
|
||||||
|
private MyRecord my_record;
|
||||||
|
private boolean has_grabbed;
|
||||||
|
@Data
|
||||||
|
public static class Records {
|
||||||
|
private int id;
|
||||||
|
private int redpacket_id;
|
||||||
|
private int user_id;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
private String amount;
|
||||||
|
private String createtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class MyRecord {
|
||||||
|
private int id;
|
||||||
|
private int redpacket_id;
|
||||||
|
private String nickname;
|
||||||
|
private String user_id;
|
||||||
|
private String avatar;
|
||||||
|
private String amount;
|
||||||
|
private String createtime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/10
|
||||||
|
*@description: 魅力详情列表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RoomUserCharmListBean {
|
||||||
|
private int user_id;
|
||||||
|
private String total_price;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
private String user_code;
|
||||||
|
private int charm;
|
||||||
|
private List<String> icon ;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SearchAll {
|
||||||
|
private List<RoomSearchResp> rooms;
|
||||||
|
private List<UserResultResp> users;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.xscm.moduleutil.bean;
|
||||||
|
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/2
|
||||||
|
*@description: 巡乐会开始后推送的信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class XLHBean implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private String text;
|
||||||
|
private String room_id;
|
||||||
|
|
||||||
|
private int from_type ;//100:巡乐会进度更新 101:巡乐会即将开始 102:巡乐会已经开始 103:巡乐会有人锁定了礼物 104:巡乐会结束落包
|
||||||
|
private BlindBoxBean.XlhData xlh_data;
|
||||||
|
private UserInfo FromUserInfo;
|
||||||
|
private String end_time;
|
||||||
|
private BlindBoxBean.xlhUser room_user;
|
||||||
|
private String gift_num;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
package com.xscm.moduleutil.bean.blindboxwheel;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/8/27
|
||||||
|
*@description: 获取活动礼物列表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BlindBoxBean {
|
||||||
|
private String title;
|
||||||
|
private String rule_url;
|
||||||
|
private String rule;
|
||||||
|
private int box_price ;///每一次抽奖的价格
|
||||||
|
private String xlh_end_time;///巡乐会结束时间
|
||||||
|
private int is_xlh; ///是否开启巡乐会 0 关闭 1 开启
|
||||||
|
private Object xlh_data;
|
||||||
|
private List<GiftBean> gift_list;
|
||||||
|
private String end_time;//巡乐会结束时间
|
||||||
|
|
||||||
|
private GiveGift give_homeowner_gift;//房主礼物
|
||||||
|
private GiveGift locking_gift;//锁定礼物
|
||||||
|
|
||||||
|
|
||||||
|
private xlhUser xlh_user;//巡乐会中奖用户
|
||||||
|
private xlhUser homeowner_user;//房主信息
|
||||||
|
|
||||||
|
public boolean isXlhDataArray() {
|
||||||
|
return xlh_data instanceof JsonArray || xlh_data instanceof List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isXlhDataObject() {
|
||||||
|
return xlh_data instanceof JsonObject || xlh_data instanceof Map || xlh_data instanceof XlhData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<XlhData> getXlhDataAsList() {
|
||||||
|
if (isXlhDataArray()) {
|
||||||
|
// 转换为List
|
||||||
|
return (List<XlhData>) xlh_data;
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public XlhData getXlhDataAsObject() {
|
||||||
|
if (isXlhDataObject()) {
|
||||||
|
// 如果已经是XlhData类型,直接返回
|
||||||
|
if (xlh_data instanceof XlhData) {
|
||||||
|
return (XlhData) xlh_data;
|
||||||
|
}
|
||||||
|
// 如果是Map类型(Gson解析后的LinkedTreeMap),手动转换
|
||||||
|
else if (xlh_data instanceof Map) {
|
||||||
|
Map<String, Object> map = (Map<String, Object>) xlh_data;
|
||||||
|
XlhData xlhData = new XlhData();
|
||||||
|
|
||||||
|
// 安全地转换各个字段
|
||||||
|
Object waitingStartNum = map.get("waiting_start_num");
|
||||||
|
if (waitingStartNum != null) {
|
||||||
|
xlhData.setWaiting_start_num(waitingStartNum.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
Object startNum = map.get("start_num");
|
||||||
|
if (startNum != null) {
|
||||||
|
xlhData.setStart_num(startNum.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
Object currentNum = map.get("current_num");
|
||||||
|
if (currentNum != null) {
|
||||||
|
if (currentNum instanceof Number) {
|
||||||
|
xlhData.setCurrent_num(((Number) currentNum).intValue());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
xlhData.setCurrent_num(Integer.parseInt(currentNum.toString()));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
xlhData.setCurrent_num(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Object status = map.get("status");
|
||||||
|
if (status != null) {
|
||||||
|
if (status instanceof Number) {
|
||||||
|
xlhData.setStatus(((Number) status).intValue());
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
xlhData.setStatus(Integer.parseInt(status.toString()));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
xlhData.setStatus(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object endTime = map.get("end_time");
|
||||||
|
if (endTime != null) {
|
||||||
|
if (endTime instanceof String){
|
||||||
|
xlhData.setEnd_time(endTime.toString());
|
||||||
|
}else {
|
||||||
|
xlhData.setEnd_time(endTime.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return xlhData;
|
||||||
|
}
|
||||||
|
// 如果是JsonObject,也需要转换
|
||||||
|
else if (xlh_data instanceof JsonObject) {
|
||||||
|
JsonObject jsonObject = (JsonObject) xlh_data;
|
||||||
|
XlhData xlhData = new XlhData();
|
||||||
|
|
||||||
|
if (jsonObject.has("waiting_start_num")) {
|
||||||
|
xlhData.setWaiting_start_num(jsonObject.get("waiting_start_num").getAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonObject.has("start_num")) {
|
||||||
|
xlhData.setStart_num(jsonObject.get("start_num").getAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonObject.has("current_num")) {
|
||||||
|
xlhData.setCurrent_num(jsonObject.get("current_num").getAsInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonObject.has("status")) {
|
||||||
|
xlhData.setStatus(jsonObject.get("status").getAsInt());
|
||||||
|
}
|
||||||
|
if (jsonObject.has("end_time")){
|
||||||
|
xlhData.setEnd_time(jsonObject.get("end_time").getAsString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return xlhData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@Data
|
||||||
|
public static class XlhData {
|
||||||
|
private String waiting_start_num;//等待开始需要达到的次数
|
||||||
|
private String start_num;//巡乐会开启需要达到的次数
|
||||||
|
private int current_num;//当前已抽奖次数
|
||||||
|
private int status;
|
||||||
|
private String end_time;
|
||||||
|
}
|
||||||
|
@Data
|
||||||
|
public static class GiveGift {
|
||||||
|
private int gift_id;
|
||||||
|
private String gift_name;
|
||||||
|
private String base_image;
|
||||||
|
private String gift_num;
|
||||||
|
private String gift_price;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class xlhUser {
|
||||||
|
private String user_id;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.xscm.moduleutil.bean.blindboxwheel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author qx
|
||||||
|
* @data 2025/8/27
|
||||||
|
* @description: 礼物抽奖结果
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BlindReslutBean {
|
||||||
|
private String blind_box_turntable_id;//本次抽奖标识 Id 效果完成后用这个值推送发放
|
||||||
|
private List<ReslutList> reslut_list;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ReslutList {
|
||||||
|
private int gift_id;//中奖礼物Id
|
||||||
|
private int count;//中奖礼物数量
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.xscm.moduleutil.bean.blindboxwheel;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/4
|
||||||
|
*@description: 巡乐会抽奖
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class XlhDrawBean {
|
||||||
|
private int gift_id;
|
||||||
|
private String gift_name;
|
||||||
|
private String base_image;
|
||||||
|
private String gift_price;
|
||||||
|
private int count ;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.xscm.moduleutil.bean.room;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
// TODO: 2025/3/10 亲密关系
|
||||||
|
@Data
|
||||||
|
public class CloseBean {
|
||||||
|
private String id;//关系id
|
||||||
|
private String user_id;//用户id
|
||||||
|
private String head_picture; //用户头像
|
||||||
|
private String nickname;//用户昵称
|
||||||
|
private String sex;//性别
|
||||||
|
private String contact_end_time;//剩余天数
|
||||||
|
private String heart_value;//心动值
|
||||||
|
private String friend_config_id;//关系类型id
|
||||||
|
private String relationship_icon ;//关系类型图标
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.xscm.moduleutil.bean.room
|
||||||
|
|
||||||
|
class Emotion {
|
||||||
|
var type_name: String? = ""
|
||||||
|
var id: Int? = 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.xscm.moduleutil.bean.room
|
||||||
|
|
||||||
|
data class EmotionDeatils(
|
||||||
|
var id: Int? = 0,
|
||||||
|
var pid: Int? = 0,
|
||||||
|
var type_id: Int? = 0,
|
||||||
|
var name: String? = "",
|
||||||
|
var image: String? = "",
|
||||||
|
var animate_image : String? = "",
|
||||||
|
var children: List<Children>? =ArrayList (),
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Children(
|
||||||
|
var id: Int? = 0,
|
||||||
|
var pid: Int? = 0,
|
||||||
|
var type_id: Int? = 0,
|
||||||
|
var name: String? = "",
|
||||||
|
var image: String? = "",
|
||||||
|
var animate_image : String? = "",
|
||||||
|
)
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xscm.moduleutil.bean.room;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/8/24
|
||||||
|
*@description: 结束后返回的关系数据,
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FriendUserBean implements Serializable {
|
||||||
|
private int is_cp;//1:卡关系 0:不卡关系
|
||||||
|
private String user1_id;//王者位用户1id
|
||||||
|
private String user1_avatar;//王者位用户1头像
|
||||||
|
private String user1_nickname;//王者位用户1昵称
|
||||||
|
private String user2_id;//王者位用户2id
|
||||||
|
private String user2_avatar;//王者位用户2头像
|
||||||
|
private String user2_nickname;//王者位用户2昵称
|
||||||
|
|
||||||
|
private String heart_value;//连线值
|
||||||
|
|
||||||
|
private String heart_id;//连线值ID
|
||||||
|
private String relation_name;//什么关系
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xscm.moduleutil.bean.room;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 红包的结果集
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RedResultBean {
|
||||||
|
private String redUserName;//发布红包的用户名称
|
||||||
|
private String redUserAvatar;//发布红包的用户头像
|
||||||
|
private String redTitle;//发布红包的备注
|
||||||
|
private String redJb;//中奖的金币
|
||||||
|
private String redyl;//已经领取的个数
|
||||||
|
|
||||||
|
private List<RedBean> redList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class RedBean {
|
||||||
|
private String redUserName;
|
||||||
|
private String redUserAvatar;
|
||||||
|
private String redNum;
|
||||||
|
private String redTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.xscm.moduleutil.bean.room;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
// TODO: 2025/3/12 关系表
|
||||||
|
@Data
|
||||||
|
public class RoomConcernDean {
|
||||||
|
|
||||||
|
private String concernName;
|
||||||
|
private String concernType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.xscm.moduleutil.bean.room;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/29
|
||||||
|
*@description:小时榜实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RoomHourBean {
|
||||||
|
private String time_range;
|
||||||
|
private List<RoomListBean> lists;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RoomListBean {
|
||||||
|
private String room_id;
|
||||||
|
private String room_name;
|
||||||
|
private int label_id;
|
||||||
|
private String room_cover;
|
||||||
|
private int total_price;
|
||||||
|
private String label_icon;
|
||||||
|
private int xlh_status;
|
||||||
|
private int redpacket_status;// >0 有红包,=0 没有红包
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
package com.xscm.moduleutil.dialog;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Choreographer;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogNewRankingXlhFragmentBinding;
|
||||||
|
import com.xscm.moduleutil.databinding.FframentDataBinding;
|
||||||
|
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryContacts;
|
||||||
|
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryPresenter;
|
||||||
|
import com.xscm.moduleutil.dialog.giftLottery.GiftRecordAdapte;
|
||||||
|
import com.xscm.moduleutil.dialog.giftLottery.NewGiftRecordAdapte;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LotteryFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FframentDataBinding> implements GiftLotteryContacts.View {
|
||||||
|
private int page=1;
|
||||||
|
private String roomId;
|
||||||
|
private int type=-1;
|
||||||
|
private GiftRecordAdapte giftRecordAdapte;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GiftLotteryPresenter bindPresenter() {
|
||||||
|
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||||
|
}
|
||||||
|
public static LotteryFragment newInstance(String giftBagId,int type) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
LotteryFragment fragment = new LotteryFragment();
|
||||||
|
args.putString("roomId", giftBagId);
|
||||||
|
args.putInt("type",type);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
roomId = getArguments().getString("roomId");
|
||||||
|
type = getArguments().getInt("type");
|
||||||
|
MvpPre.xlhAllRecord(roomId, "1", "20",type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
|
||||||
|
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page = 1;
|
||||||
|
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page++;
|
||||||
|
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
giftRecordAdapte=new GiftRecordAdapte();
|
||||||
|
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
|
||||||
|
mBinding.recyclerView.setAdapter(giftRecordAdapte);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.fframent_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||||
|
|
||||||
|
if (data != null){
|
||||||
|
if (page==1){
|
||||||
|
giftRecordAdapte.setNewData(data);
|
||||||
|
}else {
|
||||||
|
giftRecordAdapte.addData(data);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (page == 1) {
|
||||||
|
giftRecordAdapte.setNewData(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRefreshLoadMore() {
|
||||||
|
mBinding.smartRefreshLayout.finishRefresh();
|
||||||
|
mBinding.smartRefreshLayout.finishLoadMore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wallet(WalletBean walletBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,368 @@
|
|||||||
|
package com.xscm.moduleutil.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.RadioButton;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.blankj.utilcode.util.ScreenUtils;
|
||||||
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.adapter.HeavenGiftAdapter;
|
||||||
|
import com.xscm.moduleutil.bean.BaseListData;
|
||||||
|
import com.xscm.moduleutil.bean.FirstChargeGiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||||
|
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogNewPeopleBinding;
|
||||||
|
import com.xscm.moduleutil.http.BaseObserver;
|
||||||
|
import com.xscm.moduleutil.http.RetrofitClient;
|
||||||
|
import com.xscm.moduleutil.utils.ColorManager;
|
||||||
|
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||||
|
import com.zhpan.bannerview.indicator.DrawableIndicator;
|
||||||
|
import com.zhpan.indicator.base.IIndicator;
|
||||||
|
import com.zhpan.indicator.enums.IndicatorSlideMode;
|
||||||
|
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author
|
||||||
|
* @data
|
||||||
|
* @description: 新人好礼
|
||||||
|
*/
|
||||||
|
public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||||
|
|
||||||
|
HeavenGiftAdapter heavenGiftAdapter;
|
||||||
|
FirstChargeGiftBean firstChargeGiftBean;
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
public NewPeopleDialog(@NonNull Context context) {
|
||||||
|
super(context, R.style.BaseDialogStyleH);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLayoutId() {
|
||||||
|
return R.layout.dialog_new_people;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initView() {
|
||||||
|
setCancelable(false);
|
||||||
|
setCanceledOnTouchOutside(false);
|
||||||
|
Window window = getWindow();
|
||||||
|
window.setLayout((int) (ScreenUtils.getScreenWidth() * 375.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||||
|
mBinding.ivClose.setOnClickListener(v -> dismiss());
|
||||||
|
|
||||||
|
heavenGiftAdapter = new HeavenGiftAdapter();
|
||||||
|
mBinding.bannerViewPager
|
||||||
|
.setPageMargin(15)
|
||||||
|
.setAutoPlay(false)
|
||||||
|
.setRevealWidth(0, 0)
|
||||||
|
.setIndicatorVisibility(View.VISIBLE)
|
||||||
|
.setIndicatorView(getVectorDrawableIndicator())
|
||||||
|
.setIndicatorSlideMode(IndicatorSlideMode.NORMAL)
|
||||||
|
.setAdapter(heavenGiftAdapter)
|
||||||
|
.create();
|
||||||
|
|
||||||
|
mBinding.rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(RadioGroup radioGroup, int i) {
|
||||||
|
if (firstChargeGiftBean == null || firstChargeGiftBean.getGift_bag().size() == 0) {
|
||||||
|
ToastUtils.showShort("暂无礼包");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == R.id.btn_0) {
|
||||||
|
List<RoonGiftModel> list = new ArrayList<>();
|
||||||
|
if (firstChargeGiftBean.getGift_bag().size() > 1) {
|
||||||
|
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle1());
|
||||||
|
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle2());
|
||||||
|
mBinding.tvTitle2.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
mBinding.btn0.setText(firstChargeGiftBean.getGift_bag().get(0).getName());
|
||||||
|
list.addAll(firstChargeGiftBean.getGift_bag().get(0).getGift_list());
|
||||||
|
mBinding.bannerViewPager.create(baseListData(list, 4));
|
||||||
|
}
|
||||||
|
type = 1;
|
||||||
|
} else if (i == R.id.btn_1) {
|
||||||
|
List<RoonGiftModel> list = new ArrayList<>();
|
||||||
|
if (firstChargeGiftBean.getGift_bag().size() > 2) {
|
||||||
|
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(1).getTitle1());
|
||||||
|
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(1).getTitle2());
|
||||||
|
mBinding.tvTitle2.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
mBinding.btn1.setText(firstChargeGiftBean.getGift_bag().get(1).getName());
|
||||||
|
list.addAll(firstChargeGiftBean.getGift_bag().get(1).getGift_list());
|
||||||
|
mBinding.bannerViewPager.create(baseListData(list, 4));
|
||||||
|
}
|
||||||
|
type = 2;
|
||||||
|
} else if (i == R.id.btn_2) {
|
||||||
|
List<RoonGiftModel> list = new ArrayList<>();
|
||||||
|
if (firstChargeGiftBean.getGift_bag().size() > 3) {
|
||||||
|
if (firstChargeGiftBean.getGift_bag().get(2) != null) {
|
||||||
|
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(2).getTitle1());
|
||||||
|
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(2).getTitle2());
|
||||||
|
mBinding.tvTitle2.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
|
||||||
|
mBinding.btn2.setText(firstChargeGiftBean.getGift_bag().get(2).getName());
|
||||||
|
list.addAll(firstChargeGiftBean.getGift_bag().get(2).getGift_list());
|
||||||
|
mBinding.bannerViewPager.create(baseListData(list, 4));
|
||||||
|
type = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (i == R.id.btn_3) {
|
||||||
|
List<RoonGiftModel> list = new ArrayList<>();
|
||||||
|
if (firstChargeGiftBean.getGift_bag().size() >= 4) {
|
||||||
|
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(3).getTitle1());
|
||||||
|
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(3).getTitle2());
|
||||||
|
mBinding.btn3.setText(firstChargeGiftBean.getGift_bag().get(3).getName());
|
||||||
|
mBinding.tvTitle2.setPaintFlags(0); // 清除所有绘制标志
|
||||||
|
list.addAll(firstChargeGiftBean.getGift_bag().get(3).getGift_list());
|
||||||
|
mBinding.bannerViewPager.create(baseListData(list, 4));
|
||||||
|
type = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mBinding.rg.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mBinding.tvInvite.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
// RechargeDialogFragment.show(roomId, getSupportFragmentManager());
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onFirstChargeConfirmed(firstChargeGiftBean, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnFirstChargeListener {
|
||||||
|
void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type);
|
||||||
|
|
||||||
|
void onFirstChargeCancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
private OnFirstChargeListener listener;
|
||||||
|
|
||||||
|
// 设置监听器的方法
|
||||||
|
public void setOnFirstChargeListener(OnFirstChargeListener listener) {
|
||||||
|
this.listener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initData() {
|
||||||
|
RetrofitClient.getInstance().getNewChargeGift(new BaseObserver<FirstChargeGiftBean>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(FirstChargeGiftBean firstChargeGiftBean) {
|
||||||
|
if (firstChargeGiftBean != null) {
|
||||||
|
showGift(firstChargeGiftBean);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<BaseListData<RoonGiftModel>> baseListData(List<RoonGiftModel> list, int chunkSize) {
|
||||||
|
List<BaseListData<RoonGiftModel>> baseListData = new ArrayList<>();
|
||||||
|
for (int i = 0; i < list.size(); i += chunkSize) {
|
||||||
|
BaseListData<RoonGiftModel> baseListData1 = new BaseListData<>();
|
||||||
|
baseListData1.setData(list.subList(i, Math.min(i + chunkSize, list.size())));
|
||||||
|
baseListData.add(baseListData1);
|
||||||
|
}
|
||||||
|
return baseListData;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IIndicator getVectorDrawableIndicator() {
|
||||||
|
int dp6 = getResources().getDimensionPixelOffset(com.xscm.moduleutil.R.dimen.dp_6);
|
||||||
|
return new DrawableIndicator(getContext())
|
||||||
|
.setIndicatorGap(getResources().getDimensionPixelOffset(com.xscm.moduleutil.R.dimen.dp_2_5))
|
||||||
|
.setIndicatorDrawable(com.xscm.moduleutil.R.drawable.banner_indicator_nornal, com.xscm.moduleutil.R.drawable.banner_indicator_focus)
|
||||||
|
.setIndicatorSize(getResources().getDimensionPixelOffset(com.xscm.moduleutil.R.dimen.dp_13), dp6, getResources().getDimensionPixelOffset(com.xscm.moduleutil.R.dimen.dp_13), dp6);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Resources getResources() {
|
||||||
|
return getContext().getResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showGift(FirstChargeGiftBean firstChargeGiftBean) {
|
||||||
|
this.firstChargeGiftBean = firstChargeGiftBean;
|
||||||
|
mBinding.rg.check(R.id.btn_0);
|
||||||
|
if (firstChargeGiftBean.getGift_bag() != null && firstChargeGiftBean.getGift_bag().size() > 0) {
|
||||||
|
if (firstChargeGiftBean.getGift_bag().size() >= 0) {
|
||||||
|
type = 1;
|
||||||
|
List<RoonGiftModel> list = new ArrayList<>();
|
||||||
|
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle1());
|
||||||
|
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle2());
|
||||||
|
mBinding.btn0.setText(firstChargeGiftBean.getGift_bag().get(0).getName());
|
||||||
|
list.addAll(firstChargeGiftBean.getGift_bag().get(0).getGift_list());
|
||||||
|
mBinding.bannerViewPager.create(baseListData(list, 4));
|
||||||
|
|
||||||
|
|
||||||
|
mBinding.btn1.setText(firstChargeGiftBean.getGift_bag().get(1).getName());
|
||||||
|
mBinding.btn2.setText(firstChargeGiftBean.getGift_bag().get(2).getName());
|
||||||
|
mBinding.btn3.setText(firstChargeGiftBean.getGift_bag().get(3).getName());
|
||||||
|
|
||||||
|
initGiftBagButtonStatus(firstChargeGiftBean);
|
||||||
|
} else if (firstChargeGiftBean.getGift_bag().size() == 2) {
|
||||||
|
// mBinding.rg.check(R.id.btn_0);
|
||||||
|
// mBinding.btn1.setVisibility(View.VISIBLE);
|
||||||
|
// mBinding.btn2.setVisibility(View.INVISIBLE);
|
||||||
|
} else if (firstChargeGiftBean.getGift_bag().size() == 3) {
|
||||||
|
// mBinding.rg.check(R.id.btn_0);
|
||||||
|
// mBinding.btn1.setVisibility(View.VISIBLE);
|
||||||
|
// mBinding.btn2.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
// mBinding.rg.check(R.id.btn_0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isstatus = true;
|
||||||
|
|
||||||
|
private void initGiftBagButtonStatus(FirstChargeGiftBean firstChargeGiftBean) {
|
||||||
|
// 1. 准备按钮列表:顺序与gift_bag中的元素顺序一一对应
|
||||||
|
List<RadioButton> buttonList = Arrays.asList(
|
||||||
|
mBinding.btn0,
|
||||||
|
mBinding.btn1,
|
||||||
|
mBinding.btn2
|
||||||
|
// 未来加按钮:mBinding.btn3, mBinding.btn4...
|
||||||
|
);
|
||||||
|
|
||||||
|
// 2. 空安全检查:先判断核心对象/列表非空
|
||||||
|
if (firstChargeGiftBean != null && firstChargeGiftBean.getGift_bag() != null) {
|
||||||
|
List<FirstChargeGiftBean.GiftBag> giftBagList = firstChargeGiftBean.getGift_bag();
|
||||||
|
|
||||||
|
// 3. 循环处理每个按钮
|
||||||
|
for (int i = 0; i < buttonList.size(); i++) {
|
||||||
|
RadioButton currentBtn = buttonList.get(i);
|
||||||
|
// 4. 索引防护:若gift_bag列表长度不足,默认按status=0处理
|
||||||
|
int status = (i < giftBagList.size()) ? giftBagList.get(i).getStatus() : 0;
|
||||||
|
// 检查是否有status=0的情况,如果有则将isStatus设为false
|
||||||
|
if (status == 0) {
|
||||||
|
isstatus = false;
|
||||||
|
}
|
||||||
|
setButtonStatus(currentBtn, status, i); // 增加索引参数
|
||||||
|
}
|
||||||
|
updateRechargeTextViewStatus(isstatus, 0);
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 5. 兜底逻辑:数据为空时,所有按钮按status=0处理
|
||||||
|
for (int i = 0; i < buttonList.size(); i++) {
|
||||||
|
setButtonStatus(buttonList.get(i), 0, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工具方法:统一设置单个按钮的状态
|
||||||
|
*
|
||||||
|
* @param button 要设置的RadioButton
|
||||||
|
* @param status 状态值
|
||||||
|
* @param index 按钮索引,用于标识不同按钮
|
||||||
|
*/
|
||||||
|
private void setButtonStatus(RadioButton button, int status, int index) {
|
||||||
|
if (button == null) return;
|
||||||
|
|
||||||
|
// 移除之前的点击监听器,避免重复设置
|
||||||
|
button.setOnClickListener(null);
|
||||||
|
|
||||||
|
if (status == 1) {
|
||||||
|
// 可用状态
|
||||||
|
button.setEnabled(true);
|
||||||
|
// button.setChecked(true);
|
||||||
|
|
||||||
|
// 恢复充值按钮状态
|
||||||
|
updateRechargeTextViewStatus(true, index);
|
||||||
|
button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
updateRechargeTextViewStatus(true, index);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// status=0和其他状态:特殊处理
|
||||||
|
button.setEnabled(true); // 保持可点击以响应交互
|
||||||
|
// button.setChecked(false);
|
||||||
|
// 设置特殊背景(根据需求修改为你的资源)
|
||||||
|
button.setBackground(getResources().getDrawable(R.drawable.bf_e9));
|
||||||
|
button.setTextColor(getResources().getColor(R.color.colorBlack65));
|
||||||
|
updateRechargeTextViewStatus(false, index);
|
||||||
|
// 添加点击事件
|
||||||
|
button.setOnClickListener(v -> {
|
||||||
|
// 点击时再次确认是status=0状态才处理
|
||||||
|
button.setBackground(getResources().getDrawable(R.drawable.banner_indicator_focus));
|
||||||
|
// 更新充值按钮状态为不可点击
|
||||||
|
updateRechargeTextViewStatus(false, index);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否至少有一个元素达标(status == 1)
|
||||||
|
*/
|
||||||
|
public static boolean hasAnyQualified(List<FirstChargeGiftBean.GiftBag> giftBagList) {
|
||||||
|
// 空列表处理 + 任意匹配检查
|
||||||
|
return giftBagList != null && !giftBagList.isEmpty()
|
||||||
|
&& giftBagList.stream()
|
||||||
|
.anyMatch(gift -> gift.getStatus() == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新充值TextView的状态
|
||||||
|
*
|
||||||
|
* @param enabled 是否可点击
|
||||||
|
* @param index 关联的按钮索引
|
||||||
|
*/
|
||||||
|
private void updateRechargeTextViewStatus(boolean enabled, int index) {
|
||||||
|
TextView rechargeTv = mBinding.tvInvite; // 假设充值按钮的id是tvRecharge
|
||||||
|
if (rechargeTv == null) return;
|
||||||
|
|
||||||
|
// 设置是否可点击
|
||||||
|
rechargeTv.setEnabled(enabled);
|
||||||
|
|
||||||
|
// 根据状态和索引设置不同背景
|
||||||
|
if (enabled) {
|
||||||
|
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvInvite, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||||
|
mBinding.tvInvite.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
// 不可点击状态的背景
|
||||||
|
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvInvite, ColorManager.getInstance().getButtonColorInt(), 53);
|
||||||
|
mBinding.tvInvite.setTextColor(getResources().getColor(R.color.colorBlack65));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,228 @@
|
|||||||
|
package com.xscm.moduleutil.dialog;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.webkit.JavascriptInterface;
|
||||||
|
import android.webkit.WebSettings;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
|
import com.blankj.utilcode.util.ScreenUtils;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||||
|
import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat;
|
||||||
|
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||||
|
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||||
|
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||||||
|
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogRoomAuctionWebviewBinding;
|
||||||
|
import com.xscm.moduleutil.databinding.WebViewDialogBinding;
|
||||||
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
|
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/24
|
||||||
|
*@description: 这是拍卖房的规则界面
|
||||||
|
*/
|
||||||
|
public class RoomAuctionWebViewDialog extends BaseDialog<DialogRoomAuctionWebviewBinding> {
|
||||||
|
|
||||||
|
String mUrl;
|
||||||
|
int type;//10:天空之境 11:岁月之城 12:时空之巅
|
||||||
|
|
||||||
|
public RoomAuctionWebViewDialog(@NonNull Context context, Bundle args) {
|
||||||
|
super(context, R.style.BaseDialogStyleH);
|
||||||
|
this.mUrl = args.getString("url");
|
||||||
|
this.type = args.getInt("type");
|
||||||
|
initData1();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
if (getWindow() != null) {
|
||||||
|
// 获取屏幕尺寸
|
||||||
|
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
|
||||||
|
// 设置高度为屏幕高度的80%
|
||||||
|
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||||
|
params.height = (int) (displayMetrics.heightPixels * 0.9);
|
||||||
|
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
|
getWindow().setAttributes(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public int getLayoutId() {
|
||||||
|
return R.layout.dialog_room_auction_webview;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initView() {
|
||||||
|
setCancelable(true);
|
||||||
|
setCanceledOnTouchOutside(true);
|
||||||
|
Window window = getWindow();
|
||||||
|
assert window != null;
|
||||||
|
window.setGravity(Gravity.BOTTOM);
|
||||||
|
window.setLayout((int) (ScreenUtils.getScreenWidth() * 320.f / 375), WindowManager.LayoutParams.MATCH_PARENT);
|
||||||
|
mBinding.topBar.setTitle("规则");
|
||||||
|
mBinding.topBar.getIvBack().setOnClickListener(v -> dismiss());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void initData1() {
|
||||||
|
// WebSettings webSettings = mBinding.webView.getSettings();
|
||||||
|
// webSettings.setUseWideViewPort(true);
|
||||||
|
// webSettings.setLoadWithOverviewMode(true);
|
||||||
|
// webSettings.setJavaScriptEnabled(true);
|
||||||
|
// webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
|
||||||
|
// //增加JSBridge
|
||||||
|
// mBinding.webView.addJavascriptInterface(new WebAppInterface(getContext()), "Android");
|
||||||
|
//// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
|
||||||
|
// webSettings.setBuiltInZoomControls(false);
|
||||||
|
// webSettings.setSupportZoom(false);
|
||||||
|
// webSettings.setDomStorageEnabled(true);
|
||||||
|
// webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||||
|
// // 启用 WebView 内容的滚动
|
||||||
|
// mBinding.webView.setVerticalScrollBarEnabled(true);
|
||||||
|
// mBinding.webView.setScrollbarFadingEnabled(true);
|
||||||
|
// webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
|
// webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||||
|
// mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||||
|
// mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
|
||||||
|
// mBinding.webView.setWebViewClient(new WebViewClient());
|
||||||
|
// mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||||
|
// mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||||
|
//
|
||||||
|
// mBinding.webView.requestFocus();
|
||||||
|
// mBinding.webView.loadUrl(mUrl);
|
||||||
|
|
||||||
|
WebSettings webSettings = mBinding.webView.getSettings();
|
||||||
|
webSettings.setUseWideViewPort(true);
|
||||||
|
webSettings.setLoadWithOverviewMode(true);
|
||||||
|
webSettings.setJavaScriptEnabled(true);
|
||||||
|
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
|
||||||
|
//增加JSBridge
|
||||||
|
mBinding.webView.addJavascriptInterface(new WebAppInterface(getContext()), "Android");
|
||||||
|
// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
|
||||||
|
webSettings.setBuiltInZoomControls(false);
|
||||||
|
webSettings.setSupportZoom(false);
|
||||||
|
webSettings.setDomStorageEnabled(true);
|
||||||
|
webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||||
|
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||||
|
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||||
|
// 启用 WebView 内容的滚动,但隐藏滚动条
|
||||||
|
mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||||
|
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示滚动条
|
||||||
|
mBinding.webView.setWebViewClient(new WebViewClient());
|
||||||
|
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||||
|
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||||
|
|
||||||
|
// 确保内容可以滚动
|
||||||
|
webSettings.setDomStorageEnabled(true);
|
||||||
|
|
||||||
|
mBinding.webView.requestFocus();
|
||||||
|
mBinding.webView.loadUrl(mUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Resources getResources() {
|
||||||
|
return getContext().getResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class WebAppInterface {
|
||||||
|
Context mContext;
|
||||||
|
|
||||||
|
WebAppInterface(Context c) {
|
||||||
|
mContext = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 被 H5 调用的方法
|
||||||
|
@JavascriptInterface
|
||||||
|
public void showToast(String toast) {
|
||||||
|
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void closeWeb() {
|
||||||
|
LogUtils.e("value: ");
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void customerService() {
|
||||||
|
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(); // 填移动应用(App)的 AppId
|
||||||
|
IWXAPI api = WXAPIFactory.createWXAPI(mContext, appId);
|
||||||
|
|
||||||
|
// 判断当前版本是否支持拉起客服会话
|
||||||
|
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
|
||||||
|
req.corpId = "ww1de4300858c0b461"; // 企业ID
|
||||||
|
req.url = "https://work.weixin.qq.com/kfid/kfcb3d23a59c188a0e7"; // 客服URL
|
||||||
|
api.sendReq(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void jumpRoomPage(String room_id) {
|
||||||
|
RoomManager.getInstance().fetchRoomDataAndEnter(getContext(), room_id,"");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
|
||||||
|
}
|
||||||
|
@JavascriptInterface
|
||||||
|
public void jumpWebPage(String objects) {
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation();
|
||||||
|
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", objects).navigation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void enterGroupChat(String group_id,String cover,String guild_name) {
|
||||||
|
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
|
||||||
|
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
|
||||||
|
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void chatWithUser(String user_id,String nickname) {
|
||||||
|
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
|
||||||
|
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
|
||||||
|
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
||||||
|
mContext.startActivity(intent);
|
||||||
|
}
|
||||||
|
@JavascriptInterface
|
||||||
|
public void exchange(){
|
||||||
|
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void Withdrawal() {
|
||||||
|
ARouter.getInstance().build(ARouteConstants.WITHDRAWAL_ACTIVITY).navigation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void enterAuthent() {//实名认证
|
||||||
|
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
public void Recharge(){
|
||||||
|
ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
|
|
||||||
|
public class GiftItemAdapter extends BaseQuickAdapter<XlhDrawBean, BaseViewHolder> {
|
||||||
|
public GiftItemAdapter() {
|
||||||
|
super(R.layout.item_xlh_gift);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, XlhDrawBean item) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_gift_name, item.getGift_name()+"x"+item.getCount());
|
||||||
|
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.gift_img));
|
||||||
|
helper.setText(R.id.tv_gift_num, item.getGift_price());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/8/25
|
||||||
|
*@description: 盲盒抽奖的实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class GiftLottery {
|
||||||
|
private String id;
|
||||||
|
private String icon;
|
||||||
|
private String number;
|
||||||
|
private String name;
|
||||||
|
private String price;
|
||||||
|
private boolean isSelected;
|
||||||
|
|
||||||
|
public GiftLottery(String id, String icon, String number, String name, String price, boolean isSelected) {
|
||||||
|
this.id = id;
|
||||||
|
this.icon = icon;
|
||||||
|
this.number = number;
|
||||||
|
this.name = name;
|
||||||
|
this.price = price;
|
||||||
|
this.isSelected = isSelected;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.animation.AnimatorSet;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.ScaleAnimation;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBoxBean;
|
||||||
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author qx
|
||||||
|
* @data 2025/8/25
|
||||||
|
* @description: 盲盒抽奖展示的视图
|
||||||
|
*/
|
||||||
|
// GiftLotteryAdapter.java
|
||||||
|
public class GiftLotteryAdapter extends BaseQuickAdapter<GiftBean, BaseViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
|
public GiftLotteryAdapter() {
|
||||||
|
super(R.layout.item_gift_lottery);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||||
|
helper.setText(R.id.tv_gift_time, item.getCreatetime());
|
||||||
|
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_image));
|
||||||
|
// 使用 SpannableString 给 "x4" 设置不同颜色
|
||||||
|
TextView giftNameTextView = helper.getView(R.id.gift_name);
|
||||||
|
TextView nickNameTextView = helper.getView(R.id.tv_user_name);
|
||||||
|
if (giftNameTextView != null) {
|
||||||
|
String baseName = item.getGift_name();
|
||||||
|
String countText = "x"+item.getCount();
|
||||||
|
String fullText = baseName + countText;
|
||||||
|
|
||||||
|
SpannableStringBuilder spannable = new SpannableStringBuilder(fullText);
|
||||||
|
|
||||||
|
// 给 "x4" 部分设置颜色
|
||||||
|
spannable.setSpan(
|
||||||
|
new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_C7BF62)), // 替换为实际颜色
|
||||||
|
baseName.length(),
|
||||||
|
fullText.length(),
|
||||||
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
|
);
|
||||||
|
|
||||||
|
giftNameTextView.setText(spannable);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nickNameTextView!=null){
|
||||||
|
nickNameTextView.setText(item.getNickname());
|
||||||
|
String nickName = "赠予";
|
||||||
|
String fullText = nickName + " " + item.getNickname();
|
||||||
|
SpannableStringBuilder spannable = new SpannableStringBuilder(fullText);
|
||||||
|
|
||||||
|
// 给 "x4" 部分设置颜色
|
||||||
|
spannable.setSpan(
|
||||||
|
new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_C7BF62)), // 替换为实际颜色
|
||||||
|
0,
|
||||||
|
nickName.length(),
|
||||||
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
|
);
|
||||||
|
|
||||||
|
nickNameTextView.setText(spannable);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogGiftLotteryFragmentBinding;
|
||||||
|
import com.xscm.moduleutil.widget.pagerecyclerview.PagerGridSnapHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/8/28
|
||||||
|
*@description: 盲盒转盘中奖记录
|
||||||
|
*/
|
||||||
|
public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, DialogGiftLotteryFragmentBinding> implements GiftLotteryContacts.View{
|
||||||
|
|
||||||
|
private int page=1;
|
||||||
|
private String giftBagId;
|
||||||
|
private int type=1;
|
||||||
|
private GiftLotteryAdapter adapter;
|
||||||
|
private GiftRecordAdapte giftRecordAdapte;
|
||||||
|
private List<GiftBean> data=new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GiftLotteryPresenter bindPresenter() {
|
||||||
|
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GiftLotteryDialogFragment newInstance(String giftBagId) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
GiftLotteryDialogFragment fragment = new GiftLotteryDialogFragment();
|
||||||
|
args.putString("giftBagId", giftBagId);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
dialog.setCancelable(true);
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Window window = getDialog().getWindow();
|
||||||
|
if (window != null) {
|
||||||
|
// 获取屏幕高度
|
||||||
|
android.util.DisplayMetrics displayMetrics = new android.util.DisplayMetrics();
|
||||||
|
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int screenHeight = displayMetrics.heightPixels;
|
||||||
|
// 设置高度为屏幕高度的100%(全屏)
|
||||||
|
int heightInPx = (int) (screenHeight * 0.8);;
|
||||||
|
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||||
|
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
|
|
||||||
|
// 可选:设置动画样式(从底部弹出)
|
||||||
|
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initDialogStyle(Window window) {
|
||||||
|
super.initDialogStyle(window);
|
||||||
|
window.setGravity(Gravity.BOTTOM);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
giftBagId = getArguments().getString("giftBagId");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
MvpPre.getMyRecord(giftBagId, "1", "20",type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
|
||||||
|
if (giftBagId.equals("10")){
|
||||||
|
mBinding.clRoot.setBackgroundResource(R.mipmap.tkzj);
|
||||||
|
mBinding.imJc.setImageResource(R.mipmap.jilu);
|
||||||
|
}else if (giftBagId.equals("11")){
|
||||||
|
mBinding.clRoot.setBackgroundResource(R.mipmap.syzc);
|
||||||
|
mBinding.imJc.setImageResource(R.mipmap.syzc_jl);
|
||||||
|
}else if (giftBagId.equals("12")){
|
||||||
|
mBinding.clRoot.setBackgroundResource(R.mipmap.skzj);
|
||||||
|
mBinding.imJc.setImageResource(R.mipmap.skzl_jl);
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page = 1;
|
||||||
|
MvpPre.getMyRecord(giftBagId, page+"", "20",type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page++;
|
||||||
|
MvpPre.getMyRecord(giftBagId, page+"", "20",type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mBinding.textView1.setOnClickListener(this::onClick);
|
||||||
|
mBinding.textView2.setOnClickListener(this::onClick);
|
||||||
|
|
||||||
|
adapter=new GiftLotteryAdapter();
|
||||||
|
giftRecordAdapte=new GiftRecordAdapte();
|
||||||
|
|
||||||
|
// PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL);
|
||||||
|
|
||||||
|
dianj(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onClick(View view) {
|
||||||
|
int id = view.getId();
|
||||||
|
if (id==R.id.textView1){
|
||||||
|
dianj(1);
|
||||||
|
}else if (id==R.id.textView2){
|
||||||
|
dianj(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void dianj(int type1){
|
||||||
|
if (type1==1) {
|
||||||
|
GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 3);
|
||||||
|
|
||||||
|
mBinding.recyclerView.setLayoutManager(layoutManager);
|
||||||
|
mBinding.recyclerView.setOnFlingListener(null);
|
||||||
|
// 设置滚动辅助工具
|
||||||
|
PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper();
|
||||||
|
pageSnapHelper.attachToRecyclerView(mBinding.recyclerView);
|
||||||
|
mBinding.recyclerView.setAdapter(adapter);
|
||||||
|
type=1;
|
||||||
|
setTextViewStyle(mBinding.textView2, false);
|
||||||
|
setTextViewStyle(mBinding.textView1, true);
|
||||||
|
}else if (type1==2){
|
||||||
|
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
|
||||||
|
mBinding.recyclerView.setAdapter(giftRecordAdapte);
|
||||||
|
type=2;
|
||||||
|
setTextViewStyle(mBinding.textView2, true);
|
||||||
|
setTextViewStyle(mBinding.textView1, false);
|
||||||
|
}
|
||||||
|
page=1;
|
||||||
|
data.clear();
|
||||||
|
MvpPre.getMyRecord(giftBagId, page+"", "20",type);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTextViewStyle(TextView textView, boolean isSelected) {
|
||||||
|
if (isSelected) {
|
||||||
|
textView.setTextColor(getResources().getColor(R.color.white));
|
||||||
|
textView.setTextSize(16);
|
||||||
|
textView.setBackground(getResources().getDrawable(R.mipmap.tab_dy));
|
||||||
|
} else {
|
||||||
|
textView.setTextColor(getResources().getColor(R.color.color_5B5B5B));
|
||||||
|
textView.setTextSize(14);
|
||||||
|
textView.setBackgroundColor(getResources().getColor(R.color.transparent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.dialog_gift_lottery_fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||||
|
if (data != null){
|
||||||
|
if (page==1){
|
||||||
|
adapter.setNewData(data);
|
||||||
|
}else {
|
||||||
|
adapter.addData(data);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (page == 1) {
|
||||||
|
adapter.setNewData(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||||
|
|
||||||
|
if (data != null){
|
||||||
|
if (page==1){
|
||||||
|
giftRecordAdapte.setNewData(data);
|
||||||
|
}else {
|
||||||
|
giftRecordAdapte.addData(data);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (page == 1) {
|
||||||
|
giftRecordAdapte.setNewData(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRefreshLoadMore() {
|
||||||
|
mBinding.smartRefreshLayout.finishRefresh();
|
||||||
|
mBinding.smartRefreshLayout.finishLoadMore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wallet(WalletBean walletBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
|
|
||||||
|
public class GiftRecordAdapte extends BaseQuickAdapter<GiftBean, BaseViewHolder> {
|
||||||
|
public GiftRecordAdapte() {
|
||||||
|
super(R.layout.item_gift_record);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_user_name, item.getNickname());
|
||||||
|
helper.setText(R.id.tv_gift_count_name,"x"+item.getCount()+" "+ item.getGift_name());
|
||||||
|
helper.setText(R.id.tv_time, item.getCreatetime());
|
||||||
|
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_icon));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
|
|
||||||
|
public class GiftRecordAdapter extends BaseQuickAdapter<GiftBean, BaseViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
|
public GiftRecordAdapter() {
|
||||||
|
super(R.layout.item_my_record);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||||
|
helper.setText(R.id.tv_gift_time, item.getCreatetime());
|
||||||
|
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_image));
|
||||||
|
// 使用 SpannableString 给 "x4" 设置不同颜色
|
||||||
|
TextView giftNameTextView = helper.getView(R.id.tv_gift_name);
|
||||||
|
if (giftNameTextView != null) {
|
||||||
|
String baseName = item.getGift_name();
|
||||||
|
String countText = "x"+item.getCount();
|
||||||
|
String fullText = baseName + countText;
|
||||||
|
|
||||||
|
SpannableStringBuilder spannable = new SpannableStringBuilder(fullText);
|
||||||
|
|
||||||
|
// 给 "x4" 部分设置颜色
|
||||||
|
spannable.setSpan(
|
||||||
|
new ForegroundColorSpan(mContext.getResources().getColor(R.color.color_C7BF62)), // 替换为实际颜色
|
||||||
|
baseName.length(),
|
||||||
|
fullText.length(),
|
||||||
|
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||||
|
);
|
||||||
|
|
||||||
|
giftNameTextView.setText(spannable);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class GiftXlhChouAdapter extends BaseQuickAdapter<GiftBean, BaseViewHolder> {
|
||||||
|
private List<GiftBean> giftLists = new ArrayList<>();
|
||||||
|
private int selectedPosition = -1;
|
||||||
|
private static final int LOOP_COUNT = 8; // 循环倍数
|
||||||
|
|
||||||
|
|
||||||
|
public GiftXlhChouAdapter() {
|
||||||
|
super(R.layout.item_xlh);
|
||||||
|
}
|
||||||
|
// 设置数据时创建循环数据
|
||||||
|
@Override
|
||||||
|
public void setNewData(List<GiftBean> data) {
|
||||||
|
this.giftLists = data != null ? data : new ArrayList<>();
|
||||||
|
super.setNewData(createLoopData());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建循环数据
|
||||||
|
* @return 循环数据列表
|
||||||
|
*/
|
||||||
|
private List<GiftBean> createLoopData() {
|
||||||
|
List<GiftBean> loopData = new ArrayList<>();
|
||||||
|
if (giftLists.isEmpty()) {
|
||||||
|
return loopData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建足够多的循环数据以实现循环效果
|
||||||
|
for (int i = 0; i < LOOP_COUNT; i++) {
|
||||||
|
loopData.addAll(giftLists);
|
||||||
|
}
|
||||||
|
return loopData;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
// 如果原始数据为空,返回0
|
||||||
|
if (giftLists.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// 返回循环数据的数量
|
||||||
|
return super.getItemCount();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取实际位置(将循环位置映射到原始数据位置)
|
||||||
|
* @param position 循环列表中的位置
|
||||||
|
* @return 原始数据中的实际位置
|
||||||
|
*/
|
||||||
|
private int getActualPosition(int position) {
|
||||||
|
if (giftLists.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return position % giftLists.size();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||||
|
// 获取实际位置
|
||||||
|
int actualPosition = getActualPosition(helper.getAdapterPosition());
|
||||||
|
GiftBean actualItem = giftLists.get(actualPosition);
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_gift_name, actualItem.getGift_name());
|
||||||
|
helper.setText(R.id.tv_gift_pic, actualItem.getGift_price());
|
||||||
|
ImageUtils.loadHeadCC(actualItem.getBase_image(), helper.getView(R.id.iv_gift_image));
|
||||||
|
// 处理选中状态
|
||||||
|
View selectedIcon = helper.getView(R.id.selected_icon);
|
||||||
|
// 处理选中状态
|
||||||
|
if (selectedIcon != null) {
|
||||||
|
// 检查当前item是否为选中位置
|
||||||
|
if (actualPosition == selectedPosition) {
|
||||||
|
selectedIcon.setVisibility(View.GONE);
|
||||||
|
helper.setBackgroundRes(R.id.ll_bg,R.mipmap.ke_bg);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
helper.setBackgroundRes(R.id.ll_bg,R.mipmap.xlh_cj_item);
|
||||||
|
selectedIcon.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置选中位置并更新UI
|
||||||
|
* @param position 选中的位置
|
||||||
|
*/
|
||||||
|
public void setSelectedPosition(int position) {
|
||||||
|
int previousPosition = selectedPosition;
|
||||||
|
selectedPosition = position;
|
||||||
|
|
||||||
|
if (previousPosition >= 0) {
|
||||||
|
notifyItemsByActualPosition(previousPosition, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedPosition >= 0) {
|
||||||
|
notifyItemsByActualPosition(selectedPosition, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 根据实际位置通知所有匹配的item更新
|
||||||
|
* @param actualPosition 原始数据中的位置
|
||||||
|
* @param isSelected 是否选中
|
||||||
|
*/
|
||||||
|
private void notifyItemsByActualPosition(int actualPosition, boolean isSelected) {
|
||||||
|
if (giftLists.isEmpty() || actualPosition >= giftLists.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通知所有匹配该实际位置的item更新
|
||||||
|
for (int i = 0; i < getItemCount(); i++) {
|
||||||
|
if (getActualPosition(i) == actualPosition) {
|
||||||
|
notifyItemChanged(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 清除选中状态
|
||||||
|
*/
|
||||||
|
public void clearSelection() {
|
||||||
|
int previousPosition = selectedPosition;
|
||||||
|
selectedPosition = -1;
|
||||||
|
|
||||||
|
if (previousPosition >= 0) {
|
||||||
|
notifyItemsByActualPosition(previousPosition, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取原始数据大小
|
||||||
|
* @return 原始数据大小
|
||||||
|
*/
|
||||||
|
public int getOriginalDataSize() {
|
||||||
|
List<GiftBean> loopData = new ArrayList<>();
|
||||||
|
for (int i = 0; i < LOOP_COUNT; i++) {
|
||||||
|
loopData.addAll(giftLists);
|
||||||
|
}
|
||||||
|
return loopData.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
|
import com.xscm.moduleutil.databinding.FframentDataBinding;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class LuckyFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FframentDataBinding> implements GiftLotteryContacts.View {
|
||||||
|
private int page=1;
|
||||||
|
private String roomId;
|
||||||
|
private int type=-1;
|
||||||
|
private NewGiftRecordAdapte giftRecordAdapte;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GiftLotteryPresenter bindPresenter() {
|
||||||
|
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||||
|
}
|
||||||
|
public static LuckyFragment newInstance(String giftBagId, int type) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
LuckyFragment fragment = new LuckyFragment();
|
||||||
|
args.putString("roomId", giftBagId);
|
||||||
|
args.putInt("type",type);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
roomId = getArguments().getString("roomId");
|
||||||
|
type = getArguments().getInt("type");
|
||||||
|
MvpPre.xlhAllRecord(roomId, "1", "20",type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
|
||||||
|
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page = 1;
|
||||||
|
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page++;
|
||||||
|
MvpPre.xlhAllRecord(roomId, page+"", "20",type);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
giftRecordAdapte=new NewGiftRecordAdapte();
|
||||||
|
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
|
||||||
|
mBinding.recyclerView.setAdapter(giftRecordAdapte);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.fframent_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||||
|
|
||||||
|
if (data != null){
|
||||||
|
if (page==1){
|
||||||
|
giftRecordAdapte.setNewData(data);
|
||||||
|
}else {
|
||||||
|
giftRecordAdapte.addData(data);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (page == 1) {
|
||||||
|
giftRecordAdapte.setNewData(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRefreshLoadMore() {
|
||||||
|
mBinding.smartRefreshLayout.finishRefresh();
|
||||||
|
mBinding.smartRefreshLayout.finishLoadMore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wallet(WalletBean walletBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
|
|
||||||
|
public class NewGiftRecordAdapte extends BaseQuickAdapter<GiftBean, BaseViewHolder> {
|
||||||
|
public NewGiftRecordAdapte() {
|
||||||
|
super(R.layout.item_gift_record_new);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||||
|
helper.setText(R.id.tv_issue,item.getPeriods());
|
||||||
|
helper.setText(R.id.tv_user_name, item.getNickname());
|
||||||
|
helper.setText(R.id.tv_gift_count_name, item.getGift_name());
|
||||||
|
helper.setText(R.id.tv_time, item.getCreatetime());
|
||||||
|
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_icon));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.widget.RadioGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.adapter.MyPagerAdapter;
|
||||||
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogNewRankingXlhFragmentBinding;
|
||||||
|
import com.xscm.moduleutil.dialog.LotteryFragment;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/4
|
||||||
|
*@description:巡乐会榜单
|
||||||
|
*/
|
||||||
|
public class NewXlhRankingDialog extends BaseMvpDialogFragment<GiftLotteryPresenter, DialogNewRankingXlhFragmentBinding> implements GiftLotteryContacts.View{
|
||||||
|
private String roomId;
|
||||||
|
|
||||||
|
private MyPagerAdapter pagerAdapter;
|
||||||
|
private List<Fragment> fragmentList;
|
||||||
|
private List<String> titleList = new ArrayList();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GiftLotteryPresenter bindPresenter() {
|
||||||
|
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NewXlhRankingDialog newInstance(String giftBagId) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
NewXlhRankingDialog fragment = new NewXlhRankingDialog();
|
||||||
|
args.putString("roomId", giftBagId);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
dialog.setCancelable(true);
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Window window = getDialog().getWindow();
|
||||||
|
if (window != null) {
|
||||||
|
// 获取屏幕高度
|
||||||
|
android.util.DisplayMetrics displayMetrics = new android.util.DisplayMetrics();
|
||||||
|
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int screenHeight = displayMetrics.heightPixels;
|
||||||
|
// 设置高度为屏幕高度的100%(全屏)
|
||||||
|
int heightInPx = (int) (screenHeight * 0.8);;
|
||||||
|
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||||
|
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
|
|
||||||
|
// 可选:设置动画样式(从底部弹出)
|
||||||
|
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initDialogStyle(Window window) {
|
||||||
|
super.initDialogStyle(window);
|
||||||
|
window.setGravity(Gravity.BOTTOM);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
roomId = getArguments().getString("roomId");
|
||||||
|
// MvpPre.xlhAllRecord(roomId, "1", "20");
|
||||||
|
// 初始化Fragment列表
|
||||||
|
initFragments();
|
||||||
|
initViewPager();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化Fragment列表
|
||||||
|
private void initFragments() {
|
||||||
|
fragmentList = new ArrayList<>();
|
||||||
|
fragmentList.add(new LotteryFragment().newInstance(roomId,1)); // 第1页:抽奖榜单
|
||||||
|
fragmentList.add(new LuckyFragment().newInstance(roomId,2)); // 第1页:抽奖榜单
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化ViewPager
|
||||||
|
private void initViewPager() {
|
||||||
|
titleList.add("");
|
||||||
|
titleList.add("");
|
||||||
|
FragmentManager childFragmentManager = getChildFragmentManager();
|
||||||
|
pagerAdapter = new MyPagerAdapter(childFragmentManager, fragmentList,titleList );
|
||||||
|
mBinding.ivViewPager.setAdapter(pagerAdapter);
|
||||||
|
mBinding.ivViewPager.setCurrentItem(0); // 默认显示第1页
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
mBinding.rbBtn.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||||
|
if (checkedId==R.id.radio_all){
|
||||||
|
mBinding.ivViewPager.setCurrentItem(0);
|
||||||
|
}else {
|
||||||
|
mBinding.ivViewPager.setCurrentItem(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.dialog_new_ranking_xlh_fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRefreshLoadMore() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wallet(WalletBean walletBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.adapter.MyBaseAdapter;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/8/28
|
||||||
|
*@description: 盲盒转盘的奖池适配器
|
||||||
|
*/
|
||||||
|
public class PrizePoolAdapter extends BaseQuickAdapter<GiftBean, BaseViewHolder> {
|
||||||
|
private Context context;
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
public PrizePoolAdapter(int type) {
|
||||||
|
super(R.layout.item_prize_pool);
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, GiftBean item) {
|
||||||
|
|
||||||
|
if (type == 10 || type == 12){
|
||||||
|
helper.setImageResource(R.id.iv_prize_pool,R.mipmap.tkzj_z);
|
||||||
|
}else {
|
||||||
|
helper.setImageResource(R.id.iv_prize_pool,R.mipmap.xlh_hd);
|
||||||
|
}
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_gift_name, item.getGift_name());
|
||||||
|
helper.setText(R.id.tv_gift_pic, item.getGift_price());
|
||||||
|
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_image));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class ViewHolder {
|
||||||
|
private ImageView imGiftImage;
|
||||||
|
private TextView tv_gift_name;
|
||||||
|
private TextView tv_gift_price;
|
||||||
|
|
||||||
|
public ViewHolder(View convertView) {
|
||||||
|
imGiftImage = convertView.findViewById(R.id.iv_gift_image);
|
||||||
|
tv_gift_name = convertView.findViewById(R.id.tv_gift_name);
|
||||||
|
tv_gift_price = convertView.findViewById(R.id.tv_gift_pic);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogPrizePoolBinding;
|
||||||
|
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author qx
|
||||||
|
* @data 2025/8/28
|
||||||
|
* @description: 盲盒转盘奖池弹窗
|
||||||
|
*/
|
||||||
|
public class PrizePoolDialog extends BaseDialog<DialogPrizePoolBinding> {
|
||||||
|
private Context mContext;
|
||||||
|
private List<GiftBean> gift_list;
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
public PrizePoolDialog(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
this.mContext = context;
|
||||||
|
// 设置对话框从底部弹出并紧贴底部
|
||||||
|
if (getWindow() != null) {
|
||||||
|
getWindow().setGravity(android.view.Gravity.BOTTOM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
if (getWindow() != null) {
|
||||||
|
// 获取屏幕尺寸
|
||||||
|
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
|
||||||
|
// 设置高度为屏幕高度的80%
|
||||||
|
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||||
|
params.height = (int) (displayMetrics.heightPixels * 0.7);
|
||||||
|
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||||
|
getWindow().setAttributes(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLayoutId() {
|
||||||
|
return R.layout.dialog_prize_pool;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initView() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showEmptyState() {
|
||||||
|
// 显示空状态或加载中提示
|
||||||
|
// mBinding.tvEmpty.setVisibility(View.VISIBLE);
|
||||||
|
// mBinding.tvEmpty.setText("暂无奖池数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提供更新数据的方法
|
||||||
|
public void updateData(List<GiftBean> newData, int type) {
|
||||||
|
if (type == 10) {
|
||||||
|
mBinding.clPrize.setBackgroundResource(R.mipmap.tkzj);
|
||||||
|
mBinding.imJc.setImageResource(R.mipmap.jiangc);
|
||||||
|
} else if (type == 11) {
|
||||||
|
mBinding.clPrize.setBackgroundResource(R.mipmap.syzc);
|
||||||
|
mBinding.imJc.setImageResource(R.mipmap.syzc_jc);
|
||||||
|
} else if (type == 12) {
|
||||||
|
mBinding.clPrize.setBackgroundResource(R.mipmap.skzj);
|
||||||
|
mBinding.imJc.setImageResource(R.mipmap.skzl_jc);
|
||||||
|
}else if (type == 13){
|
||||||
|
mBinding.clPrize.setBackgroundResource(R.mipmap.xlh);
|
||||||
|
mBinding.imJc.setImageResource(R.mipmap.xlh_jc);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据屏幕密度调整行数和列数
|
||||||
|
int rows, columns;
|
||||||
|
float density = mContext.getResources().getDisplayMetrics().density;
|
||||||
|
|
||||||
|
if (density <= 2.0) { // 低密度屏幕(如mdpi, hdpi)
|
||||||
|
rows = 4;
|
||||||
|
columns = 3;
|
||||||
|
} else if (density <= 3.0) { // 中密度屏幕(如xhdpi)
|
||||||
|
rows = 4;
|
||||||
|
columns = 3;
|
||||||
|
} else { // 高密度屏幕(如xxhdpi, xxxhdpi)
|
||||||
|
rows = 4;
|
||||||
|
columns = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newData != null && !newData.isEmpty()) {
|
||||||
|
this.gift_list = newData;
|
||||||
|
if (mBinding != null && mContext != null) {
|
||||||
|
PrizePoolAdapter prizePoolAdapter = new PrizePoolAdapter(type);
|
||||||
|
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 3);
|
||||||
|
// PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL);
|
||||||
|
mBinding.gvGift.setLayoutManager(layoutManager);
|
||||||
|
// mBinding.gvGift.setOnFlingListener(null);
|
||||||
|
// 设置滚动辅助工具
|
||||||
|
// PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper();
|
||||||
|
// pageSnapHelper.attachToRecyclerView(mBinding.gvGift);
|
||||||
|
mBinding.gvGift.setAdapter(prizePoolAdapter);
|
||||||
|
prizePoolAdapter.setNewData(gift_list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
|
||||||
|
import com.blankj.utilcode.util.ScreenUtils;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogHeavenGiftBinding;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogXlhObtainBinding;
|
||||||
|
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author qx
|
||||||
|
* @data 2025/9/2
|
||||||
|
* @description: 巡乐会恭喜或得礼弹窗
|
||||||
|
*/
|
||||||
|
public class XlhObtainDialog extends BaseDialog<DialogXlhObtainBinding> {
|
||||||
|
|
||||||
|
public interface OnGiftItemClickListener {
|
||||||
|
|
||||||
|
void onPlayAgainClick();
|
||||||
|
|
||||||
|
void onCloseClick();
|
||||||
|
}
|
||||||
|
|
||||||
|
private GiftItemAdapter mAdapter;
|
||||||
|
private OnGiftItemClickListener mListener;
|
||||||
|
private List<XlhDrawBean> mGiftList;
|
||||||
|
|
||||||
|
public XlhObtainDialog(@NonNull Context context) {
|
||||||
|
super(context, R.style.BaseDialogStyleH);
|
||||||
|
}
|
||||||
|
|
||||||
|
public XlhObtainDialog(@NonNull Context context, List<XlhDrawBean> giftList) {
|
||||||
|
super(context, R.style.BaseDialogStyleH);
|
||||||
|
this.mGiftList = giftList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLayoutId() {
|
||||||
|
return R.layout.dialog_xlh_obtain;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initView() {
|
||||||
|
setCancelable(false);
|
||||||
|
setCanceledOnTouchOutside(false);
|
||||||
|
Window window = getWindow();
|
||||||
|
// 设置对话框在屏幕中央显示
|
||||||
|
window.setGravity(Gravity.CENTER);
|
||||||
|
// 去掉背景阴影
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||||
|
|
||||||
|
// 设置窗口背景为透明
|
||||||
|
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
|
window.setLayout((int) (ScreenUtils.getScreenWidth() * 375.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||||
|
// 设置点击事件
|
||||||
|
mBinding.xlhClose.setOnClickListener(v -> {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onCloseClick();
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
|
||||||
|
mBinding.ivAgain.setOnClickListener(v -> {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onPlayAgainClick();
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
});
|
||||||
|
initRecyclerView();
|
||||||
|
}
|
||||||
|
private void initRecyclerView() {
|
||||||
|
mAdapter = new GiftItemAdapter();
|
||||||
|
mBinding.rvHead.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||||
|
mBinding.rvHead.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置礼物数据
|
||||||
|
*/
|
||||||
|
public void setGiftList(List<XlhDrawBean> giftList) {
|
||||||
|
this.mGiftList = giftList;
|
||||||
|
if (mAdapter != null) {
|
||||||
|
mAdapter.setNewData(giftList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置点击回调监听器
|
||||||
|
*/
|
||||||
|
public void setOnGiftItemClickListener(OnGiftItemClickListener listener) {
|
||||||
|
this.mListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,176 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogGiftLotteryFragmentBinding;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogRankingXlhFragmentBinding;
|
||||||
|
import com.xscm.moduleutil.widget.pagerecyclerview.PagerGridSnapHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/4
|
||||||
|
*@description:巡乐会榜单
|
||||||
|
*/
|
||||||
|
public class XlhRankingDialog extends BaseMvpDialogFragment<GiftLotteryPresenter, DialogRankingXlhFragmentBinding> implements GiftLotteryContacts.View{
|
||||||
|
private int page=1;
|
||||||
|
private String roomId;
|
||||||
|
private GiftRecordAdapte giftRecordAdapte;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GiftLotteryPresenter bindPresenter() {
|
||||||
|
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static XlhRankingDialog newInstance(String giftBagId,int type) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
XlhRankingDialog fragment = new XlhRankingDialog();
|
||||||
|
args.putString("roomId", giftBagId);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
dialog.setCancelable(true);
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Window window = getDialog().getWindow();
|
||||||
|
if (window != null) {
|
||||||
|
// 获取屏幕高度
|
||||||
|
android.util.DisplayMetrics displayMetrics = new android.util.DisplayMetrics();
|
||||||
|
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int screenHeight = displayMetrics.heightPixels;
|
||||||
|
// 设置高度为屏幕高度的100%(全屏)
|
||||||
|
int heightInPx = (int) (screenHeight * 0.8);;
|
||||||
|
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||||
|
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
|
|
||||||
|
// 可选:设置动画样式(从底部弹出)
|
||||||
|
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initDialogStyle(Window window) {
|
||||||
|
super.initDialogStyle(window);
|
||||||
|
window.setGravity(Gravity.BOTTOM);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
roomId = getArguments().getString("roomId");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
MvpPre.xlhAllRecord(roomId, "1", "20",1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
|
||||||
|
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page = 1;
|
||||||
|
MvpPre.xlhAllRecord(roomId, page+"", "20",1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page++;
|
||||||
|
MvpPre.xlhAllRecord(roomId, page+"", "20",1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
giftRecordAdapte=new GiftRecordAdapte();
|
||||||
|
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
|
||||||
|
mBinding.recyclerView.setAdapter(giftRecordAdapte);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.dialog_ranking_xlh_fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||||
|
|
||||||
|
if (data != null){
|
||||||
|
if (page==1){
|
||||||
|
giftRecordAdapte.setNewData(data);
|
||||||
|
}else {
|
||||||
|
giftRecordAdapte.addData(data);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (page == 1) {
|
||||||
|
giftRecordAdapte.setNewData(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRefreshLoadMore() {
|
||||||
|
mBinding.smartRefreshLayout.finishRefresh();
|
||||||
|
mBinding.smartRefreshLayout.finishLoadMore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wallet(WalletBean walletBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
package com.xscm.moduleutil.dialog.giftLottery;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.Window;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||||
|
import com.xscm.moduleutil.R;
|
||||||
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogGiftLotteryFragmentBinding;
|
||||||
|
import com.xscm.moduleutil.databinding.DialogXlhRecordFragmentBinding;
|
||||||
|
import com.xscm.moduleutil.widget.pagerecyclerview.PagerGridSnapHelper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/4
|
||||||
|
*@description:巡乐会记录
|
||||||
|
*/
|
||||||
|
public class XlhRecordDialog extends BaseMvpDialogFragment<GiftLotteryPresenter, DialogXlhRecordFragmentBinding> implements GiftLotteryContacts.View{
|
||||||
|
|
||||||
|
private int page=1;
|
||||||
|
private String roomId;
|
||||||
|
private GiftRecordAdapter adapter;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected GiftLotteryPresenter bindPresenter() {
|
||||||
|
return new GiftLotteryPresenter(this,getSelfActivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static XlhRecordDialog newInstance(String roomId) {
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
XlhRecordDialog fragment = new XlhRecordDialog();
|
||||||
|
args.putString("roomId", roomId);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||||
|
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||||
|
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
dialog.setCancelable(true);
|
||||||
|
return dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
Window window = getDialog().getWindow();
|
||||||
|
if (window != null) {
|
||||||
|
// 获取屏幕高度
|
||||||
|
android.util.DisplayMetrics displayMetrics = new android.util.DisplayMetrics();
|
||||||
|
requireActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
int screenHeight = displayMetrics.heightPixels;
|
||||||
|
// 设置高度为屏幕高度的100%(全屏)
|
||||||
|
int heightInPx = (int) (screenHeight * 0.8);;
|
||||||
|
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, heightInPx);
|
||||||
|
window.setBackgroundDrawableResource(android.R.color.transparent);
|
||||||
|
|
||||||
|
// 可选:设置动画样式(从底部弹出)
|
||||||
|
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initDialogStyle(Window window) {
|
||||||
|
super.initDialogStyle(window);
|
||||||
|
window.setGravity(Gravity.BOTTOM);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
roomId = getArguments().getString("roomId");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initData() {
|
||||||
|
MvpPre.xlhMyRecord(roomId, "1", "20");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initView() {
|
||||||
|
|
||||||
|
|
||||||
|
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||||
|
@Override
|
||||||
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page = 1;
|
||||||
|
MvpPre.xlhMyRecord(roomId, page+"", "20");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||||
|
page++;
|
||||||
|
MvpPre.xlhMyRecord(roomId, page+"", "20");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adapter=new GiftRecordAdapter();
|
||||||
|
GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 3);
|
||||||
|
|
||||||
|
mBinding.recyclerView.setLayoutManager(layoutManager);
|
||||||
|
mBinding.recyclerView.setOnFlingListener(null);
|
||||||
|
// 设置滚动辅助工具
|
||||||
|
PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper();
|
||||||
|
pageSnapHelper.attachToRecyclerView(mBinding.recyclerView);
|
||||||
|
mBinding.recyclerView.setAdapter(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getLayoutId() {
|
||||||
|
return R.layout.dialog_xlh_record_fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMyRecordSuccess(List<GiftBean> data) {
|
||||||
|
if (data != null){
|
||||||
|
if (page==1){
|
||||||
|
adapter.setNewData(data);
|
||||||
|
}else {
|
||||||
|
adapter.addData(data);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (page == 1) {
|
||||||
|
adapter.setNewData(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getAllRecordSuccess(List<GiftBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void finishRefreshLoadMore() {
|
||||||
|
mBinding.smartRefreshLayout.finishRefresh();
|
||||||
|
mBinding.smartRefreshLayout.finishLoadMore();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wallet(WalletBean walletBean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||