1、修改登录功能并验证,除了支付宝登录其他都已验证
2、完成个人中心的功能,个人主页完成、钱包完成、背包完成
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-05-13T12:53:07.787808500Z">
|
||||
<DropdownSelection timestamp="2025-05-20T06:42:14.989297Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=6705124a" />
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=88Y4C19912006888" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
2
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -30,7 +30,7 @@
|
||||
<option name="composableFile" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="JavadocDeclaration" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ADDITIONAL_TAGS" value="data" />
|
||||
<option name="ADDITIONAL_TAGS" value="data,description:" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PreviewAnnotationInFunctionWithParameters" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
|
||||
@@ -11,8 +11,8 @@ android {
|
||||
applicationId "com.qxcm.qxlive"
|
||||
minSdk 24
|
||||
targetSdk 35
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionCode Integer.parseInt(project.findProperty("APP_VERSION_CODE"))
|
||||
versionName project.findProperty("APP_VERSION_NAME")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -57,6 +57,7 @@ android {
|
||||
}
|
||||
|
||||
debug {
|
||||
debuggable true
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
|
||||
21
app/proguard-rules.pro
vendored
@@ -765,4 +765,25 @@ public static java.lang.String TABLENAME;
|
||||
-dontwarn **.R$*
|
||||
-keep class com.hln.game.grabmarbles.**{*;}
|
||||
|
||||
-keep class com.alibaba.sdk.android.oss.** { *; }
|
||||
-dontwarn okio.**
|
||||
-dontwarn org.apache.commons.codec.binary.**
|
||||
|
||||
|
||||
-keep class com.tencent.mm.opensdk.** {
|
||||
|
||||
*;
|
||||
|
||||
}
|
||||
|
||||
-keep class com.tencent.wxop.** {
|
||||
|
||||
*;
|
||||
|
||||
}
|
||||
|
||||
-keep class com.tencent.mm.sdk.** {
|
||||
|
||||
*;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.qxcm.qxlive">
|
||||
|
||||
<!-- Features -->
|
||||
<!-- Features -->
|
||||
<uses-feature
|
||||
android:name="android.hardware.telephony"
|
||||
@@ -11,12 +12,51 @@
|
||||
android:name="android.hardware.camera"
|
||||
android:required="false" />
|
||||
|
||||
<!-- Tools override -->
|
||||
<uses-sdk xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:overrideLibrary="cn.sharesdk.onekeyshare" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.GET_ACCOUNTS"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.CALL_PHONE"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_LOGS"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_CALL_LOG"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_CALL_LOG"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.READ_SMS"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.SEND_SMS"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_SMS"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.RECEIVE_SMS"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.RECEIVE_WAP_PUSH"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.RECEIVE_MMS"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.SEND_MMS"
|
||||
tools:node="remove" />
|
||||
<uses-permission
|
||||
android:name="android.permission.PROCESS_OUTGOING_CALLS"
|
||||
tools:node="remove" />
|
||||
|
||||
<!-- Permissions -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.NETWORK_PROVIDER" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
@@ -25,41 +65,52 @@
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32"
|
||||
tools:ignore="ScopedStorage" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.REORDER_TASKS" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="${applicationId}.permission.JPUSH_MESSAGE" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
|
||||
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO"/>
|
||||
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>
|
||||
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
|
||||
<queries>
|
||||
<package android:name="com.tencent.mm" />
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:name="AppContext"
|
||||
android:allowBackup="true"
|
||||
android:extractNativeLibs="true"
|
||||
android:largeHeap="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
tools:replace="android:theme"
|
||||
tools:targetApi="31">
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:targetApi="31"
|
||||
tools:ignore="SelectedPhotoAccess">
|
||||
<activity
|
||||
android:name=".LaunchPageActivity"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize"
|
||||
@@ -67,6 +118,8 @@
|
||||
android:screenOrientation="behind"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="com.example.action.LAUNCH_PAGE" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
@@ -94,6 +147,14 @@
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="behind"
|
||||
android:theme="@style/authsdk_activity_dialog" />
|
||||
|
||||
<activity
|
||||
android:name=".wxapi.WXEntryActivity"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||
android:exported="true"
|
||||
android:taskAffinity="com.qxcm.qxlive"
|
||||
android:launchMode="singleTask">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
BIN
app/src/main/ic_launcher-playstore.png
Normal file
|
After Width: | Height: | Size: 223 KiB |
@@ -1,13 +1,9 @@
|
||||
package com.qxcm.qxlive;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.hjq.toast.IToastInterceptor;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.qxcm.moduleutil.utils.config.EnvironmentEnum;
|
||||
import com.qxcm.moduleutil.utils.config.EnvironmentPrefs;
|
||||
import com.qxcm.moduleutil.widget.CommonAppConfig;
|
||||
import com.qxcm.moduleutil.widget.CommonAppContext;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
|
||||
|
||||
/**
|
||||
@@ -17,7 +13,6 @@ import com.qxcm.moduleutil.widget.CommonAppContext;
|
||||
public class AppContext extends CommonAppContext {
|
||||
|
||||
private boolean mBeautyInited;
|
||||
private EnvironmentEnum currentEnvironment;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
@@ -30,11 +25,6 @@ public class AppContext extends CommonAppContext {
|
||||
// }
|
||||
// });
|
||||
// L.setDeBug(BuildConfig.DEBUG);
|
||||
EnvironmentPrefs prefs = new EnvironmentPrefs(this);
|
||||
currentEnvironment = prefs.getSelectedEnvironment();
|
||||
}
|
||||
public EnvironmentEnum getCurrentEnvironment() {
|
||||
return currentEnvironment;
|
||||
}
|
||||
public static void initSdk() {
|
||||
CommonAppContext context = CommonAppContext.getInstance();
|
||||
|
||||
@@ -13,6 +13,6 @@ public final class LaunchContacter {
|
||||
|
||||
public interface ILoginPre extends IPresenter {
|
||||
|
||||
|
||||
void oauthLogin(String login_token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.qxcm.qxlive;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
@@ -19,21 +20,24 @@ import com.mobile.auth.gatewayauth.PreLoginResultListener;
|
||||
import com.mobile.auth.gatewayauth.ResultCode;
|
||||
import com.mobile.auth.gatewayauth.TokenResultListener;
|
||||
import com.mobile.auth.gatewayauth.model.TokenRet;
|
||||
import com.qxcm.modulelogin.activity.ImproveInfoActivity;
|
||||
import com.qxcm.modulelogin.activity.LoginActivity;
|
||||
import com.qxcm.modulelogin.activity.PasswordLoginActivity;
|
||||
import com.qxcm.modulemain.activity.MainActivity;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.dialog.PolicyDialog;
|
||||
import com.qxcm.moduleutil.utils.SpUtil;
|
||||
import com.qxcm.moduleutil.utils.logger.Logger;
|
||||
import com.qxcm.qxlive.databinding.ActivityLaunchPageBinding;
|
||||
|
||||
public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, ActivityLaunchPageBinding> implements LaunchContacter.View{
|
||||
public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, ActivityLaunchPageBinding> implements LaunchContacter.View {
|
||||
private Handler handler;
|
||||
public PhoneNumberAuthHelper phoneNumberAuthHelper;
|
||||
private TokenResultListener tokenResultListener;
|
||||
private boolean canOnePass;
|
||||
private boolean isCanOnePass=false;
|
||||
private boolean isCanOnePass = true;
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
@@ -51,8 +55,8 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
|
||||
// BaseApplication.getInstance().checkInEmulator();
|
||||
// BaseApplication.getInstance().initHeartBeat();
|
||||
// //延迟1.5秒执行
|
||||
// handler.postDelayed(runnable, 100);
|
||||
initLogin();
|
||||
handler.postDelayed(runnable, 100);
|
||||
// initLogin();
|
||||
} else {
|
||||
PolicyDialog policyDialog = new PolicyDialog(this);
|
||||
policyDialog.setCancelable(false);
|
||||
@@ -82,12 +86,8 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
|
||||
|
||||
private void initLogin() {
|
||||
|
||||
if (isCanOnePass){
|
||||
initQuickLogin();
|
||||
checkOnePass();
|
||||
}else {
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkOnePass() {
|
||||
@@ -116,6 +116,7 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
|
||||
isRoot();
|
||||
}
|
||||
}
|
||||
|
||||
private void isRoot() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
@@ -156,18 +157,20 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
|
||||
}
|
||||
} else {
|
||||
Logger.e("SplashEnd", "ARouters.MAIN");
|
||||
// UserBean userBean = MyApplication.getInstance().getUser();
|
||||
// if (userBean.getSex() == 0) {
|
||||
// Intent intent = new Intent(this, ImproveInfoActivity.class);
|
||||
// intent.putExtra("nickname", String.format("用户%s", userBean.getUser_code()));
|
||||
// intent.putExtra("user_no_parent", userBean.getUser_no_parent());
|
||||
// startActivity(intent);
|
||||
// } else {
|
||||
// startActivity(new Intent(this, MainActivity.class));
|
||||
// }
|
||||
UserBean userBean = CommonAppContext.getInstance().getUser();
|
||||
if (userBean.getSex() == 0) {
|
||||
Intent intent = new Intent(this, ImproveInfoActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putSerializable("userBean", userBean);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
} else {
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void doOnePass() {
|
||||
AuthUIConfig authUIConfig = new AuthUIConfig.Builder()
|
||||
//导航栏
|
||||
@@ -237,6 +240,7 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
|
||||
phoneNumberAuthHelper.setAuthUIConfig(authUIConfig);
|
||||
phoneNumberAuthHelper.getLoginToken(getApplicationContext(), 5000);
|
||||
}
|
||||
|
||||
private void initQuickLogin() {
|
||||
tokenResultListener = new TokenResultListener() {
|
||||
@Override
|
||||
@@ -252,7 +256,8 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
|
||||
phoneNumberAuthHelper.hideLoginLoading();
|
||||
//获取成功 dimiss就去登录、登录成功
|
||||
phoneNumberAuthHelper.quitLoginPage();
|
||||
// MvpPre.oauthLogin(null, tokenRet.getToken(), 4);
|
||||
LogUtils.e("@@@",tokenRet.getToken());
|
||||
MvpPre.oauthLogin(tokenRet.getToken());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
go2Login();
|
||||
@@ -277,20 +282,22 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
|
||||
};
|
||||
|
||||
try {
|
||||
phoneNumberAuthHelper = PhoneNumberAuthHelper.getInstance(getApplicationContext(),tokenResultListener);
|
||||
phoneNumberAuthHelper = PhoneNumberAuthHelper.getInstance(getApplicationContext(), null);
|
||||
phoneNumberAuthHelper.getReporter().setLoggerEnable(true);
|
||||
LogUtils.e("initAuthSDK", ((AppContext) getApplication()).getCurrentEnvironment().getALI_AUTH_KEY());
|
||||
phoneNumberAuthHelper.setAuthSDKInfo("6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=");
|
||||
// phoneNumberAuthHelper.setAuthSDKInfo("6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=");
|
||||
phoneNumberAuthHelper.setAuthSDKInfo(((AppContext) getApplication()).getCurrentEnvironment().getALI_AUTH_KEY());
|
||||
phoneNumberAuthHelper.checkEnvAvailable(2);
|
||||
|
||||
} catch (Throwable ignored) {
|
||||
Logger.e("initAuthSDK", ignored);
|
||||
}
|
||||
}
|
||||
|
||||
private void go2Login() {
|
||||
startActivity(new Intent(this, PasswordLoginActivity.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_launch_page;
|
||||
@@ -298,7 +305,7 @@ public class LaunchPageActivity extends BaseMvpActivity<LaunchPresenter, Activit
|
||||
|
||||
@Override
|
||||
protected LaunchPresenter bindPresenter() {
|
||||
return new LaunchPresenter( this,this);
|
||||
return new LaunchPresenter(this, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,83 @@
|
||||
package com.qxcm.qxlive;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.modulelogin.activity.ImproveInfoActivity;
|
||||
import com.qxcm.modulelogin.activity.SwitchAccountsActivity;
|
||||
import com.qxcm.modulemain.activity.MainActivity;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.qxlive.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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(new LoginFinishEvent());
|
||||
// EventBus.getDefault().post(new SplashFinishEvent());
|
||||
// AppLog.setUserUniqueID(userBean.getUser_id()); // 设置您自己的账号体系ID, 并保证其唯一性 !
|
||||
}
|
||||
}
|
||||
|
||||
233
app/src/main/java/com/qxcm/qxlive/wxapi/WXEntryActivity.java
Normal file
@@ -0,0 +1,233 @@
|
||||
package com.qxcm.qxlive.wxapi;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.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();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 2.4 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 6.5 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 9.1 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 19 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Normal file
|
After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 25 KiB |
@@ -1,5 +1,5 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
|
||||
<string name="app_name">Vespa</string>
|
||||
|
||||
<string name="recommend_skip">Skip</string>
|
||||
<string name="a_067">Click to jump to third-party applications</string>
|
||||
</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>
|
||||
@@ -1,5 +1,5 @@
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">羽声</string>
|
||||
|
||||
<string name="recommend_skip">跳过</string>
|
||||
<string name="a_067">点击跳转第三方应用</string>
|
||||
</resources>
|
||||
@@ -29,3 +29,7 @@ org.gradle.parallel=false
|
||||
org.gradle.deamon=false
|
||||
android.injected.testOnly=false
|
||||
|
||||
APP_VERSION_NAME=1.0.0
|
||||
APP_VERSION_CODE=1
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
[versions]
|
||||
agp = "8.8.0"
|
||||
alipayAlipaysdkAndroid = "15.8.33"
|
||||
comJacktuotuoCustomviewVerificationcodeview2 = "1.0.5"
|
||||
custompopwindow = "2.1.1"
|
||||
databindingRuntimeVersion = "7.0.2"
|
||||
easypermissions = "3.0.0"
|
||||
easyProtectorRelease = "1.1.2"
|
||||
flexboxVersion = "1.0.0"
|
||||
githubBannerviewpagerVersion = "3.5.12"
|
||||
githubGlide = "4.12.0"
|
||||
@@ -11,6 +15,7 @@ junit = "4.13.2"
|
||||
junitVersion = "1.1.5"
|
||||
espressoCore = "3.5.1"
|
||||
appcompat = "1.6.1"
|
||||
lombok = "1.18.32"
|
||||
marqueeview = "1.1.0"
|
||||
material = "1.10.0"
|
||||
activity = "1.8.0"
|
||||
@@ -28,6 +33,8 @@ eventbusVersion = "3.3.1"
|
||||
logger = "2.2.0"
|
||||
loggingInterceptorVersion = "3.10.0"
|
||||
multidex = "2.0.1"
|
||||
ossAndroidSdkVersion = "2.9.21"
|
||||
persistentcookiejar = "v1.0.1"
|
||||
picture_libraryVersion = "v2.6.0"
|
||||
reactivexRxjava = "2.2.21"
|
||||
retrofit2KotlinCoroutinesAdapterVersion = "0.9.2"
|
||||
@@ -48,13 +55,20 @@ kotlinVersion = "1.9.24"
|
||||
coreKtx = "1.10.1"
|
||||
lifecycleLivedataKtx = "2.6.1"
|
||||
lifecycleViewmodelKtx = "2.6.1"
|
||||
wechatSdkAndroid = "6.8.30"
|
||||
xbanner = "1.7.0"
|
||||
|
||||
[libraries]
|
||||
alipay-alipaysdk-android = { module = "com.alipay.sdk:alipaysdk-android", version.ref = "alipayAlipaysdkAndroid" }
|
||||
android-flexbox = { module = "com.google.android:flexbox", version.ref = "flexboxVersion" }
|
||||
com-github-bumptech-glide-glide = { module = "com.github.bumptech.glide:glide", version.ref = "githubGlide" }
|
||||
com-github-zhpanvip-bannerviewpager = { module = "com.github.zhpanvip:bannerviewpager", version.ref = "githubBannerviewpagerVersion" }
|
||||
com-jacktuotuo-customview-verificationcodeview3 = { module = "com.jacktuotuo.customview:verificationcodeview", version.ref = "comJacktuotuoCustomviewVerificationcodeview2" }
|
||||
custompopwindow = { module = "com.github.pinguo-zhouwei:CustomPopwindow", version.ref = "custompopwindow" }
|
||||
databinding-runtime-v702 = { module = "androidx.databinding:databinding-runtime", version.ref = "databindingRuntimeVersion" }
|
||||
dpa-oss-android-sdk = { module = "com.aliyun.dpa:oss-android-sdk", version.ref = "ossAndroidSdkVersion" }
|
||||
easy-protector-release = { module = "com.lahm.library:easy-protector-release", version.ref = "easyProtectorRelease" }
|
||||
easypermissions = { module = "pub.devrel:easypermissions", version.ref = "easypermissions" }
|
||||
github-photoview = { module = "com.github.chrisbanes:PhotoView", version.ref = "githubPhotoview" }
|
||||
github-shadowlayout = { module = "com.github.lihangleo2:ShadowLayout", version.ref = "githubShadowlayout" }
|
||||
glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "githubGlide" }
|
||||
@@ -62,6 +76,7 @@ junit = { group = "junit", name = "junit", version.ref = "junit" }
|
||||
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
|
||||
espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
||||
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
||||
lombok = { module = "org.projectlombok:lombok", version.ref = "lombok" }
|
||||
marqueeview = { module = "com.sunfusheng:marqueeview", version.ref = "marqueeview" }
|
||||
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
||||
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
|
||||
@@ -82,6 +97,7 @@ google-gson = { module = "com.google.code.gson:gson", version.ref = "gsonVersion
|
||||
logger = { module = "com.orhanobut:logger", version.ref = "logger" }
|
||||
multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" }
|
||||
okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptorVersion" }
|
||||
persistentcookiejar = { module = "com.github.franmontiel:PersistentCookieJar", version.ref = "persistentcookiejar" }
|
||||
pictureselector-picture_library = { module = "com.github.LuckSiege.PictureSelector:picture_library", version.ref = "picture_libraryVersion" }
|
||||
reactivex-rxjava = { module = "io.reactivex.rxjava2:rxjava", version.ref = "reactivexRxjava" }
|
||||
roundedimageview = { module = "com.makeramen:roundedimageview", version.ref = "roundedimageview" }
|
||||
@@ -105,6 +121,8 @@ material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||
core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||
lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycleLivedataKtx" }
|
||||
lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" }
|
||||
wechat-sdk-android = { module = "com.tencent.mm.opensdk:wechat-sdk-android", version.ref = "wechatSdkAndroid" }
|
||||
xbanner = { module = "com.github.xiaohaibin:XBanner", version.ref = "xbanner" }
|
||||
|
||||
|
||||
[plugins]
|
||||
|
||||
@@ -42,6 +42,7 @@ dependencies {
|
||||
implementation libs.activity
|
||||
implementation libs.constraintlayout
|
||||
implementation project(':modulemain')
|
||||
implementation project(':modulevocal')
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
>
|
||||
<application android:allowBackup="true">
|
||||
<activity
|
||||
android:name=".activity.SwitchAccountsActivity"
|
||||
android:exported="true" />
|
||||
<activity
|
||||
android:name=".activity.ImproveInfoActivity"
|
||||
android:exported="true" />
|
||||
@@ -17,6 +17,7 @@
|
||||
android:name=".activity.LoginActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -15,6 +15,7 @@ import com.qxcm.modulelogin.databinding.ActivityLoginBinding;
|
||||
import com.qxcm.modulelogin.present.LoginContacter;
|
||||
import com.qxcm.modulelogin.present.LoginPresenter;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
|
||||
public class ForgetPasswordActivity extends BaseMvpActivity<LoginPresenter, ActivityForgetPasswordBinding> implements LoginContacter.View, View.OnClickListener {
|
||||
|
||||
@@ -35,8 +36,19 @@ public class ForgetPasswordActivity extends BaseMvpActivity<LoginPresenter, Acti
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess(String phoneNumber) {
|
||||
public void sendCodeSuccess1(String phoneNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(UserBean userBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authorizationSuccess(String s) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.qxcm.modulelogin.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
@@ -18,11 +19,14 @@ import com.qxcm.modulelogin.present.ImproveInfoContacts;
|
||||
import com.qxcm.modulelogin.present.ImproveInfoPresenter;
|
||||
import com.qxcm.modulemain.activity.MainActivity;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.bean.UserPictrue;
|
||||
import com.qxcm.moduleutil.utils.DateSelectDialog;
|
||||
import com.qxcm.moduleutil.utils.GlideEngine;
|
||||
import com.qxcm.moduleutil.utils.ImageLoader;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
import com.qxcm.moduleutil.utils.MyPictureParameterStyle;
|
||||
import com.qxcm.moduleutil.utils.SpUtil;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
|
||||
|
||||
@@ -43,6 +47,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
||||
private boolean isBoySelected = false;
|
||||
private DateSelectDialog mDateSelectDialog;
|
||||
private boolean isFirst = false;
|
||||
UserBean userBean;
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
@@ -54,8 +59,16 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
mBinding.edNickName.setText(nickname);
|
||||
Bundle extras = getIntent().getExtras();
|
||||
userBean= extras != null ? (UserBean) extras.getSerializable("userBean") : null;
|
||||
assert userBean != null;
|
||||
if (userBean.getNickname().isEmpty()){
|
||||
MvpPre.updateNickname();
|
||||
}else {
|
||||
mBinding.edNickName.setText(userBean.getNickname());
|
||||
}
|
||||
mBinding.edNickName.setClearIconVisible(true);
|
||||
ImageUtils.loadHeadCC(userBean.getAvatar(), mBinding.rvUserHead);
|
||||
if (!TextUtils.isEmpty(user_no_parent) && !"0".equals(user_no_parent)) {
|
||||
mBinding.etInviteCode.setText(user_no_parent);
|
||||
mBinding.etInviteCode.setKeyListener(null);
|
||||
@@ -234,13 +247,16 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
||||
|
||||
@Override
|
||||
public void upLoadSuccess(String url, int type) {
|
||||
MvpPre.updateAvatar(url);
|
||||
// MvpPre.updateAvatar(url);
|
||||
ImageUtils.loadHeadCC(url, mBinding.rvUserHead);
|
||||
map.put("avatar", url);
|
||||
isFirst = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAvatarSuccess(String headPicture) {
|
||||
ImageLoader.loadHead(this, mBinding.rvUserHead, headPicture);
|
||||
map.put("head_picture", headPicture);
|
||||
map.put("avatar", headPicture);
|
||||
isFirst = true;
|
||||
}
|
||||
|
||||
@@ -251,14 +267,15 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSexTrue(UserPictrue sex) {
|
||||
ImageLoader.loadHead(this, mBinding.rvUserHead,sex.getDefaultAvatar());
|
||||
map.put("head_picture", sex.getDefaultAvatar());
|
||||
public void updateSexTrue(String sex) {
|
||||
ImageLoader.loadHead(this, mBinding.rvUserHead,sex);
|
||||
map.put("avatar", sex);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSuccess() {
|
||||
public void updateSuccess(UserBean userBean) {
|
||||
SpUtil.saveUserInfo(userBean);
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.qxcm.modulelogin.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
@@ -12,6 +15,11 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alipay.sdk.app.AlipayApi;
|
||||
import com.alipay.sdk.app.AlipayResultActivity;
|
||||
import com.alipay.sdk.app.AuthTask;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.modulelogin.R;
|
||||
import com.qxcm.modulelogin.databinding.ActivityLoginBinding;
|
||||
@@ -20,19 +28,28 @@ import com.qxcm.modulelogin.present.LoginContacter;
|
||||
import com.qxcm.modulelogin.present.LoginPresenter;
|
||||
import com.qxcm.modulemain.activity.MainActivity;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.utils.BarUtils;
|
||||
import com.qxcm.moduleutil.utils.LanguageUtil;
|
||||
import com.qxcm.moduleutil.utils.PreferencesUtils;
|
||||
import com.qxcm.moduleutil.widget.CommonAppContext;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.tencent.mm.opensdk.constants.ConstantsAPI;
|
||||
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;
|
||||
|
||||
/**
|
||||
*@author
|
||||
*@data
|
||||
*@description: 密码登录
|
||||
* @author
|
||||
* @data
|
||||
* @description: 密码登录
|
||||
*/
|
||||
public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLoginBinding> implements LoginContacter.View, View.OnClickListener {
|
||||
|
||||
@@ -168,11 +185,24 @@ public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLogin
|
||||
disLoading();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess(String phoneNumber) {
|
||||
// ARouter.getInstance().build(ARouters.INPUT_CODE).withString("mobile", phoneNumber).navigation();
|
||||
public void sendCodeSuccess1(String phoneNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(UserBean userBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authorizationSuccess(String s) {
|
||||
zfbLogin(s);
|
||||
}
|
||||
|
||||
boolean isPasswordVisible = false;
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
@@ -196,22 +226,24 @@ public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLogin
|
||||
ToastUtils.showShort("请输入登录密码");
|
||||
return;
|
||||
}
|
||||
// MvpPre.login(phoneNumber, password, "", 1);
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
MvpPre.login(phoneNumber, password, "", 2);
|
||||
// Intent intent = new Intent(this, MainActivity.class);
|
||||
// startActivity(intent);
|
||||
// finish();
|
||||
} else if (id == R.id.iv_zfb) {
|
||||
if (!mBinding.cbPrivacy.isChecked()) {
|
||||
com.hjq.toast.ToastUtils.show("请先勾选服务条款");
|
||||
return;
|
||||
}
|
||||
MvpPre.authorization();
|
||||
MvpPre.authorization("zfb");
|
||||
// zfbLogin();
|
||||
} else if (id == R.id.iv_weixin) {
|
||||
|
||||
if (!mBinding.cbPrivacy.isChecked()) {
|
||||
com.hjq.toast.ToastUtils.show("请先勾选服务条款");
|
||||
return;
|
||||
}
|
||||
MvpPre.authorization();
|
||||
wcLogin();
|
||||
} else if (id == R.id.tv_yhxy) {
|
||||
MvpPre.ysxl();
|
||||
} else if (id == R.id.tv_ysxy) {
|
||||
@@ -226,12 +258,71 @@ public class LoginActivity extends BaseMvpActivity<LoginPresenter, ActivityLogin
|
||||
mBinding.edPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
||||
mBinding.ivEye.setImageResource(com.qxcm.moduleutil.R.mipmap.eye_close); // 设置按钮文本为显示密码
|
||||
}
|
||||
mBinding.edPassword.setSelection( mBinding.edPassword.getText().length()); // 将光标移动到文字末尾
|
||||
mBinding.edPassword.setSelection(mBinding.edPassword.getText().length()); // 将光标移动到文字末尾
|
||||
isPasswordVisible = !isPasswordVisible; // 切换状态
|
||||
}else if (id == R.id.tv_forget_password) {
|
||||
} else if (id == R.id.tv_forget_password) {
|
||||
Intent intent = new Intent(this, ForgetPasswordActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||
private void wcLogin() {
|
||||
//发起登陆请求前先注册微信api
|
||||
IWXAPI api = WXAPIFactory.createWXAPI(this, CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(), true);
|
||||
api.registerApp(CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId());
|
||||
if (!api.isWXAppInstalled()) {
|
||||
//todo 提醒未安装微信
|
||||
ToastUtils.showShort("请安装微信客户端");
|
||||
return;
|
||||
}
|
||||
//开始发起登陆请求
|
||||
final SendAuth.Req req = new SendAuth.Req();
|
||||
req.scope = "snsapi_userinfo";
|
||||
req.state = "wechat_sdk_demo_test";
|
||||
api.sendReq(req);
|
||||
}
|
||||
|
||||
private void zfbLogin(String s) {
|
||||
LogUtils.e("@@@",s);
|
||||
CommonAppContext.getInstance();
|
||||
if (!CommonAppContext.isAlipayInstalled(this)){
|
||||
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(LoginActivity.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();
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,29 +8,35 @@ import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
import com.alipay.sdk.app.AuthTask;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.qxcm.modulelogin.R;
|
||||
import com.qxcm.modulelogin.databinding.ActivityLoginBinding;
|
||||
import com.qxcm.modulelogin.databinding.ActivityPasswordLoginBinding;
|
||||
import com.qxcm.modulelogin.even.LoginFinishEvent;
|
||||
import com.qxcm.modulelogin.present.LoginContacter;
|
||||
import com.qxcm.modulelogin.present.LoginPresenter;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.utils.BarUtils;
|
||||
import com.qxcm.moduleutil.utils.PreferencesUtils;
|
||||
import com.qxcm.moduleutil.widget.CommonAppContext;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.utils.logger.DataLogger;
|
||||
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;
|
||||
@@ -109,6 +115,7 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
mBinding.ivZfb.setOnClickListener(this::onClick);
|
||||
mBinding.ivWeixin.setOnClickListener(this::onClick);
|
||||
mBinding.tvSendCode.setOnClickListener(this::onClick);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,7 +154,8 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
intent.putExtra("mobile", mBinding.edPhone.getText().toString());
|
||||
startActivity(intent);
|
||||
finish();
|
||||
} else if (id == R.id.fl_login) {
|
||||
}
|
||||
else if (id == R.id.fl_login) {
|
||||
if (!mBinding.cbPrivacy.isChecked()) {
|
||||
ToastUtils.show("请先勾选服务条款");
|
||||
return;
|
||||
@@ -157,7 +165,12 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
|
||||
return;
|
||||
}
|
||||
MvpPre.sendCode(phone, 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 (id == R.id.tv_yhxy) {
|
||||
MvpPre.yhxy();
|
||||
} else if (id == R.id.tv_ysxy) {
|
||||
@@ -167,18 +180,49 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
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(SHARE_MEDIA.WEIXIN);
|
||||
// MvpPre.authorization("wx");
|
||||
wcLogin();
|
||||
} else if (id == R.id.tv_send_code) {
|
||||
sendCodeSuccess(mBinding.edPhone.getText().toString().trim());
|
||||
String phone = mBinding.edPhone.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(phone)) {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("请输入手机号");
|
||||
return;
|
||||
}
|
||||
sendCodeSuccess(phone);
|
||||
MvpPre.sendCode(phone, 1);
|
||||
}
|
||||
}
|
||||
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();
|
||||
@@ -211,4 +255,53 @@ public class PasswordLoginActivity extends BaseMvpActivity<LoginPresenter, Activ
|
||||
};
|
||||
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);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.qxcm.modulelogin.activity;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.qxcm.modulelogin.R;
|
||||
import com.qxcm.modulelogin.adapter.SwitchAccountsAdapter;
|
||||
import com.qxcm.modulelogin.databinding.ActivitySwitchAccountsBinding;
|
||||
import com.qxcm.modulelogin.present.LoginContacter;
|
||||
import com.qxcm.modulelogin.present.LoginPresenter;
|
||||
import com.qxcm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/19
|
||||
*@description: 选择账号
|
||||
*/
|
||||
public class SwitchAccountsActivity extends BaseMvpActivity<LoginPresenter, ActivitySwitchAccountsBinding> implements LoginContacter.View {
|
||||
|
||||
private List<UserBean> userBeanList=new ArrayList<>();
|
||||
private SwitchAccountsAdapter switchAccountsAdapter;
|
||||
@Override
|
||||
protected void initData() {
|
||||
mBinding.topBar.setTitle("选择账号");
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
if (bundle != null) {
|
||||
Object serializable = bundle.getSerializable("userbean", null);
|
||||
if (serializable instanceof List<?>) {
|
||||
userBeanList = (List<UserBean>) serializable;
|
||||
} else {
|
||||
// 可选:记录错误或提示
|
||||
Log.e("UserBeanError", "Expected List<UserBean> but got: " + (serializable != null ? serializable.getClass().getName() : "null"));
|
||||
}
|
||||
} else {
|
||||
Log.e("UserBeanError", "Bundle is null");
|
||||
}
|
||||
}
|
||||
if (userBeanList!=null&&userBeanList.size()>0){
|
||||
switchAccountsAdapter=new SwitchAccountsAdapter();
|
||||
mBinding.rvList.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
|
||||
mBinding.rvList.setAdapter(switchAccountsAdapter);
|
||||
switchAccountsAdapter.setNewData(userBeanList);
|
||||
switchAccountsAdapter.setOnItemClickListener(item -> {
|
||||
MvpPre.switchAccounts(String.valueOf(item.getUser_id()));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_switch_accounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LoginPresenter bindPresenter() {
|
||||
return new LoginPresenter(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCodeSuccess1(String phoneNumber) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(UserBean userBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authorizationSuccess(String s) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.qxcm.modulelogin.adapter;
|
||||
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.qxcm.modulelogin.R;
|
||||
import com.qxcm.moduleutil.bean.BlackUserBean;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/19
|
||||
*@description: 用户列表适配器
|
||||
*/
|
||||
public class SwitchAccountsAdapter extends BaseQuickAdapter<UserBean, BaseViewHolder> {
|
||||
|
||||
// 定义接口用于回调点击事件
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(UserBean item);
|
||||
}
|
||||
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
|
||||
public SwitchAccountsAdapter() {
|
||||
super(R.layout.item_switch_accounts);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, UserBean item) {
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.im_user));
|
||||
helper.setText(R.id.tv_nick_name, item.getNickname());
|
||||
ImageView imageView= helper.getView(R.id.im_g);
|
||||
// 根据 type 设置图片资源
|
||||
// 根据 type 和 status 设置图片资源
|
||||
imageView.setImageResource(com.qxcm.moduleutil.R.mipmap.yigz);
|
||||
// 设置点击事件
|
||||
imageView.setOnClickListener(v -> {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onItemClick(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.app.Activity;
|
||||
import com.qxcm.modulelogin.bean.UserFillResp;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.bean.UserPictrue;
|
||||
|
||||
import java.io.File;
|
||||
@@ -23,9 +24,9 @@ public final class ImproveInfoContacts {
|
||||
|
||||
void updateNicknameSuccess(String nickname);
|
||||
|
||||
void updateSexTrue(UserPictrue sex);
|
||||
void updateSexTrue(String sex);
|
||||
|
||||
void updateSuccess();
|
||||
void updateSuccess(UserBean userBean);
|
||||
}
|
||||
|
||||
public interface IImproveInfoPre extends IPresenter {
|
||||
|
||||
@@ -4,8 +4,10 @@ import android.content.Context;
|
||||
|
||||
|
||||
import com.qxcm.modulelogin.bean.UserFillResp;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.utils.oss.OSSOperUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
@@ -18,21 +20,18 @@ public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View
|
||||
}
|
||||
@Override
|
||||
public void upDateUserInfo(Map<String, String> map) {
|
||||
// ApiClient.getInstance().userUpdate(map, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
// MvpRef.get().updateSuccess();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// }
|
||||
// });
|
||||
api.userUpdate(map, new BaseObserver<UserBean>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(UserBean userBean) {
|
||||
MvpRef.get().updateSuccess(userBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void fill(String user_no, String nickname, String sex) {
|
||||
@@ -57,29 +56,29 @@ public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View
|
||||
|
||||
@Override
|
||||
public void uploadFile(File file, int type) {
|
||||
// MvpRef.get().showLoadings("上传中...");
|
||||
// String url = OSSOperUtils.getPath(file, type);
|
||||
// OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
// @Override
|
||||
// public void onSuccess() {
|
||||
// if (isViewAttach()) {
|
||||
// MvpRef.get().disLoadings();
|
||||
// MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail() {
|
||||
// if (isViewAttach()) {
|
||||
// MvpRef.get().disLoadings();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
MvpRef.get().showLoadings("上传中...");
|
||||
String url = OSSOperUtils.getPath(file, type);
|
||||
OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().disLoadings();
|
||||
MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().disLoadings();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAvatar(String headPicture) {
|
||||
MvpRef.get().showLoadings();
|
||||
// MvpRef.get().showLoadings();
|
||||
// ApiClient.getInstance().updateAvatar(headPicture, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
@@ -101,46 +100,42 @@ public class ImproveInfoPresenter extends BasePresenter<ImproveInfoContacts.View
|
||||
@Override
|
||||
public void updateNickname() {
|
||||
// TODO: 2019/1/15 完善昵称修改功能
|
||||
MvpRef.get().showLoadings();
|
||||
// api.upUserNickname(new BaseObserver<UserNickBean>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(UserNickBean s) {
|
||||
// MvpRef.get().updateNicknameSuccess(s.getNickname());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// MvpRef.get().disLoadings();
|
||||
// }
|
||||
// });
|
||||
api.upUserNickname(new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().updateNicknameSuccess(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSexTrue(String sex) {
|
||||
// TODO: 2019/1/15 完善性别获取头像信息
|
||||
MvpRef.get().showLoadings();
|
||||
// api.upUserTrue(sex, new BaseObserver<UserPictrue>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(UserPictrue userPictrue) {
|
||||
// MvpRef.get().updateSexTrue(userPictrue);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// MvpRef.get().disLoadings();
|
||||
// }
|
||||
// });
|
||||
api.upUserPic(sex, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String userPictrue) {
|
||||
MvpRef.get().updateSexTrue(userPictrue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,14 @@ import android.app.Activity;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
|
||||
public final class LoginContacter {
|
||||
public interface View extends IView<Activity> {
|
||||
void sendCodeSuccess(String phoneNumber);
|
||||
void sendCodeSuccess1(String phoneNumber);
|
||||
void loginSuccess(UserBean userBean);
|
||||
|
||||
void authorizationSuccess(String s);
|
||||
}
|
||||
|
||||
public interface ILoginPre extends IPresenter {
|
||||
@@ -15,9 +19,12 @@ public final class LoginContacter {
|
||||
|
||||
void login(String mobile, String password, String code, int type);
|
||||
|
||||
void thirdPartyLogin(String oldOpenId, String openId, int three_party, String nickname, String head_pic);
|
||||
|
||||
void oauthLogin(String netease_token, String access_token, int type);
|
||||
void oauthLogin(String auth_code,int type);//阿里登录
|
||||
|
||||
void switchAccounts(String loginId);//切换账号
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,37 @@
|
||||
package com.qxcm.modulelogin.present;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alipay.sdk.app.AuthTask;
|
||||
import com.blankj.utilcode.util.AppUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.qxcm.modulelogin.activity.ImproveInfoActivity;
|
||||
import com.qxcm.modulelogin.activity.LoginActivity;
|
||||
import com.qxcm.modulelogin.activity.SwitchAccountsActivity;
|
||||
import com.qxcm.modulemain.activity.MainActivity;
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.http.BaseObserver;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.utils.PreferencesUtils;
|
||||
import com.tencent.mm.opensdk.modelmsg.SendAuth;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class LoginPresenter extends BasePresenter<LoginContacter.View> implements LoginContacter.ILoginPre {
|
||||
public LoginPresenter(LoginContacter.View view, Context context) {
|
||||
super(view, context);
|
||||
@@ -16,89 +39,176 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implemen
|
||||
|
||||
@Override
|
||||
public void sendCode(String phoneNumber, int type) {
|
||||
api.sendCode(phoneNumber,"default", new BaseObserver<Object>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Object o) {
|
||||
MvpRef.get().sendCodeSuccess1(o+"");
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param mobile 手机号
|
||||
* @param password 密码
|
||||
* @param code 验证码
|
||||
* @param type 1:手机号登录 2:密码登录
|
||||
*/
|
||||
@Override
|
||||
public void login(String mobile, String password, String code, int type) {
|
||||
if (type==1){
|
||||
api.login(mobile, code, new BaseObserver<List<UserBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserBean> userBeans) {
|
||||
loginSuccess(userBeans);
|
||||
}
|
||||
|
||||
});
|
||||
}else if (type==2){
|
||||
api.userLogin(mobile,password, new BaseObserver<List<UserBean>>(){
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserBean> userBeans) {
|
||||
loginSuccess(userBeans);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支付宝登录
|
||||
* @param auth_code
|
||||
* @param type type=1:微信登录;type=2:支付宝登录
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void oauthLogin(String auth_code, int type) {
|
||||
api.authCode(auth_code,type, new BaseObserver<List<UserBean>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserBean> userBeans) {
|
||||
loginSuccess(userBeans);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void thirdPartyLogin(String oldOpenId, String openId, int three_party, String nickname, String head_pic) {
|
||||
public void switchAccounts(String loginId) {
|
||||
api.switchAccounts(loginId, new BaseObserver<List<UserBean>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void oauthLogin(String netease_token, String access_token, int type) {
|
||||
public void onNext(List<UserBean> userBeans) {
|
||||
loginSuccess(userBeans);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
|
||||
}
|
||||
public void authorization() {
|
||||
// if (share_media.getName().equals(SHARE_MEDIA.QQ.getName())) {
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.A010304_qq, "be_null", "be_null");
|
||||
// if (!AppUtils.isAppInstalled("com.tencent.mobileqq")) {
|
||||
// ToastUtils.showShort("请安装QQ客户端");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// if (share_media.getName().equals(SHARE_MEDIA.WEIXIN.getName())) {
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.A010304_wx, "be_null", "be_null");
|
||||
// if (!AppUtils.isAppInstalled("com.tencent.mm")) {
|
||||
// ToastUtils.showShort("请安装微信客户端");
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// UMShareAPI.get(MvpRef.get().getSelfActivity()).getPlatformInfo(MvpRef.get().getSelfActivity(), share_media, new UMAuthListener() {
|
||||
// @Override
|
||||
// public void onStart(SHARE_MEDIA share_media) {
|
||||
// Log.d(TAG, "onStart " + "授权开始");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete(SHARE_MEDIA share_media, int i, Map<String, String> map) {
|
||||
// Log.d(TAG, "onComplete " + "授权完成");
|
||||
//
|
||||
// //sdk是6.4.4的,但是获取值的时候用的是6.2以前的(access_token)才能获取到值,未知原因
|
||||
// String uid = map.get("uid");
|
||||
// String openid = map.get("openid");//微博没有
|
||||
// String unionid = map.get("unionid");//微博没有
|
||||
// String access_token = map.get("access_token");
|
||||
// String refresh_token = map.get("refresh_token");//微信,qq,微博都没有获取到
|
||||
// String expires_in = map.get("expires_in");
|
||||
// String name = map.get("name");
|
||||
// String gender = map.get("gender");
|
||||
// String iconurl = map.get("iconurl");
|
||||
//
|
||||
// if (isViewAttach() && MvpRef.get().getSelfActivity() != null) {
|
||||
// MvpRef.get().getSelfActivity().runOnUiThread(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// if (share_media.getName().equals(SHARE_MEDIA.QQ.getName())) {
|
||||
// thirdPartyLogin(uid, openid, 2, name, iconurl);
|
||||
// } else {
|
||||
// thirdPartyLogin(uid, openid, 1, name, iconurl);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(SHARE_MEDIA share_media, int i, Throwable throwable) {
|
||||
// Log.d(TAG, "onError " + "授权失败");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCancel(SHARE_MEDIA share_media, int i) {
|
||||
// Log.d(TAG, "onCancel " + "授权取消");
|
||||
// }
|
||||
// });
|
||||
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(new LoginFinishEvent());
|
||||
// EventBus.getDefault().post(new SplashFinishEvent());
|
||||
// AppLog.setUserUniqueID(userBean.getUser_id()); // 设置您自己的账号体系ID, 并保证其唯一性 !
|
||||
}
|
||||
public void authorization(String type) {
|
||||
|
||||
if (type.equals("wx")) {
|
||||
if (!AppUtils.isAppInstalled("com.tencent.mm")) {
|
||||
ToastUtils.showShort("请安装微信客户端");
|
||||
return;
|
||||
}
|
||||
// IWXAPI api = WXEntryActivity.getWXAPI();
|
||||
// final SendAuth.Req req = new SendAuth.Req();
|
||||
// req.scope = "snsapi_userinfo"; // 只能填 snsapi_userinfo
|
||||
// req.state = "wechat_sdk_demo_test";
|
||||
// api.sendReq(req);
|
||||
}else if (type.equals("zfb")){
|
||||
// Map<String, String> result = authTask.authV2(authInfo, true);
|
||||
api.authorization(new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().authorizationSuccess(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void ysxl() {
|
||||
// ARouter.getInstance().build(ARouters.H5).withString("url", Constant.URL.URL_USER_YSXY).withString("title", "隐私协议").navigation();
|
||||
}
|
||||
|
||||
@@ -138,8 +138,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_girl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="@dimen/dp_160"
|
||||
android:layout_height="@dimen/dp_77"
|
||||
android:src="@mipmap/check_girl"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
@@ -157,8 +157,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_boy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="@dimen/dp_160"
|
||||
android:layout_height="@dimen/dp_77"
|
||||
android:src="@mipmap/check_boy"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:hint="@string/login_hint_code"
|
||||
android:inputType="textPassword"
|
||||
android:inputType="number"
|
||||
android:maxLength="20"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/black"
|
||||
|
||||
32
moduleLogin/src/main/res/layout/activity_switch_accounts.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context=".activity.SwitchAccountsActivity">
|
||||
|
||||
<data>
|
||||
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<com.qxcm.moduleutil.widget.CustomTopBar
|
||||
android:id="@+id/top_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/rv_list"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
android:background="@color/white"
|
||||
android:clipToPadding="false"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingTop="10dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
37
moduleLogin/src/main/res/layout/item_switch_accounts.xml
Normal file
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_szmm"
|
||||
style="@style/My_Info_Item_LL_Style"
|
||||
android:background="@drawable/bg_r15_white">
|
||||
|
||||
<com.qxcm.moduleutil.widget.GifAvatarOvalView
|
||||
android:id="@+id/im_user"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="10dp"
|
||||
android:src="@mipmap/me_img_upld_head" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nick_name"
|
||||
style="@style/My_Info_Item_Title_Style"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
tools:text="@string/set_password" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/im_g"
|
||||
android:layout_width="@dimen/dp_79"
|
||||
android:layout_height="@dimen/dp_31"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:layout_gravity="center"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,4 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">moduleLogin</string>
|
||||
|
||||
</resources>
|
||||
@@ -10,6 +10,9 @@ android {
|
||||
defaultConfig {
|
||||
minSdk 24
|
||||
|
||||
versionCode Integer.parseInt(project.findProperty("APP_VERSION_CODE"))
|
||||
versionName project.findProperty("APP_VERSION_NAME")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
@@ -38,6 +41,7 @@ dependencies {
|
||||
implementation libs.appcompat
|
||||
implementation libs.material
|
||||
implementation libs.core.ktx
|
||||
implementation project(':moduletablayout')
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
@@ -95,6 +99,23 @@ dependencies {
|
||||
|
||||
api(libs.github.shadowlayout)
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.32'
|
||||
//判断是否是模拟器
|
||||
api(libs.easy.protector.release)
|
||||
//第三方Popup
|
||||
api(libs.custompopwindow)
|
||||
// cookie
|
||||
api(libs.persistentcookiejar)
|
||||
|
||||
//noinspection GradleDynamicVersion
|
||||
api(libs.dpa.oss.android.sdk)
|
||||
//微信登录
|
||||
api(libs.wechat.sdk.android)
|
||||
//支付宝
|
||||
api(libs.alipay.alipaysdk.android)
|
||||
|
||||
api(libs.easypermissions)
|
||||
api(libs.xbanner)
|
||||
|
||||
api(libs.lombok)
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.32'
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true">
|
||||
|
||||
|
||||
@@ -1,27 +1,19 @@
|
||||
package com.example.modulecircle.adapter;
|
||||
package com.qxcm.moduleutil.adapter;
|
||||
|
||||
import android.media.MediaPlayer;
|
||||
import android.os.CountDownTimer;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.modulecircle.R;
|
||||
import com.qxcm.moduleutil.adapter.OneImageYuanJiaoAdapter;
|
||||
import com.qxcm.moduleutil.R;
|
||||
import com.qxcm.moduleutil.bean.CircleListBean;
|
||||
import com.qxcm.moduleutil.utils.ImageUtils;
|
||||
import com.qxcm.moduleutil.widget.MyGridView;
|
||||
import com.qxcm.moduleutil.widget.img.FullScreenUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CirleListAdapter extends BaseQuickAdapter<CircleListBean, BaseViewHolder> {
|
||||
public CirleListAdapter() {
|
||||
super(R.layout.item_cirle_list);
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.qxcm.moduleutil.adapter;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MyPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private List<Fragment> fragments;
|
||||
private List<String> typeOnes;
|
||||
|
||||
public MyPagerAdapter(FragmentManager fm, List<Fragment> mFragments, List<String> ones) {
|
||||
super(fm);
|
||||
this.fragments = mFragments;
|
||||
this.typeOnes = ones;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return fragments.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return typeOnes.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return fragments.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
super.destroyItem(container, position, object);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.qxcm.moduleutil.base;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
public class BaseApplication extends Application {
|
||||
|
||||
}
|
||||
@@ -1,28 +1,52 @@
|
||||
package com.qxcm.moduleutil.widget;
|
||||
package com.qxcm.moduleutil.base;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Application;
|
||||
import android.app.LauncherActivity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.multidex.MultiDex;
|
||||
import androidx.multidex.MultiDexApplication;
|
||||
|
||||
import com.blankj.utilcode.util.AppUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ProcessUtils;
|
||||
import com.blankj.utilcode.util.ServiceUtils;
|
||||
import com.lahm.library.EasyProtectorLib;
|
||||
import com.lahm.library.EmulatorCheckCallback;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.event.AppLifecycleEvent;
|
||||
import com.qxcm.moduleutil.interfaces.AppLifecycleUtil;
|
||||
import com.qxcm.moduleutil.utils.FloatWindowHelper;
|
||||
import com.qxcm.moduleutil.utils.SPConstants;
|
||||
import com.qxcm.moduleutil.utils.SpUtil;
|
||||
import com.qxcm.moduleutil.utils.UtilConfig;
|
||||
import com.qxcm.moduleutil.utils.config.EnvironmentEnum;
|
||||
import com.qxcm.moduleutil.utils.config.EnvironmentPrefs;
|
||||
import com.qxcm.moduleutil.widget.CommonAppConfig;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,14 +59,47 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
private static Handler sMainThreadHandler;
|
||||
private int mCount;
|
||||
private boolean mFront;//是否前台
|
||||
|
||||
|
||||
public String emulator = "0";
|
||||
@Getter
|
||||
private EnvironmentEnum currentEnvironment;
|
||||
public UserBean mUserBean;
|
||||
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
|
||||
private ScheduledExecutorService scheduledExecutorServiceRoom = null;
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
sInstance = this;
|
||||
sMainThreadHandler=new Handler();
|
||||
UtilConfig.init(this);
|
||||
registerActivityLifecycleCallbacks();
|
||||
initWebView();
|
||||
if (ProcessUtils.isMainProcess()) {
|
||||
if (SpUtil.isAgreePolicy()) {
|
||||
checkInEmulator();
|
||||
UtilConfig.checkInEmulator();
|
||||
}
|
||||
}
|
||||
EnvironmentPrefs prefs = new EnvironmentPrefs(this);
|
||||
currentEnvironment = prefs.getSelectedEnvironment();
|
||||
}
|
||||
private void initWebView() {
|
||||
//Android P 以及之后版本不支持同时从多个进程使用具有相同数据目录的WebView
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
String processName = getProcessName(this);
|
||||
if (!AppUtils.getAppPackageName().equals(processName)) {//判断不等于默认进程名称
|
||||
WebView.setDataDirectorySuffix(processName);
|
||||
}
|
||||
}
|
||||
}
|
||||
public String getProcessName(Context context) {
|
||||
if (context == null) return null;
|
||||
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) {
|
||||
if (processInfo.pid == android.os.Process.myPid()) {
|
||||
return processInfo.processName;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
@@ -66,7 +123,14 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
public void checkInEmulator() {
|
||||
emulator = EasyProtectorLib.checkIsRunningInEmulator(this, new EmulatorCheckCallback() {
|
||||
@Override
|
||||
public void findEmulator(String emulatorInfo) {
|
||||
// Logger.e(emulatorInfo);
|
||||
}
|
||||
}) ? "1" : "0";
|
||||
}
|
||||
|
||||
public static void postDelayed(Runnable runnable, long delayMillis) {
|
||||
if (sMainThreadHandler != null) {
|
||||
@@ -195,4 +259,44 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
public void startInitSdk(){
|
||||
|
||||
}
|
||||
|
||||
public void setUser(UserBean userBean) {
|
||||
mUserBean = userBean;
|
||||
SpUtil.saveUserId(userBean.getUser_id());
|
||||
SpUtil.saveUserInfo(userBean);
|
||||
SpUtil.putToken(userBean.getToken());
|
||||
}
|
||||
|
||||
public UserBean getUser() {
|
||||
if (mUserBean == null) {
|
||||
mUserBean = SpUtil.getUserInfo();
|
||||
}
|
||||
return mUserBean;
|
||||
}
|
||||
public void setUserBean(UserBean bean) {
|
||||
mUserBean = bean;
|
||||
}
|
||||
public void clearLoginInfo() throws ClassNotFoundException {
|
||||
// mUid = null;
|
||||
// mToken = null;
|
||||
// SpUtil.getInstance().removeValue(
|
||||
// SPConstants.USER_ID, SPConstants.TOKEN, SPConstants.USER_INFO
|
||||
// );
|
||||
mUserBean = null;
|
||||
SpUtil.saveUserId(-1);
|
||||
SpUtil.saveUserInfo(new UserBean());
|
||||
SpUtil.putToken("");
|
||||
Intent intent = new Intent("com.example.action.LAUNCH_PAGE");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
getApplicationContext().startActivity(intent);
|
||||
}
|
||||
|
||||
public static boolean isAlipayInstalled(Context context){
|
||||
try {
|
||||
context.getPackageManager().getPackageInfo("com.eg.android.AlipayGphone", 0);
|
||||
return true;//安装了支付宝
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return false; //未安装支付宝
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class AttentionResp {
|
||||
|
||||
private String room_id;
|
||||
private String room_name;
|
||||
private String room_code;
|
||||
private String popularity;
|
||||
private String label_name;
|
||||
private String label_icon;
|
||||
private String owner_picture;
|
||||
private String owner_nickname;
|
||||
private int locked;
|
||||
|
||||
private String label_id;
|
||||
|
||||
public String getLabel_id() {
|
||||
return label_id;
|
||||
}
|
||||
|
||||
public void setLabel_id(String label_id) {
|
||||
this.label_id = label_id;
|
||||
}
|
||||
private String cover_picture;
|
||||
|
||||
public String getRoomPicture() {
|
||||
if (!TextUtils.isEmpty(cover_picture)) {
|
||||
return cover_picture;
|
||||
}
|
||||
return owner_picture;
|
||||
}
|
||||
|
||||
public String getCover_picture() {
|
||||
return cover_picture;
|
||||
}
|
||||
|
||||
public void setCover_picture(String cover_picture) {
|
||||
this.cover_picture = cover_picture;
|
||||
}
|
||||
|
||||
public int getLocked() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
public void setLocked(int locked) {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public String getRoom_id() {
|
||||
return room_id;
|
||||
}
|
||||
|
||||
public void setRoom_id(String room_id) {
|
||||
this.room_id = room_id;
|
||||
}
|
||||
|
||||
public String getRoom_name() {
|
||||
return room_name;
|
||||
}
|
||||
|
||||
public void setRoom_name(String room_name) {
|
||||
this.room_name = room_name;
|
||||
}
|
||||
|
||||
public String getRoom_code() {
|
||||
return room_code;
|
||||
}
|
||||
|
||||
public void setRoom_code(String room_code) {
|
||||
this.room_code = room_code;
|
||||
}
|
||||
|
||||
public String getPopularity() {
|
||||
return popularity;
|
||||
}
|
||||
|
||||
public void setPopularity(String popularity) {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
|
||||
public String getLabel_name() {
|
||||
return label_name;
|
||||
}
|
||||
|
||||
public void setLabel_name(String label_name) {
|
||||
this.label_name = label_name;
|
||||
}
|
||||
|
||||
public String getLabel_icon() {
|
||||
return label_icon;
|
||||
}
|
||||
|
||||
public void setLabel_icon(String label_icon) {
|
||||
this.label_icon = label_icon;
|
||||
}
|
||||
|
||||
public String getOwner_picture() {
|
||||
return owner_picture;
|
||||
}
|
||||
|
||||
public void setOwner_picture(String owner_picture) {
|
||||
this.owner_picture = owner_picture;
|
||||
}
|
||||
|
||||
public String getOwner_nickname() {
|
||||
return owner_nickname;
|
||||
}
|
||||
|
||||
public void setOwner_nickname(String owner_nickname) {
|
||||
this.owner_nickname = owner_nickname;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BlackUserBean {
|
||||
private String userName;
|
||||
private String userId;
|
||||
private String userAvatar;
|
||||
private int type;//0:关注;1:黑名单;2:粉丝
|
||||
private int status;//0:未关注 1:已关注
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
public class CheckTxtResp {
|
||||
|
||||
|
||||
private int result;
|
||||
|
||||
public int getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(int result) {
|
||||
this.result = result;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package com.qxcm.moduleutil.bean;
|
||||
|
||||
import com.qxcm.moduleutil.widget.picker.PickerView;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DateBean implements PickerView.PickerItem {
|
||||
|
||||
private String text;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
public class GiftBean {
|
||||
|
||||
private String number;
|
||||
private String gift_id;
|
||||
private String name;
|
||||
private String picture;
|
||||
private String price;
|
||||
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getGift_id() {
|
||||
return gift_id;
|
||||
}
|
||||
|
||||
public void setGift_id(String gift_id) {
|
||||
this.gift_id = gift_id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPicture() {
|
||||
return picture;
|
||||
}
|
||||
|
||||
public void setPicture(String picture) {
|
||||
this.picture = picture;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(String price) {
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
|
||||
import com.example.moduletablayout.listener.CustomTabEntity;
|
||||
|
||||
/**
|
||||
* 项目名称 qipao-android
|
||||
* 包名:com.qpyy.module.me.bean
|
||||
* 创建人 黄强
|
||||
* 创建时间 2020/12/1 17:40
|
||||
* 描述 describe
|
||||
*/
|
||||
public class HomePageTabBean implements CustomTabEntity {
|
||||
public HomePageTabBean(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
private String title;
|
||||
|
||||
@Override
|
||||
public String getTabTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTabSelectedIcon() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTabUnselectedIcon() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class HomeRoomInfo {
|
||||
private String room_name;
|
||||
private String cover_picture;
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class ManageRoomResp {
|
||||
|
||||
private String id;
|
||||
private String room_id;
|
||||
private String room_name;
|
||||
private String room_code;
|
||||
private String popularity;
|
||||
private String label_name;
|
||||
private String label_icon;
|
||||
private String owner_picture;
|
||||
private String owner_nickname;
|
||||
private int sys_type_id;
|
||||
private int locked;
|
||||
private String label_id;
|
||||
|
||||
public String getLabel_id() {
|
||||
return label_id;
|
||||
}
|
||||
|
||||
public void setLabel_id(String label_id) {
|
||||
this.label_id = label_id;
|
||||
}
|
||||
|
||||
private String cover_picture;
|
||||
|
||||
public String getRoomPicture() {
|
||||
if (!TextUtils.isEmpty(cover_picture)) {
|
||||
return cover_picture;
|
||||
}
|
||||
return owner_picture;
|
||||
}
|
||||
|
||||
public String getCover_picture() {
|
||||
return cover_picture;
|
||||
}
|
||||
|
||||
public void setCover_picture(String cover_picture) {
|
||||
this.cover_picture = cover_picture;
|
||||
}
|
||||
|
||||
public int getLocked() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
public void setLocked(int locked) {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public int getSys_type_id() {
|
||||
return sys_type_id;
|
||||
}
|
||||
|
||||
public void setSys_type_id(int sys_type_id) {
|
||||
this.sys_type_id = sys_type_id;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRoom_id() {
|
||||
return room_id;
|
||||
}
|
||||
|
||||
public void setRoom_id(String room_id) {
|
||||
this.room_id = room_id;
|
||||
}
|
||||
|
||||
public String getRoom_name() {
|
||||
return room_name;
|
||||
}
|
||||
|
||||
public void setRoom_name(String room_name) {
|
||||
this.room_name = room_name;
|
||||
}
|
||||
|
||||
public String getRoom_code() {
|
||||
return room_code;
|
||||
}
|
||||
|
||||
public void setRoom_code(String room_code) {
|
||||
this.room_code = room_code;
|
||||
}
|
||||
|
||||
public String getPopularity() {
|
||||
return popularity;
|
||||
}
|
||||
|
||||
public void setPopularity(String popularity) {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
|
||||
public String getLabel_name() {
|
||||
return label_name;
|
||||
}
|
||||
|
||||
public void setLabel_name(String label_name) {
|
||||
this.label_name = label_name;
|
||||
}
|
||||
|
||||
public String getLabel_icon() {
|
||||
return label_icon;
|
||||
}
|
||||
|
||||
public void setLabel_icon(String label_icon) {
|
||||
this.label_icon = label_icon;
|
||||
}
|
||||
|
||||
public String getOwner_picture() {
|
||||
return owner_picture;
|
||||
}
|
||||
|
||||
public void setOwner_picture(String owner_picture) {
|
||||
this.owner_picture = owner_picture;
|
||||
}
|
||||
|
||||
public String getOwner_nickname() {
|
||||
return owner_nickname;
|
||||
}
|
||||
|
||||
public void setOwner_nickname(String owner_nickname) {
|
||||
this.owner_nickname = owner_nickname;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MyBagBean {
|
||||
private String myBagTitle;
|
||||
private String myBagType;
|
||||
|
||||
public MyBagBean(String myBagTitle, String myBagType) {
|
||||
this.myBagTitle = myBagTitle;
|
||||
this.myBagType = myBagType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MyBagDataBean {
|
||||
private String title;
|
||||
private String giftName;
|
||||
private String time;
|
||||
private String base_image;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
public class MyFootResp {
|
||||
|
||||
private String room_name;
|
||||
private String room_code;
|
||||
private String popularity;
|
||||
private String label_name;
|
||||
private String label_icon;
|
||||
private String owner_picture;
|
||||
private String owner_nickname;
|
||||
private String room_id;
|
||||
private int locked;
|
||||
|
||||
private String cover_picture;
|
||||
private String label_id;
|
||||
|
||||
public String getLabel_id() {
|
||||
return label_id;
|
||||
}
|
||||
|
||||
public void setLabel_id(String label_id) {
|
||||
this.label_id = label_id;
|
||||
}
|
||||
|
||||
public String getRoomPicture() {
|
||||
if (!TextUtils.isEmpty(cover_picture)) {
|
||||
return cover_picture;
|
||||
}
|
||||
return owner_picture;
|
||||
}
|
||||
|
||||
public String getCover_picture() {
|
||||
return cover_picture;
|
||||
}
|
||||
|
||||
public void setCover_picture(String cover_picture) {
|
||||
this.cover_picture = cover_picture;
|
||||
}
|
||||
|
||||
public int getLocked() {
|
||||
return locked;
|
||||
}
|
||||
|
||||
public void setLocked(int locked) {
|
||||
this.locked = locked;
|
||||
}
|
||||
|
||||
public String getRoom_id() {
|
||||
return room_id;
|
||||
}
|
||||
|
||||
public void setRoom_id(String room_id) {
|
||||
this.room_id = room_id;
|
||||
}
|
||||
|
||||
public String getRoom_name() {
|
||||
return room_name;
|
||||
}
|
||||
|
||||
public void setRoom_name(String room_name) {
|
||||
this.room_name = room_name;
|
||||
}
|
||||
|
||||
public String getRoom_code() {
|
||||
return room_code;
|
||||
}
|
||||
|
||||
public void setRoom_code(String room_code) {
|
||||
this.room_code = room_code;
|
||||
}
|
||||
|
||||
public String getPopularity() {
|
||||
return popularity;
|
||||
}
|
||||
|
||||
public void setPopularity(String popularity) {
|
||||
this.popularity = popularity;
|
||||
}
|
||||
|
||||
public String getLabel_name() {
|
||||
return label_name;
|
||||
}
|
||||
|
||||
public void setLabel_name(String label_name) {
|
||||
this.label_name = label_name;
|
||||
}
|
||||
|
||||
public String getLabel_icon() {
|
||||
return label_icon;
|
||||
}
|
||||
|
||||
public void setLabel_icon(String label_icon) {
|
||||
this.label_icon = label_icon;
|
||||
}
|
||||
|
||||
public String getOwner_picture() {
|
||||
return owner_picture;
|
||||
}
|
||||
|
||||
public void setOwner_picture(String owner_picture) {
|
||||
this.owner_picture = owner_picture;
|
||||
}
|
||||
|
||||
public String getOwner_nickname() {
|
||||
return owner_nickname;
|
||||
}
|
||||
|
||||
public void setOwner_nickname(String owner_nickname) {
|
||||
this.owner_nickname = owner_nickname;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
public class MyRoomBean {
|
||||
|
||||
/*
|
||||
"room_id": "10184180",
|
||||
"cover_picture": "httpss://osschumeng.oss-cn-beijing.aliyuncs.com/img/e86e2efe3f4412561e9c30326162d946.jpg",
|
||||
"room_name": "钊的房间",
|
||||
"online_num": 0,
|
||||
"label_id": "23",
|
||||
"label_name": "聊天",
|
||||
"label_icon": "",
|
||||
"favorite_count": "0",
|
||||
"come_count": "161",
|
||||
"today_income": 0
|
||||
*/
|
||||
|
||||
private String room_name; //房间名称
|
||||
private int room_id; //房间ID
|
||||
private String label_id; //房间类型
|
||||
private String label_name; //房间类型名称
|
||||
private String cover_picture; //房间图片
|
||||
private String label_icon; //房间类型图标
|
||||
private String online_num; //房间在线人数
|
||||
private String favorite_count; //房间收藏数
|
||||
private String come_count; //房间进入数
|
||||
private Double today_income; //今日收益;
|
||||
private int earnings_ratio;//房间收益比例
|
||||
|
||||
public int getEarnings_ratio() {
|
||||
return earnings_ratio;
|
||||
}
|
||||
|
||||
public void setEarnings_ratio(int earnings_ratio) {
|
||||
this.earnings_ratio = earnings_ratio;
|
||||
}
|
||||
|
||||
public String getRoom_name() {
|
||||
return room_name;
|
||||
}
|
||||
|
||||
public void setRoom_name(String room_name) {
|
||||
this.room_name = room_name;
|
||||
}
|
||||
|
||||
public int getRoom_id() {
|
||||
return room_id;
|
||||
}
|
||||
|
||||
public void setRoom_id(int room_id) {
|
||||
this.room_id = room_id;
|
||||
}
|
||||
|
||||
public String getLabel_id() {
|
||||
return label_id;
|
||||
}
|
||||
|
||||
public void setLabel_id(String label_id) {
|
||||
this.label_id = label_id;
|
||||
}
|
||||
|
||||
public String getLabel_name() {
|
||||
return label_name;
|
||||
}
|
||||
|
||||
public void setLabel_name(String label_name) {
|
||||
this.label_name = label_name;
|
||||
}
|
||||
|
||||
public String getCover_picture() {
|
||||
return cover_picture;
|
||||
}
|
||||
|
||||
public void setCover_picture(String cover_picture) {
|
||||
this.cover_picture = cover_picture;
|
||||
}
|
||||
|
||||
public String getLabel_icon() {
|
||||
return label_icon;
|
||||
}
|
||||
|
||||
public void setLabel_icon(String label_icon) {
|
||||
this.label_icon = label_icon;
|
||||
}
|
||||
|
||||
public String getOnline_num() {
|
||||
return online_num;
|
||||
}
|
||||
|
||||
public void setOnline_num(String online_num) {
|
||||
this.online_num = online_num;
|
||||
}
|
||||
|
||||
public String getFavorite_count() {
|
||||
return favorite_count;
|
||||
}
|
||||
|
||||
public void setFavorite_count(String favorite_count) {
|
||||
this.favorite_count = favorite_count;
|
||||
}
|
||||
|
||||
public String getCome_count() {
|
||||
return come_count;
|
||||
}
|
||||
|
||||
public void setCome_count(String come_count) {
|
||||
this.come_count = come_count;
|
||||
}
|
||||
|
||||
public Double getToday_income() {
|
||||
return today_income;
|
||||
}
|
||||
|
||||
public void setToday_income(Double today_income) {
|
||||
this.today_income = today_income;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class PhotoWallResp implements Serializable {
|
||||
|
||||
public String getVedio() {
|
||||
return vedio;
|
||||
}
|
||||
|
||||
public void setVedio(String vedio) {
|
||||
this.vedio = vedio;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getVedio_cover() {
|
||||
return vedio_cover;
|
||||
}
|
||||
|
||||
public void setVedio_cover(String vedio_cover) {
|
||||
this.vedio_cover = vedio_cover;
|
||||
}
|
||||
|
||||
public List<GiftResp> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<GiftResp> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
private String vedio;
|
||||
private String avatar;
|
||||
private String vedio_cover;
|
||||
private List<GiftResp> list;
|
||||
|
||||
public static class GiftResp implements Serializable {
|
||||
public GiftResp(String id, String url, int width, int height) {
|
||||
this.id = id;
|
||||
this.url = url;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
private String id;
|
||||
private String url;
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* ProjectName: isolated-island
|
||||
* Package: com.yutang.xqipao.data
|
||||
* Description: java类作用描述
|
||||
* Author: 姚闻达
|
||||
* CreateDate: 2020/11/1 10:14
|
||||
* UpdateUser: 更新者
|
||||
* UpdateDate: 2020/11/1 10:14
|
||||
* UpdateRemark: 更新说明
|
||||
* Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class RechargeBean implements MultiItemEntity {
|
||||
private int itemViewType;
|
||||
private String goldNum;
|
||||
private String money;
|
||||
private boolean isCustom; // 是否为自定义项
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoomDetails {
|
||||
/**
|
||||
* list : [{"total_price":416,"total_earning":83.2,"time":"2025-03-07","list":[{"user_head_picture":"https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png","user_nickname":"用户10137552","get_user_nickname":"用户10137840","gift_name":"退烧药","gift_number":"3","total_price":"297.00","time":"2025-03-07","earning":59.4},{"user_head_picture":"https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png","user_nickname":"用户10137552","get_user_nickname":"用户10137840","gift_name":"征婚帖","gift_number":"1","total_price":"19.00","time":"2025-03-07","earning":3.8},{"user_head_picture":"https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png","user_nickname":"用户10137552","get_user_nickname":"用户10137840","gift_name":"香槟","gift_number":"1","total_price":"99.00","time":"2025-03-07","earning":19.8},{"user_head_picture":"https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png","user_nickname":"钊","get_user_nickname":"用户10137840","gift_name":"小心心","gift_number":"1","total_price":"1.00","time":"2025-03-07","earning":0.2}]}]
|
||||
* total_amount : 416
|
||||
* total_earning : 83.2
|
||||
* room_name : 钊的房间
|
||||
* page : <div> </div>
|
||||
*/
|
||||
|
||||
private double total_amount;
|
||||
private double total_earning;
|
||||
private String room_name;
|
||||
private String page;
|
||||
private List<RoomDetailsList> list;
|
||||
|
||||
public double getTotal_amount() {
|
||||
return total_amount;
|
||||
}
|
||||
|
||||
public void setTotal_amount(double total_amount) {
|
||||
this.total_amount = total_amount;
|
||||
}
|
||||
|
||||
public double getTotal_earning() {
|
||||
return total_earning;
|
||||
}
|
||||
|
||||
public void setTotal_earning(double total_earning) {
|
||||
this.total_earning = total_earning;
|
||||
}
|
||||
|
||||
public String getRoom_name() {
|
||||
return room_name;
|
||||
}
|
||||
|
||||
public void setRoom_name(String room_name) {
|
||||
this.room_name = room_name;
|
||||
}
|
||||
|
||||
public String getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
public void setPage(String page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
public List<RoomDetailsList> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<RoomDetailsList> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public static class RoomDetailsList implements MultiItemEntity {
|
||||
/**
|
||||
* total_price : 416
|
||||
* total_earning : 83.2
|
||||
* time : 2025-03-07
|
||||
* list : [{"user_head_picture":"https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png","user_nickname":"用户10137552","get_user_nickname":"用户10137840","gift_name":"退烧药","gift_number":"3","total_price":"297.00","time":"2025-03-07","earning":59.4},{"user_head_picture":"https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png","user_nickname":"用户10137552","get_user_nickname":"用户10137840","gift_name":"征婚帖","gift_number":"1","total_price":"19.00","time":"2025-03-07","earning":3.8},{"user_head_picture":"https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png","user_nickname":"用户10137552","get_user_nickname":"用户10137840","gift_name":"香槟","gift_number":"1","total_price":"99.00","time":"2025-03-07","earning":19.8},{"user_head_picture":"https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png","user_nickname":"钊","get_user_nickname":"用户10137840","gift_name":"小心心","gift_number":"1","total_price":"1.00","time":"2025-03-07","earning":0.2}]
|
||||
*/
|
||||
private int itemViewType = 1;
|
||||
private double total_price;
|
||||
private double total_earning;
|
||||
private String time;
|
||||
private List<RoomDetail> list;
|
||||
|
||||
public double getTotal_price() {
|
||||
return total_price;
|
||||
}
|
||||
|
||||
public void setTotal_price(double total_price) {
|
||||
this.total_price = total_price;
|
||||
}
|
||||
|
||||
public double getTotal_earning() {
|
||||
return total_earning;
|
||||
}
|
||||
|
||||
public void setTotal_earning(double total_earning) {
|
||||
this.total_earning = total_earning;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public List<RoomDetail> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<RoomDetail> list) {
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public void setItemViewType(int itemViewType) {
|
||||
this.itemViewType = itemViewType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemViewType;
|
||||
}
|
||||
|
||||
public static class RoomDetail implements MultiItemEntity{
|
||||
/**
|
||||
* user_head_picture : https://osschumeng.oss-cn-beijing.aliyuncs.com/admin_images/67932634b1555.png
|
||||
* user_nickname : 用户10137552
|
||||
* get_user_nickname : 用户10137840
|
||||
* gift_name : 退烧药
|
||||
* gift_number : 3
|
||||
* total_price : 297.00
|
||||
* time : 2025-03-07
|
||||
* earning : 59.4
|
||||
*/
|
||||
private int itemViewType = 2;
|
||||
private String user_head_picture;
|
||||
private String user_nickname;
|
||||
private String get_user_nickname;
|
||||
private String gift_name;
|
||||
private int gift_number;
|
||||
private double total_price;
|
||||
private String time;
|
||||
private double earning;
|
||||
|
||||
|
||||
public String getUser_head_picture() {
|
||||
return user_head_picture;
|
||||
}
|
||||
|
||||
public void setUser_head_picture(String user_head_picture) {
|
||||
this.user_head_picture = user_head_picture;
|
||||
}
|
||||
|
||||
public String getUser_nickname() {
|
||||
return user_nickname;
|
||||
}
|
||||
|
||||
public void setUser_nickname(String user_nickname) {
|
||||
this.user_nickname = user_nickname;
|
||||
}
|
||||
|
||||
public String getGet_user_nickname() {
|
||||
return get_user_nickname;
|
||||
}
|
||||
|
||||
public void setGet_user_nickname(String get_user_nickname) {
|
||||
this.get_user_nickname = get_user_nickname;
|
||||
}
|
||||
|
||||
public String getGift_name() {
|
||||
return gift_name;
|
||||
}
|
||||
|
||||
public void setGift_name(String gift_name) {
|
||||
this.gift_name = gift_name;
|
||||
}
|
||||
|
||||
public int getGift_number() {
|
||||
return gift_number;
|
||||
}
|
||||
|
||||
public void setGift_number(int gift_number) {
|
||||
this.gift_number = gift_number;
|
||||
}
|
||||
|
||||
public double getTotal_price() {
|
||||
return total_price;
|
||||
}
|
||||
|
||||
public void setTotal_price(double total_price) {
|
||||
this.total_price = total_price;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public double getEarning() {
|
||||
return earning;
|
||||
}
|
||||
|
||||
public void setEarning(double earning) {
|
||||
this.earning = earning;
|
||||
}
|
||||
|
||||
public void setItemViewType(int itemViewType) {
|
||||
this.itemViewType = itemViewType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemViewType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoomSubsidy {
|
||||
private String explain;//api/about/showAbout&id=39",//补贴说明 (这是个页面,需要前端拼个域名)
|
||||
|
||||
private LastWeek lastweek;
|
||||
private ThisWeek thisweek;
|
||||
|
||||
|
||||
@Data
|
||||
public static class LastWeek {
|
||||
private double total_transaction;//累计流水
|
||||
private double subsidy_amount; //获得补贴
|
||||
private int status;//发放状态 0未发放,1已发放
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ThisWeek {
|
||||
private double total_transaction;
|
||||
private double subsidy_amount;
|
||||
private int status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoomSubsidyDetails {
|
||||
private String room_id;//房间id:214,
|
||||
private String start_time;//开始时间:"2025-04-07",
|
||||
private String end_time;//结束时间:"2025-04-13",
|
||||
private String total_transaction;//: 0, //累计流水
|
||||
private String subsidy_amount;// 0, //获得补贴
|
||||
private String status;//: 0 //0未发放,1已发放
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SocietyBean {
|
||||
private int id;
|
||||
private String name;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserBean implements Serializable {
|
||||
|
||||
private int user_id;
|
||||
private int user_code;
|
||||
private String avatar;
|
||||
private String nickname;
|
||||
private String token;
|
||||
private String tencent_im;
|
||||
private String mobile;
|
||||
private int sex;
|
||||
|
||||
private List<MultiUserBean> multi_user;
|
||||
|
||||
@Data
|
||||
private static class MultiUserBean{
|
||||
private String id;
|
||||
private String user_code;
|
||||
private String avatar;
|
||||
private String nickname;
|
||||
private String sex;
|
||||
private String mobile;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserHomeResp implements Serializable {
|
||||
|
||||
private String user_id;
|
||||
private String user_code;
|
||||
private String head_picture;
|
||||
private String nickname;
|
||||
private String sex;
|
||||
private String signature;
|
||||
private String birthday;
|
||||
private String constellation;
|
||||
private String profession;
|
||||
private String emchat_username;
|
||||
private String nobility_icon;
|
||||
private String nobility_image;
|
||||
private String rank_icon;
|
||||
private String intro_voice;
|
||||
private String intro_voice_time;
|
||||
private String follow;
|
||||
private String follow_count;
|
||||
private String fans_count;
|
||||
private String age;
|
||||
private String city;
|
||||
private String is_online;
|
||||
private String only_friend;
|
||||
private String good_number;
|
||||
private String id_color;
|
||||
private String vedio;
|
||||
private PhotoWallResp user_photo;
|
||||
private String picture;
|
||||
private String charm_icon;
|
||||
private String charm_exp;
|
||||
private String user_title;
|
||||
|
||||
private String room_id_current;//用户当前所在房间ID
|
||||
private HomeRoomInfo room_info;
|
||||
|
||||
private String room_id_owner;//用户自己的房间id 0表示没有创建房间": 0,
|
||||
private String room_name_owner;//用户自己的房间名称
|
||||
|
||||
private int auth_status; // 1:已实名认证 0:未实名认证
|
||||
private SocietyBean society; // 公会信息
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserImgList {
|
||||
private String id;
|
||||
private String url;
|
||||
|
||||
public UserImgList(String id, String url) {
|
||||
this.id = id;
|
||||
this.url = url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.qxcm.moduleutil.bean;
|
||||
|
||||
import com.stx.xhb.xbanner.entity.SimpleBannerInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class XBannerData extends SimpleBannerInfo implements Serializable {
|
||||
|
||||
|
||||
private int type;
|
||||
private String url;
|
||||
private String vedioCover;
|
||||
|
||||
public XBannerData(int type, String url, String vedioCover) {
|
||||
this.type = type;
|
||||
this.url = url;
|
||||
this.vedioCover = vedioCover;
|
||||
}
|
||||
|
||||
public String getVedioCover() {
|
||||
return vedioCover;
|
||||
}
|
||||
|
||||
public void setVedioCover(String vedioCover) {
|
||||
this.vedioCover = vedioCover;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getXBannerUrl() {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.qxcm.moduleutil.bean.details;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
public class BaseMultiItemEntity implements MultiItemEntity {
|
||||
public static final int TYPE_A = 1;
|
||||
public static final int TYPE_B = 2;
|
||||
|
||||
private int itemViewType;
|
||||
|
||||
public BaseMultiItemEntity(int itemViewType) {
|
||||
this.itemViewType = itemViewType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemViewType;
|
||||
}
|
||||
}
|
||||
|
||||
// 定义 TypeA 数据模型类
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.qxcm.moduleutil.bean.details;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DataModel {
|
||||
private RoomDeatailList typeA;
|
||||
private List<RoomDeatil> list;
|
||||
|
||||
// 添加相应的 getter 和 setter 方法
|
||||
public RoomDeatailList getTypeA() {
|
||||
return typeA;
|
||||
}
|
||||
|
||||
public void setTypeA(RoomDeatailList typeA) {
|
||||
this.typeA = typeA;
|
||||
}
|
||||
|
||||
public List<RoomDeatil> getList() {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setList(List<RoomDeatil> list) {
|
||||
this.list = list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.qxcm.moduleutil.bean.details;
|
||||
|
||||
public class RoomDeatailList extends BaseMultiItemEntity {
|
||||
private double total_price;
|
||||
private double total_earning;
|
||||
private String time;
|
||||
public RoomDeatailList() {
|
||||
super(BaseMultiItemEntity.TYPE_A);
|
||||
}
|
||||
|
||||
public double getTotal_price() {
|
||||
return total_price;
|
||||
}
|
||||
|
||||
public void setTotal_price(double total_price) {
|
||||
this.total_price = total_price;
|
||||
}
|
||||
|
||||
public double getTotal_earning() {
|
||||
return total_earning;
|
||||
}
|
||||
|
||||
public void setTotal_earning(double total_earning) {
|
||||
this.total_earning = total_earning;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.qxcm.moduleutil.bean.details;
|
||||
|
||||
public class RoomDeatil extends BaseMultiItemEntity {
|
||||
private String user_head_picture;
|
||||
private String user_nickname;
|
||||
private String get_user_nickname;
|
||||
private String gift_name;
|
||||
private int gift_number;
|
||||
private double total_price;
|
||||
private String time;
|
||||
private double earning;
|
||||
|
||||
public RoomDeatil() {
|
||||
super(BaseMultiItemEntity.TYPE_B);
|
||||
}
|
||||
|
||||
// 添加相应的 getter 和 setter 方法
|
||||
public String getUser_head_picture() {
|
||||
return user_head_picture;
|
||||
}
|
||||
|
||||
public void setUser_head_picture(String user_head_picture) {
|
||||
this.user_head_picture = user_head_picture;
|
||||
}
|
||||
|
||||
public String getUser_nickname() {
|
||||
return user_nickname;
|
||||
}
|
||||
|
||||
public void setUser_nickname(String user_nickname) {
|
||||
this.user_nickname = user_nickname;
|
||||
}
|
||||
|
||||
public String getGet_user_nickname() {
|
||||
return get_user_nickname;
|
||||
}
|
||||
|
||||
public void setGet_user_nickname(String get_user_nickname) {
|
||||
this.get_user_nickname = get_user_nickname;
|
||||
}
|
||||
|
||||
public String getGift_name() {
|
||||
return gift_name;
|
||||
}
|
||||
|
||||
public void setGift_name(String gift_name) {
|
||||
this.gift_name = gift_name;
|
||||
}
|
||||
|
||||
public int getGift_number() {
|
||||
return gift_number;
|
||||
}
|
||||
|
||||
public void setGift_number(int gift_number) {
|
||||
this.gift_number = gift_number;
|
||||
}
|
||||
|
||||
public double getTotal_price() {
|
||||
return total_price;
|
||||
}
|
||||
|
||||
public void setTotal_price(double total_price) {
|
||||
this.total_price = total_price;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public double getEarning() {
|
||||
return earning;
|
||||
}
|
||||
|
||||
public void setEarning(double earning) {
|
||||
this.earning = earning;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.qxcm.moduleutil.bean.zhuangb;
|
||||
|
||||
import lombok.Data;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/16
|
||||
*@description: 装扮数据
|
||||
*/
|
||||
@Data
|
||||
public class ZhuangBanShangChengBean {
|
||||
|
||||
private int did = 0;
|
||||
private String title = "";
|
||||
private String type = "";
|
||||
private String integral = "";
|
||||
private int period = 0;
|
||||
private String base_image = "";
|
||||
private boolean is_select = false;
|
||||
|
||||
public boolean isIs_select() {
|
||||
return is_select;
|
||||
}
|
||||
|
||||
public void setIs_select(boolean is_select) {
|
||||
this.is_select = is_select;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.qxcm.moduleutil.dialog;
|
||||
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.DatePicker;
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.R;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* A simple dialog containing an {@link DatePicker}.
|
||||
*
|
||||
* <p>
|
||||
* See the <a href="{@docRoot}guide/topics/ui/controls/pickers.html">Pickers</a>
|
||||
* guide.
|
||||
* </p>
|
||||
*/
|
||||
public class DoubleDatePickerDialog extends AlertDialog implements DialogInterface.OnClickListener, DatePicker.OnDateChangedListener {
|
||||
|
||||
private static final String START_YEAR = "start_year";
|
||||
private static final String END_YEAR = "end_year";
|
||||
private static final String START_MONTH = "start_month";
|
||||
private static final String END_MONTH = "end_month";
|
||||
private static final String START_DAY = "start_day";
|
||||
private static final String END_DAY = "end_day";
|
||||
|
||||
private final DatePicker mDatePicker_start;
|
||||
private final DatePicker mDatePicker_end;
|
||||
private final OnDateSetListener mCallBack;
|
||||
|
||||
/**
|
||||
* The callback used to indicate the user is done filling in the date.
|
||||
*/
|
||||
public interface OnDateSetListener {
|
||||
|
||||
void onDateSet(DatePicker startDatePicker, int startYear, int startMonthOfYear, int startDayOfMonth,
|
||||
DatePicker endDatePicker, int endYear, int endMonthOfYear, int endDayOfMonth);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* The context the dialog is to run in.
|
||||
* @param callBack
|
||||
* How the parent is notified that the date is set.
|
||||
* @param year
|
||||
* The initial year of the dialog.
|
||||
* @param monthOfYear
|
||||
* The initial month of the dialog.
|
||||
* @param dayOfMonth
|
||||
* The initial day of the dialog.
|
||||
*/
|
||||
public DoubleDatePickerDialog(Context context, OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) {
|
||||
this(context, 0, callBack, year, monthOfYear, dayOfMonth);
|
||||
}
|
||||
|
||||
public DoubleDatePickerDialog(Context context, int theme, OnDateSetListener callBack, int year, int monthOfYear,
|
||||
int dayOfMonth) {
|
||||
this(context, 0, callBack, year, monthOfYear, dayOfMonth, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* The context the dialog is to run in.
|
||||
* @param theme
|
||||
* the theme to apply to this dialog
|
||||
* @param callBack
|
||||
* How the parent is notified that the date is set.
|
||||
* @param year
|
||||
* The initial year of the dialog.
|
||||
* @param monthOfYear
|
||||
* The initial month of the dialog.
|
||||
* @param dayOfMonth
|
||||
* The initial day of the dialog.
|
||||
*/
|
||||
public DoubleDatePickerDialog(Context context, int theme, OnDateSetListener callBack, int year, int monthOfYear,
|
||||
int dayOfMonth, boolean isDayVisible) {
|
||||
super(context, theme);
|
||||
|
||||
mCallBack = callBack;
|
||||
|
||||
Context themeContext = getContext();
|
||||
setButton(BUTTON_POSITIVE, "确 定", this);
|
||||
setButton(BUTTON_NEGATIVE, "取 消", this);
|
||||
// setButton(BUTTON_POSITIVE,
|
||||
// themeContext.getText(android.R.string.date_time_done), this);
|
||||
setIcon(0);
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) themeContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
View view = inflater.inflate(R.layout.date_picker_dialog, null);
|
||||
setView(view);
|
||||
mDatePicker_start = (DatePicker) view.findViewById(R.id.datePickerStart);
|
||||
mDatePicker_end = (DatePicker) view.findViewById(R.id.datePickerEnd);
|
||||
mDatePicker_start.init(year, monthOfYear, dayOfMonth, this);
|
||||
mDatePicker_end.init(year, monthOfYear, dayOfMonth, this);
|
||||
// updateTitle(year, monthOfYear, dayOfMonth);
|
||||
|
||||
// 如果要隐藏当前日期,则使用下面方法。
|
||||
if (!isDayVisible) {
|
||||
hidDay(mDatePicker_start);
|
||||
hidDay(mDatePicker_end);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏DatePicker中的日期显示
|
||||
*
|
||||
* @param mDatePicker
|
||||
*/
|
||||
private void hidDay(DatePicker mDatePicker) {
|
||||
Field[] datePickerfFields = mDatePicker.getClass().getDeclaredFields();
|
||||
for (Field datePickerField : datePickerfFields) {
|
||||
if ("mDaySpinner".equals(datePickerField.getName())) {
|
||||
datePickerField.setAccessible(true);
|
||||
Object dayPicker = new Object();
|
||||
try {
|
||||
dayPicker = datePickerField.get(mDatePicker);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// datePicker.getCalendarView().setVisibility(View.GONE);
|
||||
((View) dayPicker).setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
// Log.d(this.getClass().getSimpleName(), String.format("which:%d",
|
||||
// which));
|
||||
// 如果是“取 消”按钮,则返回,如果是“确 定”按钮,则往下执行
|
||||
if (which == BUTTON_POSITIVE)
|
||||
tryNotifyDateSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDateChanged(DatePicker view, int year, int month, int day) {
|
||||
if (view.getId() == R.id.datePickerStart)
|
||||
mDatePicker_start.init(year, month, day, this);
|
||||
if (view.getId() == R.id.datePickerEnd)
|
||||
mDatePicker_end.init(year, month, day, this);
|
||||
// updateTitle(year, month, day);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得开始日期的DatePicker
|
||||
*
|
||||
* @return The calendar view.
|
||||
*/
|
||||
public DatePicker getDatePickerStart() {
|
||||
return mDatePicker_start;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得结束日期的DatePicker
|
||||
*
|
||||
* @return The calendar view.
|
||||
*/
|
||||
public DatePicker getDatePickerEnd() {
|
||||
return mDatePicker_end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the start date.
|
||||
*
|
||||
* @param year
|
||||
* The date year.
|
||||
* @param monthOfYear
|
||||
* The date month.
|
||||
* @param dayOfMonth
|
||||
* The date day of month.
|
||||
*/
|
||||
public void updateStartDate(int year, int monthOfYear, int dayOfMonth) {
|
||||
mDatePicker_start.updateDate(year, monthOfYear, dayOfMonth);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the end date.
|
||||
*
|
||||
* @param year
|
||||
* The date year.
|
||||
* @param monthOfYear
|
||||
* The date month.
|
||||
* @param dayOfMonth
|
||||
* The date day of month.
|
||||
*/
|
||||
public void updateEndDate(int year, int monthOfYear, int dayOfMonth) {
|
||||
mDatePicker_end.updateDate(year, monthOfYear, dayOfMonth);
|
||||
}
|
||||
|
||||
private void tryNotifyDateSet() {
|
||||
if (mCallBack != null) {
|
||||
mDatePicker_start.clearFocus();
|
||||
mDatePicker_end.clearFocus();
|
||||
mCallBack.onDateSet(mDatePicker_start, mDatePicker_start.getYear(), mDatePicker_start.getMonth(),
|
||||
mDatePicker_start.getDayOfMonth(), mDatePicker_end, mDatePicker_end.getYear(),
|
||||
mDatePicker_end.getMonth(), mDatePicker_end.getDayOfMonth());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
// tryNotifyDateSet();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Bundle onSaveInstanceState() {
|
||||
Bundle state = super.onSaveInstanceState();
|
||||
state.putInt(START_YEAR, mDatePicker_start.getYear());
|
||||
state.putInt(START_MONTH, mDatePicker_start.getMonth());
|
||||
state.putInt(START_DAY, mDatePicker_start.getDayOfMonth());
|
||||
state.putInt(END_YEAR, mDatePicker_end.getYear());
|
||||
state.putInt(END_MONTH, mDatePicker_end.getMonth());
|
||||
state.putInt(END_DAY, mDatePicker_end.getDayOfMonth());
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
int start_year = savedInstanceState.getInt(START_YEAR);
|
||||
int start_month = savedInstanceState.getInt(START_MONTH);
|
||||
int start_day = savedInstanceState.getInt(START_DAY);
|
||||
mDatePicker_start.init(start_year, start_month, start_day, this);
|
||||
|
||||
int end_year = savedInstanceState.getInt(END_YEAR);
|
||||
int end_month = savedInstanceState.getInt(END_MONTH);
|
||||
int end_day = savedInstanceState.getInt(END_DAY);
|
||||
mDatePicker_end.init(end_year, end_month, end_day, this);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.utils.Sha1Util;
|
||||
import com.qxcm.moduleutil.utils.SpUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
|
||||
public class AccessTokenInterceptor implements Interceptor {
|
||||
|
||||
private final static String TAG = AccessTokenInterceptor.class.getCanonicalName();
|
||||
|
||||
private static final Map<String, String> mHeaderMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static String token = "";
|
||||
|
||||
public AccessTokenInterceptor(Map<String, String> headers) {
|
||||
mHeaderMap.putAll(headers);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, String> getHeaders() {
|
||||
return mHeaderMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
mHeaderMap.put("X-Token", SpUtil.getToken());
|
||||
mHeaderMap.put("token", SpUtil.getToken());
|
||||
long timestamp = System.currentTimeMillis() / 1000;
|
||||
mHeaderMap.put("timestamp", String.valueOf(timestamp));
|
||||
mHeaderMap.put("sign", Sha1Util.shaEncode(timestamp));
|
||||
Request newRequest = request.newBuilder().headers(Headers.of(mHeaderMap)).build();
|
||||
Response response = chain.proceed(newRequest);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
282
moduleUtil/src/main/java/com/qxcm/moduleutil/http/ApiServer.java
Normal file
@@ -0,0 +1,282 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FieldMap;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface ApiServer {
|
||||
|
||||
|
||||
@FormUrlEncoded //请求验证码
|
||||
@POST(Constants.SEND_CODE)
|
||||
Observable<BaseModel<Object>> sendCode(@Field("mobile") String mobile,@Field("event")String event);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.LOGIN)
|
||||
Observable<BaseModel<List<UserBean>>> login(@Field("user_login") String user_login, @Field("sms_code") String sms_code);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.USER_LOGIN)
|
||||
Observable<BaseModel<List<UserBean>>> userLogin(@Field("user_login") String user_login, @Field("password") String password);
|
||||
|
||||
@POST(Constants.UPLOAD_NICK_NAME)
|
||||
Observable<BaseModel<String>> upUserNickname();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.UPLOAD_USER_PIC)
|
||||
Observable<BaseModel<String>> upUserPic(@Field("sex") String sex);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.SWITCH_ACCOUNTS)
|
||||
Observable<BaseModel<List<UserBean>>> switchAccounts(@Field("user_login") String user_id);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.USER_UPDATE)
|
||||
Observable<BaseModel<UserBean>> userUpdate(@FieldMap Map<String, String> map);
|
||||
|
||||
@GET(Constants.AUTHORIZATION)
|
||||
Observable<BaseModel<String>> authorization();
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.CHANGE_PASSWORD)
|
||||
Call<BaseModel<String>> getPostData(@Field("new_password") String new_password,@Field("mobile") String mobile,@Field("sms_code") String code,@Field("user_id") String userId);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.URL_LOGIN)
|
||||
Observable<BaseModel<List<UserBean>>> oauthLogin(@Field("login_token") String login_token);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.URL_AUTH_CODE)
|
||||
Observable<BaseModel<List<UserBean>>> authCode(@Field("auth_code") String login_token);
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.URL_WX_CODE)
|
||||
Observable<BaseModel<List<UserBean>>> authCode1(@Field("code") String login_token);
|
||||
|
||||
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.ADDBANK)
|
||||
// Observable<BaseModel<String>> addBank(@Field("token") String token, @Field("bank_num") String bankNum, @Field("cardholder") String cardholder, @Field("bank_type") int bankType,
|
||||
// @Field("bank_name") String bankName, @Field("mobile") String mobile, @Field("bank_zhi") String bankZhi, @Field("card_number") String cardNumber,
|
||||
// @Field("code") String code
|
||||
// );
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.SEND_CODE)
|
||||
// Observable<BaseModel<String>> sendCode(@Field("token") String token, @Field("mobile") String mobile, @Field("type") int type);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(URLConstants.CHECK_SMS_CODE)
|
||||
// Observable<BaseModel<String>> checkSmsCode(@Field("mobile") String mobile, @Field("code") String code);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.USER_BANK)
|
||||
// Observable<BaseModel<UserBankModel>> getUserBank(@Field("token") String token);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.RECHARGE)
|
||||
// Observable<BaseModel<String>> userRecharge(@Field("token") String token, @Field("money") String money, @Field("type") int type);
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.THREE_PARTY_LOGIN)
|
||||
// Observable<BaseModel<BeanPayData>> threePay(@Field("user_id") String userId, @Field("type") int type, @Field("id") String id);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.ALIPAYMENT)
|
||||
// Observable<BaseModel<String>> aliPay(@Field("token") String token, @Field("user_id") String userId, @Field("type") int type, @Field("id") String id);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.WXPAYMENT)
|
||||
// Observable<BaseModel<WxPayModel>> wxPay(@Field("token") String token, @Field("user_id") String userId, @Field("type") int type, @Field("id") String id);
|
||||
//
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.EDITBANK)
|
||||
// Observable<BaseModel<String>> editBank(@Field("token") String token, @Field("cardholder") String cardholder, @Field("bank_name") String bank_name,
|
||||
// @Field("mobile") String mobile, @Field("card_number") String card_number, @Field("id") String id,
|
||||
// @Field("bank_num") String bank_num, @Field("bank_zhi") String bank_zhi, @Field("code") String code);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.USERWITHDRAW)
|
||||
// Observable<BaseModel<String>> userWithdraw(@Field("token") String token, @Field("bank_id") String bank_id, @Field("number") String number, @Field("password") String password);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.LOGIN)
|
||||
// Observable<BaseModel<UserBean>> login(@Field("mobile") String mobile, @Field("password") String password, @Field("code") String code, @Field("type") int type);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.LOGIN)
|
||||
// Observable<BaseModel<UserBean>> oauthLogin(@Field("netease_token") String netease_token, @Field("access_token") String access_token, @Field("type") int type);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.SETUSERSEX)
|
||||
// Observable<BaseModel<String>> setUserSex(@Field("user_id") String user_id, @Field("sex") int sex);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.THIRDPARTYLOGIN)
|
||||
// Observable<BaseModel<UserBean>> thirdPartyLogin(@Field("openid") String openid, @Field("three_party") int three_party, @Field("nickname") String nickname,@Field("openid_old") String oldOpenId, @Field("head_pic") String head_pic);
|
||||
//
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.EARNINGS)
|
||||
// Observable<BaseModel<EarningsModel>> getEarnings(@Field("token") String token);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.CONVERTEARNINGS)
|
||||
// Observable<BaseModel<String>> convertEarnings(@Field("token") String token, @Field("number") String number, @Field("password") String password);
|
||||
//
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.CASHLOG)
|
||||
// Observable<BaseModel<List<EarningsModel.EarningInfo>>> getCashLog(@Field("token") String token, @Field("p") int p, @Field("change_type") int change_type);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.BALANCE)
|
||||
// Observable<BaseModel<UserMoneyBean>> getBalance(@Field("token") String token, @Field("type") int type);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.FOLLOW)
|
||||
// Observable<BaseModel<String>> follow(@Field("token") String token, @Field("user_id") String userId, @Field("type") int type);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.FRIENDLIST)
|
||||
// Observable<BaseModel<List<FriendModel>>> friendList(@Field("p") int p);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.FOLLOWLIST)
|
||||
// Observable<BaseModel<List<FriendModel>>> followList(@Field("p") int p);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.FANSLIST)
|
||||
// Observable<BaseModel<List<FriendModel>>> fansList(@Field("p") int p);
|
||||
//
|
||||
// @POST(Constant.URL.MYINFO)
|
||||
// Observable<BaseModel<UserInfoModel>> userInfo();
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.USERINFO)
|
||||
// Observable<BaseModel<UserInfoDataModel>> userInfoData(@Field("user_id") String userId, @Field("emchat_username") String emchatUsername, @Field("visit") int visit);
|
||||
//
|
||||
// @POST(Constant.URL.VIPINFO)
|
||||
// Observable<BaseModel<VipInfo>> vipinfo();
|
||||
//
|
||||
// @POST(Constant.URL.SERVICEUSER)
|
||||
// Observable<BaseModel<String>> serviceUser();
|
||||
//
|
||||
// @POST(Constant.URL.ARTICLE_CATEGORIES)
|
||||
// Observable<BaseModel<List<HelpTitleModel>>> articleCategories();
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.ARTICLE_LIST)
|
||||
// Observable<BaseModel<List<HelpModel>>> articleList(@Field("article_cat_id") String articleCatId);
|
||||
//
|
||||
// @POST(Constant.URL.USER_NOBILITYINFO)
|
||||
// Observable<BaseModel<NobilityInfo>> userNobilityInfo();
|
||||
//
|
||||
// @POST(Constant.URL.NOBILITY)
|
||||
// Observable<BaseModel<List<NobilityModel>>> nobility();
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.BUYNOBILITY)
|
||||
// Observable<BaseModel<String>> buyNobility(@Field("nobility_id") String nobilityId);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.RENEWNOBILITY)
|
||||
// Observable<BaseModel<String>> renewNobility(@Field("day") String day);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.UPDATE_USERINFO)
|
||||
// Observable<BaseModel<String>> updateUserInfo(@Field("signature") String signature, @Field("birthday") String birthday, @Field("constellation") String constellation, @Field("profession") String profession,
|
||||
// @Field("city_id") String city_id, @Field("user_photo") String user_photo, @Field("sex") String sex, @Field("head_picture") String head_picture,
|
||||
// @Field("nickname") String nickname, @Field("province_id") String province_id, @Field("user_no") String userNo, @Field("county_id") String county_id);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.INDEX_LABEL)
|
||||
// Observable<BaseModel<List<LabelModel>>> indexLabel(@Field("category_id") String categoryId, @Field("p") int p);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.ADDLABEL)
|
||||
// Observable<BaseModel<String>> addLabel(@Field("ids") String ids);
|
||||
//
|
||||
// @POST(Constant.URL.CASHTYPE)
|
||||
// Observable<BaseModel<List<CashTypeModel>>> cashType();
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.COMEUSER)
|
||||
// Observable<BaseModel<List<LatelyVisitInfo>>> comeUser(@Field("token") String token, @Field("p") int p);
|
||||
//
|
||||
// @GET(Constant.URL.APPUPDATE)
|
||||
// Observable<BaseModel<AppUpdateModel>> appUpdate();
|
||||
//
|
||||
// @GET(Constant.URL.CHECK_UPDATE)
|
||||
// Observable<BaseModel<AppUpdateModel>> checkUpdate();
|
||||
//
|
||||
// @POST(Constant.URL.USER_FILES)
|
||||
// Observable<BaseModel<UserBean>> userFiles();
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.BIND_MOBILE)
|
||||
// Observable<BaseModel<String>> bindMobile(@Field("mobile") String mobile, @Field("code") String code);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.RESET_PASSWORD)
|
||||
// Observable<BaseModel<String>> resetPassword(@Field("mobile") String mobile, @Field("code") String code, @Field("password") String password);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.MESSAGE_SETTING)
|
||||
// Observable<BaseModel<String>> messageSetting(@Field("broadcast") int broadcast, @Field("fans") int fans, @Field("news_voice") int news_voice, @Field("news_vibrate") int news_vibrate, @Field("only_friend") int only_friend );
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.USER_BLACK_LIST)
|
||||
// Observable<BaseModel<List<BlacListSectionBean>>> userBlackList(@Field("p") int page, @Field("keyword") String keyword);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.ADD_BLACK_USER)
|
||||
// Observable<BaseModel<String>> removeBlackUser(@Field("black_id") String blackId, @Field("type") int type);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.QUIT_ROOM_WITH_USER_ID)
|
||||
// Observable<BaseModel<String>> quitRoomWithUserId(@Field("room_id") String roomId, @Field("user_id") String userId);
|
||||
//
|
||||
// @POST(Constant.URL.SIGN_SWITCH)
|
||||
// Observable<BaseModel<SignSwitchModel>> signSwitch();
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.SET_SECOND_PASSWORD)
|
||||
// Observable<BaseModel<String>> setSecondPassword(@Field("mobile") String mobile, @Field("password") String password, @Field("code") String code);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(URLConstants.NAME_AUTH)
|
||||
// Observable<BaseModel<String>> nameAuth(@Field("userId") String userId, @Field("fullName") String fullName, @Field("idNumber") String idNumber, @Field("idCard") String idCard, @Field("front") String front, @Field("back") String back);
|
||||
//
|
||||
// @POST(Constant.URL.USER_PHOTO)
|
||||
// Observable<BaseModel<List<MyPhotoItem>>> userPhotos();
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.DELETE_USER_PHOTO)
|
||||
// Observable<BaseModel<String>> deleteUserPhoto(@Field("id") String ids);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.ADD_USER_PHOTO)
|
||||
// Observable<BaseModel<String>> addUserPhoto(@Field("photo") String photo);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.LOGOUT_REASON)
|
||||
// Observable<BaseModel<String>> logoutReason(@Field("token") String token, @Field("mobile") String mobile,
|
||||
// @Field("reason") String reason,@Field("code") String code);
|
||||
//
|
||||
// @FormUrlEncoded
|
||||
// @POST(Constant.URL.LOGOUT_STATUS)
|
||||
// Observable<BaseModel<LogoutReasonModel>> getlogoutStatus(@Field("token") String token, @Field("mobile") String mobile);
|
||||
|
||||
}
|
||||
@@ -4,9 +4,9 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
public class BaseModel<T> implements Parcelable {
|
||||
private int status;
|
||||
private int code;
|
||||
private T data;
|
||||
private String info;
|
||||
private String msg;
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
@@ -16,26 +16,28 @@ public class BaseModel<T> implements Parcelable {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getInfo() {
|
||||
return info;
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setInfo(String info) {
|
||||
this.info = info;
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public BaseModel() {
|
||||
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return code == 1; // 根据实际业务码判断是否成功
|
||||
}
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -43,13 +45,13 @@ public class BaseModel<T> implements Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(this.status);
|
||||
dest.writeString(this.info);
|
||||
dest.writeInt(this.code);
|
||||
dest.writeString(this.msg);
|
||||
}
|
||||
|
||||
protected BaseModel(Parcel in) {
|
||||
this.status = in.readInt();
|
||||
this.info = in.readString();
|
||||
this.code = in.readInt();
|
||||
this.msg = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<BaseModel> CREATOR = new Creator<BaseModel>() {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.ObservableTransformer;
|
||||
|
||||
public class DefaultTransformer<T extends BaseModel<R>, R>
|
||||
implements ObservableTransformer<T, R> {
|
||||
|
||||
@Override
|
||||
public ObservableSource<R> apply(Observable<T> upstream) {
|
||||
return upstream.compose(SchedulerTransformer.<T>create())
|
||||
.compose(new ErrorCheckerTransformer<T, R>());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.ObservableTransformer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
|
||||
public class ErrorCheckerTransformer<T extends BaseModel<R>, R>
|
||||
implements ObservableTransformer<T, R> {
|
||||
|
||||
@Override
|
||||
public ObservableSource<R> apply(Observable<T> upstream) {
|
||||
return upstream.map(new Function<T, R>() {
|
||||
@Override
|
||||
public R apply(T t) throws Exception {
|
||||
if (t != null) {
|
||||
int code = t.getCode();
|
||||
String msg = t.getMsg();
|
||||
if (code == 1) {//请求成功
|
||||
return t.getData();
|
||||
} else if (code == 301) {
|
||||
throw new APIException(code, msg);
|
||||
} else {
|
||||
String message = ErrorMessage.get(code);
|
||||
if (message != null) {
|
||||
throw new APIException(code, message);
|
||||
} else {
|
||||
throw new APIException(code, t.getMsg());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
/**
|
||||
* 常见错误码对应的错误信息
|
||||
* Created by dmx on 16/12/1.
|
||||
*/
|
||||
|
||||
public class ErrorMessage {
|
||||
|
||||
|
||||
/**
|
||||
* 根据编码获取对应的错误信息,没有对应编码则返回null
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static String get(int code) {
|
||||
switch (code) {
|
||||
|
||||
case 0:
|
||||
return "失败";
|
||||
//
|
||||
case 203:
|
||||
return "系统维护中";
|
||||
|
||||
case 301:
|
||||
return "token失效";
|
||||
//
|
||||
// case 20:
|
||||
// return "用户不存在";
|
||||
//
|
||||
// case 21:
|
||||
// return "用户已经存在";
|
||||
//
|
||||
// case 22:
|
||||
// return "用户状态已改变,请刷新重试";
|
||||
//
|
||||
// case 100:
|
||||
// return "验证码获取太频繁";
|
||||
//
|
||||
// case 101:
|
||||
// return "获取验证码次数限制";
|
||||
//
|
||||
// case 102:
|
||||
// return "验证码错误";
|
||||
// case 103:
|
||||
// return "密码错误";
|
||||
// case 104:
|
||||
// return "第一次登录需要设置密码";
|
||||
// case 500:
|
||||
// return "接口不存在";
|
||||
//
|
||||
// case 502:
|
||||
// return "已经提交代理申请";
|
||||
//
|
||||
// case 504:
|
||||
// return "已经是雇员了";
|
||||
//// case 528:
|
||||
//// return "不在续保期内,无法续保";
|
||||
// case 661:
|
||||
// return "客户身份证重复";
|
||||
//
|
||||
// case 1000:
|
||||
// return "employeeId错误或者缺少";
|
||||
//
|
||||
//
|
||||
// case 1009:
|
||||
// return "手机号错误";
|
||||
//
|
||||
// case 1020:
|
||||
// return "参数pwd错误或者缺失";
|
||||
//
|
||||
// case 1022:
|
||||
// return "参数id错误或者缺失";
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.qxcm.moduleutil.utils.GsonUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Converter;
|
||||
import retrofit2.Retrofit;
|
||||
|
||||
public class MyConverterFactory extends Converter.Factory {
|
||||
|
||||
/**
|
||||
* Create an instance using a default {@link Gson} instance for conversion. Encoding to JSON and
|
||||
* decoding from JSON (when no charset is specified by a header) will use UTF-8.
|
||||
*/
|
||||
public static MyConverterFactory create() {
|
||||
return create(GsonUtils.getGSON());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance using {@code gson} for conversion. Encoding to JSON and
|
||||
* decoding from JSON (when no charset is specified by a header) will use UTF-8.
|
||||
*/
|
||||
@SuppressWarnings("ConstantConditions") // Guarding public API nullability.
|
||||
public static MyConverterFactory create(Gson gson) {
|
||||
if (gson == null) {
|
||||
throw new NullPointerException("gson == null");
|
||||
}
|
||||
return new MyConverterFactory(gson);
|
||||
}
|
||||
|
||||
private final Gson gson;
|
||||
|
||||
private MyConverterFactory(Gson gson) {
|
||||
this.gson = gson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations, Annotation[] methodAnnotations, Retrofit retrofit) {
|
||||
TypeAdapter<?> adapter = gson.getAdapter(TypeToken.get(type));
|
||||
return new RequestBodyConverter<>(gson, adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {
|
||||
TypeAdapter<?> adapter = gson.getAdapter(TypeToken.get(type));
|
||||
return new ResponseBodyConverter<>(gson, adapter);
|
||||
// return new ResponseBodyConverter<>(gson, TypeToken.get(type));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import okio.Buffer;
|
||||
import retrofit2.Converter;
|
||||
|
||||
public class RequestBodyConverter<T> implements Converter<T, RequestBody> {
|
||||
|
||||
private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");
|
||||
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
||||
|
||||
private final Gson gson;
|
||||
private final TypeAdapter<T> adapter;
|
||||
|
||||
RequestBodyConverter(Gson gson, TypeAdapter<T> adapter) {
|
||||
this.gson = gson;
|
||||
this.adapter = adapter;
|
||||
}
|
||||
|
||||
@Override public RequestBody convert(@NonNull T value) throws IOException {
|
||||
Buffer buffer = new Buffer();
|
||||
Writer writer = new OutputStreamWriter(buffer.outputStream(), UTF_8);
|
||||
JsonWriter jsonWriter = gson.newJsonWriter(writer);
|
||||
adapter.write(jsonWriter, value);
|
||||
jsonWriter.close();
|
||||
return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.qxcm.moduleutil.utils.GsonUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Converter;
|
||||
|
||||
public class ResponseBodyConverter<T> implements Converter<ResponseBody, T> {
|
||||
|
||||
private final Gson gson;
|
||||
private final TypeAdapter<T> adapter;
|
||||
|
||||
ResponseBodyConverter(Gson gson, TypeAdapter<T> adapter) {
|
||||
this.gson = gson;
|
||||
this.adapter = adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T convert(@NonNull ResponseBody value) throws IOException {
|
||||
String json = value.string();
|
||||
BaseModel obj = GsonUtils.GsonToBean(json, BaseModel.class);
|
||||
if (obj.getCode() != 1) {
|
||||
String info = obj.getMsg();
|
||||
if ("当前余额不足".equals(info)) {
|
||||
value.close();
|
||||
return adapter.fromJson(json);
|
||||
} else {
|
||||
throw new APIException(obj.getCode(), info);
|
||||
}
|
||||
}
|
||||
value.close();
|
||||
return adapter.fromJson(json);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
//import com.blankj.utilcode.util.LogUtils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
|
||||
import com.franmontiel.persistentcookiejar.ClearableCookieJar;
|
||||
import com.franmontiel.persistentcookiejar.PersistentCookieJar;
|
||||
import com.franmontiel.persistentcookiejar.cache.SetCookieCache;
|
||||
import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.bean.UserBean;
|
||||
import com.qxcm.moduleutil.presenter.BasePresenter;
|
||||
import com.qxcm.moduleutil.utils.SystemUtils;
|
||||
import com.qxcm.moduleutil.utils.logger.DataLogger;
|
||||
import com.qxcm.moduleutil.utils.logger.DataLoggingInterceptor;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.Proxy;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import okhttp3.Cache;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
|
||||
public class RetrofitClient {
|
||||
|
||||
private static RetrofitClient INSTANCE;
|
||||
private static ApiServer sApiServer;
|
||||
public static final int DEFAULT_TIME_OUT = 60;
|
||||
private static OkHttpClient client;
|
||||
private final Retrofit mRetrofit;
|
||||
|
||||
public OkHttpClient getHttpClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
File cacheFile = new File(CommonAppContext.getInstance().getCacheDir(), "cache");
|
||||
Cache cache = new Cache(cacheFile, 1024 * 1024 * 100); // 100MB 的缓存空间
|
||||
boolean isNetworkAvailable = checkNetworkConnection(); // 实现这个方法来检查网络状态
|
||||
String cacheControl = isNetworkAvailable ? "max-age=0" : "only-if-cached, max-stale=86400";
|
||||
|
||||
private boolean checkNetworkConnection() {
|
||||
ConnectivityManager connectivityManager = (ConnectivityManager) CommonAppContext.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
|
||||
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
|
||||
}
|
||||
|
||||
private OkHttpClient provideOkHttpClient() {
|
||||
Map<String, String> headers = SystemUtils.getSystemParams();
|
||||
SetCookieCache cookieCache = new SetCookieCache();
|
||||
ClearableCookieJar cookieJar =
|
||||
new PersistentCookieJar(cookieCache, new SharedPrefsCookiePersistor(CommonAppContext.getInstance()));
|
||||
try {
|
||||
X509TrustManager trustAllCert = new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
return new java.security.cert.X509Certificate[]{};
|
||||
}
|
||||
};
|
||||
SSLContext sslContext = null;
|
||||
sslContext = SSLContext.getInstance("SSL");
|
||||
sslContext.init(null, new TrustManager[]{trustAllCert}, new SecureRandom());
|
||||
|
||||
final OkHttpClient client = new OkHttpClient.Builder()
|
||||
// .addInterceptor(new LoggerInterceptor("HttpLog", true))
|
||||
.addInterceptor(new DataLoggingInterceptor(new DataLogger()))
|
||||
.addInterceptor(new AccessTokenInterceptor(headers))
|
||||
.proxy(Proxy.NO_PROXY)
|
||||
.sslSocketFactory(sslContext.getSocketFactory(), trustAllCert)
|
||||
.hostnameVerifier((hostname, session) -> true)
|
||||
.cookieJar(cookieJar)
|
||||
.connectTimeout(DEFAULT_TIME_OUT, TimeUnit.SECONDS)
|
||||
.readTimeout(DEFAULT_TIME_OUT, TimeUnit.SECONDS)
|
||||
.writeTimeout(DEFAULT_TIME_OUT, TimeUnit.SECONDS)
|
||||
.build();
|
||||
RetrofitClient.client = client;
|
||||
} catch (KeyManagementException | NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
private Retrofit provideRetrofit(OkHttpClient client) {
|
||||
return new Retrofit.Builder()
|
||||
.addConverterFactory(MyConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
.baseUrl(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl())
|
||||
.client(client)
|
||||
|
||||
.build();
|
||||
}
|
||||
|
||||
// private static Retrofit mRainRetrofit;
|
||||
//
|
||||
// public static Retrofit getRainRetrofit() {
|
||||
// if (mRainRetrofit == null) {
|
||||
// synchronized (RetrofitClient.class) {
|
||||
// mRainRetrofit = new Retrofit.Builder()
|
||||
// .addConverterFactory(RainConverterFactory.create())
|
||||
// .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
|
||||
// .baseUrl(BuildConfig.RAIN_GAME_BASE_URL)
|
||||
// .client(client)
|
||||
// .build();
|
||||
// }
|
||||
// }
|
||||
// return mRainRetrofit;
|
||||
// }
|
||||
|
||||
private RetrofitClient() {
|
||||
mRetrofit = provideRetrofit(provideOkHttpClient());
|
||||
sApiServer = mRetrofit.create(ApiServer.class);
|
||||
}
|
||||
|
||||
public static RetrofitClient getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (RetrofitClient.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new RetrofitClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public <T> T createApiClient(Class<T> apiClientClass) {
|
||||
return mRetrofit.create(apiClientClass);
|
||||
}
|
||||
|
||||
public void login() {
|
||||
// login("18473492252", "123456");
|
||||
// login("18229732986", "123456");
|
||||
}
|
||||
|
||||
|
||||
public void sendCode(String mobile,String event,BaseObserver<Object> observer) {
|
||||
sApiServer.sendCode(mobile,event).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void login(String mobile, String password, BaseObserver<List<UserBean>> observer) {
|
||||
sApiServer.login(mobile, password).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
public void userLogin(String mobile, String password, BaseObserver<List<UserBean>> observer) {
|
||||
sApiServer.userLogin(mobile, password).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void upUserNickname(BaseObserver<String> observer){
|
||||
sApiServer.upUserNickname().compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void upUserPic(String sex,BaseObserver<String> observer){
|
||||
sApiServer.upUserPic(sex).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void switchAccounts(String loginId, BaseObserver<List<UserBean>> observer){
|
||||
sApiServer.switchAccounts(loginId).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void userUpdate(Map<String, String> map, BaseObserver<UserBean> observer) {
|
||||
sApiServer.userUpdate(map).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void authorization(BaseObserver<String> observer){
|
||||
sApiServer.authorization().compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
|
||||
public void oauthLogin(String netease_token, BaseObserver<List<UserBean>> observer) {
|
||||
sApiServer.oauthLogin(netease_token).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
public void authCode(String netease_token,int type, BaseObserver<List<UserBean>> observer) {
|
||||
if (type==1){
|
||||
sApiServer.authCode1(netease_token).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}else {
|
||||
sApiServer.authCode(netease_token).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.qxcm.moduleutil.http;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.ObservableTransformer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 默认线程调度
|
||||
* Created by dmx on 16/12/1.
|
||||
*/
|
||||
|
||||
public class SchedulerTransformer<T> implements ObservableTransformer<T, T> {
|
||||
|
||||
public static <T> SchedulerTransformer<T> create() {
|
||||
return new SchedulerTransformer<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableSource<T> apply(Observable<T> upstream) {
|
||||
return upstream.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
|
||||
import com.qxcm.moduleutil.activity.IPresenter;
|
||||
import com.qxcm.moduleutil.activity.IView;
|
||||
import com.qxcm.moduleutil.http.RetrofitClient;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -15,7 +16,7 @@ import io.reactivex.disposables.Disposable;
|
||||
|
||||
public abstract class BasePresenter<V extends IView> implements IPresenter {
|
||||
protected CompositeDisposable mDisposables = new CompositeDisposable();
|
||||
// private RemoteDataSource api;
|
||||
protected RetrofitClient api = RetrofitClient.getInstance();
|
||||
protected Reference<V> MvpRef;
|
||||
protected Context mContext;
|
||||
|
||||
@@ -40,12 +41,6 @@ public abstract class BasePresenter<V extends IView> implements IPresenter {
|
||||
return null;
|
||||
}
|
||||
|
||||
// protected RemoteDataSource getApi() {
|
||||
// if (api == null) {
|
||||
// api = RemoteDataSource.getInstance();
|
||||
// }
|
||||
// return api;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 主要用于判断IView的生命周期是否结束,防止出现内存泄露状况
|
||||
@@ -63,9 +58,9 @@ public abstract class BasePresenter<V extends IView> implements IPresenter {
|
||||
MvpRef.clear();
|
||||
MvpRef = null;
|
||||
}
|
||||
// if (api != null) {
|
||||
// api = null;
|
||||
// }
|
||||
if (api != null) {
|
||||
api = null;
|
||||
}
|
||||
unBindView();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.qxcm.moduleutil.utils;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/29.
|
||||
*/
|
||||
|
||||
public abstract class ActivityResultCallback {
|
||||
public abstract void onSuccess(Intent intent);
|
||||
|
||||
public void onFailure() {
|
||||
|
||||
}
|
||||
|
||||
public void onResult(int resultCode, Intent intent) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.qxcm.moduleutil.widget.CommonAppConfig;
|
||||
import com.qxcm.moduleutil.widget.CommonAppContext;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
|
||||
|
||||
public class DeviceUtils {
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.qxcm.moduleutil.utils;
|
||||
|
||||
//import com.blankj.utilcode.util.LogUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.qxcm.moduleutil.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GsonUtils {
|
||||
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
private static final JsonParser PARSER = new JsonParser();
|
||||
|
||||
public static Gson getGSON() {
|
||||
return GSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object 转 json
|
||||
*
|
||||
* @param object object
|
||||
* @return object
|
||||
*/
|
||||
public static String GsonString(Object object) {
|
||||
return GSON.toJson(object);
|
||||
}
|
||||
|
||||
public static <T> T GsonToBean(String gsonString, Class<T> cls) {
|
||||
return GSON.fromJson(gsonString, cls);
|
||||
}
|
||||
|
||||
/**
|
||||
* 转成map的
|
||||
*
|
||||
* @param gsonString str
|
||||
* @return map
|
||||
*/
|
||||
public static Map<String, Object> GsonToMaps(String gsonString) {
|
||||
return GSON.fromJson(gsonString, new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 将json 格式化输出
|
||||
*
|
||||
* @param str str
|
||||
* @return str
|
||||
*/
|
||||
public static String GsonToString(String str) {
|
||||
try {
|
||||
return GSON.toJson(PARSER.parse(str));
|
||||
} catch (JsonSyntaxException e) {
|
||||
e.printStackTrace();
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* json字符串转成list
|
||||
* 解决泛型问题
|
||||
* 备注:
|
||||
* List<T> list=gson.fromJson(gsonString, new TypeToken<List<T>>() {}.getType());
|
||||
* 该方法会报泛型类型擦除问题
|
||||
*
|
||||
* @param gsonString
|
||||
* @param cls
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> GsonToList(String gsonString, Class<T> cls) {
|
||||
List<T> list = new ArrayList<T>();
|
||||
try {
|
||||
if (GSON != null) {
|
||||
JsonArray array = new JsonParser().parse(gsonString).getAsJsonArray();
|
||||
for (final JsonElement elem : array) {
|
||||
list.add(GSON.fromJson(elem, cls));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.e("非法json字符串", e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import androidx.core.os.ConfigurationCompat;
|
||||
import androidx.core.os.LocaleListCompat;
|
||||
|
||||
|
||||
import com.qxcm.moduleutil.widget.CommonAppContext;
|
||||
import com.qxcm.moduleutil.base.CommonAppContext;
|
||||
import com.qxcm.moduleutil.widget.Constants;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||