feat : core
This commit is contained in:
3
core/.gitignore
vendored
Normal file
3
core/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/build
|
||||||
|
*.iml
|
||||||
|
*.DS_Store
|
107
core/build.gradle
Normal file
107
core/build.gradle
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'realm-android'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-parcelize'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion COMPILE_SDK_VERSION.toInteger()
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion MIN_SDK_VERSION.toInteger()
|
||||||
|
targetSdkVersion TARGET_SDK_VERSION.toInteger()
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '11'
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java.srcDirs = [
|
||||||
|
'src/main/java',
|
||||||
|
'src/model_smscode/java',
|
||||||
|
'src/model_public_chat_hall/java',
|
||||||
|
'src/model_pay/java',
|
||||||
|
'src/model_upgrade_app/java',
|
||||||
|
'src/model_labour_union/java',
|
||||||
|
'src/model_mentoring_relationship/java',
|
||||||
|
'src/model_music/java',
|
||||||
|
'src/model_database_room/java',
|
||||||
|
'src/model_mini_world/java',
|
||||||
|
'src/model_bank_card/java',
|
||||||
|
'src/model_super_admin/java',
|
||||||
|
'src/model_treasure_box/java',
|
||||||
|
'src/model_community/java',
|
||||||
|
'src/model_channel_page/java',
|
||||||
|
'src/model_treasure_box/java',
|
||||||
|
'src/model_sud_wrapper/java'
|
||||||
|
]
|
||||||
|
// jniLibs.srcDirs = ['libs', 'umeng-app-libs/jniLibs']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildToolsVersion = '30.0.3'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
def Lombok = "1.18.24"
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
api "com.orhanobut:logger:2.2.0"
|
||||||
|
|
||||||
|
compileOnly "org.projectlombok:lombok:${Lombok}"
|
||||||
|
annotationProcessor "org.projectlombok:lombok:${Lombok}"
|
||||||
|
|
||||||
|
api fileTree(dir: 'share-sdk-libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
// 声网
|
||||||
|
api 'io.agora.rtc:voice-sdk:4.2.2'
|
||||||
|
|
||||||
|
// core
|
||||||
|
// implementation 'com.liulishuo.okdownload:okdownload:1.0.4'
|
||||||
|
// provide sqlite to store breakpoints
|
||||||
|
// implementation 'com.liulishuo.okdownload:sqlite:1.0.4'
|
||||||
|
// provide okhttp to connect to backend
|
||||||
|
// implementation 'com.liulishuo.okdownload:okhttp:1.0.4'
|
||||||
|
// Room
|
||||||
|
api 'androidx.room:room-runtime:2.5.1'
|
||||||
|
annotationProcessor 'androidx.room:room-compiler:2.5.1'
|
||||||
|
// RxJava support for Room
|
||||||
|
api 'androidx.room:room-rxjava2:2.5.1'
|
||||||
|
|
||||||
|
//firebase推送、统计
|
||||||
|
// implementation 'com.google.firebase:firebase-messaging:23.1.1'
|
||||||
|
// implementation 'com.google.android.gms:play-services-base:18.1.0'
|
||||||
|
// implementation 'com.google.firebase:firebase-core:19.0.0'
|
||||||
|
// implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
|
||||||
|
|
||||||
|
api 'org.jetbrains.kotlin:kotlin-reflect:1.7.10'
|
||||||
|
|
||||||
|
api project(':nim_uikit')
|
||||||
|
api project(':library')
|
||||||
|
|
||||||
|
// implementation 'com.liulishuo.okdownload:okdownload:1.0.7'
|
||||||
|
// implementation 'com.liulishuo.okdownload:okhttp:1.0.7'
|
||||||
|
|
||||||
|
implementation 'com.tencent.liteav:LiteAVSDK_TRTC:11.7.0.13946'
|
||||||
|
|
||||||
|
api project(':modules:module_base')
|
||||||
|
|
||||||
|
api 'tech.sud.mgp:SudMGP-static:1.5.2.1238'
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
21
core/proguard-rules.pro
vendored
Normal file
21
core/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
3
core/src/main/AndroidManifest.xml
Normal file
3
core/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<manifest package="com.chwl.core">
|
||||||
|
|
||||||
|
</manifest>
|
120
core/src/main/java/com/chwl/core/Constants.java
Normal file
120
core/src/main/java/com/chwl/core/Constants.java
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
package com.chwl.core;
|
||||||
|
|
||||||
|
import com.chwl.library.common.application.Env;
|
||||||
|
import com.chwl.library.utils.config.BasicConfig;
|
||||||
|
import com.chwl.library.utils.pref.CommonPref;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> 常量集合 </p>
|
||||||
|
* Created by Administrator on 2017/11/9.
|
||||||
|
*/
|
||||||
|
public class Constants {
|
||||||
|
public static final String ERBAN_DIR_NAME = XConstants.XCHAT_DIR_NAME;
|
||||||
|
public static final String nimAppKey = Env.isDebug() ?
|
||||||
|
SdkConfig.INSTANCE.getNimKeyDebug() : SdkConfig.INSTANCE.getNimKeyRelease();
|
||||||
|
// public static final String nimAppSecret = "da03b83af84a";
|
||||||
|
/**
|
||||||
|
* 百度统计
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static final String LOG_DIR = ERBAN_DIR_NAME + File.separator + "logs";
|
||||||
|
public static final String CONFIG_DIR = ERBAN_DIR_NAME + File.separator + "config";
|
||||||
|
public static final String VOICE_DIR = ERBAN_DIR_NAME + File.separator + "voice";
|
||||||
|
public static final String CACHE_DIR = ERBAN_DIR_NAME + File.separator + "cache";
|
||||||
|
public static final String HTTP_CACHE_DIR = ERBAN_DIR_NAME + File.separator + "http";
|
||||||
|
public static final String IMAGE_CACHE_DIR = ERBAN_DIR_NAME + File.separator + "image";
|
||||||
|
public static final String DYNAMIC_CACHE_DIR = ERBAN_DIR_NAME + File.separator + "dynamic";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String KEY_MAIN_POSITION = "key_main_position";
|
||||||
|
|
||||||
|
public static final int RESULT_OK = 200;
|
||||||
|
|
||||||
|
public static final int PAGE_START = 1;
|
||||||
|
public static final int PAGE_SIZE = 20;
|
||||||
|
public static final int PAGE_HOME_HOT_SIZE = 12;
|
||||||
|
public static final int BILL_PAGE_SIZE = 50;
|
||||||
|
|
||||||
|
public static final int DEBUG_MAX_UID = 100000;
|
||||||
|
|
||||||
|
|
||||||
|
public static final String HOME_TAB_INFO = "home_tab_info";
|
||||||
|
public static final String KEY_USER_INFO = "key_user_info";
|
||||||
|
|
||||||
|
public static final String KEY_HOME_LIST = "key_home_list";
|
||||||
|
public static final String KEY_HOME_HOT_LIST = "key_home_hot_list";
|
||||||
|
public static final String KEY_HOME_NO_HOT_LIST = "key_home_no_hot_list";
|
||||||
|
|
||||||
|
public static final int FAN_MAIN_PAGE_TYPE = 100;
|
||||||
|
public static final int FAN_NO_MAIN_PAGE_TYPE = 101;
|
||||||
|
public static final String KEY_PAGE_TYPE = "page_type";
|
||||||
|
public static final String KEY_MAIN_TAB_LIST = "main_tab_list";
|
||||||
|
|
||||||
|
public static final String KEY_POSITION = "position";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String CHARGE_UNION_PAY = "fastpay";
|
||||||
|
|
||||||
|
public static final int PAGE_TYPE_MAIN_FRAGMENT = 102;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间相关Key设置
|
||||||
|
*/
|
||||||
|
public static final String ROOM_UPDATE_KEY_POSTION = "micPosition";
|
||||||
|
public static final String ROOM_UPDATE_KEY_UID = "micUid";
|
||||||
|
public static final String ROOM_UPDATE_KEY_GENDER = "gender";
|
||||||
|
|
||||||
|
public static final String KEY_CHAT_ROOM_INFO_ROOM = "roomInfo";
|
||||||
|
public static final String KEY_CHAT_ROOM_INFO_MIC = "micQueue";
|
||||||
|
|
||||||
|
public static final String ROOM_UID = "ROOM_UID";
|
||||||
|
public static final String ROOM_TYPE = "ROOM_TYPE";
|
||||||
|
public static final String ROOM_INFO = "ROOM_INFO";
|
||||||
|
public static final String IS_ROOM_MIN = "is_room_min";
|
||||||
|
public static final String IS_PARTY = "is_party";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 座驾版本第一次显示控制key
|
||||||
|
*/
|
||||||
|
public static final String SHOW_CAR_GUIDE = "show_car_guide";
|
||||||
|
|
||||||
|
public static final String NEW_USER_ICON = "https://image.zhongjialx.com/newUserIcon.png";
|
||||||
|
|
||||||
|
public static final String IS_SEND = "isSend";
|
||||||
|
public static final String TOP_TITLE = "top_title";
|
||||||
|
|
||||||
|
public static final int CLIENT_ROLE_BROADCASTER = 1;
|
||||||
|
public static final int CLIENT_ROLE_AUDIENCE = 2;
|
||||||
|
|
||||||
|
public static final int DRAGON_BAR_ID = XConstants.DRAGON_BALL_ID;
|
||||||
|
|
||||||
|
public static final byte TYPE_JOINED = 1;
|
||||||
|
public static final byte TYPE_RECOMMEND = 2;
|
||||||
|
public static final byte TYPE_ALL = 0;
|
||||||
|
|
||||||
|
public static final String WXPAY_REFERER = (BuildConfig.DEBUG && CommonPref.instance(BasicConfig.INSTANCE.getAppContext()).getInt(Env.KEY_ENVIRONMENT) == Env.EnvType.Debug.code) ?
|
||||||
|
XConstants.KEY_REFERER_DEBUG : XConstants.KEY_REFERER_RELEASE;
|
||||||
|
|
||||||
|
//相亲模式男神坑位下标
|
||||||
|
public static final List<Integer> maleIndex = Arrays.asList(0, 1, 4, 5);
|
||||||
|
|
||||||
|
public static final String GOOGLE = com.chwl.library.common.Constants.GOOGLE;
|
||||||
|
|
||||||
|
public static final String ANDROID = "android";
|
||||||
|
|
||||||
|
//上传的图片 默认大小不能超过大小 640KB
|
||||||
|
public static final int UPLOAD_IMAGE_MAX_FILE_LENGTH = 640;
|
||||||
|
//上传的图片 默认宽高最大值 2340
|
||||||
|
public static final int UPLOAD_IMAGE_MAX_SIZE = 2340;
|
||||||
|
//上传的gif 默认大小不能超过 1MB
|
||||||
|
public static final int UPLOAD_GIF_MAX_SIZE = 1 << 20;
|
||||||
|
|
||||||
|
public static final String PHONE_LOGIN = "phone_login";
|
||||||
|
|
||||||
|
public static final String IS_SHOW_FREE_GIFT = "is_show_free_gift";
|
||||||
|
|
||||||
|
}
|
346
core/src/main/java/com/chwl/core/DemoCache.java
Normal file
346
core/src/main/java/com/chwl/core/DemoCache.java
Normal file
@@ -0,0 +1,346 @@
|
|||||||
|
package com.chwl.core;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.netease.nimlib.sdk.StatusBarNotificationConfig;
|
||||||
|
import com.chwl.core.auth.AuthModel;
|
||||||
|
import com.chwl.core.auth.entity.AccountInfo;
|
||||||
|
import com.chwl.core.auth.entity.TicketInfo;
|
||||||
|
import com.chwl.core.home.bean.MainTabInfo;
|
||||||
|
import com.chwl.core.initial.bean.SplashComponent;
|
||||||
|
import com.chwl.core.initial.bean.InitInfo;
|
||||||
|
import com.chwl.core.noble.bean.NobleConfig;
|
||||||
|
import com.chwl.core.noble.bean.NobleRight;
|
||||||
|
import com.chwl.core.utils.CurrentTimeUtils;
|
||||||
|
import com.chwl.core.utils.SharedPreferenceUtils;
|
||||||
|
import com.chwl.library.utils.pref.ObjectPref;
|
||||||
|
import com.chwl.library.utils.pref.SettingsPref;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/6.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DemoCache {
|
||||||
|
public static final String KEY_IS_FIRST_HOME_HIGH_PARTY_DIALOG = "IsFirstHomeHighPartyDialog";
|
||||||
|
private static final String KEY_BOX_MESSAGE = "key_box_message";
|
||||||
|
private static final String KEY_TICKET_INFO = "TicketInfo";
|
||||||
|
private static final String KEY_ACCOUNT_INFO = "AccountInfo";
|
||||||
|
private static final String KEY_FACE_LIST_INFO = "FaceListInfo";
|
||||||
|
private static final String KEY_INIT_DATA = "InitInfo";
|
||||||
|
private static final String KEY_INIT_DATA_SAVE_TIME = "InitInfoSavingTime";
|
||||||
|
private static final String KEY_INIT_DATA_SPLASH_PICTURE = "InitInfoSplashPicture";
|
||||||
|
private static final String KEY_INIT_DATA_SPLASH_DATA = "InitInfoSplashData";
|
||||||
|
private static final String KEY_INIT_DATA_NOBLE_VERSION = "InitInfoNobleVersion";
|
||||||
|
private static final String KEY_INIT_DATA_NOBLE_RIGHTS = "InitInfoNobleRights";
|
||||||
|
private static final String KEY_INIT_DATA_NOBLE_CONFIGS = "InitInfoNobleConfigs";
|
||||||
|
private static final String KEY_RED_PACKAGE = "RedPackage";
|
||||||
|
private static final String KEY_AT_MSG_UUID = "AtMsgUuid";
|
||||||
|
private static final String KEY_BGM_SINGLE_CYCLE = "key_bgm_single_cycle";
|
||||||
|
private static final String KEY_SINGLE_ROOM_TIP = "key_single_room_tip";
|
||||||
|
private static final String KEY_NEW_USER_GIFT = "key_new_user_gift";
|
||||||
|
private static final String KEY_NEW_USER_CHARGE_GIFT = "key_new_user_charge_gift";
|
||||||
|
private static final String KEY_MAIN_TAB_DATA = "key_main_tab_data";
|
||||||
|
private static final String KEY_SPEEDY_MESSAGE_GONE_TIME = "SpeedyMessageGoneTime";
|
||||||
|
private static final String KEY_ANCHOR_CARD_VIEW = "key_anchor_card_view";
|
||||||
|
private static final String KEY_ANCHOR_CARD_VIEW_TIME = "key_anchor_card_view_time";
|
||||||
|
private static final String KEY_LAUNCH_COUNT = "key_launch_count";
|
||||||
|
private static final String KEY_RADISH_TIPS = "key_radish_tips";
|
||||||
|
private static final String KEY_KICK_OUT_ROOM = "kick_out_room";
|
||||||
|
private static final String KEY_BOUND_AUTH_CODE = "key_bound_auth_code";
|
||||||
|
private static final String KEY_MY_FAIRY_INDEX = "key_my_fairy_index";
|
||||||
|
|
||||||
|
private static StatusBarNotificationConfig notificationConfig;
|
||||||
|
|
||||||
|
public static Long readSpeedyMessageGoneTime() {
|
||||||
|
return (Long) ObjectPref.instance().get(KEY_SPEEDY_MESSAGE_GONE_TIME, 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveSpeedyMessageGoneTime(Long savingTime) {
|
||||||
|
ObjectPref.instance().put(KEY_SPEEDY_MESSAGE_GONE_TIME, savingTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, NobleRight> readNobleRights() {
|
||||||
|
String string = SettingsPref.instance().getString(KEY_INIT_DATA_NOBLE_RIGHTS, null);
|
||||||
|
if (TextUtils.isEmpty(string)) return null;
|
||||||
|
return new Gson().fromJson(string,
|
||||||
|
new TypeToken<Map<String, NobleRight>>() {
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveNobleRights(String json) {
|
||||||
|
SettingsPref.instance().putString(KEY_INIT_DATA_NOBLE_RIGHTS, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveNobleConfigs(String json) {
|
||||||
|
SettingsPref.instance().putString(KEY_INIT_DATA_NOBLE_CONFIGS, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, NobleConfig> readNobleConfigs() {
|
||||||
|
String string = SettingsPref.instance().getString(KEY_INIT_DATA_NOBLE_CONFIGS, null);
|
||||||
|
if (TextUtils.isEmpty(string)) return null;
|
||||||
|
return new Gson().fromJson(string,
|
||||||
|
new TypeToken<Map<String, NobleConfig>>() {
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, Long> readRedPackage() {
|
||||||
|
String string = SettingsPref.instance().getString(KEY_RED_PACKAGE, null);
|
||||||
|
if (TextUtils.isEmpty(string)) return null;
|
||||||
|
return new Gson().fromJson(string,
|
||||||
|
new TypeToken<Map<String, Long>>() {
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveRedPackage(String id) {
|
||||||
|
Map<String, Long> map = readRedPackage();
|
||||||
|
if (map == null) map = new HashMap<>();
|
||||||
|
for (Iterator<Map.Entry<String, Long>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||||
|
if (CurrentTimeUtils.getCurrentTime() - it.next().getValue() > 60 * 60 * 24 * 7 * 1000) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put(id, CurrentTimeUtils.getCurrentTime());
|
||||||
|
SettingsPref.instance().putString(KEY_RED_PACKAGE, new Gson().toJson(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, Long> readAtMsgUuid() {
|
||||||
|
String string = SettingsPref.instance().getString(KEY_AT_MSG_UUID, null);
|
||||||
|
if (TextUtils.isEmpty(string)) return null;
|
||||||
|
return new Gson().fromJson(string,
|
||||||
|
new TypeToken<Map<String, Long>>() {
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
//云信聊天室云端历史消息最长保存10天,这里保存30天的应该够用了
|
||||||
|
public static void saveAtMsgUuid(String id) {
|
||||||
|
Map<String, Long> map = readAtMsgUuid();
|
||||||
|
if (map == null) map = new HashMap<>();
|
||||||
|
for (Iterator<Map.Entry<String, Long>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||||
|
if (CurrentTimeUtils.getCurrentTime() - it.next().getValue() > 60 * 60 * 24 * 30 * 1000L) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put(id, CurrentTimeUtils.getCurrentTime());
|
||||||
|
SettingsPref.instance().putString(KEY_AT_MSG_UUID, new Gson().toJson(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void saveBoolean(String key, boolean value) {
|
||||||
|
SettingsPref.instance().putBoolean(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean readBoolean(String key, boolean defult) {
|
||||||
|
return SettingsPref.instance().getBoolean(key, defult);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String readNobleVersion() {
|
||||||
|
return SettingsPref.instance().getString(KEY_INIT_DATA_NOBLE_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveNobleVersion(String version) {
|
||||||
|
SettingsPref.instance().putString(KEY_INIT_DATA_NOBLE_VERSION, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String readSplashPicture() {
|
||||||
|
return SettingsPref.instance().getString(KEY_INIT_DATA_SPLASH_PICTURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveSplashPicture(String path) {
|
||||||
|
SettingsPref.instance().putString(KEY_INIT_DATA_SPLASH_PICTURE, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Long readInitInfoSavingTime() {
|
||||||
|
return (Long) ObjectPref.instance().get(KEY_INIT_DATA_SAVE_TIME, System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveInitInfoSavingTime(Long savingTime) {
|
||||||
|
ObjectPref.instance().put(KEY_INIT_DATA_SAVE_TIME, savingTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SplashComponent readSplashInfo() {
|
||||||
|
return (SplashComponent) ObjectPref.instance().readObject(KEY_INIT_DATA_SPLASH_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveSplashInfo(SplashComponent splashComponent) {
|
||||||
|
ObjectPref.instance().saveObject(KEY_INIT_DATA_SPLASH_DATA, splashComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static InitInfo readInitInfo() {
|
||||||
|
return (InitInfo) ObjectPref.instance().readObject(KEY_INIT_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveInitInfo(InitInfo initInfo) {
|
||||||
|
ObjectPref.instance().saveObject(KEY_INIT_DATA, initInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static List<MainTabInfo> readMainTabInfoList() {
|
||||||
|
String jsonString = String.valueOf(SharedPreferenceUtils.get(KEY_MAIN_TAB_DATA, ""));
|
||||||
|
if (TextUtils.isEmpty(jsonString)) return null;
|
||||||
|
return new Gson().fromJson(jsonString,
|
||||||
|
new TypeToken<List<MainTabInfo>>() {
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveMainTabInfoList(List<MainTabInfo> tabInfoList) {
|
||||||
|
SharedPreferenceUtils.put(KEY_MAIN_TAB_DATA, new Gson().toJson(tabInfoList));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static String readFaceList() {
|
||||||
|
return (String) ObjectPref.instance().get(KEY_FACE_LIST_INFO, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveFaceList(String encrypt) {
|
||||||
|
ObjectPref.instance().put(KEY_FACE_LIST_INFO, encrypt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveCurrentAccountInfo(AccountInfo accountInfo) {
|
||||||
|
ObjectPref.instance().saveObject(KEY_ACCOUNT_INFO, accountInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AccountInfo readCurrentAccountInfo() {
|
||||||
|
return (AccountInfo) ObjectPref.instance().readObject(KEY_ACCOUNT_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveTicketInfo(TicketInfo ticketInfo) {
|
||||||
|
ObjectPref.instance().saveObject(KEY_TICKET_INFO, ticketInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TicketInfo readTicketInfo() {
|
||||||
|
return (TicketInfo) ObjectPref.instance().readObject(KEY_TICKET_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatusBarNotificationConfig getNotificationConfig() {
|
||||||
|
return notificationConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setNotificationConfig(StatusBarNotificationConfig notificationConfig) {
|
||||||
|
DemoCache.notificationConfig = notificationConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveNeedBoxMsg(boolean value) {
|
||||||
|
SettingsPref.instance().putBoolean(KEY_BOX_MESSAGE + AuthModel.get().getCurrentUid(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean readNeedBoxMsg() {
|
||||||
|
return SettingsPref.instance().getBoolean(KEY_BOX_MESSAGE + AuthModel.get().getCurrentUid(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveBgmSingleCycle(boolean value) {
|
||||||
|
SettingsPref.instance().putBoolean(KEY_BGM_SINGLE_CYCLE, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean readBgmSingleCycle() {
|
||||||
|
return SettingsPref.instance().getBoolean(KEY_BGM_SINGLE_CYCLE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveSingleRoomTip(boolean value) {
|
||||||
|
SettingsPref.instance().putBoolean(KEY_SINGLE_ROOM_TIP, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Boolean readSingleRoomTip() {
|
||||||
|
return SettingsPref.instance().getBoolean(KEY_SINGLE_ROOM_TIP, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveNewUserGift(boolean value) {
|
||||||
|
SettingsPref.instance().putBoolean(KEY_NEW_USER_GIFT, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean readNewUserGift() {
|
||||||
|
return SettingsPref.instance().getBoolean(KEY_NEW_USER_GIFT, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value 0初始值 1 需要弹窗 2 不需要弹窗
|
||||||
|
*/
|
||||||
|
public static void saveNewUserChargeGift(int value) {
|
||||||
|
SettingsPref.instance().putInt(KEY_NEW_USER_CHARGE_GIFT, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int readNewUserChargeGift() {
|
||||||
|
return SettingsPref.instance().getInt(KEY_NEW_USER_CHARGE_GIFT, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param value 0初始值 1 显示首次弹窗 2 非首次弹窗,需要判断时间再显示
|
||||||
|
*/
|
||||||
|
public static void saveAnchorCardView(int value) {
|
||||||
|
SettingsPref.instance().putInt(KEY_ANCHOR_CARD_VIEW, value);
|
||||||
|
if (value == 2) {
|
||||||
|
SettingsPref.instance().putLong(KEY_ANCHOR_CARD_VIEW_TIME, CurrentTimeUtils.getCurrentTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int readAnchorCardView() {
|
||||||
|
return SettingsPref.instance().getInt(KEY_ANCHOR_CARD_VIEW, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long readAnchorCardViewTime() {
|
||||||
|
return SettingsPref.instance().getLong(KEY_ANCHOR_CARD_VIEW_TIME, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveLaunchCount() {
|
||||||
|
SettingsPref.instance().putInt(KEY_LAUNCH_COUNT, readLaunchCount() + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int readLaunchCount() {
|
||||||
|
return SettingsPref.instance().getInt(KEY_LAUNCH_COUNT, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveRadishTips(boolean value) {
|
||||||
|
SettingsPref.instance().putBoolean(KEY_RADISH_TIPS, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean readRadishTips() {
|
||||||
|
return SettingsPref.instance().getBoolean(KEY_RADISH_TIPS, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static Map<String, Long> readKickOutRoom() {
|
||||||
|
String string = SettingsPref.instance().getString(KEY_KICK_OUT_ROOM + AuthModel.get().getCurrentUid(), null);
|
||||||
|
if (TextUtils.isEmpty(string)) return null;
|
||||||
|
return new Gson().fromJson(string,
|
||||||
|
new TypeToken<Map<String, Long>>() {
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveKickOutRoom(String roomUid) {
|
||||||
|
Map<String, Long> map = readKickOutRoom();
|
||||||
|
if (map == null) map = new HashMap<>();
|
||||||
|
for (Iterator<Map.Entry<String, Long>> it = map.entrySet().iterator(); it.hasNext(); ) {
|
||||||
|
if (CurrentTimeUtils.getCurrentTime() - it.next().getValue() > XConstants.KICK_OUT_ROOM_LIMIT_ENTER_TIME) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put(roomUid, CurrentTimeUtils.getCurrentTime());
|
||||||
|
SettingsPref.instance().putString(KEY_KICK_OUT_ROOM + AuthModel.get().getCurrentUid(), new Gson().toJson(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveBoundAuthCode(boolean value) {
|
||||||
|
SettingsPref.instance().putBoolean(KEY_BOUND_AUTH_CODE, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean readBoundAuthCode() {
|
||||||
|
return SettingsPref.instance().getBoolean(KEY_BOUND_AUTH_CODE, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveMyFairyIndex(int index) {
|
||||||
|
SettingsPref.instance().putInt(KEY_MY_FAIRY_INDEX, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int readMyFairyIndex() {
|
||||||
|
return SettingsPref.instance().getInt(KEY_MY_FAIRY_INDEX, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
49
core/src/main/java/com/chwl/core/OldHttpObserver.java
Normal file
49
core/src/main/java/com/chwl/core/OldHttpObserver.java
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
package com.chwl.core;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.RequestError;
|
||||||
|
import com.chwl.core.bean.response.ResponseData;
|
||||||
|
|
||||||
|
import io.reactivex.SingleObserver;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import retrofit2.HttpException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jack
|
||||||
|
* @Description
|
||||||
|
* @Date 2018/5/7
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class OldHttpObserver<T> implements SingleObserver<T> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable throwable) {
|
||||||
|
try {
|
||||||
|
if (throwable instanceof HttpException){
|
||||||
|
retrofit2.Response<?> response = ((HttpException) throwable).response();
|
||||||
|
if (response.errorBody() == null){
|
||||||
|
onFail(new RequestError(throwable.getMessage()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
byte[] bodyByte = response.errorBody().bytes();
|
||||||
|
if (bodyByte.length <= 0){
|
||||||
|
onFail(new RequestError(throwable.getMessage()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ResponseData error = new ResponseData(bodyByte);
|
||||||
|
onFail(new RequestError(error));
|
||||||
|
}else {
|
||||||
|
onFail(new RequestError(throwable.getMessage()));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
onFail(new RequestError(e.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onFail(RequestError error);
|
||||||
|
}
|
113
core/src/main/java/com/chwl/core/PreferencesUtils.java
Normal file
113
core/src/main/java/com/chwl/core/PreferencesUtils.java
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
package com.chwl.core;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.netease.nimlib.sdk.StatusBarNotificationConfig;
|
||||||
|
import com.netease.nimlib.sdk.auth.LoginInfo;
|
||||||
|
import com.chwl.core.auth.entity.AccountInfo;
|
||||||
|
import com.chwl.core.auth.entity.TicketInfo;
|
||||||
|
import com.chwl.library.utils.config.BasicConfig;
|
||||||
|
import com.chwl.library.utils.pref.ObjectPref;
|
||||||
|
import com.chwl.library.utils.pref.SettingsPref;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/19.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PreferencesUtils {
|
||||||
|
|
||||||
|
private static AccountInfo accountInfo;
|
||||||
|
private static TicketInfo ticketInfo;
|
||||||
|
|
||||||
|
private static final String KEY_TICKET_INFO = "TicketInfo";
|
||||||
|
private static final String KEY_FRIST_SEED_GOLD = "FristSendGold";
|
||||||
|
private static final String KEY_FRIST_USER = "FristUser";
|
||||||
|
private static final String KEY_LOGIN_INFO = "LoginInfo";
|
||||||
|
private static final String KEY_ACCOUNT_INFO = "AccountInfo";
|
||||||
|
private static final String KEY_NOTI_TOGGLE = "NotiToggle";
|
||||||
|
private static final String KEY_NOTI_CONFIG = "StatusBarNotificationConfig";
|
||||||
|
private static final String KEY_AGREE_PRIVACY = "key_agree_privacy";
|
||||||
|
|
||||||
|
|
||||||
|
public static void saveTicketInfo(TicketInfo ticketInfo) {
|
||||||
|
ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).saveObject(KEY_TICKET_INFO, ticketInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void saveCurrentAccountInfo(AccountInfo accountInfo) {
|
||||||
|
ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).saveObject(KEY_ACCOUNT_INFO, accountInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void saveLoginInfo(LoginInfo loginInfo) {
|
||||||
|
ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).saveObject(KEY_LOGIN_INFO, loginInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AccountInfo readCurrentAccountInfo() {
|
||||||
|
if (null == accountInfo) {
|
||||||
|
accountInfo = (AccountInfo) ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).readObject(KEY_ACCOUNT_INFO);
|
||||||
|
}
|
||||||
|
return accountInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TicketInfo readTicketInfo() {
|
||||||
|
if (null == ticketInfo) {
|
||||||
|
return (TicketInfo) ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).readObject(KEY_TICKET_INFO);
|
||||||
|
}
|
||||||
|
return ticketInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LoginInfo readLoginInfo(Context context) {
|
||||||
|
return (LoginInfo) ObjectPref.instance(context).readObject(KEY_LOGIN_INFO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean readNotificationToggle() {
|
||||||
|
return SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).getBoolean(KEY_NOTI_TOGGLE, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setNotificationToggle(boolean isOpen) {
|
||||||
|
SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).putBoolean(KEY_NOTI_TOGGLE, isOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean readFristSendGold() {
|
||||||
|
return SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).getBoolean(KEY_FRIST_SEED_GOLD, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setFristSendGold(boolean isOpen) {
|
||||||
|
SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).putBoolean(KEY_FRIST_SEED_GOLD, isOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean readFristUser() {
|
||||||
|
return SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).getBoolean(KEY_FRIST_USER, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setFristUser(boolean isOpen) {
|
||||||
|
SettingsPref.instance(BasicConfig.INSTANCE.getAppContext()).putBoolean(KEY_FRIST_USER, isOpen);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void saveStatusBarNotificationConfig(StatusBarNotificationConfig notificationConfig) {
|
||||||
|
ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).put(KEY_NOTI_CONFIG, notificationConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static StatusBarNotificationConfig readStatusBarNotificationConfig() {
|
||||||
|
return (StatusBarNotificationConfig) ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).readObject(KEY_NOTI_CONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clear() {
|
||||||
|
accountInfo = null;
|
||||||
|
ticketInfo = null;
|
||||||
|
saveCurrentAccountInfo(new AccountInfo());
|
||||||
|
saveTicketInfo(new TicketInfo());
|
||||||
|
saveLoginInfo(new LoginInfo("", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void savePrivacyState(boolean privacy) {
|
||||||
|
ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).put(KEY_AGREE_PRIVACY, privacy);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean readPrivacyState() {
|
||||||
|
return (boolean) ObjectPref.instance(BasicConfig.INSTANCE.getAppContext()).get(KEY_AGREE_PRIVACY, false);
|
||||||
|
}
|
||||||
|
}
|
118
core/src/main/java/com/chwl/core/RegionHelper.kt
Normal file
118
core/src/main/java/com/chwl/core/RegionHelper.kt
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
package com.chwl.core
|
||||||
|
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.coroutineScope
|
||||||
|
import com.example.lib_utils.AppUtils
|
||||||
|
import com.example.lib_utils.TelephonyUtils
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import com.chwl.core.bean.RegionBean
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
import java.io.InputStream
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/7 18:23
|
||||||
|
* Desc:地区
|
||||||
|
**/
|
||||||
|
class RegionHelper {
|
||||||
|
|
||||||
|
fun loadRecommendRegion(lifecycle: Lifecycle, textView: TextView){
|
||||||
|
lifecycle.coroutineScope.launch {
|
||||||
|
RegionHelper().getCurrentOrDefRegion().let {
|
||||||
|
textView.text = it.fullCode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getDefaultRegion(): RegionBean {
|
||||||
|
return RegionBean(name = "Taiwan", abbr = "TW", mcc = "466", code = "886")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前地区或默认
|
||||||
|
*/
|
||||||
|
private suspend fun getCurrentOrDefRegion(): RegionBean {
|
||||||
|
return withContext(Dispatchers.IO) {
|
||||||
|
var operator = TelephonyUtils.getNetWorkOperator()
|
||||||
|
if (operator.isNullOrEmpty()) {
|
||||||
|
operator = TelephonyUtils.getSimOperator()
|
||||||
|
}
|
||||||
|
val mcc = operator?.take(3)
|
||||||
|
val region = getAllRegionList().firstOrNull {
|
||||||
|
it.mcc == mcc
|
||||||
|
}
|
||||||
|
region ?: getDefaultRegion()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取地区选择器列表
|
||||||
|
*/
|
||||||
|
suspend fun getRegionSelectorList(groupItemType: Int): List<RegionBean> {
|
||||||
|
return withContext(Dispatchers.IO) {
|
||||||
|
val list = ArrayList<RegionBean>()
|
||||||
|
list.addAll(getHotRegionList())
|
||||||
|
var lastGroup: Char? = null
|
||||||
|
list.addAll(getAllRegionList()
|
||||||
|
.map {
|
||||||
|
val firstName = it.name?.firstOrNull()?.uppercaseChar() ?: '#'
|
||||||
|
if (firstName in 'A'..'Z') {
|
||||||
|
it.groupName = firstName
|
||||||
|
it.sortedBy = "$firstName${it.name?.uppercase()}"
|
||||||
|
} else {
|
||||||
|
it.groupName = '#'
|
||||||
|
it.sortedBy = "${'Z' + 1}${it.name?.uppercase()}"
|
||||||
|
}
|
||||||
|
it
|
||||||
|
}
|
||||||
|
.sortedBy {
|
||||||
|
it.sortedBy
|
||||||
|
}.map {
|
||||||
|
val groupName = it.groupName ?: '#'
|
||||||
|
if (groupName != lastGroup) {
|
||||||
|
it.itemType = groupItemType
|
||||||
|
}
|
||||||
|
lastGroup = groupName
|
||||||
|
it
|
||||||
|
}
|
||||||
|
)
|
||||||
|
list
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取热门地区
|
||||||
|
*/
|
||||||
|
suspend fun getHotRegionList(): List<RegionBean> {
|
||||||
|
return getRegionListFromAssets("hot_region.json")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部地区
|
||||||
|
*/
|
||||||
|
suspend fun getAllRegionList(): List<RegionBean> {
|
||||||
|
return getRegionListFromAssets("region.json")
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从资源文件中获取地区列表
|
||||||
|
*/
|
||||||
|
private fun getRegionListFromAssets(fileName: String): MutableList<RegionBean> {
|
||||||
|
//获取IO流
|
||||||
|
try {
|
||||||
|
val inputStream: InputStream =
|
||||||
|
AppUtils.getApp().applicationContext.assets.open(fileName)
|
||||||
|
val json: String
|
||||||
|
inputStream.use {
|
||||||
|
json = it.bufferedReader().readText()
|
||||||
|
}
|
||||||
|
return Gson().fromJson(json, object : TypeToken<MutableList<RegionBean>>() {}.type)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
return mutableListOf()
|
||||||
|
}
|
||||||
|
}
|
28
core/src/main/java/com/chwl/core/SdkConfig.kt
Normal file
28
core/src/main/java/com/chwl/core/SdkConfig.kt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.chwl.core
|
||||||
|
|
||||||
|
import com.chwl.library.utils.codec.DESUtils
|
||||||
|
|
||||||
|
object SdkConfig {
|
||||||
|
// 1400823228
|
||||||
|
fun getTXAppId() = decrypt("cTkOfnb3r7vaFs4wfq3Aog==")
|
||||||
|
|
||||||
|
// 3da88e33bc4f45019cc867ec51d7b465
|
||||||
|
fun getAgoraKey() = decrypt("k9xONsWAgzCkXtzm5Wu+4U8sxtf9XKwlXXAl3l9BE6ppYKlmIfzkBA==")
|
||||||
|
|
||||||
|
// 3da88e33bc4f45019cc867ec51d7b465
|
||||||
|
fun getAgoraKeyDebug() = decrypt("k9xONsWAgzCkXtzm5Wu+4U8sxtf9XKwlXXAl3l9BE6ppYKlmIfzkBA==")
|
||||||
|
|
||||||
|
// 79bc37000f4018a2a24ea9dc6ca08d32
|
||||||
|
fun getNimKeyDebug() = decrypt("/1KxSXOF+PIET/9E3Aq3uBF7eesBfAABUy05XDWBl+JpYKlmIfzkBA==")
|
||||||
|
|
||||||
|
// 7371d729710cd6ce3a50163b956b5eb6
|
||||||
|
fun getNimKeyRelease() = decrypt("g3J0oqC++xZPMO7VrKdr+eXlAnxFhWFvdpD0Bm9sR01pYKlmIfzkBA==")
|
||||||
|
|
||||||
|
private fun decrypt(value: String): String {
|
||||||
|
return try {
|
||||||
|
DESUtils.decryptDef2(value)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
74
core/src/main/java/com/chwl/core/UriHelper.java
Normal file
74
core/src/main/java/com/chwl/core/UriHelper.java
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
package com.chwl.core;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
public class UriHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param url 访问链接
|
||||||
|
* @return 返回增加时间戳,避免重复链接访问缓存内容
|
||||||
|
*/
|
||||||
|
public static String applyTimestampForUrl(String url) {
|
||||||
|
if (TextUtils.isEmpty(url)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
url = appendUri(url, "t", String.valueOf(System.currentTimeMillis()));
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL增加参数
|
||||||
|
*
|
||||||
|
* @param uri 原始链接
|
||||||
|
* @param appendQueryKey 增加参数,key
|
||||||
|
* @param appendQueryValue 增加参数,value
|
||||||
|
* @return 拼接后的完整链接
|
||||||
|
*/
|
||||||
|
public static String appendUri(String uri, String appendQueryKey, String appendQueryValue) {
|
||||||
|
if (TextUtils.isEmpty(uri)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(appendQueryKey) || TextUtils.isEmpty(appendQueryValue)) {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
Uri oldUri = Uri.parse(uri);
|
||||||
|
|
||||||
|
String value = oldUri.getQueryParameter(appendQueryKey);
|
||||||
|
if (!TextUtils.isEmpty(value)) {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
Uri.Builder builder = Uri.parse(uri).buildUpon();
|
||||||
|
builder.appendQueryParameter(appendQueryKey, appendQueryValue);
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* URL增加参数 值允许为空字符串
|
||||||
|
*
|
||||||
|
* @param uri 原始链接
|
||||||
|
* @param appendQueryKey 增加参数,key
|
||||||
|
* @param appendQueryValue 增加参数,value
|
||||||
|
* @return 拼接后的完整链接
|
||||||
|
*/
|
||||||
|
public static String appendUriAllowEmpty(String uri, String appendQueryKey, String appendQueryValue) {
|
||||||
|
if (TextUtils.isEmpty(uri)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(appendQueryKey)) {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
Uri oldUri = Uri.parse(uri);
|
||||||
|
|
||||||
|
String value = oldUri.getQueryParameter(appendQueryKey);
|
||||||
|
if (!TextUtils.isEmpty(value)) {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
Uri.Builder builder = Uri.parse(uri).buildUpon();
|
||||||
|
if (TextUtils.isEmpty(appendQueryValue)) {
|
||||||
|
builder.appendQueryParameter(appendQueryKey, "");
|
||||||
|
} else {
|
||||||
|
builder.appendQueryParameter(appendQueryKey, appendQueryValue);
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
386
core/src/main/java/com/chwl/core/UriProvider.java
Normal file
386
core/src/main/java/com/chwl/core/UriProvider.java
Normal file
@@ -0,0 +1,386 @@
|
|||||||
|
package com.chwl.core;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.chwl.core.manager.AvRoomDataManager;
|
||||||
|
import com.chwl.library.common.application.Env;
|
||||||
|
/**
|
||||||
|
* 请求接口接口地址
|
||||||
|
*/
|
||||||
|
public class UriProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认以下生产环境地址
|
||||||
|
*/
|
||||||
|
public static String JAVA_WEB_URL = "https://";
|
||||||
|
public static String IM_SERVER_URL = "https://";
|
||||||
|
public static String AAPP = "/molistar";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化URL
|
||||||
|
*
|
||||||
|
* @param serverDebug
|
||||||
|
* @param serverStaging
|
||||||
|
* @param serverRelease
|
||||||
|
*/
|
||||||
|
public static void initUri(String serverDebug, String serverStaging, String serverRelease) {
|
||||||
|
Env.EnvType envType = Env.getCurrentEnv();
|
||||||
|
if (envType == Env.EnvType.Debug) {
|
||||||
|
initUrl(serverDebug);
|
||||||
|
} else if (envType == Env.EnvType.Staging) {
|
||||||
|
initUrl(serverStaging);
|
||||||
|
} else if (envType == Env.EnvType.Release) {
|
||||||
|
initUrl(serverRelease);
|
||||||
|
} else {
|
||||||
|
initUrl(serverDebug);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void initUrl(String url) {
|
||||||
|
JAVA_WEB_URL = url;
|
||||||
|
IM_SERVER_URL = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取房间背景(有动效)
|
||||||
|
*
|
||||||
|
* @return -
|
||||||
|
*/
|
||||||
|
public static String getRoomBg() {
|
||||||
|
return IM_SERVER_URL.concat(AAPP+"/modules/noble/roomBgList.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贵族介绍页
|
||||||
|
*/
|
||||||
|
public static String getNobleIntro() {
|
||||||
|
return IM_SERVER_URL.concat(AAPP+"/modules/nobles/intro.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 帮助页
|
||||||
|
*/
|
||||||
|
public static String getHelp() {
|
||||||
|
return IM_SERVER_URL.concat(AAPP+"/modules/rule/guide.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等级界面
|
||||||
|
*/
|
||||||
|
public static String getUserLevelUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/level/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户协议H5
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getUserProtocolUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/protocol.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 举报H5
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getUserReportUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/inform/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MoliParty专属,实名认证页面
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getTutuRealNamePage() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/identity/new.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCommnunityNorms() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/community-norms.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐私协议
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getPrivacyAgreement() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/privacy-wap.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getLinkUrl(String linkUrl) {
|
||||||
|
if (TextUtils.isEmpty(linkUrl)) {
|
||||||
|
return JAVA_WEB_URL;
|
||||||
|
}
|
||||||
|
return JAVA_WEB_URL.concat(linkUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人魅力榜
|
||||||
|
*/
|
||||||
|
public static String getPersonalCharismaRank() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/charm/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相亲规则
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getDatingRule() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/dating.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第三方SDK协议
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getSDKPermissionUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/sdk.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 隐私指引
|
||||||
|
*/
|
||||||
|
public static String getPrivacyUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/privacy-wap.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户充值协议
|
||||||
|
*/
|
||||||
|
public static String getChargeAgreementUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/rechargeAgreement.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户注册服务协议
|
||||||
|
*/
|
||||||
|
public static String getRegistrationAgreementUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/protocol.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号注销协议
|
||||||
|
*/
|
||||||
|
public static String getCancellationAgreementUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/logout-agreement.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直播乱象
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getLiveAgreement() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/activity/activemodel/index.html?code=ZBGG");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贵族中心帮助页
|
||||||
|
*/
|
||||||
|
public static String getVipHelpUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/introduction-patrician.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贵族榜
|
||||||
|
*/
|
||||||
|
public static String getRankListUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/noble/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取宝箱钥匙
|
||||||
|
*/
|
||||||
|
public static String getBoxKey() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/activity/explore/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宝箱记录
|
||||||
|
*/
|
||||||
|
public static String getBoxHistory() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rank/index.html#/newWishingWellRecord");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宝箱帮助
|
||||||
|
*/
|
||||||
|
public static String getBoxHelp() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/newWishingWellRule.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getRanking() {
|
||||||
|
return IM_SERVER_URL.concat(AAPP+"/modules/rank/index.html#/rank");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钻石明细
|
||||||
|
*/
|
||||||
|
public static String getDiamondDetail() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/myincome/index.html#/DiamondLog");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 金币明细
|
||||||
|
*/
|
||||||
|
public static String getGoldDetail() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/myincome/index.html#/GoldLog");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请好友
|
||||||
|
*/
|
||||||
|
public static String getInviteFan() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/activity/2024-invitationFission/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间排行榜
|
||||||
|
*/
|
||||||
|
public static String getRoomRanking() {
|
||||||
|
return IM_SERVER_URL.concat(AAPP+"/modules/room_rank/index.html?roomUid=" + AvRoomDataManager.get().getRoomUid());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个播小时榜
|
||||||
|
*/
|
||||||
|
public static String getSingleRoomHourRankUrl(long roomUid) {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/room_rank/hourRank.html?roomUid=" + roomUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 牌照房小时榜
|
||||||
|
*/
|
||||||
|
public static String getRoomHourRankUrl(long roomUid) {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/room_rank/hourRankLicense.html?roomUid=" + roomUid);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 粉丝团规则
|
||||||
|
*/
|
||||||
|
public static String getFansTeamRuleUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/fans_club/rule.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 粉丝团排行
|
||||||
|
*/
|
||||||
|
public static String getFansTeamRankUrl(long roomUid) {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/fans_club/fans_rank.html?roomUid=" + roomUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的粉丝团
|
||||||
|
*/
|
||||||
|
public static String getFansTeamMyFansUrl(long roomUid) {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/fans_club/myfans.html?roomUid=" + roomUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开通粉丝团
|
||||||
|
*/
|
||||||
|
public static String getFansTeamOpenUrl(long roomUid) {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/fans_club/nameplate.html?roomUid=" + roomUid);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 周星榜
|
||||||
|
*/
|
||||||
|
public static String getWeekStarUrl() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/weekStar/newWeekStar.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 幸运礼物说明
|
||||||
|
*/
|
||||||
|
public static String getLuckyGiftRule(int giftID) {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/luckyGiftRule.html?giftID=" + giftID);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏排行榜
|
||||||
|
*/
|
||||||
|
public static String getGameRank() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/gameRank/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cp规则
|
||||||
|
*/
|
||||||
|
public static String getCpRule() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/cpRule.html");
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* boom规则
|
||||||
|
*/
|
||||||
|
public static String getBoomRule(long partitionId) {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rule/boom.html?partitionId="+partitionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间等级 规则
|
||||||
|
*/
|
||||||
|
public static String getRoomLevelRule() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/roomLevel/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 幸运红包 规则
|
||||||
|
*/
|
||||||
|
public static String getLuckyBagRule() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/luckyBagRules/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人机验证h5
|
||||||
|
*/
|
||||||
|
public static String getHumanMachineVerification() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/humanMachineVerification/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动详情-h5
|
||||||
|
* http://api.moliparty.com/eparty/modules/eventDetails/index.html?eventId=21
|
||||||
|
*/
|
||||||
|
public static String getEventDetail(long id) {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/eventDetails/index.html?eventId="+id);
|
||||||
|
}
|
||||||
|
//vip中心
|
||||||
|
public static String getVipCenter() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/vip_Center/index.html");
|
||||||
|
}
|
||||||
|
|
||||||
|
//金币转赠,我的转赠
|
||||||
|
public static String getMyTransfer() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/rechargeAgent/index.html#/myTransfer");
|
||||||
|
}
|
||||||
|
|
||||||
|
//首充- 首页弹窗
|
||||||
|
public static String getFirstRechargeIndex() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/firstRechargeBonus/index.html ");
|
||||||
|
}
|
||||||
|
|
||||||
|
//首充- 钱币banner跳转
|
||||||
|
public static String getFirstRechargeBonus() {
|
||||||
|
return JAVA_WEB_URL.concat(AAPP+"/modules/firstRechargeBonus/First_Bonus.html ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String toFullUrl(String shortUrl) {
|
||||||
|
if (shortUrl == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (shortUrl.startsWith("http")) {
|
||||||
|
return shortUrl;
|
||||||
|
} else {
|
||||||
|
return JAVA_WEB_URL.concat(shortUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
86
core/src/main/java/com/chwl/core/XConstants.java
Normal file
86
core/src/main/java/com/chwl/core/XConstants.java
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
package com.chwl.core;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by MadisonRong on 09/08/2018.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class XConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 包名(各種緩存目錄的根目錄)
|
||||||
|
*/
|
||||||
|
public static final String XCHAT_DIR_NAME = "com.hhchu.molistar";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sp名字
|
||||||
|
*/
|
||||||
|
public static final String XCHAT_SHARE_PREFERENCE_NAME = "accompany_share_data";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密接口參數
|
||||||
|
*/
|
||||||
|
public static final String DES_ENCRYPT_KEY_SMS_PARAMS = "rpbs6us1m8r2j9g6u06ff2bo18orwaya";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密接口簽名
|
||||||
|
*/
|
||||||
|
public static final String DES_ENCRYPT_KEY_SMS_SIGN = "c8d514b3cdc44e898e027940e84f036c";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 本地數據庫的名字(目前是用 realm 數據庫)
|
||||||
|
*/
|
||||||
|
public static final String XCHAT_DATABASE_NAME = "accompany.db";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 龍珠表情 ID
|
||||||
|
*/
|
||||||
|
public static final int DRAGON_BALL_ID = 40;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系統消息那個用戶的UID
|
||||||
|
*/
|
||||||
|
public static final String SYSTEM_MESSAGE_UID = BuildConfig.DEBUG ? "935008" : "904770";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小秘書那個用戶的UID
|
||||||
|
*/
|
||||||
|
public static final String SECRETARY_UID = BuildConfig.DEBUG ? "935001" : "904769";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 賽事消息UID
|
||||||
|
*/
|
||||||
|
public static final String MATCH_UID = BuildConfig.DEBUG ? "1296314" : "904772";
|
||||||
|
public static final String SHOW = "show";
|
||||||
|
public static final String HIDE = "hide";
|
||||||
|
|
||||||
|
// 舉報入口標識
|
||||||
|
public static final String REPORT_TYPE_CHAT = "chat"; // 私聊
|
||||||
|
public static final String REPORT_TYPE_PERSONAL = "personal"; // 個人中心
|
||||||
|
public static final String REPORT_TYPE_ROOM = "room"; // 房間
|
||||||
|
public static final String REPORT_TYPE_VOICE = "voice"; // 聲音瓶子
|
||||||
|
public static final String REPORT_TYPE_USERCARD = "USERCARD"; // 資料卡片
|
||||||
|
public static final String REPORT_TYPE_WORLDDYNAMIC = "WORLDDYNAMIC"; // 世界動態
|
||||||
|
public static final String REPORT_TYPE_DYNAMICCOMMENT = "DYNAMICCOMMENT"; // 世界動態
|
||||||
|
public static final String REPORT_TYPE_PERSONAL_DYNAMIC = "PERSONAL_DYNAMIC"; // 個人頁動態
|
||||||
|
public static final String REPORT_TYPE_DYNAMIC_SQUARE = "DYNAMIC_SQUARE";//廣場動態
|
||||||
|
/**
|
||||||
|
* Referer (DEBUG)
|
||||||
|
*/
|
||||||
|
public static final String KEY_REFERER_DEBUG = "http://api.molistar.xyz/";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Referer (RELEASE)
|
||||||
|
*/
|
||||||
|
public static final String KEY_REFERER_RELEASE = "https://api.molistar.xyz/";
|
||||||
|
public static final String APP_MARK = "molistar";
|
||||||
|
/**
|
||||||
|
* 聊天室文本消息易盾反垃圾業務id
|
||||||
|
*/
|
||||||
|
public static final String CHAT_ROOM_ANTI_SPAM_CONFIG_ID = BuildConfig.DEBUG ? "3611b99d0457202a7f69151288183236" : "bddbbb617e9da4fcd08c6baf6686ad01";
|
||||||
|
|
||||||
|
public static final int KICK_OUT_ROOM_LIMIT_ENTER_TIME = 5 * 60 * 1000;
|
||||||
|
public static final int CODE_IGNORE_TOAST = 5263;
|
||||||
|
public static int SELECT_ANIM_DURATION = 2500;
|
||||||
|
}
|
@@ -0,0 +1,46 @@
|
|||||||
|
package com.chwl.core.activity.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by chenran on 2017/12/26.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class LotteryInfo implements Serializable{
|
||||||
|
private long uid;
|
||||||
|
private int leftDrawNum;
|
||||||
|
private int totalDrawNum;
|
||||||
|
private int totalWinDrawNum;
|
||||||
|
|
||||||
|
public long getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(long uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLeftDrawNum() {
|
||||||
|
return leftDrawNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLeftDrawNum(int leftDrawNum) {
|
||||||
|
this.leftDrawNum = leftDrawNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalDrawNum() {
|
||||||
|
return totalDrawNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalDrawNum(int totalDrawNum) {
|
||||||
|
this.totalDrawNum = totalDrawNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalWinDrawNum() {
|
||||||
|
return totalWinDrawNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalWinDrawNum(int totalWinDrawNum) {
|
||||||
|
this.totalWinDrawNum = totalWinDrawNum;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.chwl.core.activity.event;
|
||||||
|
|
||||||
|
import com.chwl.core.activity.bean.LotteryInfo;
|
||||||
|
|
||||||
|
public class ActivityEvent {
|
||||||
|
|
||||||
|
private LotteryInfo lotteryInfo;
|
||||||
|
|
||||||
|
public LotteryInfo setLotteryInfo(LotteryInfo lotteryInfo) {
|
||||||
|
this.lotteryInfo = lotteryInfo;
|
||||||
|
return this.lotteryInfo;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
package com.chwl.core.activity.model;
|
||||||
|
|
||||||
|
import com.chwl.core.base.BaseModel;
|
||||||
|
|
||||||
|
public class ActivityModel extends BaseModel implements IActivityModel {
|
||||||
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
package com.chwl.core.activity.model;
|
||||||
|
|
||||||
|
import com.chwl.core.base.IModel;
|
||||||
|
|
||||||
|
public interface IActivityModel extends IModel {
|
||||||
|
}
|
@@ -0,0 +1,12 @@
|
|||||||
|
package com.chwl.core.association.bean
|
||||||
|
|
||||||
|
data class ClanListInfo(
|
||||||
|
val clanId: Int = 0,
|
||||||
|
val clanElderUid: Long = 0,
|
||||||
|
val avatar: String = "",
|
||||||
|
val name: String = "",
|
||||||
|
val levelIcon: String = "",
|
||||||
|
val income: Double = 0.0,
|
||||||
|
val level: Int = 0,
|
||||||
|
var applyBtnStatus: Int = 0//0=不显示 1=可申请 2=已申请
|
||||||
|
)
|
@@ -0,0 +1,20 @@
|
|||||||
|
package com.chwl.core.association.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HallListInfo {
|
||||||
|
private long hallId;
|
||||||
|
private String hallName;
|
||||||
|
private long clanId;
|
||||||
|
private int roleType;
|
||||||
|
private long ownerUid;
|
||||||
|
private String ownerNick;
|
||||||
|
private String ownerAvatar;
|
||||||
|
private Integer memberCount;
|
||||||
|
private long ownerErbanNo;
|
||||||
|
private Double roomIncome;
|
||||||
|
private int hallBtnStatus;//0=不显示 1=可申请 2=待审核 3通过邀请
|
||||||
|
private int hallRecordId;//通过邀请时的邀请记录id
|
||||||
|
private long hallMessageUid;//联系人id
|
||||||
|
}
|
@@ -0,0 +1,20 @@
|
|||||||
|
package com.chwl.core.association.bean
|
||||||
|
|
||||||
|
import lombok.Data
|
||||||
|
|
||||||
|
@Data
|
||||||
|
data class MemberExchangeInfo(
|
||||||
|
val avatar: String = "",
|
||||||
|
val erbanNo: Int = 0,
|
||||||
|
val exchangeAuthStatus: Int = 0,
|
||||||
|
val gender: Int = 0,
|
||||||
|
val golds: Int = 0,
|
||||||
|
val hallName: String = "",
|
||||||
|
val hallRoleType: Int = 0,
|
||||||
|
val isClanElder: Boolean = false,
|
||||||
|
val manageHall: Boolean = false,
|
||||||
|
val nick: String = "",
|
||||||
|
val roleType: Int = 0,
|
||||||
|
val uid: Long = 0L,
|
||||||
|
val userLevelVo: UserLevelInfo? = null
|
||||||
|
)
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.chwl.core.association.bean
|
||||||
|
|
||||||
|
import lombok.Data
|
||||||
|
|
||||||
|
@Data
|
||||||
|
data class UserLevelInfo(
|
||||||
|
val charmAmount: Int = 0,
|
||||||
|
val charmLevelGrp: String = "",
|
||||||
|
val charmLevelName: String = "",
|
||||||
|
val charmLevelSeq: Int = 0,
|
||||||
|
val charmUrl: String = "",
|
||||||
|
val experAmount: Int = 0,
|
||||||
|
val experLevelGrp: String = "",
|
||||||
|
val experLevelName: String = "",
|
||||||
|
val experLevelSeq: Int = 0,
|
||||||
|
val experUrl: String = ""
|
||||||
|
)
|
@@ -0,0 +1,68 @@
|
|||||||
|
package com.chwl.core.association.model
|
||||||
|
|
||||||
|
import com.chwl.core.association.bean.ClanListInfo
|
||||||
|
import com.chwl.core.association.bean.HallListInfo
|
||||||
|
import com.chwl.core.association.bean.MemberExchangeInfo
|
||||||
|
import com.chwl.core.base.BaseModel
|
||||||
|
import com.chwl.core.bean.response.ServiceResult
|
||||||
|
import com.chwl.core.utils.net.launchRequest
|
||||||
|
import com.chwl.library.net.rxnet.RxNet
|
||||||
|
import retrofit2.http.*
|
||||||
|
|
||||||
|
object AssociationModel : BaseModel() {
|
||||||
|
|
||||||
|
private val api = RxNet.create(Api::class.java)
|
||||||
|
|
||||||
|
suspend fun getClanList(): List<ClanListInfo>? =
|
||||||
|
launchRequest {
|
||||||
|
api.getClanList()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getHallList(): List<HallListInfo>? =
|
||||||
|
launchRequest {
|
||||||
|
api.getHallList()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun getMemberExchangeList(): List<MemberExchangeInfo>? =
|
||||||
|
launchRequest {
|
||||||
|
api.getMemberExchangeList()
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun operateMemberExchange(status: Int, targetUid: Long): String? =
|
||||||
|
launchRequest {
|
||||||
|
api.operateMemberExchange(status, targetUid)
|
||||||
|
}
|
||||||
|
|
||||||
|
private interface Api {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公會周榜
|
||||||
|
*/
|
||||||
|
@GET("/clan/list")
|
||||||
|
suspend fun getClanList(): ServiceResult<List<ClanListInfo>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取牌照房
|
||||||
|
*/
|
||||||
|
@GET("/hall/list")
|
||||||
|
suspend fun getHallList(): ServiceResult<List<HallListInfo>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取家族下的兑换权限管理的成员列表
|
||||||
|
*/
|
||||||
|
@GET("/clan/memberExchangeAuth/list")
|
||||||
|
suspend fun getMemberExchangeList(): ServiceResult<List<MemberExchangeInfo>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改兑换权限管理
|
||||||
|
*/
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST("/clan/memberExchangeAuth/operate")
|
||||||
|
suspend fun operateMemberExchange(
|
||||||
|
@Field("status") status: Int,
|
||||||
|
@Field("targetUid") targetUid: Long
|
||||||
|
): ServiceResult<String>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
159
core/src/main/java/com/chwl/core/audio/AudioModel.java
Normal file
159
core/src/main/java/com/chwl/core/audio/AudioModel.java
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
package com.chwl.core.audio;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.chwl.core.audio.bean.HistoryVoiceInfo;
|
||||||
|
import com.chwl.core.audio.bean.SaveVoiceSuccessResultInfo;
|
||||||
|
import com.chwl.core.audio.bean.UserVoiceInfo;
|
||||||
|
import com.chwl.core.audio.bean.VoiceCardInfo;
|
||||||
|
import com.chwl.core.audio.bean.VoiceMatchInfo;
|
||||||
|
import com.chwl.core.auth.AuthModel;
|
||||||
|
import com.chwl.core.base.BaseModel;
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.core.utils.net.RxHelper;
|
||||||
|
import com.chwl.library.net.rxnet.RxNet;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.Single;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
public class AudioModel extends BaseModel implements IAudioModel {
|
||||||
|
|
||||||
|
private volatile static IAudioModel instance;
|
||||||
|
|
||||||
|
private Api api;
|
||||||
|
|
||||||
|
public static IAudioModel get() {
|
||||||
|
if (instance == null) {
|
||||||
|
synchronized (AudioModel.class) {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new AudioModel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AudioModel() {
|
||||||
|
api = RxNet.create(Api.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<List<UserVoiceInfo>> getMyVoiceInfoList(long uid) {
|
||||||
|
return api.getMyVoiceInfoList(uid)
|
||||||
|
.compose(RxHelper.handleCommon(ArrayList::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<List<VoiceCardInfo>> getVoiceCardInfoList(long uid, Integer type, int pageSize) {
|
||||||
|
return api.getVoiceCardInfoList(uid, type, pageSize)
|
||||||
|
.compose(RxHelper.handleCommon(ArrayList::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<SaveVoiceSuccessResultInfo> saveVoice(long uid, String voiceUrl, int voiceLength,
|
||||||
|
Long voiceId, Long piaId, int type) {
|
||||||
|
return api.saveVoice(uid, voiceUrl, voiceLength, voiceId, piaId, type)
|
||||||
|
.compose(RxHelper.handleCommon(SaveVoiceSuccessResultInfo::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<List<VoiceMatchInfo>> getVoiceMatchList(int gender, int pageSize) {
|
||||||
|
return api.apiVoiceMatchList(AuthModel.get().getCurrentUid(), gender, pageSize)
|
||||||
|
.compose(RxHelper.handleCommon(ArrayList::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<String> likeOrUnlikeVoice(long uid, long voiceId, int type) {
|
||||||
|
return api.likeOrUnlikeVoice(uid, voiceId, type)
|
||||||
|
.compose(RxHelper.handleIgnoreData());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<String> syncHistoryVoice(long uid, long voiceId) {
|
||||||
|
return api.syncHistoryVoice(uid, voiceId)
|
||||||
|
.compose(RxHelper.handleIgnoreData());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<HistoryVoiceInfo> queryHistoryVoice(long uid) {
|
||||||
|
return api.queryHistoryVoice(uid)
|
||||||
|
.compose(RxHelper.handleCommon(HistoryVoiceInfo::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<String> addPlayCount(long uid, Long voiceId, long voiceUid) {
|
||||||
|
return api.addPlayCount(uid, voiceId, voiceUid)
|
||||||
|
.compose(RxHelper.handleIgnoreData());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private interface Api {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的声音列表
|
||||||
|
*/
|
||||||
|
@POST("/voice/my")
|
||||||
|
Single<ServiceResult<List<UserVoiceInfo>>> getMyVoiceInfoList(@Query("uid") long uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取pia剧本
|
||||||
|
*/
|
||||||
|
@GET("/voice/pia/get")
|
||||||
|
Single<ServiceResult<List<VoiceCardInfo>>> getVoiceCardInfoList(@Query("uid") long uid,
|
||||||
|
@Query("type") Integer type,
|
||||||
|
@Query("pageSize") int pageSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存声音
|
||||||
|
*/
|
||||||
|
@POST("/voice/save")
|
||||||
|
Single<ServiceResult<SaveVoiceSuccessResultInfo>> saveVoice(@Query("uid") long uid,
|
||||||
|
@Query("voiceUrl") String voiceUrl,
|
||||||
|
@Query("voiceLength") long voiceLength,
|
||||||
|
@Query("voiceId") Long voiceId,
|
||||||
|
@Query("piaId") Long piaId,
|
||||||
|
@Query("type") int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声音匹配列表
|
||||||
|
*/
|
||||||
|
@POST("/voice/list")
|
||||||
|
Single<ServiceResult<List<VoiceMatchInfo>>> apiVoiceMatchList(@Query("uid") long uid,
|
||||||
|
@Query("gender") int gender,
|
||||||
|
@Query("pageSize") int pageSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 喜欢/不喜欢 声音
|
||||||
|
*/
|
||||||
|
@POST("/voice/like")
|
||||||
|
Single<ServiceResult<JsonElement>> likeOrUnlikeVoice(@Query("uid") long uid,
|
||||||
|
@Query("voiceId") long voiceId,
|
||||||
|
@Query("type") int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步旧版本个人介绍声音到声音瓶子
|
||||||
|
*/
|
||||||
|
@POST("/voice/history/sync")
|
||||||
|
Single<ServiceResult<JsonElement>> syncHistoryVoice(@Query("uid") long uid,
|
||||||
|
@Query("voiceId") long voiceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询旧版本个人介绍声音
|
||||||
|
*/
|
||||||
|
@POST("/voice/history/query")
|
||||||
|
Single<ServiceResult<HistoryVoiceInfo>> queryHistoryVoice(@Query("uid") long uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加播放次数
|
||||||
|
*/
|
||||||
|
@POST("/voice/add/play/count")
|
||||||
|
Single<ServiceResult<JsonElement>> addPlayCount(@Query("uid") long uid,
|
||||||
|
@Query("voiceId") Long voiceId,
|
||||||
|
@Query("voiceUid") long voiceUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,118 @@
|
|||||||
|
package com.chwl.core.audio;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.media.AudioManager;
|
||||||
|
|
||||||
|
import com.netease.nimlib.sdk.media.player.AudioPlayer;
|
||||||
|
import com.netease.nimlib.sdk.media.player.OnPlayListener;
|
||||||
|
import com.netease.nimlib.sdk.media.record.AudioRecorder;
|
||||||
|
import com.netease.nimlib.sdk.media.record.IAudioRecordCallback;
|
||||||
|
import com.netease.nimlib.sdk.media.record.RecordType;
|
||||||
|
import com.chwl.library.utils.config.BasicConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhouxiangfeng
|
||||||
|
* @date 2017/5/20
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AudioPlayAndRecordManager {
|
||||||
|
|
||||||
|
private static AudioPlayAndRecordManager audioPlayManager;
|
||||||
|
private AudioPlayer player;
|
||||||
|
private AudioRecorder recorder;
|
||||||
|
private IAudioRecordCallback mCallback;
|
||||||
|
|
||||||
|
private AudioPlayAndRecordManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static AudioPlayAndRecordManager getInstance() {
|
||||||
|
if (audioPlayManager == null)
|
||||||
|
audioPlayManager = new AudioPlayAndRecordManager();
|
||||||
|
return audioPlayManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AudioPlayer getAudioPlayer(String filePath, OnPlayListener listener) {
|
||||||
|
// 构造播放器对象
|
||||||
|
player = new AudioPlayer(BasicConfig.INSTANCE.getAppContext(), filePath, listener);
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void play() {
|
||||||
|
// 开始播放。需要传入一个 Stream Type 参数,表示是用听筒播放还是扬声器。取值可参见
|
||||||
|
// android.media.AudioManager#STREAM_***
|
||||||
|
// AudioManager.STREAM_VOICE_CALL 表示使用听筒模式
|
||||||
|
// AudioManager.STREAM_MUSIC 表示使用扬声器模式
|
||||||
|
player.start(AudioManager.STREAM_MUSIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void seekTo(int pausedPostion) {
|
||||||
|
// 如果中途切换播放设备,重新调用 start,传入指定的 streamType 即可。player 会自动停止播放,然后再以新的 streamType 重新开始播放。
|
||||||
|
// 如果需要从中断的地方继续播放,需要外面自己记住已经播放过的位置,然后在 onPrepared 回调中调用 seekTo
|
||||||
|
player.seekTo(pausedPostion);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopPlay() {
|
||||||
|
// 主动停止播放
|
||||||
|
player.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public AudioRecorder getAudioRecorder(Context context, IAudioRecordCallback callback) {
|
||||||
|
// 初始化recorder
|
||||||
|
recorder = new AudioRecorder(
|
||||||
|
BasicConfig.INSTANCE.getAppContext(),
|
||||||
|
// 录制音频类型(aac/amr)
|
||||||
|
RecordType.AAC,
|
||||||
|
// 最长录音时长,到该长度后,会自动停止录音, 默认120s
|
||||||
|
0,
|
||||||
|
callback);
|
||||||
|
mCallback = callback;
|
||||||
|
return recorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPlaying() {
|
||||||
|
return player != null && player.isPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startRecord() {
|
||||||
|
|
||||||
|
if (null != recorder) {
|
||||||
|
if (recorder.isRecording()) {
|
||||||
|
recorder.completeRecord(true);
|
||||||
|
recorder.destroyAudioRecorder();
|
||||||
|
}
|
||||||
|
recorder.startRecord();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopRecord(boolean cancel) {
|
||||||
|
if (null != recorder && recorder.isRecording()) {
|
||||||
|
recorder.completeRecord(cancel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 释放资源 */
|
||||||
|
public void release() {
|
||||||
|
if (isPlaying())
|
||||||
|
stopPlay();
|
||||||
|
stopRecord(true);
|
||||||
|
mCallback = null;
|
||||||
|
recorder = null;
|
||||||
|
if(player != null) {
|
||||||
|
player.setOnPlayListener(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// play每个页面都会新建对象,此方法可用于设置当前页面的player对象
|
||||||
|
public void setPlayer(AudioPlayer player) {
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
// play每个页面都会新建对象,此方法可用于判断对象是被覆盖
|
||||||
|
public AudioPlayer getPlayer() {
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
}
|
87
core/src/main/java/com/chwl/core/audio/IAudioModel.java
Normal file
87
core/src/main/java/com/chwl/core/audio/IAudioModel.java
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
package com.chwl.core.audio;
|
||||||
|
|
||||||
|
import com.chwl.core.audio.bean.HistoryVoiceInfo;
|
||||||
|
import com.chwl.core.audio.bean.SaveVoiceSuccessResultInfo;
|
||||||
|
import com.chwl.core.audio.bean.UserVoiceInfo;
|
||||||
|
import com.chwl.core.audio.bean.VoiceCardInfo;
|
||||||
|
import com.chwl.core.audio.bean.VoiceMatchInfo;
|
||||||
|
import com.chwl.core.base.IModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.Single;
|
||||||
|
|
||||||
|
public interface IAudioModel extends IModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的声音列表
|
||||||
|
*
|
||||||
|
* @param uid 用户Uid
|
||||||
|
*/
|
||||||
|
Single<List<UserVoiceInfo>> getMyVoiceInfoList(long uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 随机获取pia剧本(声音卡片)
|
||||||
|
*
|
||||||
|
* @param uid 用户Uid
|
||||||
|
* @param type 1.歌词 2.情话 (不传则全部)
|
||||||
|
* @param pageSize 一页大小(默认10)
|
||||||
|
*/
|
||||||
|
Single<List<VoiceCardInfo>> getVoiceCardInfoList(long uid, Integer type, int pageSize);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存声音
|
||||||
|
*
|
||||||
|
* @param uid 用户Uid
|
||||||
|
* @param voiceUrl 声音链接
|
||||||
|
* @param voiceLength 声音时长
|
||||||
|
* @param voiceId [声音id]
|
||||||
|
* @param piaId [pia剧本id]
|
||||||
|
* @param type 声音类型: 0=pia戏
|
||||||
|
*/
|
||||||
|
Single<SaveVoiceSuccessResultInfo> saveVoice(long uid, String voiceUrl, int voiceLength,
|
||||||
|
Long voiceId, Long piaId, int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声音匹配列表
|
||||||
|
*
|
||||||
|
* @param gender 性别
|
||||||
|
*/
|
||||||
|
Single<List<VoiceMatchInfo>> getVoiceMatchList(int gender, int pageSize);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 喜欢/不喜欢 声音
|
||||||
|
*
|
||||||
|
* @param uid 听者Uid
|
||||||
|
* @param voiceId 声音id
|
||||||
|
* @param type 0.不喜欢 1.喜欢
|
||||||
|
*/
|
||||||
|
Single<String> likeOrUnlikeVoice(long uid, long voiceId, int type);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步旧版本个人介绍声音到声音瓶子
|
||||||
|
*
|
||||||
|
* @param uid 用户Uid
|
||||||
|
* @param voiceId 声音id
|
||||||
|
*/
|
||||||
|
Single<String> syncHistoryVoice(long uid, long voiceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询旧版本个人介绍声音
|
||||||
|
*
|
||||||
|
* @param uid 用户Uid
|
||||||
|
*/
|
||||||
|
Single<HistoryVoiceInfo> queryHistoryVoice(long uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 增加播放次数
|
||||||
|
*
|
||||||
|
* @param uid 听者Uid
|
||||||
|
* @param voiceId 声音id(不传时为voiceUid对应的默认声音)
|
||||||
|
* @param voiceUid 声音所属用户Uid
|
||||||
|
*/
|
||||||
|
Single<String> addPlayCount(long uid, Long voiceId, long voiceUid);
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,137 @@
|
|||||||
|
package com.chwl.core.audio.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询旧版本个人介绍声音
|
||||||
|
*/
|
||||||
|
public class HistoryVoiceInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* historyVoice : {"id":14,"uid":900005,"defFlag":true,"status":2,"playCount":0,"likeCount":0,"gender":1,"voiceUrl":"https://image.zhongjialx.com/40531ccb-70f8-4981-9b47-281626c4d0621.aac?imageslim","voiceLength":3,"piaId":1}
|
||||||
|
* hasVoice : true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private HistoryVoiceBean historyVoice;// 如存在旧版本个人介绍声音则historyVoice不为空,不存在则为空
|
||||||
|
private boolean hasVoice;// 是否已录制声音,包括待审核、审核通过(true.有,false 没有)
|
||||||
|
|
||||||
|
public HistoryVoiceBean getHistoryVoice() {
|
||||||
|
return historyVoice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHistoryVoice(HistoryVoiceBean historyVoice) {
|
||||||
|
this.historyVoice = historyVoice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHasVoice() {
|
||||||
|
return hasVoice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasVoice(boolean hasVoice) {
|
||||||
|
this.hasVoice = hasVoice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class HistoryVoiceBean {
|
||||||
|
/**
|
||||||
|
* id : 14
|
||||||
|
* uid : 900005
|
||||||
|
* defFlag : true
|
||||||
|
* status : 2
|
||||||
|
* playCount : 0
|
||||||
|
* likeCount : 0
|
||||||
|
* gender : 1
|
||||||
|
* voiceUrl : https://image.zhongjialx.com/40531ccb-70f8-4981-9b47-281626c4d0621.aac?imageslim
|
||||||
|
* voiceLength : 3
|
||||||
|
* piaId : 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
private long id;// 声音id
|
||||||
|
private long uid;// 声音所属用户uid
|
||||||
|
private boolean defFlag;// 是否默认声音
|
||||||
|
private int status;// 0,待审核 1 审核通过 2.无提交审核
|
||||||
|
private int playCount;// 播放次数
|
||||||
|
private int likeCount;// 喜欢次数
|
||||||
|
private int gender;// 性别(1.男,2.女)
|
||||||
|
private String voiceUrl;// 声音链接
|
||||||
|
private int voiceLength;// 声音时长
|
||||||
|
private long piaId;// pia剧本id
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(long uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefFlag() {
|
||||||
|
return defFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefFlag(boolean defFlag) {
|
||||||
|
this.defFlag = defFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlayCount() {
|
||||||
|
return playCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayCount(int playCount) {
|
||||||
|
this.playCount = playCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLikeCount() {
|
||||||
|
return likeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLikeCount(int likeCount) {
|
||||||
|
this.likeCount = likeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(int gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVoiceUrl() {
|
||||||
|
return voiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoiceUrl(String voiceUrl) {
|
||||||
|
this.voiceUrl = voiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVoiceLength() {
|
||||||
|
return voiceLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoiceLength(int voiceLength) {
|
||||||
|
this.voiceLength = voiceLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getPiaId() {
|
||||||
|
return piaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPiaId(long piaId) {
|
||||||
|
this.piaId = piaId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,110 @@
|
|||||||
|
package com.chwl.core.audio.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存声音成功时 接口返回的声音信息
|
||||||
|
*/
|
||||||
|
public class SaveVoiceSuccessResultInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id : 42
|
||||||
|
* uid : 902385
|
||||||
|
* defFlag : true
|
||||||
|
* status : 1
|
||||||
|
* likeCount : 0
|
||||||
|
* gender : 2
|
||||||
|
* voiceUrl : https://nim.nosdn.127.net/NTMwMjgzNA==/bmltYV81ODcxNTc1MjI2XzE1NTUzOTY0MzU0NzlfODdiNjhjMjItNWU4ZS00NTI3LWIxMzItNzhmNjU4ODZjMWRi
|
||||||
|
* voiceLength : 4
|
||||||
|
* piaId : 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
private long id; // 声音id
|
||||||
|
private long uid; // 声音所属用户uid
|
||||||
|
private boolean defFlag; // 是否默认声音
|
||||||
|
private int status; // 0,待审核 1 审核通过 2.无提交审核
|
||||||
|
private int likeCount; // 喜欢次数
|
||||||
|
private int gender; // 性别(1.男,2.女)
|
||||||
|
private String voiceUrl; // 声音地址
|
||||||
|
private int voiceLength; // 声音时长
|
||||||
|
private long piaId; // Pia剧本Id
|
||||||
|
private int playCount; // 播放次数
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(long uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefFlag() {
|
||||||
|
return defFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefFlag(boolean defFlag) {
|
||||||
|
this.defFlag = defFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLikeCount() {
|
||||||
|
return likeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLikeCount(int likeCount) {
|
||||||
|
this.likeCount = likeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(int gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVoiceUrl() {
|
||||||
|
return voiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoiceUrl(String voiceUrl) {
|
||||||
|
this.voiceUrl = voiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVoiceLength() {
|
||||||
|
return voiceLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoiceLength(int voiceLength) {
|
||||||
|
this.voiceLength = voiceLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getPiaId() {
|
||||||
|
return piaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPiaId(long piaId) {
|
||||||
|
this.piaId = piaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlayCount() {
|
||||||
|
return playCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayCount(int playCount) {
|
||||||
|
this.playCount = playCount;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.chwl.core.audio.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SysMsgVoiceInfo implements Serializable {
|
||||||
|
public int status;// 状态:1 审核通过 4 审核不通过
|
||||||
|
public String reason;// 原因
|
||||||
|
public int routerType;
|
||||||
|
public String routerValue;
|
||||||
|
}
|
109
core/src/main/java/com/chwl/core/audio/bean/UserVoiceInfo.java
Normal file
109
core/src/main/java/com/chwl/core/audio/bean/UserVoiceInfo.java
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
package com.chwl.core.audio.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的声音列表
|
||||||
|
*/
|
||||||
|
public class UserVoiceInfo {
|
||||||
|
/**
|
||||||
|
* id : 42
|
||||||
|
* uid : 902385
|
||||||
|
* defFlag : true
|
||||||
|
* status : 1
|
||||||
|
* likeCount : 0
|
||||||
|
* gender : 2
|
||||||
|
* voiceUrl : https://nim.nosdn.127.net/NTMwMjgzNA==/bmltYV81ODcxNTc1MjI2XzE1NTUzOTY0MzU0NzlfODdiNjhjMjItNWU4ZS00NTI3LWIxMzItNzhmNjU4ODZjMWRi
|
||||||
|
* voiceLength : 4
|
||||||
|
* piaId : 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
private long id;// 声音id
|
||||||
|
private long uid;// 声音所属用户uid
|
||||||
|
private boolean defFlag;// 是否默认声音
|
||||||
|
private int status;// 0,待审核 1 审核通过 2.无提交审核
|
||||||
|
private int likeCount;// 喜欢次数
|
||||||
|
private int gender;// 性别(1.男,2.女)
|
||||||
|
private String voiceUrl;// 声音地址
|
||||||
|
private int voiceLength;// 声音时长
|
||||||
|
private long piaId;// Pia剧本Id
|
||||||
|
private int playCount;// 播放次数
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(long uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefFlag() {
|
||||||
|
return defFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefFlag(boolean defFlag) {
|
||||||
|
this.defFlag = defFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLikeCount() {
|
||||||
|
return likeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLikeCount(int likeCount) {
|
||||||
|
this.likeCount = likeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(int gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVoiceUrl() {
|
||||||
|
return voiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoiceUrl(String voiceUrl) {
|
||||||
|
this.voiceUrl = voiceUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVoiceLength() {
|
||||||
|
return voiceLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoiceLength(int voiceLength) {
|
||||||
|
this.voiceLength = voiceLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getPiaId() {
|
||||||
|
return piaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPiaId(long piaId) {
|
||||||
|
this.piaId = piaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPlayCount() {
|
||||||
|
return playCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayCount(int playCount) {
|
||||||
|
this.playCount = playCount;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
package com.chwl.core.audio.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class VoiceBottleSayHiInfo implements Serializable {
|
||||||
|
private String voiceUid;
|
||||||
|
private String message;
|
||||||
|
}
|
@@ -0,0 +1,54 @@
|
|||||||
|
package com.chwl.core.audio.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声音卡片的信息
|
||||||
|
*/
|
||||||
|
public class VoiceCardInfo {
|
||||||
|
|
||||||
|
private long id;// pia剧本id
|
||||||
|
private int type;// 类型 :1.歌词 2.情话
|
||||||
|
private int gender;// 0.不限 1.男 2.女
|
||||||
|
private String playBook;// 剧本内部
|
||||||
|
private String title;// 剧本标题
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(int gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlayBook() {
|
||||||
|
return playBook.replace("\\n", "\n")
|
||||||
|
.replace("\\r","\r");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlayBook(String playBook) {
|
||||||
|
this.playBook = playBook;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
package com.chwl.core.audio.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create by lvzebiao @2019/6/10
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class VoiceMatchInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id : 42
|
||||||
|
* uid : 902385
|
||||||
|
* defFlag : true
|
||||||
|
* status : 1
|
||||||
|
* likeCount : 0
|
||||||
|
* gender : 2
|
||||||
|
* voiceUrl : https://nim.nosdn.127.net/NTMwMjgzNA==/bmltYV81ODcxNTc1MjI2XzE1NTUzOTY0MzU0NzlfODdiNjhjMjItNWU4ZS00NTI3LWIxMzItNzhmNjU4ODZjMWRi
|
||||||
|
* voiceLength : 4
|
||||||
|
* piaId : 1
|
||||||
|
* nick : 二娃
|
||||||
|
* birth : 631123200000
|
||||||
|
* avatar : https://image.zhongjialx.com/picture_1557127983672.jpg?imageslim
|
||||||
|
* location : 广州市
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private int uid;
|
||||||
|
private boolean defFlag;
|
||||||
|
private int status;
|
||||||
|
private int likeCount;
|
||||||
|
private int gender;
|
||||||
|
private String voiceUrl;
|
||||||
|
private int voiceLength;
|
||||||
|
private int piaId;
|
||||||
|
private String nick;
|
||||||
|
private long birth;
|
||||||
|
private String avatar;
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
package com.chwl.core.audio.event;
|
||||||
|
|
||||||
|
public class VoiceShakeHeartEvent {
|
||||||
|
public String showTextHint;
|
||||||
|
|
||||||
|
public VoiceShakeHeartEvent(String showTextHint) {
|
||||||
|
this.showTextHint = showTextHint;
|
||||||
|
}
|
||||||
|
}
|
1334
core/src/main/java/com/chwl/core/auth/AuthModel.java
Normal file
1334
core/src/main/java/com/chwl/core/auth/AuthModel.java
Normal file
File diff suppressed because it is too large
Load Diff
154
core/src/main/java/com/chwl/core/auth/IAuthModel.java
Normal file
154
core/src/main/java/com/chwl/core/auth/IAuthModel.java
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
package com.chwl.core.auth;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
import com.chwl.core.auth.entity.ThirdUserInfo;
|
||||||
|
import com.chwl.core.base.IModel;
|
||||||
|
import com.example.module_base.support.login.ILoginService;
|
||||||
|
|
||||||
|
import io.reactivex.Single;
|
||||||
|
|
||||||
|
public interface IAuthModel extends IModel {
|
||||||
|
|
||||||
|
ILoginService getGoogleLoginService();
|
||||||
|
|
||||||
|
ThirdUserInfo getThirdUserInfo();
|
||||||
|
|
||||||
|
void setThirdUserInfo(ThirdUserInfo thirdUserInfo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前登录的uid,登录成功后就有值了
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
long getCurrentUid();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取ticket,登录成功后就有真实值
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getTicket();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否已登录
|
||||||
|
*/
|
||||||
|
boolean isLogin();
|
||||||
|
boolean isMy(long uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动登录
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> autoLogin();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号密码登录
|
||||||
|
*
|
||||||
|
* @param account
|
||||||
|
* @param password
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> login(String account,String email, String password, String yiDunToken, String shuMeiDeviceId,String type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带验证码的账号密码登录
|
||||||
|
*
|
||||||
|
* @param account
|
||||||
|
* @param password
|
||||||
|
* @param code 验证码
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> login(String phoneAreaCode, String account,String email, String password, String code, String yiDunToken, String shuMeiDeviceId,String type);
|
||||||
|
|
||||||
|
Single<String> googleLogin(Activity activity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置用户信息
|
||||||
|
*/
|
||||||
|
void reset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码
|
||||||
|
*
|
||||||
|
* @param phone
|
||||||
|
* @param sms_code
|
||||||
|
* @param newPsw
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> requestResetPsw(String phoneAreaCode, String phone, String sms_code, String newPsw);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置密码 - 邮箱
|
||||||
|
* @param email
|
||||||
|
* @param code
|
||||||
|
* @param newPsw
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> requestResetPswByEmail(String email, String code, String newPsw);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前用户是否绑定手机
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> isBindPhone();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定手机
|
||||||
|
*
|
||||||
|
* @param phone
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> bindPhone(String phoneAreaCode, String phone, String code);
|
||||||
|
Single<String> bindEmail(java.lang.String email, java.lang.String code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册
|
||||||
|
*
|
||||||
|
* @param phone
|
||||||
|
* @param sms_code
|
||||||
|
* @param password
|
||||||
|
* @param yiDunToken 易盾的 token
|
||||||
|
* @param shuMeiDeviceId 数美天网的 deviceId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> register(String phone, String sms_code, String verifyCode, String password,
|
||||||
|
String yiDunToken, String shuMeiDeviceId);
|
||||||
|
|
||||||
|
Single<String> logout();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改登录密码
|
||||||
|
*
|
||||||
|
* @param phone
|
||||||
|
* @param oldPwd
|
||||||
|
* @param newPwd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> modifyLoginPwd(String phone,
|
||||||
|
String oldPwd,
|
||||||
|
String newPwd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置登录密码,在第三方登录的情况下是没有登录密码的,这里接口可以设置登录密码,账号为耳伴号
|
||||||
|
*
|
||||||
|
* @param phone
|
||||||
|
* @param newPwd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Single<String> setLoginPwd(String phone,
|
||||||
|
String newPwd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断IM 登录状态
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isImLogin();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
package com.chwl.core.auth.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 17/3/5.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AccountInfo implements Serializable{
|
||||||
|
private long uid;
|
||||||
|
private String access_token;
|
||||||
|
private String netEaseToken;
|
||||||
|
private String token_type;
|
||||||
|
private String refresh_token;
|
||||||
|
private String expires_in;
|
||||||
|
private String scope;
|
||||||
|
private String jti;
|
||||||
|
|
||||||
|
public long getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(long uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNetEaseToken() {
|
||||||
|
return netEaseToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNetEaseToken(String netEaseToken) {
|
||||||
|
this.netEaseToken = netEaseToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccess_token() {
|
||||||
|
return access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccess_token(String access_token) {
|
||||||
|
this.access_token = access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getToken_type() {
|
||||||
|
return token_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setToken_type(String token_type) {
|
||||||
|
this.token_type = token_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefresh_token() {
|
||||||
|
return refresh_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefresh_token(String refresh_token) {
|
||||||
|
this.refresh_token = refresh_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExpires_in() {
|
||||||
|
return expires_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpires_in(String expires_in) {
|
||||||
|
this.expires_in = expires_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScope(String scope) {
|
||||||
|
this.scope = scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJti() {
|
||||||
|
return jti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJti(String jti) {
|
||||||
|
this.jti = jti;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,68 @@
|
|||||||
|
package com.chwl.core.auth.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Administrator on 2017/8/4.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ThirdUserInfo implements Serializable {
|
||||||
|
private String userName;
|
||||||
|
private String userIcon;
|
||||||
|
private String userGender;
|
||||||
|
private String platform;
|
||||||
|
private long birth;
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
public static final int TYPE_FACEBOOK = 1;
|
||||||
|
public static final int TYPE_LINE = 2;
|
||||||
|
public static final int TYPE_GOOGLE = 3;
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserIcon() {
|
||||||
|
return userIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserIcon(String userIcon) {
|
||||||
|
this.userIcon = userIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserGender() {
|
||||||
|
return userGender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserGender(String userGender) {
|
||||||
|
this.userGender = userGender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getBirth() {
|
||||||
|
return birth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirth(long birth) {
|
||||||
|
this.birth = birth;
|
||||||
|
}
|
||||||
|
}
|
50
core/src/main/java/com/chwl/core/auth/entity/TicketInfo.java
Normal file
50
core/src/main/java/com/chwl/core/auth/entity/TicketInfo.java
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package com.chwl.core.auth.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/4.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class TicketInfo implements Serializable{
|
||||||
|
private String issue_type;
|
||||||
|
private List<Ticket> tickets;
|
||||||
|
|
||||||
|
public String getIssue_type() {
|
||||||
|
return issue_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIssue_type(String issue_type) {
|
||||||
|
this.issue_type = issue_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Ticket> getTickets() {
|
||||||
|
return tickets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTickets(List<Ticket> tickets) {
|
||||||
|
this.tickets = tickets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Ticket implements Serializable{
|
||||||
|
private String ticket;
|
||||||
|
private String expires_in;
|
||||||
|
|
||||||
|
public String getTicket() {
|
||||||
|
return ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTicket(String ticket) {
|
||||||
|
this.ticket = ticket;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExpires_in() {
|
||||||
|
return expires_in;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExpires_in(String expires_in) {
|
||||||
|
this.expires_in = expires_in;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
package com.chwl.core.auth.event;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录成功事件
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BindPhoneEvent {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,14 @@
|
|||||||
|
package com.chwl.core.auth.event;
|
||||||
|
|
||||||
|
import com.chwl.core.base.BaseDataEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Created by lvzebiao on 2018/10/15.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class GetCurrentUidEvent extends BaseDataEvent<Boolean> {
|
||||||
|
public GetCurrentUidEvent(Boolean data) {
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
package com.chwl.core.auth.event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 踢出事件
|
||||||
|
*/
|
||||||
|
public class KickOutEvent {
|
||||||
|
}
|
11
core/src/main/java/com/chwl/core/auth/event/LoginEvent.java
Normal file
11
core/src/main/java/com/chwl/core/auth/event/LoginEvent.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.chwl.core.auth.event;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录成功事件
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LoginEvent {
|
||||||
|
private long uid;
|
||||||
|
}
|
@@ -0,0 +1,15 @@
|
|||||||
|
package com.chwl.core.auth.event;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 三方登录上报事件
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LoginReportEvent {
|
||||||
|
private int loginType;
|
||||||
|
|
||||||
|
public LoginReportEvent(int loginType) {
|
||||||
|
this.loginType = loginType;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
package com.chwl.core.auth.event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登录事件
|
||||||
|
*/
|
||||||
|
public class LogoutEvent {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,21 @@
|
|||||||
|
package com.chwl.core.auth.exception;
|
||||||
|
|
||||||
|
public class AccountCancelException extends Exception {
|
||||||
|
|
||||||
|
private long cancelDate;
|
||||||
|
private long erbanNo;
|
||||||
|
|
||||||
|
public AccountCancelException(String message, long erbanNo, long cancelDate) {
|
||||||
|
super(message);
|
||||||
|
this.erbanNo = erbanNo;
|
||||||
|
this.cancelDate = cancelDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getCancelDate() {
|
||||||
|
return cancelDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getErbanNo() {
|
||||||
|
return erbanNo;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,15 @@
|
|||||||
|
package com.chwl.core.auth.exception;
|
||||||
|
|
||||||
|
public class BanAccountException extends Exception {
|
||||||
|
|
||||||
|
private long date;
|
||||||
|
|
||||||
|
public BanAccountException(String message, long date) {
|
||||||
|
super(message);
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
package com.chwl.core.auth.exception;
|
||||||
|
|
||||||
|
public class BigHeadPhoneException extends Exception {
|
||||||
|
|
||||||
|
public BigHeadPhoneException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
package com.chwl.core.auth.exception;
|
||||||
|
|
||||||
|
public class IsSuperAdminException extends Exception {
|
||||||
|
|
||||||
|
public IsSuperAdminException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
16
core/src/main/java/com/chwl/core/base/BaseBusEvent.java
Normal file
16
core/src/main/java/com/chwl/core/base/BaseBusEvent.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.chwl.core.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create by lvzebiao on 2018/8/29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BaseBusEvent<T> {
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public BaseBusEvent(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
27
core/src/main/java/com/chwl/core/base/BaseDataEvent.java
Normal file
27
core/src/main/java/com/chwl/core/base/BaseDataEvent.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.chwl.core.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create by lvzebiao on 2018/9/5
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BaseDataEvent<T> {
|
||||||
|
|
||||||
|
private boolean failed;
|
||||||
|
|
||||||
|
private String error;
|
||||||
|
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public BaseDataEvent(T data) {
|
||||||
|
this.data = data;
|
||||||
|
failed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseDataEvent(String error) {
|
||||||
|
this.error = error;
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
20
core/src/main/java/com/chwl/core/base/BaseErrorEvent.java
Normal file
20
core/src/main/java/com/chwl/core/base/BaseErrorEvent.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package com.chwl.core.base;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class BaseErrorEvent {
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String error;
|
||||||
|
|
||||||
|
public BaseErrorEvent setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseErrorEvent setError(String error) {
|
||||||
|
this.error = error;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,12 @@
|
|||||||
|
package com.chwl.core.base;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create by lvzebiao @2019/8/7
|
||||||
|
*/
|
||||||
|
public class BaseErrorException extends Exception {
|
||||||
|
|
||||||
|
public BaseErrorException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
131
core/src/main/java/com/chwl/core/base/BaseModel.java
Normal file
131
core/src/main/java/com/chwl/core/base/BaseModel.java
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
package com.chwl.core.base;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.chwl.core.R;
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.library.net.rxnet.callback.CallBack;
|
||||||
|
import com.chwl.library.net.rxnet.exception.ExceptionHandle;
|
||||||
|
import com.chwl.library.utils.ResUtil;
|
||||||
|
import com.chwl.library.utils.config.BasicConfig;
|
||||||
|
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableSource;
|
||||||
|
import io.reactivex.Single;
|
||||||
|
import io.reactivex.SingleSource;
|
||||||
|
import io.reactivex.SingleTransformer;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.functions.Function;
|
||||||
|
import io.reactivex.observers.DisposableObserver;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
|
public abstract class BaseModel implements IModel {
|
||||||
|
|
||||||
|
public BaseModel() {
|
||||||
|
// 确保有默认构造函数
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Context getContext() {
|
||||||
|
return BasicConfig.INSTANCE.getAppContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public <T> void execute(Observable<? extends ServiceResult<T>> observable, final CallBack<T> callBack) {
|
||||||
|
observable.subscribe(new DisposableObserver<ServiceResult<T>>() {
|
||||||
|
@Override
|
||||||
|
public void onNext(ServiceResult<T> tServiceResult) {
|
||||||
|
if (tServiceResult != null) {
|
||||||
|
if (tServiceResult.isSuccess()) {
|
||||||
|
if (callBack != null) {
|
||||||
|
callBack.onSuccess(tServiceResult.getData());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (callBack != null) {
|
||||||
|
callBack.onFail(-1, tServiceResult.getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (callBack != null) {
|
||||||
|
callBack.onFail(-1, ResUtil.getString(R.string.xchat_android_core_base_basemodel_01));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
if (callBack != null) {
|
||||||
|
String error = ExceptionHandle.Companion.handleException(e);
|
||||||
|
callBack.onFail(-1, error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> void execute(Single<? extends ServiceResult<T>> single, final CallBack<T> callBack) {
|
||||||
|
execute(single.toObservable(), callBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> Function<ServiceResult<T>, ObservableSource<T>> getFunction() {
|
||||||
|
return roomInfoServiceResult -> {
|
||||||
|
if (roomInfoServiceResult == null)
|
||||||
|
return Observable.error(new Throwable("roomInfoServiceResult == null"));
|
||||||
|
if (roomInfoServiceResult.isSuccess())
|
||||||
|
Observable.just(roomInfoServiceResult.getData());
|
||||||
|
return Observable.error(new Throwable(
|
||||||
|
roomInfoServiceResult.getCode() + "-" + roomInfoServiceResult.getErrorMessage()));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> Function<Throwable, ObservableSource<? extends ServiceResult<T>>> getCommonExceptionFunction() {
|
||||||
|
return throwable -> {
|
||||||
|
ServiceResult<String> errorResult = new ServiceResult<>();
|
||||||
|
if (throwable instanceof UnknownHostException) {
|
||||||
|
errorResult.setCode(ServiceResult.NOT_NET);
|
||||||
|
} else {
|
||||||
|
errorResult.setCode(ServiceResult.OTHER);
|
||||||
|
}
|
||||||
|
return Observable.error(new Throwable(errorResult.getErrorMessage()));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected <T> Function<ServiceResult<T>, SingleSource<T>> getSingleFunction() {
|
||||||
|
return roomInfoServiceResult -> {
|
||||||
|
if (roomInfoServiceResult == null)
|
||||||
|
return Single.error(new Throwable("roomInfoServiceResult == null"));
|
||||||
|
if (roomInfoServiceResult.isSuccess())
|
||||||
|
return Single.just(roomInfoServiceResult.getData());
|
||||||
|
return Single.error(new Throwable(roomInfoServiceResult.getErrorMessage()));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected <T> Function<Throwable, SingleSource<? extends ServiceResult<T>>> getSingleCommonExceptionFunction() {
|
||||||
|
return throwable -> {
|
||||||
|
ServiceResult<String> errorResult = new ServiceResult<>();
|
||||||
|
if (throwable instanceof UnknownHostException) {
|
||||||
|
errorResult.setCode(ServiceResult.NOT_NET);
|
||||||
|
} else {
|
||||||
|
errorResult.setCode(ServiceResult.OTHER);
|
||||||
|
}
|
||||||
|
return Single.error(new Throwable(errorResult.getErrorMessage()));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Transformer<T> implements SingleTransformer<T, T> {
|
||||||
|
@Override
|
||||||
|
public SingleSource<T> apply(Single<T> upstream) {
|
||||||
|
return upstream.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.chwl.core.base;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击取消按钮,但是不需要toast error的情况
|
||||||
|
* create by lvzebiao @2019/9/3
|
||||||
|
*/
|
||||||
|
public class CancelNoToastException extends Throwable {
|
||||||
|
|
||||||
|
public CancelNoToastException() {
|
||||||
|
super("cancel");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
4
core/src/main/java/com/chwl/core/base/IModel.java
Normal file
4
core/src/main/java/com/chwl/core/base/IModel.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package com.chwl.core.base;
|
||||||
|
|
||||||
|
public interface IModel {
|
||||||
|
}
|
74
core/src/main/java/com/chwl/core/bean/BaseProtocol.java
Normal file
74
core/src/main/java/com/chwl/core/bean/BaseProtocol.java
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 广播通用协议
|
||||||
|
* Created by MadisonRong on 09/04/2018.
|
||||||
|
*/
|
||||||
|
public class BaseProtocol<T> {
|
||||||
|
|
||||||
|
protected int first;
|
||||||
|
protected int second;
|
||||||
|
protected T data;
|
||||||
|
|
||||||
|
public BaseProtocol() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseProtocol(int first, int second, T data) {
|
||||||
|
this.first = first;
|
||||||
|
this.second = second;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFirst() {
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirst(int first) {
|
||||||
|
this.first = first;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSecond() {
|
||||||
|
return second;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecond(int second) {
|
||||||
|
this.second = second;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (!(o instanceof BaseProtocol)) return false;
|
||||||
|
|
||||||
|
BaseProtocol that = (BaseProtocol) o;
|
||||||
|
|
||||||
|
if (getFirst() != that.getFirst()) return false;
|
||||||
|
if (getSecond() != that.getSecond()) return false;
|
||||||
|
return getData() != null ? getData().equals(that.getData()) : that.getData() == null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = getFirst();
|
||||||
|
result = 31 * result + getSecond();
|
||||||
|
result = 31 * result + (getData() != null ? getData().hashCode() : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BaseProtocol{" +
|
||||||
|
"first=" + first +
|
||||||
|
", second=" + second +
|
||||||
|
", data='" + data + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
10
core/src/main/java/com/chwl/core/bean/CarButtonInfo.java
Normal file
10
core/src/main/java/com/chwl/core/bean/CarButtonInfo.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CarButtonInfo implements Serializable {
|
||||||
|
private String context;
|
||||||
|
}
|
4
core/src/main/java/com/chwl/core/bean/EventMyBean.java
Normal file
4
core/src/main/java/com/chwl/core/bean/EventMyBean.java
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
public class EventMyBean {
|
||||||
|
}
|
54
core/src/main/java/com/chwl/core/bean/EventOfficialBean.java
Normal file
54
core/src/main/java/com/chwl/core/bean/EventOfficialBean.java
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
public class EventOfficialBean {
|
||||||
|
|
||||||
|
public long id; //活动id
|
||||||
|
public long uid;
|
||||||
|
public long roomUid;
|
||||||
|
public String avatar;
|
||||||
|
public String roomAvatar;
|
||||||
|
public String nick;
|
||||||
|
public int erbanNo;
|
||||||
|
public int gender; //性别
|
||||||
|
public int subNum; //订阅数
|
||||||
|
public boolean subStatus; //订阅原状态
|
||||||
|
public int eventStatus; // 0-待审核,1-审核通过,2-拒绝,3-删除,4-过期
|
||||||
|
public int liveStatus; // 1未开始,2进行中,3-已结束
|
||||||
|
public String eventTopic; //标题
|
||||||
|
public String eventBanner; //底图
|
||||||
|
public String eventStartTimeStr; //大于24小时 显示这个
|
||||||
|
public long offectTimes; //当前时间距离活动开始时间还剩多少 毫秒 , 小于24小时 显示这个 为负数时不处理
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public int btnStatus = -1; // 按钮状态,点击事件用
|
||||||
|
|
||||||
|
public boolean isEventReady() {
|
||||||
|
return eventStatus == 1 && liveStatus == 1;
|
||||||
|
}
|
||||||
|
public boolean isEventStart() {
|
||||||
|
return eventStatus == 1 && liveStatus == 2;
|
||||||
|
}
|
||||||
|
public boolean isEventEnd() {
|
||||||
|
return eventStatus == 1 && liveStatus == 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isReview() {
|
||||||
|
return eventStatus == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUnderReview() {
|
||||||
|
return eventStatus == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
8
core/src/main/java/com/chwl/core/bean/EventRoomBean.java
Normal file
8
core/src/main/java/com/chwl/core/bean/EventRoomBean.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
public class EventRoomBean {
|
||||||
|
public long roomUid;
|
||||||
|
public long erbanNo;
|
||||||
|
public String avatar;
|
||||||
|
public String roomName;
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class EventRoomEntity {
|
||||||
|
public EventRoomBean selfRoom;
|
||||||
|
public List<EventRoomBean> manageRooms;
|
||||||
|
}
|
@@ -0,0 +1,4 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
public class EventSquareBean {
|
||||||
|
}
|
11
core/src/main/java/com/chwl/core/bean/GiftTitleInfo.java
Normal file
11
core/src/main/java/com/chwl/core/bean/GiftTitleInfo.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GiftTitleInfo implements Serializable {
|
||||||
|
private String title;
|
||||||
|
private String num;
|
||||||
|
}
|
50
core/src/main/java/com/chwl/core/bean/I18N.kt
Normal file
50
core/src/main/java/com/chwl/core/bean/I18N.kt
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package com.chwl.core.bean
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import com.chwl.library.language.LanguageHelper
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/22 18:36
|
||||||
|
* Desc:
|
||||||
|
**/
|
||||||
|
@Keep
|
||||||
|
class I18N : HashMap<String, String>(), Serializable {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@JvmStatic
|
||||||
|
fun getFirstOrDefault(i18N: I18N?, default: String?): String? {
|
||||||
|
val text = i18N?.getFirstText()
|
||||||
|
if (text.isNullOrEmpty()) {
|
||||||
|
return default
|
||||||
|
}
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取优先显示文本
|
||||||
|
*/
|
||||||
|
fun getFirstText(): String? {
|
||||||
|
// 目前应用只支持繁体,后续支持其他语言,这里需要调整
|
||||||
|
val content = get(LanguageHelper.getCurrentLanguageType())
|
||||||
|
return if (content.isNullOrEmpty()) {
|
||||||
|
this.values.firstOrNull()
|
||||||
|
} else {
|
||||||
|
content
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setZH(value: String) {
|
||||||
|
put(LanguageHelper.ZH, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setEN(value: String) {
|
||||||
|
put(LanguageHelper.EN, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setAR(value: String) {
|
||||||
|
put(LanguageHelper.AR, value)
|
||||||
|
}
|
||||||
|
}
|
20
core/src/main/java/com/chwl/core/bean/IRouterData.kt
Normal file
20
core/src/main/java/com/chwl/core/bean/IRouterData.kt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package com.chwl.core.bean
|
||||||
|
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2024/2/20 16:43
|
||||||
|
* Desc:路由跳转参数
|
||||||
|
**/
|
||||||
|
interface IRouterData : Serializable {
|
||||||
|
|
||||||
|
fun getSkipUri(): String?
|
||||||
|
|
||||||
|
fun getSkipType(): Int
|
||||||
|
|
||||||
|
@Deprecated("SkipType==5时用到该值,后台讲这种已经没用到了")
|
||||||
|
fun getRouterType(): String?
|
||||||
|
|
||||||
|
@Deprecated("SkipType==5时用到该值,后台讲这种已经没用到了")
|
||||||
|
fun getRouterValue(): String?
|
||||||
|
}
|
11
core/src/main/java/com/chwl/core/bean/LoginTipsInfo.java
Normal file
11
core/src/main/java/com/chwl/core/bean/LoginTipsInfo.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LoginTipsInfo {
|
||||||
|
private String tips;
|
||||||
|
private boolean showWechat;
|
||||||
|
private boolean showQq;
|
||||||
|
private boolean showOneClick;
|
||||||
|
}
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PrivateChatLimitInfo implements Serializable {
|
||||||
|
private boolean chat;
|
||||||
|
private String message;
|
||||||
|
private int wealthLevel;
|
||||||
|
private int charmLevel;
|
||||||
|
|
||||||
|
private int nextVipLevel = -1; //下一级Vip等级 只返 nextVipLevel 表示未達到 第一個彈窗的級別(目前是vip3)
|
||||||
|
private int nextUserCountLimit = -1; //聊天人数 兩個都沒返,表示達到最大等級
|
||||||
|
|
||||||
|
}
|
40
core/src/main/java/com/chwl/core/bean/ProgressInfo.java
Normal file
40
core/src/main/java/com/chwl/core/bean/ProgressInfo.java
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进度信息
|
||||||
|
*
|
||||||
|
* @author zhongyongsheng on 14-9-25.
|
||||||
|
*/
|
||||||
|
public class ProgressInfo {
|
||||||
|
private long progress;
|
||||||
|
private long total;
|
||||||
|
|
||||||
|
public ProgressInfo(long progress, long total) {
|
||||||
|
this.progress = progress;
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgress(long progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTotal() {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotal(long total) {
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ProgressInfo{" +
|
||||||
|
"progress=" + progress +
|
||||||
|
", total=" + total +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
47
core/src/main/java/com/chwl/core/bean/RegionBean.kt
Normal file
47
core/src/main/java/com/chwl/core/bean/RegionBean.kt
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
package com.chwl.core.bean
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.entity.MultiItemEntity
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Max on 2023/12/7 18:48
|
||||||
|
* Desc:地区
|
||||||
|
**/
|
||||||
|
data class RegionBean(
|
||||||
|
// 名称(英文)
|
||||||
|
val name: String?,
|
||||||
|
// 简称
|
||||||
|
val abbr: String?,
|
||||||
|
// 区号
|
||||||
|
val code: String?,
|
||||||
|
// MCC
|
||||||
|
val mcc: String?
|
||||||
|
) : MultiItemEntity {
|
||||||
|
|
||||||
|
val fullCode: String?
|
||||||
|
get() {
|
||||||
|
if (code == null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return if (code.startsWith("+")) {
|
||||||
|
code
|
||||||
|
} else {
|
||||||
|
"+$code"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 本地分组用到
|
||||||
|
var groupName: Char? = null
|
||||||
|
|
||||||
|
// 本地排序用到
|
||||||
|
var sortedBy: String? = null
|
||||||
|
|
||||||
|
private var itemType: Int = 0
|
||||||
|
|
||||||
|
fun setItemType(itemType: Int) {
|
||||||
|
this.itemType = itemType
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemType(): Int {
|
||||||
|
return itemType
|
||||||
|
}
|
||||||
|
}
|
16
core/src/main/java/com/chwl/core/bean/RoomHistoryInfo.java
Normal file
16
core/src/main/java/com/chwl/core/bean/RoomHistoryInfo.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RoomHistoryInfo implements Serializable {
|
||||||
|
private long roomUid;
|
||||||
|
private long roomId;
|
||||||
|
private long erbanNo;
|
||||||
|
private long updateTime;
|
||||||
|
private String title;
|
||||||
|
private String avatar;
|
||||||
|
private boolean valid;
|
||||||
|
}
|
105
core/src/main/java/com/chwl/core/bean/RoomMicInfo.java
Normal file
105
core/src/main/java/com/chwl/core/bean/RoomMicInfo.java
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> 房间麦序(坑位)信息实体 </p>
|
||||||
|
*
|
||||||
|
* @author jiahui
|
||||||
|
* @date 2017/12/13
|
||||||
|
*/
|
||||||
|
public class RoomMicInfo implements Parcelable {
|
||||||
|
|
||||||
|
|
||||||
|
/** 当前坑位位置 */
|
||||||
|
private int position;
|
||||||
|
/** 当前坑位是否锁住,0:开锁,1:闭锁 */
|
||||||
|
private int posState;
|
||||||
|
/** 当前坑位是否开麦,0:开麦,1:闭麦 */
|
||||||
|
private int micState;
|
||||||
|
|
||||||
|
protected RoomMicInfo(Parcel in) {
|
||||||
|
position = in.readInt();
|
||||||
|
posState = in.readInt();
|
||||||
|
micState = in.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeInt(position);
|
||||||
|
dest.writeInt(posState);
|
||||||
|
dest.writeInt(micState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<RoomMicInfo> CREATOR = new Creator<RoomMicInfo>() {
|
||||||
|
@Override
|
||||||
|
public RoomMicInfo createFromParcel(Parcel in) {
|
||||||
|
return new RoomMicInfo(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RoomMicInfo[] newArray(int size) {
|
||||||
|
return new RoomMicInfo[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
public int getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosition(int position) {
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPosState() {
|
||||||
|
return posState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosState(int posState) {
|
||||||
|
this.posState = posState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMicState() {
|
||||||
|
return micState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMicState(int micState) {
|
||||||
|
this.micState = micState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 坑位是否锁了
|
||||||
|
*
|
||||||
|
* @return true:锁了,false:没锁
|
||||||
|
*/
|
||||||
|
public boolean isMicLock() {
|
||||||
|
return 1 == posState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 坑位是否闭麦了
|
||||||
|
*
|
||||||
|
* @return true:闭麦,false:开麦
|
||||||
|
*/
|
||||||
|
public boolean isMicMute() {
|
||||||
|
return 1 == micState;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RoomMicInfo{" +
|
||||||
|
", position=" + position +
|
||||||
|
", posState=" + posState +
|
||||||
|
", micState=" + micState +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
core/src/main/java/com/chwl/core/bean/RoomNewbieInfo.java
Normal file
21
core/src/main/java/com/chwl/core/bean/RoomNewbieInfo.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RoomNewbieInfo implements Serializable {
|
||||||
|
private int uid;
|
||||||
|
private int erbanNo;
|
||||||
|
private String avatar;
|
||||||
|
private String nick;
|
||||||
|
private int gender;
|
||||||
|
private int experLevelSeq;
|
||||||
|
private String experUrl;
|
||||||
|
private int charmLevelSeq;
|
||||||
|
private String charmUrl;
|
||||||
|
private boolean hello;
|
||||||
|
private long birth;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,69 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RoomNewbieMessageInfo implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* start : 20
|
||||||
|
* list : [{"id":16,"message":ResUtil.getString(R.string.xchat_android_core_bean_roomnewbiemessageinfo_01)},{"id":17,"message":ResUtil.getString(R.string.xchat_android_core_bean_roomnewbiemessageinfo_02)},{"id":18,"message":ResUtil.getString(R.string.xchat_android_core_bean_roomnewbiemessageinfo_03)},{"id":19,"message":ResUtil.getString(R.string.xchat_android_core_bean_roomnewbiemessageinfo_04)},{"id":20,"message":ResUtil.getString(R.string.xchat_android_core_bean_roomnewbiemessageinfo_05)}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int start;
|
||||||
|
private List<ListBean> list;
|
||||||
|
|
||||||
|
public int getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStart(int start) {
|
||||||
|
this.start = start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ListBean> getList() {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setList(List<ListBean> list) {
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ListBean {
|
||||||
|
/**
|
||||||
|
* id : 16
|
||||||
|
* message : 谈恋爱太麻烦了,以后就麻烦你了
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String message;
|
||||||
|
private boolean check;
|
||||||
|
|
||||||
|
public boolean isCheck() {
|
||||||
|
return check;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCheck(boolean check) {
|
||||||
|
this.check = check;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
32
core/src/main/java/com/chwl/core/bean/RoomQueueInfo.java
Normal file
32
core/src/main/java/com/chwl/core/bean/RoomQueueInfo.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import com.chwl.core.room.giftvalue.bean.GiftValueData;
|
||||||
|
import com.chwl.core.room.queue.bean.MicMemberInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> 房间麦序单个坑位信息实体,包含麦序状态,成员信息</p>
|
||||||
|
*
|
||||||
|
* @author jiahui
|
||||||
|
* @date 2017/12/13
|
||||||
|
*/
|
||||||
|
public class RoomQueueInfo {
|
||||||
|
/** 坑位信息(是否所坑,开麦等) */
|
||||||
|
public RoomMicInfo mRoomMicInfo;
|
||||||
|
/** 坑上人员信息 */
|
||||||
|
public MicMemberInfo mChatRoomMember;
|
||||||
|
|
||||||
|
public GiftValueData giftValueData = new GiftValueData();
|
||||||
|
|
||||||
|
public RoomQueueInfo(RoomMicInfo roomMicInfo, MicMemberInfo chatRoomMember) {
|
||||||
|
mRoomMicInfo = roomMicInfo;
|
||||||
|
mChatRoomMember = chatRoomMember;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "RoomQueueInfo{" +
|
||||||
|
"mRoomMicInfo=" + mRoomMicInfo +
|
||||||
|
", mChatRoomMember=" + mChatRoomMember +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
97
core/src/main/java/com/chwl/core/bean/UserInfoItem.java
Normal file
97
core/src/main/java/com/chwl/core/bean/UserInfoItem.java
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UserInfoItem<T extends Serializable> implements MultiItemEntity, Parcelable, Serializable {
|
||||||
|
|
||||||
|
public static final transient int TYPE_NONE = 0; // 空对象
|
||||||
|
public static final transient int TYPE_DIV = 1;// 分割线
|
||||||
|
public static final transient int TYPE_TITLE = 2;// 标题
|
||||||
|
|
||||||
|
public static final transient int TYPE_MAGIC_ITEMS = 3;// 礼物_魔法礼物列表
|
||||||
|
public static final transient int TYPE_RADISH_ITEMS = 4;// 礼物_萝卜礼物列表
|
||||||
|
public static final transient int TYPE_GIFT_ITEM = 5;// 礼物_礼物列表
|
||||||
|
public static final transient int TYPE_GIFT_EMPTY = 6;// 礼物_礼物列表为空
|
||||||
|
|
||||||
|
public static final transient int TYPE_CAR_ITEM = 7;// 座驾_我的座驾
|
||||||
|
public static final transient int TYPE_CAR_BUTTON = 8;// 座驾_赠送/购买
|
||||||
|
public static final transient int TYPE_CAR_EMPTY = 9;// 座驾_我的座驾列表为空
|
||||||
|
|
||||||
|
public static final transient int TYPE_DES_PHOTO = 10;// 资料_相册
|
||||||
|
public static final transient int TYPE_DES_PERSONAL = 11;// 资料_个人介绍
|
||||||
|
public static final transient int TYPE_DES_VOICE = 12;// 资料_我的声音
|
||||||
|
public static final transient int TYPE_DES_FAMILY = 13;// 资料_家族
|
||||||
|
public static final transient int TYPE_DES_HALL = 14;// 资料_模厅
|
||||||
|
public static final transient int TYPE_DES_GAME = 15;// 资料_本周战绩
|
||||||
|
public static final transient int TYPE_DES_JOIN_WORLDS = 17;// 资料_话题列表
|
||||||
|
public static final transient int TYPE_GIFT_ITEM_TOP = 18;// 礼物_礼物列表置顶
|
||||||
|
|
||||||
|
//类型
|
||||||
|
private int itemType;
|
||||||
|
private int tag;
|
||||||
|
|
||||||
|
//正常数据
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public UserInfoItem(int itemType) {
|
||||||
|
this(itemType, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public UserInfoItem(int itemType, T data) {
|
||||||
|
this.itemType = itemType;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected UserInfoItem(Parcel in) {
|
||||||
|
itemType = in.readInt();
|
||||||
|
data = (T) in.readSerializable();
|
||||||
|
tag = in.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Creator<UserInfoItem> CREATOR = new Creator<UserInfoItem>() {
|
||||||
|
@Override
|
||||||
|
public UserInfoItem createFromParcel(Parcel in) {
|
||||||
|
return new UserInfoItem(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserInfoItem[] newArray(int size) {
|
||||||
|
return new UserInfoItem[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeInt(itemType);
|
||||||
|
dest.writeSerializable(data);
|
||||||
|
dest.writeInt(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemType() {
|
||||||
|
return itemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
50
core/src/main/java/com/chwl/core/bean/VersionInfo.java
Normal file
50
core/src/main/java/com/chwl/core/bean/VersionInfo.java
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package com.chwl.core.bean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by huangmeng1 on 2018/7/18.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class VersionInfo {
|
||||||
|
/**
|
||||||
|
* os : iOS
|
||||||
|
* version : 2.0.0
|
||||||
|
* status : 1
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String os;
|
||||||
|
private String version;
|
||||||
|
private int status;
|
||||||
|
|
||||||
|
public String getOs() {
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOs(String os) {
|
||||||
|
this.os = os;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "VersionInfo{" +
|
||||||
|
"os='" + os + '\'' +
|
||||||
|
", version='" + version + '\'' +
|
||||||
|
", status=" + status +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,71 @@
|
|||||||
|
package com.chwl.core.bean.attachmsg;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.chwl.core.bean.RoomQueueInfo;
|
||||||
|
import com.chwl.core.im.custom.bean.CustomAttachment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p> 队列自定义消息</p>
|
||||||
|
*
|
||||||
|
* @author jiahui
|
||||||
|
* @date 2017/12/18
|
||||||
|
*/
|
||||||
|
public class RoomQueueMsgAttachment extends CustomAttachment {
|
||||||
|
public RoomQueueInfo roomQueueInfo;
|
||||||
|
public String uid;
|
||||||
|
public int micPosition;
|
||||||
|
public long handleUid;
|
||||||
|
public String handleNick;
|
||||||
|
public String targetNick;
|
||||||
|
public int groupType;
|
||||||
|
|
||||||
|
public RoomQueueMsgAttachment(int first, int second) {
|
||||||
|
super(first, second);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JSONObject packData() {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
if (uid != null) {
|
||||||
|
jsonObject.put("uid", uid);
|
||||||
|
}
|
||||||
|
jsonObject.put("handleUid", handleUid);
|
||||||
|
if (handleNick != null) {
|
||||||
|
jsonObject.put("handleNick", handleNick);
|
||||||
|
}
|
||||||
|
if (targetNick != null) {
|
||||||
|
jsonObject.put("targetNick", targetNick);
|
||||||
|
}
|
||||||
|
jsonObject.put("micPosition", micPosition);
|
||||||
|
|
||||||
|
if (groupType != 0) {
|
||||||
|
jsonObject.put("groupType", groupType);
|
||||||
|
}
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void parseData(JSONObject data) {
|
||||||
|
super.parseData(data);
|
||||||
|
if (data != null) {
|
||||||
|
if (data.containsKey("uid")) {
|
||||||
|
uid = data.getString("uid");
|
||||||
|
}
|
||||||
|
if (data.containsKey("micPosition")) {
|
||||||
|
micPosition = data.getIntValue("micPosition");
|
||||||
|
}
|
||||||
|
if (data.containsKey("handleUid")) {
|
||||||
|
handleUid = data.getLongValue("handleUid");
|
||||||
|
}
|
||||||
|
if (data.containsKey("handleNick")) {
|
||||||
|
handleNick = data.getString("handleNick");
|
||||||
|
}
|
||||||
|
if (data.containsKey("targetNick")) {
|
||||||
|
targetNick = data.getString("targetNick");
|
||||||
|
}
|
||||||
|
if (data.containsKey("groupType")) {
|
||||||
|
groupType = data.getInteger("groupType");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
core/src/main/java/com/chwl/core/bean/game/GameConfigBean.kt
Normal file
12
core/src/main/java/com/chwl/core/bean/game/GameConfigBean.kt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package com.chwl.core.bean.game
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
class GameConfigBean {
|
||||||
|
val mgId: Long? = null
|
||||||
|
val mgIdStr: String? = null
|
||||||
|
val name: String? = null
|
||||||
|
val pic: String? = null
|
||||||
|
val gameModes: List<GameModeBean>? = null
|
||||||
|
}
|
14
core/src/main/java/com/chwl/core/bean/game/GameModeBean.kt
Normal file
14
core/src/main/java/com/chwl/core/bean/game/GameModeBean.kt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.chwl.core.bean.game
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
class GameModeBean : Serializable {
|
||||||
|
val ticket: Long? = null
|
||||||
|
val modeIcon: String? = null
|
||||||
|
val gameMode: Int? = null
|
||||||
|
val scores: List<Int>? = null
|
||||||
|
val ruleUrl: String? = null
|
||||||
|
val modeName: String? = null
|
||||||
|
}
|
30
core/src/main/java/com/chwl/core/bean/game/GameResultBean.kt
Normal file
30
core/src/main/java/com/chwl/core/bean/game/GameResultBean.kt
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package com.chwl.core.bean.game
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import java.io.Serializable
|
||||||
|
import java.math.BigDecimal
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
class GameResultBean : Serializable {
|
||||||
|
var rank: Int? = null
|
||||||
|
var uid: Long? = null
|
||||||
|
var avatar: String? = null
|
||||||
|
var nick: String? = null
|
||||||
|
var winNum: Double? = null
|
||||||
|
var isWin: Boolean? = null
|
||||||
|
var isEscaped: Boolean? = null
|
||||||
|
|
||||||
|
fun getScoreStr(): String {
|
||||||
|
val number = winNum ?: return "0"
|
||||||
|
try {
|
||||||
|
val bigDecimal = BigDecimal.valueOf(number)
|
||||||
|
val coinsStr = bigDecimal.stripTrailingZeros().toPlainString()
|
||||||
|
if (number > 0) {
|
||||||
|
return "+$coinsStr"
|
||||||
|
}
|
||||||
|
return coinsStr
|
||||||
|
} catch (e: Exception) {
|
||||||
|
return number.toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
core/src/main/java/com/chwl/core/bean/game/GameRoomData.kt
Normal file
26
core/src/main/java/com/chwl/core/bean/game/GameRoomData.kt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package com.chwl.core.bean.game
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
class GameRoomData : Serializable {
|
||||||
|
val mgId: String? = null
|
||||||
|
val gameRoomIcon: String? = null
|
||||||
|
val configJson: String? = null
|
||||||
|
val scores: MutableList<Double>? = null
|
||||||
|
|
||||||
|
// 匹配状态(0:匹配中、1:匹配成功、2:游戏结束、3:匹配失败)
|
||||||
|
var matchStatus: Int? = null
|
||||||
|
|
||||||
|
// 轮次ID
|
||||||
|
val matchRoundId: Long? = null
|
||||||
|
|
||||||
|
// 轮次状态(0:进行中、1:结束)
|
||||||
|
val roundStatus: Int? = null
|
||||||
|
override fun toString(): String {
|
||||||
|
return "GameRoomData(mgId=$mgId, gameRoomIcon=$gameRoomIcon, configJson=$configJson, scores=$scores, matchStatus=$matchStatus, matchRoundId=$matchRoundId, roundStatus=$roundStatus)"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
package com.chwl.core.bean.game
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import com.chwl.core.bean.room.BaseRoomInfo
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
class GameRoomInfo : BaseRoomInfo<GameRoomData>() {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,26 @@
|
|||||||
|
package com.chwl.core.bean.game
|
||||||
|
|
||||||
|
import androidx.annotation.Keep
|
||||||
|
import com.chwl.library.utils.json.JsonUtils
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
class SudGameConfigBean {
|
||||||
|
private val app_common_game_setting_select_info: HashMap<String, Any>? = null
|
||||||
|
|
||||||
|
private val ui: HashMap<String, Any>? = null
|
||||||
|
|
||||||
|
fun getGameSettingSelectConfigStr(): String? {
|
||||||
|
return JsonUtils.toJson(app_common_game_setting_select_info)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getGameConfigStr(): String? {
|
||||||
|
val uiMap = ui
|
||||||
|
if (uiMap.isNullOrEmpty()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return JsonUtils.toJson(ConfigModel(uiMap))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
private data class ConfigModel(var ui: HashMap<String, Any>)
|
||||||
|
}
|
35
core/src/main/java/com/chwl/core/bean/response/BeanResult.kt
Normal file
35
core/src/main/java/com/chwl/core/bean/response/BeanResult.kt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package com.chwl.core.bean.response
|
||||||
|
|
||||||
|
import com.chwl.core.R
|
||||||
|
import com.chwl.core.utils.net.ServerException
|
||||||
|
import com.chwl.library.utils.ResUtil
|
||||||
|
|
||||||
|
data class BeanResult<T>(
|
||||||
|
val isSuccess: Boolean,
|
||||||
|
val code: Int = 0,
|
||||||
|
val message: String? = null,
|
||||||
|
val data: T? = null
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun <T> success(data: T?): BeanResult<T> {
|
||||||
|
return BeanResult(true, 0, "", data)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> failed(code: Int, message: String?): BeanResult<T> {
|
||||||
|
return BeanResult(false, code, message, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> failed(throwable: Throwable): BeanResult<T> {
|
||||||
|
return if (throwable is ServerException) {
|
||||||
|
failed(throwable.code, throwable.message)
|
||||||
|
} else {
|
||||||
|
failed(-1, ResUtil.getString(R.string.bean_response_beanresult_01))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -0,0 +1,12 @@
|
|||||||
|
package com.chwl.core.bean.response;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jack
|
||||||
|
* @Description
|
||||||
|
* @Date 2018/5/8
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class JsonServiceResult extends ServiceResult<JsonElement> {
|
||||||
|
}
|
40
core/src/main/java/com/chwl/core/bean/response/ListResult.kt
Normal file
40
core/src/main/java/com/chwl/core/bean/response/ListResult.kt
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package com.chwl.core.bean.response
|
||||||
|
|
||||||
|
import com.chwl.core.R
|
||||||
|
import com.chwl.core.utils.net.ServerException
|
||||||
|
import com.chwl.library.utils.ResUtil
|
||||||
|
|
||||||
|
data class ListResult<T>(
|
||||||
|
val isSuccess: Boolean,
|
||||||
|
val isRefresh: Boolean,
|
||||||
|
val data: List<T>? = null,
|
||||||
|
val code: Int = 0,
|
||||||
|
val message: String? = null
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun <T> success(data: List<T>?, pageNum: Int): ListResult<T> {
|
||||||
|
return ListResult(true, pageNum == 1, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> failed(pageNum: Int): ListResult<T> {
|
||||||
|
return ListResult(false, pageNum == 1, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> failed(pageNum: Int, code: Int, message: String?): ListResult<T> {
|
||||||
|
return ListResult(false, pageNum == 1, null, code, message)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun <T> failed(pageNum: Int, throwable: Throwable): ListResult<T> {
|
||||||
|
return if (throwable is ServerException) {
|
||||||
|
failed(pageNum, throwable.code, throwable.message)
|
||||||
|
} else {
|
||||||
|
failed(pageNum, -1, ResUtil.getString(R.string.bean_response_beanresult_01))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -0,0 +1,40 @@
|
|||||||
|
package com.chwl.core.bean.response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhongyongsheng on 14-6-6.
|
||||||
|
*/
|
||||||
|
public class RequestError extends Exception {
|
||||||
|
|
||||||
|
public final ResponseData responseData;
|
||||||
|
|
||||||
|
public RequestError() {
|
||||||
|
responseData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestError(ResponseData response) {
|
||||||
|
responseData = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestError(String exceptionMessage) {
|
||||||
|
super(exceptionMessage);
|
||||||
|
responseData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestError(String exceptionMessage, Throwable reason) {
|
||||||
|
super(exceptionMessage, reason);
|
||||||
|
responseData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RequestError(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
responseData = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorStr(){
|
||||||
|
if(null == responseData){
|
||||||
|
return getMessage();
|
||||||
|
}else{
|
||||||
|
return responseData.getErrorStr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
156
core/src/main/java/com/chwl/core/bean/response/ResponseData.java
Normal file
156
core/src/main/java/com/chwl/core/bean/response/ResponseData.java
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2011 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.chwl.core.bean.response;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.chwl.core.R;
|
||||||
|
import com.chwl.library.coremanager.CoreError;
|
||||||
|
import com.chwl.library.utils.ResUtil;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网络或者cache的数据封装
|
||||||
|
*
|
||||||
|
* @author zhongyongsheng
|
||||||
|
*/
|
||||||
|
public class ResponseData {
|
||||||
|
|
||||||
|
public final int statusCode;
|
||||||
|
public final Map<String, String> headers;
|
||||||
|
public final boolean notModified;
|
||||||
|
private final Gson gson;
|
||||||
|
public byte[] data;
|
||||||
|
|
||||||
|
public ResponseData(int statusCode, byte[] data, Map<String, String> headers,
|
||||||
|
boolean notModified) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
this.data = data;
|
||||||
|
this.headers = headers;
|
||||||
|
this.notModified = notModified;
|
||||||
|
gson = new Gson();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseData(byte[] data) {
|
||||||
|
this(200, data, Collections.<String, String>emptyMap(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponseData(byte[] data, Map<String, String> headers) {
|
||||||
|
this(200, data, headers, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceResult getResult() {
|
||||||
|
|
||||||
|
ServiceResult result = gson.fromJson(new String(data, Charset.forName("UTF-8")), ServiceResult.class);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int RELOGIN = 0;
|
||||||
|
public static final int RECHECK_TICKET = 1;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* accessToken失效的时候需要重新登录
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isNeedReLogin() {
|
||||||
|
ServiceResult result = getResult();
|
||||||
|
if (result.getCode() == CoreError.ACCESS_TOKEN_HAS_EXPIRED || result.getCode() == CoreError.ACCESS_TOKEN_HAS_EXPIRED_SINCE_PASSWORD_CHANGED || result.getCode() == CoreError.ACCESS_TOKEN_IS_MISSING || result.getCode() == CoreError.INVALID_AUTHORIZATION_CODE) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ticket失效的时候需要重新检查tickets
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean isNeedReCheckTickets() {
|
||||||
|
ServiceResult result = getResult();
|
||||||
|
if (result.getCode() == CoreError.INVALID_TICKET || result.getCode() == CoreError.TICKET_IS_MISSING || result.getCode() == CoreError.TICKET_HAS_EXPIRED || result.getCode() == CoreError.TICKET_HAS_EXPIRED_SINCE_PASSWORD_CHANGED) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorStr() {
|
||||||
|
String error = "";
|
||||||
|
if (null != data) {
|
||||||
|
ServiceResult result = getResult();
|
||||||
|
if (null != result) {
|
||||||
|
switch (result.getCode()) {
|
||||||
|
case CoreError.USERNAME_PASSWORD_MISMATCH:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_01);
|
||||||
|
break;
|
||||||
|
case CoreError.INVALID_USER:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_02);
|
||||||
|
break;
|
||||||
|
case CoreError.INVALID_TOKEN:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_03);
|
||||||
|
break;
|
||||||
|
case CoreError.USER_HAS_BLOCKED:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_04);
|
||||||
|
break;
|
||||||
|
case CoreError.INVALID_IDENTIFYING_CODE:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_05);
|
||||||
|
break;
|
||||||
|
case CoreError.INVALID_USERNAME:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_06);
|
||||||
|
break;
|
||||||
|
case CoreError.INVALID_RESET_CODE:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_07);
|
||||||
|
break;
|
||||||
|
case CoreError.INVALID_NICK:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_08);
|
||||||
|
break;
|
||||||
|
case CoreError.USER_HAS_SIGNED_UP:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_09);
|
||||||
|
break;
|
||||||
|
|
||||||
|
//------------------->accessToken
|
||||||
|
case CoreError.ACCESS_TOKEN_HAS_EXPIRED:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_010);
|
||||||
|
break;
|
||||||
|
case CoreError.ACCESS_TOKEN_HAS_EXPIRED_SINCE_PASSWORD_CHANGED:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_011);
|
||||||
|
break;
|
||||||
|
case CoreError.ACCESS_TOKEN_IS_MISSING:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_012);
|
||||||
|
break;
|
||||||
|
case CoreError.INVALID_AUTHORIZATION_CODE:
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_013);
|
||||||
|
break;
|
||||||
|
//------------------->accessToken
|
||||||
|
|
||||||
|
default:
|
||||||
|
error =result.getErrorMessage();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
error = ResUtil.getString(R.string.bean_response_responsedata_014);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,197 @@
|
|||||||
|
package com.chwl.core.bean.response;
|
||||||
|
import com.chwl.core.R;
|
||||||
|
import com.chwl.library.utils.ResUtil;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author houzhenjing
|
||||||
|
*/
|
||||||
|
public class ServiceResult<T> implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1954065564856833013L;
|
||||||
|
|
||||||
|
public static final int SC_SUCCESS = 200;
|
||||||
|
|
||||||
|
private int code = -1;
|
||||||
|
|
||||||
|
private String message = "";
|
||||||
|
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
private long timestamp;
|
||||||
|
|
||||||
|
public ServiceResult() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return this.code == SC_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServiceResult<T> success(T data) {
|
||||||
|
return success(data, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> ServiceResult<T> success(T data, String message) {
|
||||||
|
ServiceResult<T> result = new ServiceResult<T>();
|
||||||
|
result.setCodeSuccess().setMessage(message).setData(data);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceResult<T> setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceResult<T> setCodeSuccess() {
|
||||||
|
this.code = SC_SUCCESS;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceResult<T> setMessage(String message) {
|
||||||
|
this.message = message;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServiceResult<T> setData(T data) {
|
||||||
|
this.data = data;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimestamp(long timestamp) {
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final int SUCCESS = 200;//成功
|
||||||
|
public static final int INVALID_SERVICE = 199;//服务不可用
|
||||||
|
public static final int SERVEXCEPTION = 5000;//服务端异常
|
||||||
|
public static final int UNKNOWN = 999;//未知错误
|
||||||
|
public static final int BUSIERROR = 4000;//服务繁忙
|
||||||
|
public static final int PARAMETERILLEGAL = 1444;//该用户不存在
|
||||||
|
public static final int ROOMRUNNING = 1500;//房间正在运行中...
|
||||||
|
public static final int AUCTCURDOING = 2100;//当前被竞拍者正在被竞拍中,还未结束
|
||||||
|
public static final int AUCTCURLESSTHANMAXMONEY = 2101;//竞拍价格小于当前最高价
|
||||||
|
public static final int ORDERNOTEXISTS = 3404;//订单不存在
|
||||||
|
public static final int SMSSENDERROR = 4001;//发送短信出错
|
||||||
|
public static final int PHONEINVALID = 4002;//手机格式不正确
|
||||||
|
public static final int DIAMONDNUMNOTENOUGH = 2104;//钻石数量不够
|
||||||
|
public static final int SMSCODEERROR = 4003;//短信验证码错误
|
||||||
|
public static final int WEEKNOTWITHCASHTOWNUMS = 1600;//每周提现俩次
|
||||||
|
public static final int CODE_NEED_COMPLETE_USER_INFO = 1415;//每周提现俩次
|
||||||
|
|
||||||
|
public static final int CODE_ROOM_MANAGER_LIMIT = 20504;//管理员超越上限
|
||||||
|
|
||||||
|
/** 没有网络 */
|
||||||
|
public static final int NOT_NET = 50010;
|
||||||
|
public static final int OTHER = 50011;
|
||||||
|
|
||||||
|
|
||||||
|
public String getErrorMessage() {
|
||||||
|
String errorStr = ResUtil.getString(R.string.bean_response_serviceresult_01);
|
||||||
|
switch (code) {
|
||||||
|
case DIAMONDNUMNOTENOUGH:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_02);
|
||||||
|
break;
|
||||||
|
case SMSCODEERROR:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_03);
|
||||||
|
break;
|
||||||
|
case PARAMETERILLEGAL:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_04);
|
||||||
|
break;
|
||||||
|
case ROOMRUNNING:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_05);
|
||||||
|
break;
|
||||||
|
case AUCTCURDOING:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_06);
|
||||||
|
break;
|
||||||
|
case AUCTCURLESSTHANMAXMONEY:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_07);
|
||||||
|
break;
|
||||||
|
case ORDERNOTEXISTS:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_08);
|
||||||
|
break;
|
||||||
|
case PHONEINVALID:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_09);
|
||||||
|
break;
|
||||||
|
case NOT_NET:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_010);
|
||||||
|
break;
|
||||||
|
case UNKNOWN:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_011);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errorStr = message;
|
||||||
|
}
|
||||||
|
return errorStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getError() {
|
||||||
|
String errorStr = ResUtil.getString(R.string.bean_response_serviceresult_012);
|
||||||
|
switch (code) {
|
||||||
|
case DIAMONDNUMNOTENOUGH:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_013);
|
||||||
|
break;
|
||||||
|
case SMSCODEERROR:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_014);
|
||||||
|
break;
|
||||||
|
case INVALID_SERVICE:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_015);
|
||||||
|
break;
|
||||||
|
case SERVEXCEPTION:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_016);
|
||||||
|
break;
|
||||||
|
case UNKNOWN:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_017);
|
||||||
|
break;
|
||||||
|
case BUSIERROR:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_018);
|
||||||
|
break;
|
||||||
|
case PARAMETERILLEGAL:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_019);
|
||||||
|
break;
|
||||||
|
case ROOMRUNNING:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_020);
|
||||||
|
break;
|
||||||
|
case AUCTCURDOING:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_021);
|
||||||
|
break;
|
||||||
|
case AUCTCURLESSTHANMAXMONEY:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_022);
|
||||||
|
break;
|
||||||
|
case ORDERNOTEXISTS:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_023);
|
||||||
|
break;
|
||||||
|
case SMSSENDERROR:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_024);
|
||||||
|
break;
|
||||||
|
case PHONEINVALID:
|
||||||
|
errorStr = ResUtil.getString(R.string.bean_response_serviceresult_025);
|
||||||
|
break;
|
||||||
|
case WEEKNOTWITHCASHTOWNUMS:
|
||||||
|
errorStr = ResUtil.getString(R.string.network_abnormality_check_again);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errorStr = message;
|
||||||
|
|
||||||
|
}
|
||||||
|
return errorStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,14 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.core.redPacket.bean.ActionDialogInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/28.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ActionDialogResult extends ServiceResult<List<ActionDialogInfo>> {
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.core.user.bean.AttentionInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Administrator on 2017/7/5 0005.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AttentionListResult extends ServiceResult<List<AttentionInfo>> {
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.core.room.auction.bean.AuctionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/28.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AuctionInfoResult extends ServiceResult<AuctionInfo> {
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.core.room.auction.bean.AuctionListUserInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by chenran on 2017/8/9.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AuctionListUserInfoResult extends ServiceResult<List<AuctionListUserInfo>> {
|
||||||
|
}
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.core.room.auction.bean.AuctionUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/28.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AuctionUserListResult extends ServiceResult<List<AuctionUser>> {
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.core.room.auction.bean.AuctionUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/28.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class AuctionUserResult extends ServiceResult<AuctionUser> {
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by chenran on 2017/2/16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BoolApiResult extends ServiceResult<Boolean>{
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,10 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/27.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BooleanResult extends ServiceResult<Boolean> {
|
||||||
|
}
|
@@ -0,0 +1,17 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.pay.bean.ChargeBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by zhouxiangfeng on 2017/5/4.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ChargeListResult {
|
||||||
|
List<ChargeBean> list;
|
||||||
|
List<ChargeBean> bigList;
|
||||||
|
private int defaultPay;
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
import com.chwl.core.recall.bean.CheckLostUserInfo;
|
||||||
|
|
||||||
|
public class CheckLostUserResult extends ServiceResult<CheckLostUserInfo> {
|
||||||
|
}
|
@@ -0,0 +1,10 @@
|
|||||||
|
package com.chwl.core.bean.response.result;
|
||||||
|
|
||||||
|
import com.chwl.core.bean.response.ServiceResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Administrator on 2017/7/5 0005.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ExchangeInfoResult extends ServiceResult<ExchangerInfo> {
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user