66陪玩-origin
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
|
BIN
core/alipay-libs/alipaySdk-20180601.jar
Normal file
BIN
core/alipay-libs/alipaySdk-20180601.jar
Normal file
Binary file not shown.
150
core/build.gradle
Normal file
150
core/build.gradle
Normal file
@@ -0,0 +1,150 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'realm-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 26
|
||||
defaultConfig {
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 26
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
flavorDimensions 'default'
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
qingxun {
|
||||
java.srcDirs = [
|
||||
'src/main/java',
|
||||
'src/diff_src_erban/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_multi_domain/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'
|
||||
|
||||
]
|
||||
jniLibs.srcDirs = ['libs', 'umeng-app-libs/jniLibs', 'shumei-tianwang-libs/jniLibs']
|
||||
}
|
||||
|
||||
mengsheng {
|
||||
java.srcDirs = [
|
||||
'src/main/java',
|
||||
'src/diff_src_mengsheng/java',
|
||||
'src/model_smscode/java'
|
||||
]
|
||||
jniLibs.srcDirs = ['libs']
|
||||
}
|
||||
haha {
|
||||
java.srcDirs = [
|
||||
'src/main/java',
|
||||
'src/diff_src_haha/java',
|
||||
'src/model_smscode/java',
|
||||
'src/model_pay/java'
|
||||
]
|
||||
jniLibs.srcDirs = ['libs']
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
productFlavors{
|
||||
qingxun {
|
||||
dimension 'default'
|
||||
}
|
||||
mengsheng{
|
||||
dimension 'default'
|
||||
}
|
||||
haha{
|
||||
dimension 'default'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
def link_page = "1.1.2"
|
||||
def loggerVersion = "2.1.1"
|
||||
def BaiduMtjVersion = "3.8.2.1"
|
||||
def Lombok = "1.16.20"
|
||||
def room_version = "1.1.1"
|
||||
def umeng_common = "2.1.8"
|
||||
def umeng_analytics = "8.1.4"
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
|
||||
api "cc.linkedme.deeplinks:link-page:${link_page}"
|
||||
|
||||
api "com.orhanobut:logger:${loggerVersion}"
|
||||
|
||||
// 百度统计
|
||||
api "com.baidu.mobstat:mtj-sdk:${BaiduMtjVersion}"
|
||||
|
||||
// 友盟统计
|
||||
api "com.umeng.umsdk:analytics:${umeng_analytics}"
|
||||
api "com.umeng.umsdk:common:${umeng_common}"
|
||||
|
||||
compileOnly "org.projectlombok:lombok:${Lombok}"
|
||||
annotationProcessor "org.projectlombok:lombok:${Lombok}"
|
||||
|
||||
api 'com.aliyun.openservices:aliyun-log-android-sdk:0.4.0'
|
||||
|
||||
api fileTree(dir: 'share-sdk-libs', include: ['*.jar'])
|
||||
|
||||
// 支付
|
||||
api fileTree(dir: 'alipay-libs', include: ['*.jar'])
|
||||
api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.1.6'
|
||||
|
||||
// 声网
|
||||
api 'io.agora.rtc:full-sdk:2.4.1'
|
||||
|
||||
// 易盾
|
||||
api 'com.netease.mobsec:netmobsecLib:4.2.4.1@aar'
|
||||
|
||||
// 数美-天网
|
||||
api fileTree(dir: 'shumei-tianwang-libs', include: ['*.jar'])
|
||||
|
||||
// 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 "android.arch.persistence.room:runtime:${room_version}"
|
||||
annotationProcessor "android.arch.persistence.room:compiler:1.1.0"
|
||||
// RxJava support for Room
|
||||
api "android.arch.persistence.room:rxjava2:${room_version}"
|
||||
|
||||
|
||||
api project(':nim_uikit')
|
||||
api project(':library')
|
||||
api project(':agora-ktv-kit-release')
|
||||
}
|
58
core/proguard-rules.pro
vendored
Normal file
58
core/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
# 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
|
||||
|
||||
# Alipay
|
||||
-keep class com.alipay.android.app.IAlixPay{*;}
|
||||
-keep class com.alipay.android.app.IAlixPay$Stub{*;}
|
||||
-keep class com.alipay.android.app.IRemoteServiceCallback{*;}
|
||||
-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{*;}
|
||||
-keep class com.alipay.sdk.app.PayTask{ public *;}
|
||||
-keep class com.alipay.sdk.app.AuthTask{ public *;}
|
||||
-keep class com.alipay.sdk.app.H5PayCallback {
|
||||
<fields>;
|
||||
<methods>;
|
||||
}
|
||||
-keep class com.alipay.android.phone.mrpc.core.** { *; }
|
||||
-keep class com.alipay.apmobilesecuritysdk.** { *; }
|
||||
-keep class com.alipay.mobile.framework.service.annotation.** { *; }
|
||||
-keep class com.alipay.mobilesecuritysdk.face.** { *; }
|
||||
-keep class com.alipay.tscenter.biz.rpc.** { *; }
|
||||
-keep class org.json.alipay.** { *; }
|
||||
-keep class com.alipay.tscenter.** { *; }
|
||||
-keep class com.ta.utdid2.** { *;}
|
||||
-keep class com.ut.device.** { *;}
|
||||
|
||||
# umeng-app
|
||||
-keep class com.umeng.** {*;}
|
||||
-keepclassmembers class * {
|
||||
public <init> (org.json.JSONObject);
|
||||
}
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
# 易盾
|
||||
-keep class com.netease.mobsec.**{*;}
|
||||
|
||||
# 数美天网
|
||||
-keep class com.ishumei.dfp.SMSDK { *; }
|
BIN
core/share-sdk-libs/MobCommons-2019.0925.1537.jar
Normal file
BIN
core/share-sdk-libs/MobCommons-2019.0925.1537.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/MobTools-2019.0925.1537.jar
Normal file
BIN
core/share-sdk-libs/MobTools-2019.0925.1537.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/ShareSDK-Core-3.6.8.jar
Normal file
BIN
core/share-sdk-libs/ShareSDK-Core-3.6.8.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/ShareSDK-QQ-3.6.8.jar
Normal file
BIN
core/share-sdk-libs/ShareSDK-QQ-3.6.8.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/ShareSDK-QQ-Core-3.6.8.jar
Normal file
BIN
core/share-sdk-libs/ShareSDK-QQ-Core-3.6.8.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/ShareSDK-QZone-3.6.8.jar
Normal file
BIN
core/share-sdk-libs/ShareSDK-QZone-3.6.8.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/ShareSDK-Wechat-3.6.8.jar
Normal file
BIN
core/share-sdk-libs/ShareSDK-Wechat-3.6.8.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/ShareSDK-Wechat-Core-3.6.8.jar
Normal file
BIN
core/share-sdk-libs/ShareSDK-Wechat-Core-3.6.8.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/ShareSDK-Wechat-Favorite-3.6.8.jar
Normal file
BIN
core/share-sdk-libs/ShareSDK-Wechat-Favorite-3.6.8.jar
Normal file
Binary file not shown.
BIN
core/share-sdk-libs/ShareSDK-Wechat-Moments-3.6.8.jar
Normal file
BIN
core/share-sdk-libs/ShareSDK-Wechat-Moments-3.6.8.jar
Normal file
Binary file not shown.
BIN
core/shumei-tianwang-libs/jniLibs/arm64-v8a/libsmsdk.so
Normal file
BIN
core/shumei-tianwang-libs/jniLibs/arm64-v8a/libsmsdk.so
Normal file
Binary file not shown.
BIN
core/shumei-tianwang-libs/jniLibs/armeabi-v7a/libsmsdk.so
Normal file
BIN
core/shumei-tianwang-libs/jniLibs/armeabi-v7a/libsmsdk.so
Normal file
Binary file not shown.
BIN
core/shumei-tianwang-libs/jniLibs/armeabi/libsmsdk.so
Normal file
BIN
core/shumei-tianwang-libs/jniLibs/armeabi/libsmsdk.so
Normal file
Binary file not shown.
BIN
core/shumei-tianwang-libs/jniLibs/x86/libsmsdk.so
Normal file
BIN
core/shumei-tianwang-libs/jniLibs/x86/libsmsdk.so
Normal file
Binary file not shown.
BIN
core/shumei-tianwang-libs/jniLibs/x86_64/libsmsdk.so
Normal file
BIN
core/shumei-tianwang-libs/jniLibs/x86_64/libsmsdk.so
Normal file
Binary file not shown.
BIN
core/shumei-tianwang-libs/smantifraud.jar
Normal file
BIN
core/shumei-tianwang-libs/smantifraud.jar
Normal file
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
package com.yizhuan.xchat_android_core;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("com.yizhuan.xchat_android_core.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
@@ -0,0 +1,259 @@
|
||||
package com.yizhuan.xchat_android_constants;
|
||||
|
||||
import com.yizhuan.xchat_android_core.BuildConfig;
|
||||
|
||||
/**
|
||||
* Created by MadisonRong on 09/08/2018.
|
||||
*/
|
||||
|
||||
public class XChatConstants {
|
||||
|
||||
/**
|
||||
* 包名(各种缓存目录的根目录)
|
||||
*/
|
||||
public static final String XCHAT_DIR_NAME = "com.wudoo.qingxun";
|
||||
|
||||
/**
|
||||
* sp名字
|
||||
*/
|
||||
public static final String XCHAT_SHARE_PREFERENCE_NAME = "qx_share_data";
|
||||
|
||||
/**
|
||||
* 加密接口参数
|
||||
*/
|
||||
public static final String DES_ENCRYPT_KEY_SMS_PARAMS = "70d26f6a5c214d3b858f3f8daad7a161";
|
||||
|
||||
/**
|
||||
* 加密接口签名
|
||||
*/
|
||||
public static final String DES_ENCRYPT_KEY_SMS_SIGN = "c8d514b3cdc44e898e027940e84f036c";
|
||||
|
||||
/**
|
||||
* 本地数据库的名字(目前是用 realm 数据库)
|
||||
*/
|
||||
public static final String XCHAT_DATABASE_NAME = "qx.db";
|
||||
|
||||
/**
|
||||
* 微信支付 APP ID
|
||||
*/
|
||||
public static final String WX_APP_ID = "";
|
||||
|
||||
/**
|
||||
* bugly key (DEBUG)
|
||||
*/
|
||||
public static final String BUGLY_KEY_DEBUG = "0a1c8049b9";
|
||||
|
||||
/**
|
||||
* bugly key (RELEASE)
|
||||
*/
|
||||
public static final String BUGLY_KEY_RELEASE = "3ffe6f95c2";
|
||||
|
||||
/**
|
||||
* 云信 key (DEBUG)
|
||||
*/
|
||||
public static final String NIM_KEY_DEBUG = "2c375581f900a7b4ea3922fa7643f307";
|
||||
|
||||
/**
|
||||
* 云信 key (RELEASE)
|
||||
*/
|
||||
public static final String NIM_KEY_RELEASE = "ca46478c438dda51d25306f52fe7506b";
|
||||
|
||||
/**
|
||||
* 网易易盾 productNumber
|
||||
*/
|
||||
public static final String YI_DUN_PRODUCT_NUMBER = "YD00937811914948";
|
||||
|
||||
/**
|
||||
* 网易易盾 业务 ID 注册
|
||||
*/
|
||||
public static final String YI_DUN_BUSINESS_ID = "af43d0f8752147c48f8281800da6049e";
|
||||
/**
|
||||
* 网易易盾 业务 ID 注册
|
||||
*/
|
||||
public static final String YI_DUN_LOGIN_BUSINESS_ID = "67881c7a69764c058435ba93a51b1285";
|
||||
|
||||
/**
|
||||
* 数美-天网 的 organization
|
||||
*/
|
||||
public static final String SHU_MEI_TIAN_WANG_ORGANIZATION = "2qjgWI5tyNipa08YPjOt";
|
||||
|
||||
/**
|
||||
* 声网 key
|
||||
*/
|
||||
public static final String AGORA_KEY = "c5f1fa4878d141f99f3e86ec59f619d9";
|
||||
|
||||
/**
|
||||
* 七牛 access_url
|
||||
*/
|
||||
public static final String QINIU_ACCESS_URL = "https://img.erbanyy.com/";
|
||||
|
||||
/**
|
||||
* 七牛 access_bucket
|
||||
*/
|
||||
public static final String QINIU_ACCESS_BUCKET = "erban-img";
|
||||
|
||||
/**
|
||||
* 七牛 access_key
|
||||
*/
|
||||
public static final String QINIU_ACCESS_KEY = "_yrUANU6t3YGhNXZzdMNt03EhqDKUvFZ3oSbAAKJ";
|
||||
|
||||
/**
|
||||
* 七牛 secret_key
|
||||
*/
|
||||
public static final String QINIU_SECRET_KEY = "PJ-NZ_qc0cabSebH2A9eYsodgRMFqV3tOFbP2Grr";
|
||||
|
||||
/**
|
||||
* 阿里云日志空间名字
|
||||
*/
|
||||
public static final String ALIYUN_LOG_NAME = "qingxunlog";
|
||||
/**
|
||||
* 阿里云日志空间名字
|
||||
*/
|
||||
public static final String ALIYUN_LOG_STORE = "qingxunlog";
|
||||
|
||||
/**
|
||||
* 百度统计 key
|
||||
*/
|
||||
public static final String BAIDU_APP_KEY = "a9d2302aef";
|
||||
|
||||
/**
|
||||
* 友盟统计 key
|
||||
*/
|
||||
public static final String UMENG_APP_KEY = "5d3ac7853fc19591d2000384";
|
||||
|
||||
/**
|
||||
* linkedMe key
|
||||
*/
|
||||
public static final String LINKED_ME_KEY = "978cd79c98264f836450afda1228762e";
|
||||
|
||||
/**
|
||||
* 公屏第一条提示消息
|
||||
*/
|
||||
public static final String MESSAGE_VIEW_FIRST_MSG = "封面、背景及内容含低俗、引导、暴露等都会被屏蔽处理,泄露用户隐私、导流第三方平台、欺诈用户等将被封号处理。请珍惜自己的房间哦!";
|
||||
|
||||
/**
|
||||
* 龙珠表情 ID
|
||||
*/
|
||||
public static final int DRAGON_BALL_ID = 40;
|
||||
|
||||
/**
|
||||
* 分享 H5 的 URL
|
||||
*/
|
||||
public static final String SHARE_H5_URL = "/activity/double12/index.html";
|
||||
|
||||
/**
|
||||
* 分享房间文本
|
||||
*/
|
||||
public static final String SHARE_ROOM_TEXT = "带你走进Ta的房间——";
|
||||
|
||||
/**
|
||||
* 分享房间标题
|
||||
*/
|
||||
public static final String SHARE_ROOM_TITLE = "上轻寻,轻松寻觅对的TA";
|
||||
|
||||
/**
|
||||
* 分享房间 URL
|
||||
*/
|
||||
public static final String SHARE_ROOM_URL = "/modules/share/share_room.html?shareUid=";
|
||||
|
||||
/**
|
||||
* 分享家族文本
|
||||
*/
|
||||
public static final String SHARE_FAMILY_TEXT = "加入家族,和你兴趣相投的小伙伴一起玩耍吧~";
|
||||
|
||||
/**
|
||||
* 分享家族标题
|
||||
*/
|
||||
public static final String SHARE_FAMILY_TITLE = "hi,我想邀请您加入我的轻寻家族:";
|
||||
|
||||
/**
|
||||
* 分享家族 URL
|
||||
*/
|
||||
public static final String SHARE_FAMILY_URL = "/modules/share/share_family.html";
|
||||
|
||||
/**
|
||||
* 分享群组文本
|
||||
*/
|
||||
public static final String SHARE_TEAM_TEXT = "加入家族,和你兴趣相投的小伙伴一起玩耍吧~";
|
||||
|
||||
/**
|
||||
* 分享群组标题
|
||||
*/
|
||||
public static final String SHARE_TEAM_TITLE = "hi,我想邀请您加入我的轻寻群聊:";
|
||||
|
||||
/**
|
||||
* 分享群组 URL
|
||||
*/
|
||||
public static final String SHARE_TEAM_URL = "/modules/share/share_family.html";
|
||||
/**
|
||||
* 分享群组 URL
|
||||
*/
|
||||
public static final String SHARE_WORLD_DYNAMIC_URL = "/modules/world/share-page/index.html";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 游戏排行榜 URL
|
||||
*/
|
||||
public static final String GAME_ROOK = "/modules/erbanRank/game_rank.html?type=week";
|
||||
|
||||
/**
|
||||
* 系统消息那个用户的UID
|
||||
*/
|
||||
public static final long SYSTEM_MESSAGER_UID = 90295478;
|
||||
|
||||
/**
|
||||
* 测试环境系统消息那个用户的UID
|
||||
*/
|
||||
public static final long SYSTEM_MESSAGER_UID_DEBUG = 94188;
|
||||
|
||||
/**
|
||||
* 小秘书那个用户的UID
|
||||
*/
|
||||
public static final long SECRETARY_UID = 90003989;
|
||||
/**
|
||||
* 测试小秘书那个用户的UID
|
||||
*/
|
||||
public static final long SECRETARY_UID_DEBUG = 91333;
|
||||
|
||||
/**
|
||||
* 登录页面「如何登录」对应的 H5 页面
|
||||
*/
|
||||
public static final String LOGIN_ERBAN_ACCOUNT_URL = "/modules/rule/login_tips.html";
|
||||
public static final String ROOM_INTRODUCTION = "可点击房间话题查看本房间公告";
|
||||
|
||||
public static final String SHOW = "show";
|
||||
public static final String HIDE = "hide";
|
||||
|
||||
/**
|
||||
* 网易七鱼客服系统key
|
||||
*/
|
||||
public static final String QI_YU_KF_KEY = BuildConfig.DEBUG ? "411661bd233f0805626044b6d65fa74a" : "411661bd233f0805626044b6d65fa74a";
|
||||
|
||||
public static final String UPDATE_VERSION_TIPS = "版本过旧,请下载最新版本哦";
|
||||
|
||||
public static final String NET_ERROR = "网络错误";
|
||||
|
||||
public static final String UNKOWN_ERROR = "未知错误";
|
||||
|
||||
public static final String EMPTY_USER_INFO_TIPS = "用户信息为空,请重新登录";
|
||||
|
||||
/**
|
||||
* 当布局记录为空时的提示,比如礼物,充值
|
||||
*/
|
||||
public static final String EMPTY_RECORD_AND_THREE_MONTHS_TIPSS = "仅支持查看3个月内记录";
|
||||
|
||||
// 举报入口标识
|
||||
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_WORLD = "world"; // 小世界
|
||||
public static final String REPORT_TYPE_VOICE = "voice"; // 声音瓶子
|
||||
public static final String REPORT_TYPE_MISSION = ""; // 师徒
|
||||
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";//广场动态
|
||||
|
||||
}
|
@@ -0,0 +1,272 @@
|
||||
package com.yizhuan.xchat_android_core;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* 请求接口接口地址
|
||||
*/
|
||||
public class UriProvider {
|
||||
|
||||
|
||||
public static String SERVER_DEBUG = "http://beta.tutuyuyin.com/";
|
||||
|
||||
public static String SERVER_STAGING = "http://staging.tutuyuyin.com/";
|
||||
public static String SERVER_RELEASE = "https://www.tutuyuyin.com/";
|
||||
|
||||
|
||||
/**
|
||||
* 初始化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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 默认以下生产环境地址
|
||||
*/
|
||||
public static String JAVA_WEB_URL = "http://www.daxiaomao.com";
|
||||
public static String IM_SERVER_URL = "https://www.daxiaomao.com";
|
||||
|
||||
public static String getGroupResourceBaseUri() {
|
||||
return JAVA_WEB_URL.concat("/app/service/resource/list");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public static String getLotteryActivityPage() {
|
||||
return IM_SERVER_URL.concat("/activity/double12/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 贵族订单页面
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
public static String getNobleOrderPage() {
|
||||
return IM_SERVER_URL.concat("/modules/noble/order.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取房间背景(有动效)
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
public static String getRoomBg() {
|
||||
return IM_SERVER_URL.concat("/modules/noble/roomBgList.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取贵族推荐页面
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
public static String getNobleIntroducePage() {
|
||||
return IM_SERVER_URL.concat("/modules/noble/intro.html");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 贵族介绍页
|
||||
*/
|
||||
public static String getNobleIntro() {
|
||||
return IM_SERVER_URL.concat("/modules/nobles/intro.html");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 等级界面
|
||||
*/
|
||||
public static String getUserLevelUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/level/my-level.html?type=user");
|
||||
}
|
||||
|
||||
/**
|
||||
* 等级界面
|
||||
*/
|
||||
public static String getUserCharmLevelUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/level/my-level.html?type=charm");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 耳伴头条 http://beta.tutuyuyin.com/modules/headNews/index.html
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getErbanTopMessageUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/headNews/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 耳伴头条(与我相关) http://beta.tutuyuyin.com/modules/headNews/index.html
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getRelatedToMeHeadLineUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/headNews/index.html?atMe=1");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建家族
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getCreateFamilyUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/family/create.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族指南
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getFamilyInstructionUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/family/handbook.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族币获取帮助
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getFamilyCurrencyHelpUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/family/faq.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 举报页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getReportPageUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/report/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 公聊大厅 --> 面壁墙
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getReportWallUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/inform/inform-list.html ");
|
||||
}
|
||||
|
||||
/**
|
||||
* 公聊大厅 --> 帮助
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getPublicChatHallHelpUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/inform/help.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户协议H5
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getUserProtocolUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/guide/protocol.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 举报H5
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getUserReportUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/inform/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 小世界-说明
|
||||
*/
|
||||
public static String getMiniWorldRuleUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/world-rule/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 轻寻专属,实名认证页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getTutuRealNamePage() {
|
||||
return JAVA_WEB_URL.concat("/modules/identity/new.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 轻寻专属,101技能认证页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getTutuAprove() {
|
||||
return JAVA_WEB_URL.concat("/activity/tutu101-2/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 师徒攻略
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getMentoringRelationshipGuide() {
|
||||
return JAVA_WEB_URL.concat("/modules/strategy/strategy.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 名师排行榜
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getMentorRankingList() {
|
||||
return JAVA_WEB_URL.concat("/modules/strategy/teacher-list.html");
|
||||
}
|
||||
|
||||
public static String getCommnunityNorms() {
|
||||
return JAVA_WEB_URL.concat("/modules/rule/community-norms.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐私协议
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getPrivacyAgreement() {
|
||||
return JAVA_WEB_URL.concat("/modules/rule/privacy-wap.html");
|
||||
}
|
||||
|
||||
public static String getUserAgreement() {
|
||||
return JAVA_WEB_URL.concat("/modules/guide/protocol.html");
|
||||
}
|
||||
|
||||
public static String getLinkUrl(String linkUrl) {
|
||||
if (TextUtils.isEmpty(linkUrl)) {
|
||||
return JAVA_WEB_URL;
|
||||
}
|
||||
return JAVA_WEB_URL.concat(linkUrl);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,159 @@
|
||||
package com.yizhuan.xchat_android_core.audio;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.HistoryVoiceInfo;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.SaveVoiceSuccessResultInfo;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.UserVoiceInfo;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.VoiceCardInfo;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.VoiceMatchInfo;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_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,87 @@
|
||||
package com.yizhuan.xchat_android_core.audio;
|
||||
|
||||
import com.yizhuan.xchat_android_core.audio.bean.HistoryVoiceInfo;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.SaveVoiceSuccessResultInfo;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.UserVoiceInfo;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.VoiceCardInfo;
|
||||
import com.yizhuan.xchat_android_core.audio.bean.VoiceMatchInfo;
|
||||
import com.yizhuan.xchat_android_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.yizhuan.xchat_android_core.audio.bean;
|
||||
|
||||
/**
|
||||
* 查询旧版本个人介绍声音
|
||||
*/
|
||||
public class HistoryVoiceInfo {
|
||||
|
||||
/**
|
||||
* historyVoice : {"id":14,"uid":900005,"defFlag":true,"status":2,"playCount":0,"likeCount":0,"gender":1,"voiceUrl":"https://img.erbanyy.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://img.erbanyy.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.yizhuan.xchat_android_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,109 @@
|
||||
package com.yizhuan.xchat_android_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,54 @@
|
||||
package com.yizhuan.xchat_android_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.yizhuan.xchat_android_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://img.erbanyy.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,85 @@
|
||||
package com.yizhuan.xchat_android_core.channel;
|
||||
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.user.event.CurrentUserInfoCompleteEvent;
|
||||
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleEmitter;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
public class ChannelModel extends BaseModel implements IChannelModel{
|
||||
|
||||
private final static class InstanceHolder{
|
||||
public final static IChannelModel instance = new ChannelModel();
|
||||
}
|
||||
|
||||
private ChannelModel() {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
public static IChannelModel get(){
|
||||
return InstanceHolder.instance;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onCurrentUserInfoCompleteEvent(CurrentUserInfoCompleteEvent event){
|
||||
notifyChannelStatistic(AuthModel.get().getCurrentUid());
|
||||
}
|
||||
|
||||
/**
|
||||
* 第一次注册->登录->填写完资料, 调用一下渠道接口,告知渠道统计
|
||||
*/
|
||||
private void notifyChannelStatistic(long uid) {
|
||||
String channel = AppMetaDataUtil.getChannelID();
|
||||
if ("WM_cpa".equals(channel)) {
|
||||
Single.create(new SingleOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> e) throws Exception {
|
||||
//这里判断新设备,新用户
|
||||
UserInfo userInfo = UserModel.get().getUserInfo(uid).blockingGet();
|
||||
if (!userInfo.isNewUser()) {
|
||||
e.onSuccess("不是新用户。");
|
||||
return;
|
||||
}
|
||||
URL url = new URL(getWMCPAChannelStatisticUrl());
|
||||
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
|
||||
httpURLConnection.setReadTimeout(30 * 1000);
|
||||
httpURLConnection.setRequestMethod("GET");
|
||||
httpURLConnection.connect();
|
||||
int respCode = -1;
|
||||
if ((respCode = httpURLConnection.getResponseCode()) == 200){
|
||||
Logger.i("请求成功->"+respCode );
|
||||
e.onSuccess("请求成功");
|
||||
}else {
|
||||
Logger.i("请求成功->" + respCode);
|
||||
e.onError(new Throwable("请求异常 code:"+respCode));
|
||||
}
|
||||
httpURLConnection.disconnect();
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取WM_cpa渠道的统计连接
|
||||
* @return
|
||||
*/
|
||||
private String getWMCPAChannelStatisticUrl() {
|
||||
return "http://veim.lrswl.com/effect.php?type=ef&pid=2735";
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.yizhuan.xchat_android_core.channel;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
|
||||
public interface IChannelModel extends IModel {
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package com.yizhuan.xchat_android_core.constant;
|
||||
|
||||
public class SharePreferenceKey {
|
||||
/**是否显示首页的遮罩*/
|
||||
public static final String KEY_SHOW_HOME_COVER = "SHOW_HOME_COVER";
|
||||
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package com.yizhuan.xchat_android_core.home;
|
||||
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo;
|
||||
import com.yizhuan.xchat_android_library.coremanager.IBaseCore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 主页接口逻辑处理
|
||||
* Created by zhouxiangfeng on 2017/5/17.
|
||||
*/
|
||||
public interface IHomeCore extends IBaseCore {
|
||||
//全局数据--------------------------
|
||||
|
||||
List<TabInfo> getMainTabInfos();
|
||||
|
||||
void setMainTabInfos(List<TabInfo> tabInfoList);
|
||||
|
||||
//接口数据------------------------------
|
||||
|
||||
void getHomeData(int page, int pageSize);
|
||||
|
||||
void getLightChatData(int tabType);
|
||||
|
||||
void getHotData(int tabType);
|
||||
|
||||
void getHomePartyData(int tabType);
|
||||
|
||||
void commitFeedback(long uid, String feedbackDesc, String contact);
|
||||
|
||||
void getHomeBanner();
|
||||
|
||||
/** 获取首页排行数据 */
|
||||
void getRankingData();
|
||||
|
||||
/** 获取首页tab数据 */
|
||||
void getMainTabData();
|
||||
|
||||
/**
|
||||
* 获取tab下的数据
|
||||
*
|
||||
* @param tagId tab的id
|
||||
* @param pageNum 当前页数
|
||||
* @param pageSize 页的总数
|
||||
*/
|
||||
void getMainDataByTab(int tagId, int pageNum, int pageSize);
|
||||
|
||||
/**
|
||||
* 获取发现页数据
|
||||
* @param udi
|
||||
*/
|
||||
void loadFindPage(String udi);
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
package com.yizhuan.xchat_android_core.home;
|
||||
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.FindInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoom;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoomList;
|
||||
import com.yizhuan.xchat_android_library.coremanager.ICoreClient;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author zhouxiangfeng
|
||||
* @date 2017/5/17
|
||||
*/
|
||||
|
||||
public interface IHomeCoreClient extends ICoreClient {
|
||||
|
||||
String METHOD_ON_GET_HOME_DATA = "onGetHomeData";
|
||||
String METHOD_GET_HOME_LIST_ERROR = "onGetHomeListFail";
|
||||
|
||||
String METHOD_ON_GET_DATA_BY_TAB = "onGetHomeDataByTab";
|
||||
String METHOD_ON_GET_DATA_BY_TAB_ERROR = "onGetHomeDataByTabFail";
|
||||
|
||||
public static final String METHOD_ON_GET_HOT_DATA = "onGetHotData";
|
||||
public static final String METHOD_ON_GET_HOT_DATA_FAIL = "onGetHotDataFail";
|
||||
|
||||
public static final String METHOD_ON_GET_LIGHT_CHAT_DATA = "onGetLightChatData";
|
||||
public static final String METHOD_ON_GET_LIGHT_CHAT_DATA_FAIL = "onGetLightChatDataFail";
|
||||
|
||||
public static final String METHOD_ON_GET_HOME_PARTY_DATA = "onGetHomePartyData";
|
||||
public static final String METHOD_ON_GET_HOME_PARTY_DATA_FAIL = "onGetHomePartyDataFail";
|
||||
|
||||
public static final String METHOD_ON_COMMIT_BACK = "onCommitFeedback";
|
||||
public static final String METHOD_ON_COMMIT_BACK_FAIL = "onCommitFeedbackFail";
|
||||
|
||||
public static final String METHOD_ON_GET_BANNER_LIST = "onGetBannerList";
|
||||
public static final String METHOD_ON_GET_BANNER_LIST_FAIL = "onGetBannerListFail";
|
||||
|
||||
String METHOD_ON_GET_HOME_RANKING_LIST = "onGetHomeRankingList";
|
||||
String METHOD_ON_GET_HOME_RANKING_LIST_ERROR = "onGetHomeRankingListFail";
|
||||
|
||||
String METHOD_ON_GET_HOME_TAB_LIST = "onGetHomeTabList";
|
||||
String METHOD_ON_GET_HOME_TAB_LIST_ERROR = "onGetHomeTabListFail";
|
||||
|
||||
public void onGetHomeData(List<HomeRoom> homeDataList);
|
||||
|
||||
public void onGetHomeListFail(String error);
|
||||
|
||||
public void onGetHotData(HomeRoomList homeRoomList);
|
||||
|
||||
public void onGetHotDataFail(String error);
|
||||
|
||||
public void onGetLightChatData(HomeRoomList homeRoomList);
|
||||
|
||||
public void onGetLightChatDataFail(String error);
|
||||
|
||||
public void onGetHomePartyData(HomeRoomList homeRoomList);
|
||||
|
||||
public void onGetHomePartyDataFail(String error);
|
||||
|
||||
void onGetBannerList(List<BannerInfo> bannerInfoList);
|
||||
|
||||
void onGetBannerListFail();
|
||||
|
||||
void onCommitFeedback();
|
||||
|
||||
void onCommitFeedbackFail(String error);
|
||||
|
||||
String METHOD_ON_LOAD_FIND_PAGE_DATA = "onLoadFindPageData";
|
||||
void onLoadFindPageData(FindInfo findInfo);
|
||||
|
||||
String METHOD_ON_LOAD_FIND_PAGE_DATA_FAIL = "onLoadFindPageDataFail";
|
||||
void onLoadFindPageDataFail(String error);
|
||||
}
|
@@ -0,0 +1,89 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/8/7.
|
||||
*/
|
||||
@Data
|
||||
public class BannerInfo implements Parcelable, Serializable {
|
||||
/**
|
||||
* 跳转app
|
||||
*/
|
||||
public final static transient int SKIP_TYP_APP = 1;
|
||||
/**
|
||||
* 跳转房间
|
||||
*/
|
||||
public final static transient int SKIP_TYP_CHAT_ROOM = 2;
|
||||
/**
|
||||
* 跳转H5显示
|
||||
*/
|
||||
public final static transient int SKIP_TYP_H5 = 3;
|
||||
|
||||
/**
|
||||
* routerhandler跳转规则
|
||||
*/
|
||||
public final static transient int SKIP_TYPE_ROUTER = 5;
|
||||
|
||||
/*
|
||||
bannerId:1 //id
|
||||
bannerName: xx//横幅广告名称
|
||||
bannerPic:xx //横幅图片
|
||||
skipType:xx // 1跳app页面,2跳聊天室,3跳h5页面
|
||||
skipUri:xx //跳转uri
|
||||
*/
|
||||
private int bannerId;
|
||||
private String bannerName;
|
||||
private String bannerPic;
|
||||
private int skipType;
|
||||
private String skipUri;
|
||||
/**
|
||||
* 路由类型
|
||||
*/
|
||||
private String routerType;
|
||||
/**
|
||||
* 路由值
|
||||
*/
|
||||
private String routerValue;
|
||||
|
||||
protected BannerInfo(Parcel in) {
|
||||
bannerId = in.readInt();
|
||||
bannerName = in.readString();
|
||||
bannerPic = in.readString();
|
||||
skipType = in.readInt();
|
||||
skipUri = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(bannerId);
|
||||
dest.writeString(bannerName);
|
||||
dest.writeString(bannerPic);
|
||||
dest.writeInt(skipType);
|
||||
dest.writeString(skipUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<BannerInfo> CREATOR = new Creator<BannerInfo>() {
|
||||
@Override
|
||||
public BannerInfo createFromParcel(Parcel in) {
|
||||
return new BannerInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BannerInfo[] newArray(int size) {
|
||||
return new BannerInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/17
|
||||
*/
|
||||
@Data
|
||||
public class CategoryInfo implements Parcelable,Serializable {
|
||||
|
||||
private String icon;
|
||||
private String title;
|
||||
private List<TabInfo> tabInfos;
|
||||
|
||||
public CategoryInfo() {
|
||||
}
|
||||
|
||||
|
||||
protected CategoryInfo(Parcel in) {
|
||||
icon = in.readString();
|
||||
title = in.readString();
|
||||
tabInfos = in.createTypedArrayList(TabInfo.CREATOR);
|
||||
}
|
||||
|
||||
public static final Creator<CategoryInfo> CREATOR = new Creator<CategoryInfo>() {
|
||||
@Override
|
||||
public CategoryInfo createFromParcel(Parcel in) {
|
||||
return new CategoryInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CategoryInfo[] newArray(int size) {
|
||||
return new CategoryInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
|
||||
dest.writeString(icon);
|
||||
dest.writeString(title);
|
||||
dest.writeTypedList(tabInfos);
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/11/15
|
||||
*/
|
||||
@Data
|
||||
public class ClassifiedRoomInfo {
|
||||
private List<HomeRoom> rooms;
|
||||
private ArrayList<BannerInfo> banners;
|
||||
}
|
@@ -0,0 +1,68 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/24
|
||||
*/
|
||||
@Data
|
||||
public class FindEntranceInfo {
|
||||
public final static int TYPE_H5 = 1;
|
||||
public final static int TYPE_ROOM = 2;
|
||||
public final static int TYPE_GAME = 3;
|
||||
public final static int TYPE_DECORATION = 4;
|
||||
/**
|
||||
* 如果type=5,表示转到{@link com.yizhuan.xchat_android_core.im.custom.bean.RouterType} 处理
|
||||
*/
|
||||
public final static int TYPE_TO_ROUTERTYPE = 5;
|
||||
|
||||
/**
|
||||
* 签到入口
|
||||
*/
|
||||
public final static int ACTIVITYTYPE_SIGN_IN = 1;
|
||||
|
||||
/**
|
||||
* 任务入口
|
||||
*/
|
||||
public final static int ACTIVITYTYPE_TASK = 2;
|
||||
|
||||
private int id;
|
||||
private String pic;
|
||||
private int type;//'跳转类型1是链接 2是房间 3是游戏 4是装扮商城',
|
||||
private String param;
|
||||
|
||||
//start**********以下3.2.4之后接入
|
||||
/**
|
||||
* {@link com.yizhuan.xchat_android_core.im.custom.bean.RouterType}
|
||||
*/
|
||||
private int routerType;//3.2.4之后接入,优先获取旧版的type,得不到结果再处理routerType
|
||||
|
||||
private String routerValue;
|
||||
/**
|
||||
* 今日未完成的任务数量,任务和签到的时候用到
|
||||
*/
|
||||
private int missionNum;
|
||||
|
||||
/**
|
||||
* 活动类型,1:签到,2:任务
|
||||
*/
|
||||
private int activityType;
|
||||
|
||||
/**
|
||||
* 今日是否已经签到
|
||||
*/
|
||||
private boolean signStatus;
|
||||
|
||||
/**
|
||||
* 小图
|
||||
*/
|
||||
private String minPic;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
//end********
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import com.yizhuan.xchat_android_core.family.bean.FamilyInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/31
|
||||
*/
|
||||
@Data
|
||||
public class FindInfo {
|
||||
private List<FindEntranceInfo> banners;
|
||||
private FamilyInfo family;
|
||||
/**
|
||||
* 发现也banner
|
||||
*/
|
||||
private List<BannerInfo> bannerVos;
|
||||
|
||||
private List<TopMessage> topLineVos;
|
||||
}
|
@@ -0,0 +1,554 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GameHomeInfo {
|
||||
|
||||
private List<RoomVosBean> roomVos;
|
||||
|
||||
public List<RoomVosBean> getRoomVos() {
|
||||
return roomVos;
|
||||
}
|
||||
|
||||
public void setRoomVos(List<RoomVosBean> roomVos) {
|
||||
this.roomVos = roomVos;
|
||||
}
|
||||
|
||||
public static class RoomVosBean {
|
||||
/**
|
||||
* data : [{"uid":902385,"officeUser":1,"roomId":59451609,"title":"神啊救救我啊的房间","type":3,"meetingName":"5521f0cd18c142cdacb64b4914d164af","valid":true,"operatorStatus":1,"avatar":"https://img.erbanyy.com/picture_1552544625116.jpg?imageslim","roomDesc":"","backPic":"","openTime":"Mar 20, 2019 5:21:48 PM","onlineNum":0,"abChannelType":1,"gender":2,"nick":"神啊救救我啊","erbanNo":9090518,"roomPwd":"","roomTag":"聊天","calcSumDataIndex":0,"tagId":8,"tagPict":"https://img.erbanyy.com/new_tag_%E8%81%8A%E5%A4%A9@3x.png","recomSeq":0,"badge":"https://img.erbanyy.com/Fs-YL5F0qpA2bZbmRcwQInh12NXg?imageslim","isPermitRoom":1,"isRecom":0,"count":0,"hasAnimationEffect":true,"audioQuality":1,"isCloseScreen":false,"hasDragonGame":false,"hasKTVPriv":true,"isOpenKTV":false,"isOpenGame":false,"roomModeType":3,"limitType":"lock","roomGame":{"roomId":59451609,"uid":902385,"startUid":0,"gameId":"","gameName":"","status":2,"createTime":"Mar 19, 2019 10:59:43 AM","updateTime":"Mar 20, 2019 11:01:57 AM"},"isPureMode":false,"isExceptionClose":false}]
|
||||
* title : 102
|
||||
* type : 3
|
||||
* moduleId : 42
|
||||
* seqNo : 1
|
||||
*/
|
||||
|
||||
private String title;
|
||||
private int type;
|
||||
private int moduleId;
|
||||
private int seqNo;
|
||||
private List<DataBean> data;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getModuleId() {
|
||||
return moduleId;
|
||||
}
|
||||
|
||||
public void setModuleId(int moduleId) {
|
||||
this.moduleId = moduleId;
|
||||
}
|
||||
|
||||
public int getSeqNo() {
|
||||
return seqNo;
|
||||
}
|
||||
|
||||
public void setSeqNo(int seqNo) {
|
||||
this.seqNo = seqNo;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
/**
|
||||
* uid : 902385
|
||||
* officeUser : 1
|
||||
* roomId : 59451609
|
||||
* title : 神啊救救我啊的房间
|
||||
* type : 3
|
||||
* meetingName : 5521f0cd18c142cdacb64b4914d164af
|
||||
* valid : true
|
||||
* operatorStatus : 1
|
||||
* avatar : https://img.erbanyy.com/picture_1552544625116.jpg?imageslim
|
||||
* roomDesc :
|
||||
* backPic :
|
||||
* openTime : Mar 20, 2019 5:21:48 PM
|
||||
* onlineNum : 0
|
||||
* abChannelType : 1
|
||||
* gender : 2
|
||||
* nick : 神啊救救我啊
|
||||
* erbanNo : 9090518
|
||||
* roomPwd :
|
||||
* roomTag : 聊天
|
||||
* calcSumDataIndex : 0
|
||||
* tagId : 8
|
||||
* tagPict : https://img.erbanyy.com/new_tag_%E8%81%8A%E5%A4%A9@3x.png
|
||||
* recomSeq : 0
|
||||
* badge : https://img.erbanyy.com/Fs-YL5F0qpA2bZbmRcwQInh12NXg?imageslim
|
||||
* isPermitRoom : 1
|
||||
* isRecom : 0
|
||||
* count : 0
|
||||
* hasAnimationEffect : true
|
||||
* audioQuality : 1
|
||||
* isCloseScreen : false
|
||||
* hasDragonGame : false
|
||||
* hasKTVPriv : true
|
||||
* isOpenKTV : false
|
||||
* isOpenGame : false
|
||||
* roomModeType : 3
|
||||
* limitType : lock
|
||||
* roomGame : {"roomId":59451609,"uid":902385,"startUid":0,"gameId":"","gameName":"","status":2,"createTime":"Mar 19, 2019 10:59:43 AM","updateTime":"Mar 20, 2019 11:01:57 AM"}
|
||||
* isPureMode : false
|
||||
* isExceptionClose : false
|
||||
*/
|
||||
|
||||
private int uid;
|
||||
private int officeUser;
|
||||
private int roomId;
|
||||
private String title;
|
||||
private int type;
|
||||
private String meetingName;
|
||||
private boolean valid;
|
||||
private int operatorStatus;
|
||||
private String avatar;
|
||||
private String roomDesc;
|
||||
private String backPic;
|
||||
private String openTime;
|
||||
private int onlineNum;
|
||||
private int abChannelType;
|
||||
private int gender;
|
||||
private String nick;
|
||||
private int erbanNo;
|
||||
private String roomPwd;
|
||||
private String roomTag;
|
||||
private int calcSumDataIndex;
|
||||
private int tagId;
|
||||
private String tagPict;
|
||||
private int recomSeq;
|
||||
private String badge;
|
||||
private int isPermitRoom;
|
||||
private int isRecom;
|
||||
private int count;
|
||||
private boolean hasAnimationEffect;
|
||||
private int audioQuality;
|
||||
private boolean isCloseScreen;
|
||||
private boolean hasDragonGame;
|
||||
private boolean hasKTVPriv;
|
||||
private boolean isOpenKTV;
|
||||
private boolean isOpenGame;
|
||||
private int roomModeType;
|
||||
private String limitType;
|
||||
private RoomGameBean roomGame;
|
||||
private boolean isPureMode;
|
||||
private boolean isExceptionClose;
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getOfficeUser() {
|
||||
return officeUser;
|
||||
}
|
||||
|
||||
public void setOfficeUser(int officeUser) {
|
||||
this.officeUser = officeUser;
|
||||
}
|
||||
|
||||
public int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMeetingName() {
|
||||
return meetingName;
|
||||
}
|
||||
|
||||
public void setMeetingName(String meetingName) {
|
||||
this.meetingName = meetingName;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return valid;
|
||||
}
|
||||
|
||||
public void setValid(boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
public int getOperatorStatus() {
|
||||
return operatorStatus;
|
||||
}
|
||||
|
||||
public void setOperatorStatus(int operatorStatus) {
|
||||
this.operatorStatus = operatorStatus;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getRoomDesc() {
|
||||
return roomDesc;
|
||||
}
|
||||
|
||||
public void setRoomDesc(String roomDesc) {
|
||||
this.roomDesc = roomDesc;
|
||||
}
|
||||
|
||||
public String getBackPic() {
|
||||
return backPic;
|
||||
}
|
||||
|
||||
public void setBackPic(String backPic) {
|
||||
this.backPic = backPic;
|
||||
}
|
||||
|
||||
public String getOpenTime() {
|
||||
return openTime;
|
||||
}
|
||||
|
||||
public void setOpenTime(String openTime) {
|
||||
this.openTime = openTime;
|
||||
}
|
||||
|
||||
public int getOnlineNum() {
|
||||
return onlineNum;
|
||||
}
|
||||
|
||||
public void setOnlineNum(int onlineNum) {
|
||||
this.onlineNum = onlineNum;
|
||||
}
|
||||
|
||||
public int getAbChannelType() {
|
||||
return abChannelType;
|
||||
}
|
||||
|
||||
public void setAbChannelType(int abChannelType) {
|
||||
this.abChannelType = abChannelType;
|
||||
}
|
||||
|
||||
public int getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(int gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public int getErbanNo() {
|
||||
return erbanNo;
|
||||
}
|
||||
|
||||
public void setErbanNo(int erbanNo) {
|
||||
this.erbanNo = erbanNo;
|
||||
}
|
||||
|
||||
public String getRoomPwd() {
|
||||
return roomPwd;
|
||||
}
|
||||
|
||||
public void setRoomPwd(String roomPwd) {
|
||||
this.roomPwd = roomPwd;
|
||||
}
|
||||
|
||||
public String getRoomTag() {
|
||||
return roomTag;
|
||||
}
|
||||
|
||||
public void setRoomTag(String roomTag) {
|
||||
this.roomTag = roomTag;
|
||||
}
|
||||
|
||||
public int getCalcSumDataIndex() {
|
||||
return calcSumDataIndex;
|
||||
}
|
||||
|
||||
public void setCalcSumDataIndex(int calcSumDataIndex) {
|
||||
this.calcSumDataIndex = calcSumDataIndex;
|
||||
}
|
||||
|
||||
public int getTagId() {
|
||||
return tagId;
|
||||
}
|
||||
|
||||
public void setTagId(int tagId) {
|
||||
this.tagId = tagId;
|
||||
}
|
||||
|
||||
public String getTagPict() {
|
||||
return tagPict;
|
||||
}
|
||||
|
||||
public void setTagPict(String tagPict) {
|
||||
this.tagPict = tagPict;
|
||||
}
|
||||
|
||||
public int getRecomSeq() {
|
||||
return recomSeq;
|
||||
}
|
||||
|
||||
public void setRecomSeq(int recomSeq) {
|
||||
this.recomSeq = recomSeq;
|
||||
}
|
||||
|
||||
public String getBadge() {
|
||||
return badge;
|
||||
}
|
||||
|
||||
public void setBadge(String badge) {
|
||||
this.badge = badge;
|
||||
}
|
||||
|
||||
public int getIsPermitRoom() {
|
||||
return isPermitRoom;
|
||||
}
|
||||
|
||||
public void setIsPermitRoom(int isPermitRoom) {
|
||||
this.isPermitRoom = isPermitRoom;
|
||||
}
|
||||
|
||||
public int getIsRecom() {
|
||||
return isRecom;
|
||||
}
|
||||
|
||||
public void setIsRecom(int isRecom) {
|
||||
this.isRecom = isRecom;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public boolean isHasAnimationEffect() {
|
||||
return hasAnimationEffect;
|
||||
}
|
||||
|
||||
public void setHasAnimationEffect(boolean hasAnimationEffect) {
|
||||
this.hasAnimationEffect = hasAnimationEffect;
|
||||
}
|
||||
|
||||
public int getAudioQuality() {
|
||||
return audioQuality;
|
||||
}
|
||||
|
||||
public void setAudioQuality(int audioQuality) {
|
||||
this.audioQuality = audioQuality;
|
||||
}
|
||||
|
||||
public boolean isIsCloseScreen() {
|
||||
return isCloseScreen;
|
||||
}
|
||||
|
||||
public void setIsCloseScreen(boolean isCloseScreen) {
|
||||
this.isCloseScreen = isCloseScreen;
|
||||
}
|
||||
|
||||
public boolean isHasDragonGame() {
|
||||
return hasDragonGame;
|
||||
}
|
||||
|
||||
public void setHasDragonGame(boolean hasDragonGame) {
|
||||
this.hasDragonGame = hasDragonGame;
|
||||
}
|
||||
|
||||
public boolean isHasKTVPriv() {
|
||||
return hasKTVPriv;
|
||||
}
|
||||
|
||||
public void setHasKTVPriv(boolean hasKTVPriv) {
|
||||
this.hasKTVPriv = hasKTVPriv;
|
||||
}
|
||||
|
||||
public boolean isIsOpenKTV() {
|
||||
return isOpenKTV;
|
||||
}
|
||||
|
||||
public void setIsOpenKTV(boolean isOpenKTV) {
|
||||
this.isOpenKTV = isOpenKTV;
|
||||
}
|
||||
|
||||
public boolean isIsOpenGame() {
|
||||
return isOpenGame;
|
||||
}
|
||||
|
||||
public void setIsOpenGame(boolean isOpenGame) {
|
||||
this.isOpenGame = isOpenGame;
|
||||
}
|
||||
|
||||
public int getRoomModeType() {
|
||||
return roomModeType;
|
||||
}
|
||||
|
||||
public void setRoomModeType(int roomModeType) {
|
||||
this.roomModeType = roomModeType;
|
||||
}
|
||||
|
||||
public String getLimitType() {
|
||||
return limitType;
|
||||
}
|
||||
|
||||
public void setLimitType(String limitType) {
|
||||
this.limitType = limitType;
|
||||
}
|
||||
|
||||
public RoomGameBean getRoomGame() {
|
||||
return roomGame;
|
||||
}
|
||||
|
||||
public void setRoomGame(RoomGameBean roomGame) {
|
||||
this.roomGame = roomGame;
|
||||
}
|
||||
|
||||
public boolean isIsPureMode() {
|
||||
return isPureMode;
|
||||
}
|
||||
|
||||
public void setIsPureMode(boolean isPureMode) {
|
||||
this.isPureMode = isPureMode;
|
||||
}
|
||||
|
||||
public boolean isIsExceptionClose() {
|
||||
return isExceptionClose;
|
||||
}
|
||||
|
||||
public void setIsExceptionClose(boolean isExceptionClose) {
|
||||
this.isExceptionClose = isExceptionClose;
|
||||
}
|
||||
|
||||
public static class RoomGameBean {
|
||||
/**
|
||||
* roomId : 59451609
|
||||
* uid : 902385
|
||||
* startUid : 0
|
||||
* gameId :
|
||||
* gameName :
|
||||
* status : 2
|
||||
* createTime : Mar 19, 2019 10:59:43 AM
|
||||
* updateTime : Mar 20, 2019 11:01:57 AM
|
||||
*/
|
||||
|
||||
private int roomId;
|
||||
private int uid;
|
||||
private int startUid;
|
||||
private String gameId;
|
||||
private String gameName;
|
||||
private int status;
|
||||
private String createTime;
|
||||
private String updateTime;
|
||||
|
||||
public int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getStartUid() {
|
||||
return startUid;
|
||||
}
|
||||
|
||||
public void setStartUid(int startUid) {
|
||||
this.startUid = startUid;
|
||||
}
|
||||
|
||||
public String getGameId() {
|
||||
return gameId;
|
||||
}
|
||||
|
||||
public void setGameId(String gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public String getGameName() {
|
||||
return gameName;
|
||||
}
|
||||
|
||||
public void setGameName(String gameName) {
|
||||
this.gameName = gameName;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/11/22
|
||||
*/
|
||||
@Data
|
||||
public class HomeHallMsgInfo implements Serializable, MultiItemEntity {
|
||||
public static final transient int ITEM_TYPE_LEFT = 1;
|
||||
public static final transient int ITEM_TYPE_RIGHT = 2;
|
||||
public static final transient int ITEM_TYPE_TIP = 3;
|
||||
|
||||
public static final transient int MESSAGE_TYPE_TEXT = 1;
|
||||
public static final transient int MESSAGE_TYPE_GIFT = 2;
|
||||
public static final transient int MESSAGE_TYPE_TIME = 3;
|
||||
|
||||
|
||||
private String fromAccount;
|
||||
private String senderAvatar;
|
||||
private String nick;
|
||||
private CharSequence content;
|
||||
private String userLevelUrl;
|
||||
private String userCharmLevelUrl;
|
||||
private String nobleLevel;
|
||||
private boolean isOfficial;
|
||||
private boolean isNewUser;
|
||||
private boolean isPrettyErbanNo;
|
||||
|
||||
private String targetNick;
|
||||
private String giftImage;
|
||||
private int giftCount;
|
||||
private String giftName;
|
||||
|
||||
private String formatTime;
|
||||
|
||||
|
||||
private int messageType = MESSAGE_TYPE_TEXT;
|
||||
private int itemType;
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
/**
|
||||
* 首页接口数据类型,主要用于区分客户端页面处理类型
|
||||
* Created by lvzebiao on 2019/2/20.
|
||||
*/
|
||||
|
||||
public interface HomeImpDataType {
|
||||
/**
|
||||
* 墙裂推荐
|
||||
*/
|
||||
int RECOMENDED = 1;
|
||||
/**
|
||||
* 热门
|
||||
*/
|
||||
int HOT = 2;
|
||||
/**
|
||||
* 后台可任意配置模块
|
||||
*/
|
||||
int CONFIG = 3;
|
||||
/**
|
||||
* banner信息
|
||||
*/
|
||||
int BANNER = 4;
|
||||
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p> 首页数据 </p>
|
||||
*
|
||||
* @author Administrator
|
||||
* @date 2017/11/22
|
||||
*/
|
||||
@Data
|
||||
public class HomeInfo {
|
||||
private int type;
|
||||
private String title;
|
||||
private String icon;
|
||||
private JsonElement data;
|
||||
/**
|
||||
* 表示大图的数量
|
||||
*/
|
||||
private int maxNum;
|
||||
/**
|
||||
* 表示小图的数量
|
||||
*/
|
||||
private int listNum;
|
||||
private String tagId;
|
||||
public List<BannerInfo> banners;
|
||||
/** 排行数据 */
|
||||
public RankingInfo rankHome;
|
||||
/** 热门推荐 */
|
||||
public List<HomeRoom> hotRooms;
|
||||
/** 房间推荐 */
|
||||
public List<HomeRoom> listRoom;
|
||||
}
|
@@ -0,0 +1,148 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p> 首页View model </p>
|
||||
*
|
||||
* @author jack
|
||||
* @date 2017/11/16
|
||||
*/
|
||||
@Data
|
||||
public class HomeItem<T extends Serializable> implements MultiItemEntity, Parcelable, Serializable{
|
||||
|
||||
//
|
||||
|
||||
public static final transient int TYPE_DIV_1 = -100;//分割线类型1
|
||||
public static final transient int TYPE_DIV_2 = -102;//分割线类型2
|
||||
|
||||
public static final transient int TYPE_BANNER = 4;//首页banner
|
||||
|
||||
public static final transient int TYPE_RECOMMEND = 1; //耳伴推荐
|
||||
//显示方式是3N+M的方式,即是1行3列,和1行1列混排
|
||||
public static final transient int TYPE_CONFIG = 3; //运营可配置模块
|
||||
//显示方式是2*N的方式,即是n行2列,
|
||||
public static final transient int TYPE_TWO_LINES = 5; //运营可配置模块
|
||||
|
||||
public static final transient int TYPE_TOP_MESSAGE = 8;//耳伴头条
|
||||
|
||||
public static final transient int TYPE_MONSTER = -10;//怪兽
|
||||
|
||||
public static final transient int TYPE_KTV = 9; //ktv房间列表
|
||||
|
||||
public static final transient int TYPE_HALL = -20;//交友大厅
|
||||
|
||||
public static final transient int TYPE_MAKE_FRIENDS = 7;//交友
|
||||
|
||||
public static final transient int TYPE_SQUARE_PIC = 21;//首页显示的正方形图的item
|
||||
|
||||
public static final transient int TYPE_LINEAR_LITTLE_PIC = 22;//首页显示的横向小图普通item
|
||||
|
||||
public static final transient int TYPE_SQUARE_EMPTY = 23;//虚位以待
|
||||
|
||||
public static final transient int TYPE_BLOCK_TITLE = 24;//每个模块对应的标题
|
||||
/**
|
||||
* 两列单个显示
|
||||
*/
|
||||
public static final transient int TYPE_BLOCK_SINGLE = 25;
|
||||
/**
|
||||
* banner 不带顶部背景
|
||||
*/
|
||||
public static final transient int TYPE_BANNER_NO_TOP_BG = 26;
|
||||
/**
|
||||
* 新版首页用户列表
|
||||
*/
|
||||
public static final transient int TYPE_USER_LINEAR = 27;
|
||||
/**
|
||||
* 两列数据的虚位以待
|
||||
*/
|
||||
public static final transient int TYPE_DOUBLE_SQUARE_EMPTY = 28;//虚位以待
|
||||
|
||||
|
||||
|
||||
|
||||
//类型
|
||||
private int itemType;
|
||||
|
||||
//正常数据
|
||||
private T data;
|
||||
//分割线描述,0、1、2代表格子,第几列
|
||||
//-1代表需要底部划线,-2代表不需要
|
||||
//-3是其他头部
|
||||
private int dividerDesc;
|
||||
private boolean isShowRankHalfIcon; // 推荐位第三位显示半小时榜图标
|
||||
|
||||
private boolean isHotItem;
|
||||
|
||||
public HomeItem(int itemType) {
|
||||
this(itemType, null);
|
||||
}
|
||||
|
||||
|
||||
public HomeItem(int itemType, T data) {
|
||||
this(itemType, data, false);
|
||||
}
|
||||
|
||||
public HomeItem(int itemType, T data, boolean isHotItem) {
|
||||
this.itemType = itemType;
|
||||
this.data = data;
|
||||
this.dividerDesc = -3;
|
||||
this.isHotItem = isHotItem;
|
||||
}
|
||||
|
||||
|
||||
protected HomeItem(Parcel in) {
|
||||
itemType = in.readInt();
|
||||
data = (T) in.readSerializable();
|
||||
dividerDesc = in.readInt();
|
||||
isHotItem = in.readByte() != 0;
|
||||
isShowRankHalfIcon = in.readByte() != 0;
|
||||
}
|
||||
|
||||
public static final Creator<HomeItem> CREATOR = new Creator<HomeItem>() {
|
||||
@Override
|
||||
public HomeItem createFromParcel(Parcel in) {
|
||||
return new HomeItem(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomeItem[] newArray(int size) {
|
||||
return new HomeItem[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(itemType);
|
||||
dest.writeSerializable(data);
|
||||
dest.writeInt(dividerDesc);
|
||||
dest.writeByte((byte) (isHotItem ? 1 : 0));
|
||||
dest.writeByte((byte) (isShowRankHalfIcon ? 1 : 0));
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 首页更多数据
|
||||
* Created by lvzebiao on 2019/2/21.
|
||||
*/
|
||||
@Data
|
||||
public class HomeMoreData implements Serializable {
|
||||
|
||||
private List<HomeRoom> rooms;
|
||||
|
||||
}
|
@@ -0,0 +1,103 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
import com.yizhuan.xchat_android_core.level.UserLevelVo;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author zhouxiangfeng
|
||||
* @date 2017/5/17
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class HomeRoom extends RoomInfo implements Parcelable, Serializable, MultiItemEntity {
|
||||
/**格子布局*/
|
||||
public final static int TYPE_GIRD = 1;
|
||||
/**格子布局不足3个时的填充布局*/
|
||||
public final static int TYPE_GIRD_EMPTY = 2;
|
||||
/**线性横向布局*/
|
||||
public final static int TYPE_LINEAR = 3;
|
||||
|
||||
//性别 1:男 2:女 0 :未知
|
||||
// private int gender;
|
||||
//
|
||||
//
|
||||
// private String nick;
|
||||
|
||||
private long erbanNo;
|
||||
|
||||
//角标相关的
|
||||
public String badge;
|
||||
|
||||
/** 是否是靓号,1:靓号 */
|
||||
public boolean hasPrettyErbanNo;
|
||||
public NobleInfo nobleUsers;
|
||||
public UserLevelVo userLevelVo;
|
||||
public boolean newUser;
|
||||
|
||||
/**首页星推荐的类型*/
|
||||
private int itemStarType = TYPE_LINEAR;
|
||||
/**房间描述*/
|
||||
private String description;
|
||||
/** 房间技能标签 */
|
||||
private String skillTag;
|
||||
/** 背景图标 */
|
||||
private String icon;
|
||||
|
||||
public HomeRoom() {
|
||||
super();
|
||||
}
|
||||
|
||||
protected HomeRoom(Parcel in) {
|
||||
super(in);
|
||||
// gender = in.readInt();
|
||||
// nick = in.readString();
|
||||
erbanNo = in.readLong();
|
||||
badge = in.readString();
|
||||
hasPrettyErbanNo = in.readByte() != 0;
|
||||
newUser = in.readByte() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
// dest.writeInt(gender);
|
||||
// dest.writeString(nick);
|
||||
dest.writeLong(erbanNo);
|
||||
dest.writeString(badge);
|
||||
dest.writeByte((byte) (hasPrettyErbanNo ? 1 : 0));
|
||||
dest.writeByte((byte) (newUser ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<HomeRoom> CREATOR = new Creator<HomeRoom>() {
|
||||
@Override
|
||||
public HomeRoom createFromParcel(Parcel in) {
|
||||
return new HomeRoom(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomeRoom[] newArray(int size) {
|
||||
return new HomeRoom[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemStarType;
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/11/2
|
||||
*/
|
||||
@Data
|
||||
public class HomeRoomItem<T extends Serializable> implements MultiItemEntity, Serializable {
|
||||
|
||||
public static final transient int TYPE_HOME_ROOM = 1;//房间
|
||||
public static final transient int TYPE_BANNER = 2;//banner
|
||||
public static final transient int TYPE_TOP_THREE = 3;
|
||||
public static final transient int TYPE_TOP_EMPTY = 4;
|
||||
|
||||
private boolean isBannerInTop = false;
|
||||
//类型
|
||||
private int itemType;
|
||||
|
||||
//正常数据
|
||||
private T data;
|
||||
|
||||
public HomeRoomItem(int itemType, T data) {
|
||||
this.itemType = itemType;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoom;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by chenran on 2017/10/4.
|
||||
*/
|
||||
|
||||
public class HomeRoomList implements Serializable{
|
||||
private List<HomeRoom> recomRooms;
|
||||
private List<HomeRoom> gameRooms;
|
||||
private List<HomeRoom> chatRooms;
|
||||
|
||||
public List<HomeRoom> getRecomRooms() {
|
||||
return recomRooms;
|
||||
}
|
||||
|
||||
public void setRecomRooms(List<HomeRoom> recomRooms) {
|
||||
this.recomRooms = recomRooms;
|
||||
}
|
||||
|
||||
public List<HomeRoom> getGameRooms() {
|
||||
return gameRooms;
|
||||
}
|
||||
|
||||
public void setGameRooms(List<HomeRoom> gameRooms) {
|
||||
this.gameRooms = gameRooms;
|
||||
}
|
||||
|
||||
public List<HomeRoom> getChatRooms() {
|
||||
return chatRooms;
|
||||
}
|
||||
|
||||
public void setChatRooms(List<HomeRoom> chatRooms) {
|
||||
this.chatRooms = chatRooms;
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/23
|
||||
*/
|
||||
|
||||
public class HotInfo {
|
||||
// public List<BannerInfo> banners;
|
||||
// /** 排行数据 */
|
||||
// public RankingInfo rankHome;
|
||||
// /** 热门推荐 */
|
||||
// public List<HomeRoom> hotRooms;
|
||||
/** 房间推荐 */
|
||||
public List<HomeRoom> listRoom;
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/11/20
|
||||
*/
|
||||
@Data
|
||||
public class KTVRoom implements Serializable, MultiItemEntity {
|
||||
|
||||
/**
|
||||
* 格子布局
|
||||
*/
|
||||
public final static transient int TYPE_GIRD = 1;
|
||||
/**
|
||||
* 格子布局虚位以待
|
||||
*/
|
||||
public final static transient int TYPE_GIRD_EMPTY = 2;
|
||||
|
||||
private long roomUid;
|
||||
private long roomId;
|
||||
private String avatar;
|
||||
private String title;
|
||||
private String roomDesc;
|
||||
private String singingMusicName;
|
||||
private int onlineNum;
|
||||
private String roomPwd;
|
||||
|
||||
|
||||
private int itemType = TYPE_GIRD_EMPTY;
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/10/30
|
||||
*/
|
||||
@Data
|
||||
public class KTVRoomInfo implements Serializable{
|
||||
|
||||
private String title;
|
||||
private String subTitle;
|
||||
private List<List<KTVRoom>> roomList;
|
||||
|
||||
public KTVRoomInfo() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/10/30
|
||||
*/
|
||||
@Data
|
||||
public class MakeFriendsHallInfo implements Serializable {
|
||||
private String title;
|
||||
private String subTitle;
|
||||
|
||||
private String aitUserName;
|
||||
|
||||
private List<HomeHallMsgInfo> msgList;
|
||||
|
||||
public MakeFriendsHallInfo() {
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/19
|
||||
*/
|
||||
@Data
|
||||
public class MakeFriendsInfo implements Serializable{
|
||||
|
||||
private String title;
|
||||
private String subTitle;
|
||||
private List<HomeRoom> roomList;
|
||||
|
||||
private boolean vmIsLoading;
|
||||
|
||||
public MakeFriendsInfo() {
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/19
|
||||
*/
|
||||
@Data
|
||||
public class NormalItemInfo implements Parcelable,Serializable{
|
||||
public final static transient int TOP = 1;
|
||||
public final static transient int BOTTOM = 2;
|
||||
private int position;
|
||||
private int type;
|
||||
private String icon;
|
||||
private String title;
|
||||
private HomeRoom homeRoom;
|
||||
/**表示第几列*/
|
||||
private int row;
|
||||
|
||||
public NormalItemInfo() {
|
||||
}
|
||||
|
||||
protected NormalItemInfo(Parcel in) {
|
||||
position = in.readInt();
|
||||
type = in.readInt();
|
||||
icon = in.readString();
|
||||
title = in.readString();
|
||||
homeRoom = in.readParcelable(HomeRoom.class.getClassLoader());
|
||||
}
|
||||
|
||||
public static final Creator<NormalItemInfo> CREATOR = new Creator<NormalItemInfo>() {
|
||||
@Override
|
||||
public NormalItemInfo createFromParcel(Parcel in) {
|
||||
return new NormalItemInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NormalItemInfo[] newArray(int size) {
|
||||
return new NormalItemInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(position);
|
||||
dest.writeInt(type);
|
||||
dest.writeString(icon);
|
||||
dest.writeString(title);
|
||||
dest.writeParcelable(homeRoom, flags);
|
||||
}
|
||||
}
|
@@ -0,0 +1,54 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/17
|
||||
*/
|
||||
@Data
|
||||
public class OtherBannerInfo implements Parcelable,Serializable {
|
||||
|
||||
private String title;
|
||||
private List<BannerInfo> data;
|
||||
|
||||
public OtherBannerInfo() {
|
||||
}
|
||||
|
||||
|
||||
protected OtherBannerInfo(Parcel in) {
|
||||
title = in.readString();
|
||||
data = in.createTypedArrayList(BannerInfo.CREATOR);
|
||||
}
|
||||
|
||||
public static final Creator<OtherBannerInfo> CREATOR = new Creator<OtherBannerInfo>() {
|
||||
@Override
|
||||
public OtherBannerInfo createFromParcel(Parcel in) {
|
||||
return new OtherBannerInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OtherBannerInfo[] newArray(int size) {
|
||||
return new OtherBannerInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(title);
|
||||
dest.writeTypedList(data);
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/17
|
||||
*/
|
||||
@Data
|
||||
public class QuickEntranceInfo implements Parcelable, Serializable {
|
||||
|
||||
public final static transient int SKIP_TYP_APP = 1;
|
||||
public final static transient int SKIP_TYP_CHAT_ROOM = 2;
|
||||
public final static transient int SKIP_TYP_H5 = 3;
|
||||
|
||||
private String panelId;
|
||||
private String panelName;
|
||||
private int skipType;//跳转类型 1跳app页面,2跳聊天室,3跳h5页面
|
||||
private String skipUrl;
|
||||
private String panelPic;
|
||||
private int seqNo;//排序
|
||||
|
||||
|
||||
protected QuickEntranceInfo(Parcel in) {
|
||||
panelId = in.readString();
|
||||
panelName = in.readString();
|
||||
skipType = in.readInt();
|
||||
skipUrl = in.readString();
|
||||
panelPic = in.readString();
|
||||
seqNo = in.readInt();
|
||||
}
|
||||
|
||||
public static final Creator<QuickEntranceInfo> CREATOR = new Creator<QuickEntranceInfo>() {
|
||||
@Override
|
||||
public QuickEntranceInfo createFromParcel(Parcel in) {
|
||||
return new QuickEntranceInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuickEntranceInfo[] newArray(int size) {
|
||||
return new QuickEntranceInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(panelId);
|
||||
dest.writeString(panelName);
|
||||
dest.writeInt(skipType);
|
||||
dest.writeString(skipUrl);
|
||||
dest.writeString(panelPic);
|
||||
dest.writeInt(seqNo);
|
||||
}
|
||||
}
|
@@ -0,0 +1,140 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 首页排行信息 </p>
|
||||
* Created by Administrator on 2017/11/8.
|
||||
*/
|
||||
public class RankingInfo implements Parcelable {
|
||||
|
||||
public List<Ranking> starList;
|
||||
public List<Ranking> nobleList;
|
||||
public List<Ranking> roomList;
|
||||
|
||||
|
||||
|
||||
public static class Ranking implements Parcelable {
|
||||
/**
|
||||
* erbanNo : 850379
|
||||
* avatar : https://nos.netease.com/nim/NDI3OTA4NQ==/bmltYV83Nzg4MzQyNDJfMTUwNzIwMzM4NTc2N184YmJlZmQ4ZS01YzdiLTRmMWMtYmFhOC0xMWRlNzg3MzRlMzk=
|
||||
* nick : 阿拉善
|
||||
* gender : 1
|
||||
* totalNum : 9988923
|
||||
*/
|
||||
|
||||
private int erbanNo;
|
||||
private String avatar;
|
||||
private String nick;
|
||||
private int gender;
|
||||
private int totalNum;
|
||||
|
||||
protected Ranking(Parcel in) {
|
||||
erbanNo = in.readInt();
|
||||
avatar = in.readString();
|
||||
nick = in.readString();
|
||||
gender = in.readInt();
|
||||
totalNum = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(erbanNo);
|
||||
dest.writeString(avatar);
|
||||
dest.writeString(nick);
|
||||
dest.writeInt(gender);
|
||||
dest.writeInt(totalNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<Ranking> CREATOR = new Creator<Ranking>() {
|
||||
@Override
|
||||
public Ranking createFromParcel(Parcel in) {
|
||||
return new Ranking(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ranking[] newArray(int size) {
|
||||
return new Ranking[size];
|
||||
}
|
||||
};
|
||||
|
||||
public int getErbanNo() {
|
||||
return erbanNo;
|
||||
}
|
||||
|
||||
public void setErbanNo(int erbanNo) {
|
||||
this.erbanNo = erbanNo;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public int getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(int gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public int getTotalNum() {
|
||||
return totalNum;
|
||||
}
|
||||
|
||||
public void setTotalNum(int totalNum) {
|
||||
this.totalNum = totalNum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected RankingInfo(Parcel in) {
|
||||
starList = in.createTypedArrayList(Ranking.CREATOR);
|
||||
nobleList = in.createTypedArrayList(Ranking.CREATOR);
|
||||
roomList = in.createTypedArrayList(Ranking.CREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeTypedList(starList);
|
||||
dest.writeTypedList(nobleList);
|
||||
dest.writeTypedList(roomList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<RankingInfo> CREATOR = new Creator<RankingInfo>() {
|
||||
@Override
|
||||
public RankingInfo createFromParcel(Parcel in) {
|
||||
return new RankingInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RankingInfo[] newArray(int size) {
|
||||
return new RankingInfo[size];
|
||||
}
|
||||
};
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/17
|
||||
*/
|
||||
@Data
|
||||
public class RecommendInfo implements Serializable {
|
||||
|
||||
private String title;
|
||||
private List<HomeRoom> roomList;
|
||||
|
||||
public RecommendInfo() {
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoomGameInfo implements Serializable {
|
||||
/**
|
||||
* roomId : 58892673
|
||||
* uid : 2
|
||||
* startUid : 2
|
||||
* gameId : doushouqi1
|
||||
* gameName : doushouqi1
|
||||
* status : 5
|
||||
* createTime : 1548856711000
|
||||
* updateTime : 1548856711000
|
||||
*/
|
||||
|
||||
private long roomId;
|
||||
private long uid;
|
||||
private long startUid;
|
||||
private String gameId;
|
||||
private String gameName;
|
||||
private int status;
|
||||
private long createTime;
|
||||
private long updateTime;
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoomTabInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* uid : 2
|
||||
* officeUser : 1
|
||||
* roomId : 58892673
|
||||
* title : 轻寻张展伟的房间
|
||||
* type : 5
|
||||
* meetingName : edc36c59bc9b449bb5bb58ac17b9c0b4
|
||||
* valid : true
|
||||
* operatorStatus : 1
|
||||
* avatar : https://img.erbanyy.com/FikxU2u59uOjPVS1Sv_zfu4icqMS?imageslim
|
||||
* roomDesc :
|
||||
* backPic :
|
||||
* openTime : 1545018501000
|
||||
* onlineNum : 1
|
||||
* abChannelType : 1
|
||||
* roomPwd :
|
||||
* roomTag : 聊天
|
||||
* calcSumDataIndex : 0
|
||||
* tagId : 8
|
||||
* tagPict : https://img.erbanyy.com/new_tag_%E8%81%8A%E5%A4%A9@3x.png
|
||||
* badge :
|
||||
* isPermitRoom : 2
|
||||
* isRecom : 0
|
||||
* count : 0
|
||||
* hasAnimationEffect : true
|
||||
* audioQuality : 1
|
||||
* isCloseScreen : false
|
||||
* hasDragonGame : true
|
||||
* hasKTVPriv : true
|
||||
* isOpenKTV : false
|
||||
* isOpenGame : true
|
||||
* roomModeType : 0
|
||||
* roomGame : {"roomId":58892673,"uid":2,"startUid":2,"gameId":"doushouqi1","gameName":"doushouqi1","status":5,"createTime":1548856711000,"updateTime":1548856711000}
|
||||
* isExceptionClose : false
|
||||
* exceptionClose : false
|
||||
*/
|
||||
|
||||
private long uid;
|
||||
private int officeUser;
|
||||
private long roomId;
|
||||
private String title;
|
||||
private int type;
|
||||
private String meetingName;
|
||||
private boolean valid;
|
||||
private int operatorStatus;
|
||||
private String avatar;
|
||||
private String roomDesc;
|
||||
private String backPic;
|
||||
private long openTime;
|
||||
private int onlineNum;
|
||||
private int abChannelType;
|
||||
private String roomPwd;
|
||||
private String roomTag;
|
||||
private int calcSumDataIndex;
|
||||
private int tagId;
|
||||
private String tagPict;
|
||||
private String badge;
|
||||
private int isPermitRoom;
|
||||
private int isRecom;
|
||||
private int count;
|
||||
private boolean hasAnimationEffect;
|
||||
private int audioQuality;
|
||||
private boolean isCloseScreen;
|
||||
private boolean hasDragonGame;
|
||||
private boolean hasKTVPriv;
|
||||
private boolean isOpenKTV;
|
||||
private boolean isOpenGame;
|
||||
private int roomModeType;
|
||||
private RoomGameInfo roomGame;
|
||||
private boolean isExceptionClose;
|
||||
private boolean exceptionClose;
|
||||
}
|
@@ -0,0 +1,107 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p> tab 标签数据 </p>
|
||||
*
|
||||
* @author Administrator
|
||||
* @date 2017/11/21
|
||||
*/
|
||||
@Data
|
||||
public class TabInfo implements Parcelable,Serializable {
|
||||
|
||||
/**
|
||||
* id : 8
|
||||
* name : 聊天
|
||||
* pict : https://img.erbanyy.com/tag%E8%81%8A%E5%A4%A9.png
|
||||
* seq : 3
|
||||
* type : 1
|
||||
* status : true
|
||||
* istop : true
|
||||
* createTime : 1511155717000
|
||||
*/
|
||||
|
||||
protected int id;
|
||||
protected String name;
|
||||
protected String pict;
|
||||
protected int seq;
|
||||
protected int type;
|
||||
protected boolean status;
|
||||
protected boolean istop;
|
||||
protected long createTime;
|
||||
|
||||
public TabInfo() {
|
||||
}
|
||||
|
||||
public TabInfo(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
protected TabInfo(Parcel in) {
|
||||
id = in.readInt();
|
||||
name = in.readString();
|
||||
pict = in.readString();
|
||||
seq = in.readInt();
|
||||
type = in.readInt();
|
||||
status = in.readByte() != 0;
|
||||
istop = in.readByte() != 0;
|
||||
createTime = in.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(id);
|
||||
dest.writeString(name);
|
||||
dest.writeString(pict);
|
||||
dest.writeInt(seq);
|
||||
dest.writeInt(type);
|
||||
dest.writeByte((byte) (status ? 1 : 0));
|
||||
dest.writeByte((byte) (istop ? 1 : 0));
|
||||
dest.writeLong(createTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<TabInfo> CREATOR = new Creator<TabInfo>() {
|
||||
@Override
|
||||
public TabInfo createFromParcel(Parcel in) {
|
||||
return new TabInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TabInfo[] newArray(int size) {
|
||||
return new TabInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
public static List<TabInfo> getTabDefaultList() {
|
||||
List<TabInfo> tabInfoList = new ArrayList<>();
|
||||
tabInfoList.add(new TabInfo(14, "新秀"));
|
||||
tabInfoList.add(new TabInfo(12, "交友"));
|
||||
tabInfoList.add(new TabInfo(13, "娱乐"));
|
||||
tabInfoList.add(new TabInfo(5, "电台"));
|
||||
tabInfoList.add(new TabInfo(10, "陪玩"));
|
||||
tabInfoList.add(new TabInfo(11, "音乐"));
|
||||
return tabInfoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TabInfo{" +
|
||||
"name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TagListInfo implements Serializable {
|
||||
|
||||
private long titleId;
|
||||
private String titleName;
|
||||
private long seqNo;
|
||||
}
|
@@ -0,0 +1,482 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
|
||||
/**
|
||||
* data : [{"uid":2,"officeUser":1,"roomId":58892673,"title":"轻寻张展伟的房间","type":5,"meetingName":"edc36c59bc9b449bb5bb58ac17b9c0b4","valid":true,"operatorStatus":1,"avatar":"https://img.erbanyy.com/FikxU2u59uOjPVS1Sv_zfu4icqMS?imageslim","roomDesc":"","backPic":"","openTime":1545018501000,"onlineNum":1,"abChannelType":1,"roomPwd":"","roomTag":"聊天","calcSumDataIndex":0,"tagId":8,"tagPict":"https://img.erbanyy.com/new_tag_%E8%81%8A%E5%A4%A9@3x.png","badge":"","isPermitRoom":2,"isRecom":0,"count":0,"hasAnimationEffect":true,"audioQuality":1,"isCloseScreen":false,"hasDragonGame":true,"hasKTVPriv":true,"isOpenKTV":false,"isOpenGame":true,"roomModeType":0,"roomGame":{"roomId":58892673,"uid":2,"startUid":2,"gameId":"doushouqi1","gameName":"doushouqi1","status":5,"createTime":1548856711000,"updateTime":1548856711000},"isExceptionClose":false,"exceptionClose":false}]
|
||||
* title : 墙裂推荐
|
||||
* type : 1
|
||||
* maxNum : 3
|
||||
*/
|
||||
|
||||
private String title;
|
||||
private int type;
|
||||
private int maxNum;
|
||||
private List<DataBean> data;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getMaxNum() {
|
||||
return maxNum;
|
||||
}
|
||||
|
||||
public void setMaxNum(int maxNum) {
|
||||
this.maxNum = maxNum;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
/**
|
||||
* uid : 2
|
||||
* officeUser : 1
|
||||
* roomId : 58892673
|
||||
* title : 轻寻张展伟的房间
|
||||
* type : 5
|
||||
* meetingName : edc36c59bc9b449bb5bb58ac17b9c0b4
|
||||
* valid : true
|
||||
* operatorStatus : 1
|
||||
* avatar : https://img.erbanyy.com/FikxU2u59uOjPVS1Sv_zfu4icqMS?imageslim
|
||||
* roomDesc :
|
||||
* backPic :
|
||||
* openTime : 1545018501000
|
||||
* onlineNum : 1
|
||||
* abChannelType : 1
|
||||
* roomPwd :
|
||||
* roomTag : 聊天
|
||||
* calcSumDataIndex : 0
|
||||
* tagId : 8
|
||||
* tagPict : https://img.erbanyy.com/new_tag_%E8%81%8A%E5%A4%A9@3x.png
|
||||
* badge :
|
||||
* isPermitRoom : 2
|
||||
* isRecom : 0
|
||||
* count : 0
|
||||
* hasAnimationEffect : true
|
||||
* audioQuality : 1
|
||||
* isCloseScreen : false
|
||||
* hasDragonGame : true
|
||||
* hasKTVPriv : true
|
||||
* isOpenKTV : false
|
||||
* isOpenGame : true
|
||||
* roomModeType : 0
|
||||
* roomGame : {"roomId":58892673,"uid":2,"startUid":2,"gameId":"doushouqi1","gameName":"doushouqi1","status":5,"createTime":1548856711000,"updateTime":1548856711000}
|
||||
* isExceptionClose : false
|
||||
* exceptionClose : false
|
||||
*/
|
||||
|
||||
private int uid;
|
||||
private int officeUser;
|
||||
private int roomId;
|
||||
private String title;
|
||||
private int type;
|
||||
private String meetingName;
|
||||
private boolean valid;
|
||||
private int operatorStatus;
|
||||
private String avatar;
|
||||
private String roomDesc;
|
||||
private String backPic;
|
||||
private long openTime;
|
||||
private int onlineNum;
|
||||
private int abChannelType;
|
||||
private String roomPwd;
|
||||
private String roomTag;
|
||||
private int calcSumDataIndex;
|
||||
private int tagId;
|
||||
private String tagPict;
|
||||
private String badge;
|
||||
private int isPermitRoom;
|
||||
private int isRecom;
|
||||
private int count;
|
||||
private boolean hasAnimationEffect;
|
||||
private int audioQuality;
|
||||
private boolean isCloseScreen;
|
||||
private boolean hasDragonGame;
|
||||
private boolean hasKTVPriv;
|
||||
private boolean isOpenKTV;
|
||||
private boolean isOpenGame;
|
||||
private int roomModeType;
|
||||
private RoomGameBean roomGame;
|
||||
private boolean isExceptionClose;
|
||||
private boolean exceptionClose;
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getOfficeUser() {
|
||||
return officeUser;
|
||||
}
|
||||
|
||||
public void setOfficeUser(int officeUser) {
|
||||
this.officeUser = officeUser;
|
||||
}
|
||||
|
||||
public int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMeetingName() {
|
||||
return meetingName;
|
||||
}
|
||||
|
||||
public void setMeetingName(String meetingName) {
|
||||
this.meetingName = meetingName;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return valid;
|
||||
}
|
||||
|
||||
public void setValid(boolean valid) {
|
||||
this.valid = valid;
|
||||
}
|
||||
|
||||
public int getOperatorStatus() {
|
||||
return operatorStatus;
|
||||
}
|
||||
|
||||
public void setOperatorStatus(int operatorStatus) {
|
||||
this.operatorStatus = operatorStatus;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getRoomDesc() {
|
||||
return roomDesc;
|
||||
}
|
||||
|
||||
public void setRoomDesc(String roomDesc) {
|
||||
this.roomDesc = roomDesc;
|
||||
}
|
||||
|
||||
public String getBackPic() {
|
||||
return backPic;
|
||||
}
|
||||
|
||||
public void setBackPic(String backPic) {
|
||||
this.backPic = backPic;
|
||||
}
|
||||
|
||||
public long getOpenTime() {
|
||||
return openTime;
|
||||
}
|
||||
|
||||
public void setOpenTime(long openTime) {
|
||||
this.openTime = openTime;
|
||||
}
|
||||
|
||||
public int getOnlineNum() {
|
||||
return onlineNum;
|
||||
}
|
||||
|
||||
public void setOnlineNum(int onlineNum) {
|
||||
this.onlineNum = onlineNum;
|
||||
}
|
||||
|
||||
public int getAbChannelType() {
|
||||
return abChannelType;
|
||||
}
|
||||
|
||||
public void setAbChannelType(int abChannelType) {
|
||||
this.abChannelType = abChannelType;
|
||||
}
|
||||
|
||||
public String getRoomPwd() {
|
||||
return roomPwd;
|
||||
}
|
||||
|
||||
public void setRoomPwd(String roomPwd) {
|
||||
this.roomPwd = roomPwd;
|
||||
}
|
||||
|
||||
public String getRoomTag() {
|
||||
return roomTag;
|
||||
}
|
||||
|
||||
public void setRoomTag(String roomTag) {
|
||||
this.roomTag = roomTag;
|
||||
}
|
||||
|
||||
public int getCalcSumDataIndex() {
|
||||
return calcSumDataIndex;
|
||||
}
|
||||
|
||||
public void setCalcSumDataIndex(int calcSumDataIndex) {
|
||||
this.calcSumDataIndex = calcSumDataIndex;
|
||||
}
|
||||
|
||||
public int getTagId() {
|
||||
return tagId;
|
||||
}
|
||||
|
||||
public void setTagId(int tagId) {
|
||||
this.tagId = tagId;
|
||||
}
|
||||
|
||||
public String getTagPict() {
|
||||
return tagPict;
|
||||
}
|
||||
|
||||
public void setTagPict(String tagPict) {
|
||||
this.tagPict = tagPict;
|
||||
}
|
||||
|
||||
public String getBadge() {
|
||||
return badge;
|
||||
}
|
||||
|
||||
public void setBadge(String badge) {
|
||||
this.badge = badge;
|
||||
}
|
||||
|
||||
public int getIsPermitRoom() {
|
||||
return isPermitRoom;
|
||||
}
|
||||
|
||||
public void setIsPermitRoom(int isPermitRoom) {
|
||||
this.isPermitRoom = isPermitRoom;
|
||||
}
|
||||
|
||||
public int getIsRecom() {
|
||||
return isRecom;
|
||||
}
|
||||
|
||||
public void setIsRecom(int isRecom) {
|
||||
this.isRecom = isRecom;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public boolean isHasAnimationEffect() {
|
||||
return hasAnimationEffect;
|
||||
}
|
||||
|
||||
public void setHasAnimationEffect(boolean hasAnimationEffect) {
|
||||
this.hasAnimationEffect = hasAnimationEffect;
|
||||
}
|
||||
|
||||
public int getAudioQuality() {
|
||||
return audioQuality;
|
||||
}
|
||||
|
||||
public void setAudioQuality(int audioQuality) {
|
||||
this.audioQuality = audioQuality;
|
||||
}
|
||||
|
||||
public boolean isIsCloseScreen() {
|
||||
return isCloseScreen;
|
||||
}
|
||||
|
||||
public void setIsCloseScreen(boolean isCloseScreen) {
|
||||
this.isCloseScreen = isCloseScreen;
|
||||
}
|
||||
|
||||
public boolean isHasDragonGame() {
|
||||
return hasDragonGame;
|
||||
}
|
||||
|
||||
public void setHasDragonGame(boolean hasDragonGame) {
|
||||
this.hasDragonGame = hasDragonGame;
|
||||
}
|
||||
|
||||
public boolean isHasKTVPriv() {
|
||||
return hasKTVPriv;
|
||||
}
|
||||
|
||||
public void setHasKTVPriv(boolean hasKTVPriv) {
|
||||
this.hasKTVPriv = hasKTVPriv;
|
||||
}
|
||||
|
||||
public boolean isIsOpenKTV() {
|
||||
return isOpenKTV;
|
||||
}
|
||||
|
||||
public void setIsOpenKTV(boolean isOpenKTV) {
|
||||
this.isOpenKTV = isOpenKTV;
|
||||
}
|
||||
|
||||
public boolean isIsOpenGame() {
|
||||
return isOpenGame;
|
||||
}
|
||||
|
||||
public void setIsOpenGame(boolean isOpenGame) {
|
||||
this.isOpenGame = isOpenGame;
|
||||
}
|
||||
|
||||
public int getRoomModeType() {
|
||||
return roomModeType;
|
||||
}
|
||||
|
||||
public void setRoomModeType(int roomModeType) {
|
||||
this.roomModeType = roomModeType;
|
||||
}
|
||||
|
||||
public RoomGameBean getRoomGame() {
|
||||
return roomGame;
|
||||
}
|
||||
|
||||
public void setRoomGame(RoomGameBean roomGame) {
|
||||
this.roomGame = roomGame;
|
||||
}
|
||||
|
||||
public boolean isIsExceptionClose() {
|
||||
return isExceptionClose;
|
||||
}
|
||||
|
||||
public void setIsExceptionClose(boolean isExceptionClose) {
|
||||
this.isExceptionClose = isExceptionClose;
|
||||
}
|
||||
|
||||
public boolean isExceptionClose() {
|
||||
return exceptionClose;
|
||||
}
|
||||
|
||||
public void setExceptionClose(boolean exceptionClose) {
|
||||
this.exceptionClose = exceptionClose;
|
||||
}
|
||||
|
||||
public static class RoomGameBean {
|
||||
/**
|
||||
* roomId : 58892673
|
||||
* uid : 2
|
||||
* startUid : 2
|
||||
* gameId : doushouqi1
|
||||
* gameName : doushouqi1
|
||||
* status : 5
|
||||
* createTime : 1548856711000
|
||||
* updateTime : 1548856711000
|
||||
*/
|
||||
|
||||
private int roomId;
|
||||
private int uid;
|
||||
private int startUid;
|
||||
private String gameId;
|
||||
private String gameName;
|
||||
private int status;
|
||||
private long createTime;
|
||||
private long updateTime;
|
||||
|
||||
public int getRoomId() {
|
||||
return roomId;
|
||||
}
|
||||
|
||||
public void setRoomId(int roomId) {
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getStartUid() {
|
||||
return startUid;
|
||||
}
|
||||
|
||||
public void setStartUid(int startUid) {
|
||||
this.startUid = startUid;
|
||||
}
|
||||
|
||||
public String getGameId() {
|
||||
return gameId;
|
||||
}
|
||||
|
||||
public void setGameId(String gameId) {
|
||||
this.gameId = gameId;
|
||||
}
|
||||
|
||||
public String getGameName() {
|
||||
return gameName;
|
||||
}
|
||||
|
||||
public void setGameName(String gameName) {
|
||||
this.gameName = gameName;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public long getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(long updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TitleIndexInfo implements Serializable {
|
||||
private List<HomeRoom> rooms;
|
||||
private ArrayList<BannerInfo> banner;
|
||||
}
|
@@ -0,0 +1,53 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/4/17
|
||||
*/
|
||||
@Data
|
||||
public class TopBannerInfo implements Parcelable,Serializable {
|
||||
|
||||
private List<BannerInfo> topBannerList;
|
||||
private List<QuickEntranceInfo> panelList;
|
||||
|
||||
public TopBannerInfo() {
|
||||
}
|
||||
|
||||
|
||||
protected TopBannerInfo(Parcel in) {
|
||||
panelList = in.createTypedArrayList(QuickEntranceInfo.CREATOR);
|
||||
topBannerList = in.createTypedArrayList(BannerInfo.CREATOR);
|
||||
}
|
||||
|
||||
public static final Creator<TopBannerInfo> CREATOR = new Creator<TopBannerInfo>() {
|
||||
@Override
|
||||
public TopBannerInfo createFromParcel(Parcel in) {
|
||||
return new TopBannerInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TopBannerInfo[] newArray(int size) {
|
||||
return new TopBannerInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeTypedList(panelList);
|
||||
dest.writeTypedList(topBannerList);
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/3
|
||||
*/
|
||||
@Data
|
||||
public class TopMessage implements Serializable, MultiItemEntity {
|
||||
|
||||
public final static transient int TYPE_LAYOUT_1 = 0;
|
||||
|
||||
public final static transient int TIP_TYPE_ABOUT_ME = 1;//是@我
|
||||
public final static transient int TIP_TYPE_NEW = 2;//是最新
|
||||
public final static transient int TIP_TYPE_MONSTER = 3;//是打怪
|
||||
|
||||
private String id;
|
||||
private String title;
|
||||
private String img;
|
||||
private int tipType;
|
||||
|
||||
private int paramType;
|
||||
private String param;
|
||||
private long time;
|
||||
|
||||
//类型
|
||||
private int itemType;
|
||||
|
||||
public TopMessage(int itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return this.itemType;
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/3
|
||||
*/
|
||||
@Data
|
||||
public class VMTopMessage implements Serializable {
|
||||
|
||||
private List<TopMessage> topMessageList;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/5/3
|
||||
*/
|
||||
@Data
|
||||
public class VMTopMessageInfo implements Serializable{
|
||||
private String title;
|
||||
private List<VMTopMessage> vmTopMessageList;
|
||||
|
||||
}
|
@@ -0,0 +1,80 @@
|
||||
package com.yizhuan.xchat_android_core.home.model;
|
||||
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.community.bean.CommunityNoticeInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.functions.Function;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class CommunityNoticeModel implements ICommunityNoticeModel {
|
||||
private volatile static ICommunityNoticeModel instance;
|
||||
private Api api;
|
||||
|
||||
public static ICommunityNoticeModel get() {
|
||||
if (instance == null) {
|
||||
synchronized (HomeModel.class) {
|
||||
if (instance == null) {
|
||||
instance = new CommunityNoticeModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private CommunityNoticeModel() {
|
||||
api = RxNet.create(Api.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<CommunityNoticeInfo>> getMsg(long uid, Long id, int pageSize) {
|
||||
return api.getMsgList(uid, id, pageSize).flatMap(new Function<ServiceResult<List<CommunityNoticeInfo>>, SingleSource<List<CommunityNoticeInfo>>>() {
|
||||
@Override
|
||||
public SingleSource<List<CommunityNoticeInfo>> apply(ServiceResult<List<CommunityNoticeInfo>> listServiceResult) throws Exception {
|
||||
if (listServiceResult.isSuccess()) {
|
||||
return Single.just(listServiceResult.getData());
|
||||
} else {
|
||||
return Single.error(new Throwable(listServiceResult.getMessage()));
|
||||
|
||||
}
|
||||
}
|
||||
}).compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> delete(long uid) {
|
||||
return api.clear(uid).flatMap(new Function<ServiceResult, SingleSource<String>>() {
|
||||
@Override
|
||||
public SingleSource<String> apply(ServiceResult serviceResult) throws Exception {
|
||||
if (serviceResult.isSuccess()) {
|
||||
return Single.just("success");
|
||||
} else {
|
||||
return Single.error(new Throwable(serviceResult.getMessage()));
|
||||
|
||||
}
|
||||
}
|
||||
}).compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
* 获取互动消息
|
||||
*/
|
||||
@POST("interactive/list")
|
||||
Single<ServiceResult<List<CommunityNoticeInfo>>> getMsgList(@Query("uid") long uid,
|
||||
@Query("id") Long id, @Query("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 清空互动消息
|
||||
*/
|
||||
@POST("interactive/clear")
|
||||
Single<ServiceResult> clear(@Query("uid") long uid);
|
||||
}
|
||||
}
|
@@ -0,0 +1,817 @@
|
||||
package com.yizhuan.xchat_android_core.home.model;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.community.bean.UnReadCountInfo;
|
||||
import com.yizhuan.xchat_android_core.family.bean.HomeBannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.ClassifiedRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.FindInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeItem;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeMoreData;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoom;
|
||||
import com.yizhuan.xchat_android_core.home.bean.KTVRoom;
|
||||
import com.yizhuan.xchat_android_core.home.bean.RecommendInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TagListInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TitleIndexInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.RecommendationUserInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserRecommendRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class HomeModel extends BaseModel implements IHomeModel {
|
||||
private static final String TAG = "HomeModel";
|
||||
|
||||
private volatile static IHomeModel instance;
|
||||
private Api api;
|
||||
|
||||
private List<TabInfo> mTabInfoList;
|
||||
|
||||
public static IHomeModel get() {
|
||||
if (instance == null) {
|
||||
synchronized (HomeModel.class) {
|
||||
if (instance == null) {
|
||||
instance = new HomeModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private HomeModel() {
|
||||
api = RxNet.create(Api.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存的房间分类数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TabInfo> getmTabInfoList() {
|
||||
return mTabInfoList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页数据
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<ServiceResult<List<HomeInfo>>> loadHomeList(String uid) {
|
||||
return api.getHomeList(uid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
/**
|
||||
* 3.1.2之后改版,首页v4
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<ServiceResult<List<HomeInfo>>> loadHomeListV4(String uid) {
|
||||
return api.getHomeListV4(uid)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页加载更多
|
||||
*/
|
||||
@Override
|
||||
public Single<List<HomeRoom>> loadMoreHomeData(int page, int pageSize) {
|
||||
return api.getMoreHomeListV4(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
page,
|
||||
pageSize
|
||||
)
|
||||
.compose(RxHelper.handleCommon(HomeMoreData::new))
|
||||
.flatMap(homeMoreData -> {
|
||||
List<HomeRoom> list = homeMoreData.getRooms();
|
||||
if (list == null) {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
return Single.just(list);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取佛系交友的列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<ServiceResult<List<HomeRoom>>> loadMakeFriendList() {
|
||||
return api.loadMakeFriendList()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交反馈
|
||||
*
|
||||
* @param uid
|
||||
* @param feedbackDesc
|
||||
* @param contact
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<String> commitFeedback(long uid, String feedbackDesc, String contact) {
|
||||
return api.commitFeedback(
|
||||
String.valueOf(uid),
|
||||
feedbackDesc,
|
||||
contact,
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.flatMap(new Function<ServiceResult, SingleSource<String>>() {
|
||||
@Override
|
||||
public SingleSource<String> apply(ServiceResult serviceResult) throws Exception {
|
||||
if (serviceResult.isSuccess()) {
|
||||
return Single.just("反馈成功");
|
||||
|
||||
} else {
|
||||
return Single.error(new Throwable(serviceResult.getMessage()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页房间 分类 tab 数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<List<TabInfo>> getMainTabData() {
|
||||
return api.getMainTabList()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.doOnSuccess(new Consumer<List<TabInfo>>() {
|
||||
@Override
|
||||
public void accept(List<TabInfo> tabInfos) throws Exception {
|
||||
if (ListUtils.isListEmpty(tabInfos)) {
|
||||
return;
|
||||
}
|
||||
mTabInfoList = tabInfos;
|
||||
}
|
||||
})
|
||||
.doOnError(new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Logger.e("启动获取首页Tab失败......");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据分类 获取房间列表
|
||||
*
|
||||
* @param tagId
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
*/
|
||||
@Override
|
||||
public Single<ClassifiedRoomInfo> getMainDataByTab(final int tagId, final int pageNum, int pageSize) {
|
||||
return api.getMainDataByTab(
|
||||
String.valueOf(tagId),
|
||||
String.valueOf(pageNum),
|
||||
String.valueOf(pageSize)
|
||||
)
|
||||
.flatMap(new Function<ServiceResult<ClassifiedRoomInfo>, SingleSource<ClassifiedRoomInfo>>() {
|
||||
@Override
|
||||
public SingleSource<ClassifiedRoomInfo> apply(ServiceResult<ClassifiedRoomInfo> classifiedRoomInfoServiceResult) throws Exception {
|
||||
if (classifiedRoomInfoServiceResult.isSuccess()) {
|
||||
if (null == classifiedRoomInfoServiceResult.getData()) {
|
||||
ClassifiedRoomInfo classifiedRoomInfo = new ClassifiedRoomInfo();
|
||||
classifiedRoomInfo.setRooms(new ArrayList<>());
|
||||
return Single.just(classifiedRoomInfo);
|
||||
} else {
|
||||
return Single.just(classifiedRoomInfoServiceResult.getData());
|
||||
}
|
||||
} else {
|
||||
return Single.error(new Throwable(classifiedRoomInfoServiceResult.getMessage()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleException())
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Single<FindInfo> loadFindPage(String uid) {
|
||||
return api.loadFindPage(
|
||||
uid
|
||||
)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Single<FindInfo> loadFindPageV2(String uid) {
|
||||
return api.loadFindPageV2(
|
||||
uid
|
||||
)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取首页KTV 房间列表
|
||||
*
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @param orderType 排序方式(1:最新,2:最热)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<List<KTVRoom>> loadKTVList(String page,
|
||||
String pageSize,
|
||||
String orderType) {
|
||||
return api.loadKTVList(
|
||||
page,
|
||||
pageSize,
|
||||
orderType
|
||||
)
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取新人列表
|
||||
*
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<List<UserInfo>> loadNewUserList(String page,
|
||||
String pageSize) {
|
||||
return api.loadNewUserList(
|
||||
page,
|
||||
pageSize
|
||||
)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.flatMap(listServiceResult -> {
|
||||
if (listServiceResult != null) {
|
||||
if (listServiceResult.isSuccess()) {
|
||||
return Single.just(listServiceResult.getData() != null ?
|
||||
listServiceResult.getData() : new ArrayList<>());
|
||||
} else {
|
||||
return Single.error(new Throwable(listServiceResult.getMessage()));
|
||||
}
|
||||
} else {
|
||||
return Single.error(new Throwable("发生异常"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 导流-获取推荐的房间
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<UserRecommendRoomInfo> loadRecommendRoom(String uid) {
|
||||
return api.loadRecommendRoom(
|
||||
uid
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(new Function<ServiceResult<UserRecommendRoomInfo>, SingleSource<? extends UserRecommendRoomInfo>>() {
|
||||
@Override
|
||||
public SingleSource<? extends UserRecommendRoomInfo> apply(ServiceResult<UserRecommendRoomInfo> response) throws Exception {
|
||||
if (response.isSuccess()) {
|
||||
return Single.just(response.getData());
|
||||
} else {
|
||||
return Single.error(new Throwable(response.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<TagListInfo>> tagList(long uid) {
|
||||
return api.titleList(uid)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.flatMap(new Function<ServiceResult<List<TagListInfo>>, SingleSource<? extends List<TagListInfo>>>() {
|
||||
@Override
|
||||
public SingleSource<? extends List<TagListInfo>> apply(ServiceResult<List<TagListInfo>> response) throws Exception {
|
||||
if (response.isSuccess()) {
|
||||
return Single.just(response.getData());
|
||||
} else {
|
||||
return Single.error(new Throwable(response.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<TitleIndexInfo> titleIndex(long titleId, int pageNum, int pageSize) {
|
||||
return api.titleIndex(titleId, pageNum, pageSize)
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.flatMap(new Function<ServiceResult<TitleIndexInfo>, SingleSource<? extends TitleIndexInfo>>() {
|
||||
@Override
|
||||
public SingleSource<? extends TitleIndexInfo> apply(ServiceResult<TitleIndexInfo> response) throws Exception {
|
||||
if (response.isSuccess()) {
|
||||
return Single.just(response.getData());
|
||||
} else {
|
||||
return Single.error(new Throwable(response.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<String> getGuildRoomId() {
|
||||
return api.getGuildRoomId(AuthModel.get().getCurrentUid())
|
||||
.compose(RxHelper.handleRoomPmLimit())
|
||||
.compose(RxHelper.singleMainResult(true));
|
||||
}
|
||||
|
||||
public Single<String> addIsomerism() {
|
||||
return api.addIsomerism(AuthModel.get().getCurrentUid())
|
||||
.compose(RxHelper.handleRoomPmLimit())
|
||||
.compose(RxHelper.handleCommon(() -> ""));
|
||||
|
||||
}
|
||||
|
||||
public Single<String> removeIsomerism() {
|
||||
return api.removeIsomerism(AuthModel.get().getCurrentUid())
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<HomeItem>> getGameHomeInfo() {
|
||||
return api.getGameHomeRoom()
|
||||
.compose(RxHelper.singleMainResult())
|
||||
.flatMap(homeInfos -> {
|
||||
List<HomeItem> configList = new ArrayList<>();
|
||||
for (HomeInfo homeInfo : homeInfos) {
|
||||
if (homeInfo.getType() == HomeItem.TYPE_TWO_LINES) {
|
||||
List<HomeRoom> homeRoomList = new Gson().fromJson(homeInfo.getData(),
|
||||
new TypeToken<List<HomeRoom>>() {
|
||||
}.getType());
|
||||
RecommendInfo recommendInfo = new RecommendInfo();
|
||||
recommendInfo.setTitle(homeInfo.getTitle());
|
||||
recommendInfo.setRoomList(homeRoomList);
|
||||
HomeItem<RecommendInfo> homeItem = new HomeItem<RecommendInfo>(HomeItem.TYPE_TWO_LINES, recommendInfo);
|
||||
configList.add(homeItem);
|
||||
} else {
|
||||
HomeItem<String> titleItem = new HomeItem<>(HomeItem.TYPE_BLOCK_TITLE,
|
||||
homeInfo.getTitle());
|
||||
List<HomeItem> tmpList = handleSubListToMainList(homeInfo, -1);
|
||||
if (!ListUtils.isListEmpty(tmpList)) {
|
||||
if (!ListUtils.isListEmpty(tmpList)) {
|
||||
configList.add(titleItem);
|
||||
}
|
||||
configList.addAll(tmpList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return Single.just(configList);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 由于接口的数据是分模块返回的,
|
||||
* 所以将模块的数据处理后,合成一条list
|
||||
*/
|
||||
private List<HomeItem> handleSubListToMainList(HomeInfo homeInfo, int customSquareNum) {
|
||||
List<HomeItem> resultList = new ArrayList<>();
|
||||
if (null != homeInfo.getData() && homeInfo.getData().isJsonArray()
|
||||
&& homeInfo.getData().getAsJsonArray().size() > 0) {
|
||||
//判断不为空
|
||||
List<HomeRoom> homeRoomList = new Gson().fromJson(homeInfo.getData(),
|
||||
new TypeToken<List<HomeRoom>>() {
|
||||
}.getType());
|
||||
if (homeRoomList == null) {
|
||||
homeRoomList = new ArrayList<>();
|
||||
|
||||
}
|
||||
int maxNum;
|
||||
//表示方格子的个数,如果不足3的倍数,则补足3的倍数
|
||||
//处理热门数据,前三个为格子,其他为普通布局,如果不足三个,则补虚位以待
|
||||
if (customSquareNum >= 0) {
|
||||
maxNum = customSquareNum;
|
||||
} else {
|
||||
maxNum = homeInfo.getMaxNum();
|
||||
}
|
||||
List<HomeItem> squareList = new ArrayList<>();
|
||||
List<HomeItem> linearList = new ArrayList<>();
|
||||
for (int i = 0; i < homeRoomList.size(); i++) {
|
||||
HomeItem<HomeRoom> item;
|
||||
HomeRoom room = homeRoomList.get(i);
|
||||
if (i < maxNum) {
|
||||
item = new HomeItem<>(HomeItem.TYPE_SQUARE_PIC, room);
|
||||
squareList.add(item);
|
||||
} else if (homeInfo.getListNum() == 0 || linearList.size() < homeInfo.getListNum()) {
|
||||
item = new HomeItem<>(HomeItem.TYPE_LINEAR_LITTLE_PIC, room);
|
||||
linearList.add(item);
|
||||
}
|
||||
}
|
||||
//添加虚位以待
|
||||
int needEmptySize;
|
||||
if (squareList.size() == 0) {
|
||||
//如果方形推荐位为空,添加3个虚位以待
|
||||
//如果方块列表为空,maxnum = 0,不配置虚位以待
|
||||
needEmptySize = 0;
|
||||
} else if (squareList.size() % 3 == 0) {
|
||||
//如果刚好是3的倍数,则不需要添加
|
||||
needEmptySize = 0;
|
||||
} else {
|
||||
//其余情况补足
|
||||
needEmptySize = 3 - squareList.size() % 3;
|
||||
}
|
||||
//添加虚位以待
|
||||
if (needEmptySize > 0) {
|
||||
for (int i = 0; i < needEmptySize; i++) {
|
||||
HomeItem item = new HomeItem<>(HomeItem.TYPE_SQUARE_EMPTY, new HomeRoom());
|
||||
squareList.add(item);
|
||||
}
|
||||
}
|
||||
//加个防错机制,保证方形是3的倍数
|
||||
while (squareList.size() % 3 != 0) {
|
||||
if (squareList.size() > 0) {
|
||||
squareList.remove(squareList.size() - 1);
|
||||
}
|
||||
}
|
||||
//添加分割线
|
||||
for (int i = 0; i < squareList.size(); i++) {
|
||||
squareList.get(i).setDividerDesc(i % 3);
|
||||
}
|
||||
//分割线
|
||||
for (int i = 0; i < linearList.size(); i++) {
|
||||
if (i == linearList.size() - 1) {
|
||||
linearList.get(i).setDividerDesc(-2);
|
||||
} else {
|
||||
linearList.get(i).setDividerDesc(-1);
|
||||
}
|
||||
}
|
||||
resultList.addAll(squareList);
|
||||
resultList.addAll(linearList);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<HomeBannerInfo> getHomeBannerInfo() {
|
||||
return api.getHomeBannerInfo(1)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleException())
|
||||
.compose(RxHelper.singleMainResult())
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<Object> uploadAddress(long uid, String address, int adcode, double longitude, double latitude) {
|
||||
return api.uploadAddress(uid, address, adcode, longitude, latitude)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleException())
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<RecommendationUserInfo>> getGodList(long uid, int pageIndex, int pageSize, String type) {
|
||||
return api.getHomeListV5(uid, pageIndex, pageSize, type)
|
||||
.compose(RxHelper.handleException())
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Single<ArrayList<BannerInfo>> getGodBannerInfo() {
|
||||
return api.getHomeBannerInfo(2)
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleException())
|
||||
.compose(RxHelper.singleMainResult())
|
||||
.map(new Function<HomeBannerInfo, ArrayList<BannerInfo>>() {
|
||||
@Override
|
||||
public ArrayList<BannerInfo> apply(HomeBannerInfo homeBannerInfo) throws Exception {
|
||||
ArrayList<BannerInfo> list;
|
||||
if (homeBannerInfo != null) {
|
||||
list = homeBannerInfo.getFirstPageBannerVos();
|
||||
} else {
|
||||
list = new ArrayList<>();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<ArrayList<BannerInfo>> getTabBanner(String tabId) {
|
||||
return api.getTabBanner(tabId)
|
||||
.compose(RxHelper.handleException())
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<HomeRoom>> getTabRoomList(int pageIndex, int pageSize, String tabId) {
|
||||
return api.getTabRoomList(pageIndex, pageSize, tabId)
|
||||
.compose(RxHelper.handleException())
|
||||
.compose(RxHelper.singleMainResult());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Single<HomeBannerInfo> getQxBannerInfo() {
|
||||
return api.getHomeBannerInfo(3)
|
||||
.compose(RxHelper.handleCommon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<Integer> getUnreadCount(long uid) {
|
||||
return api.getUnreadCount(uid).flatMap(new Function<ServiceResult<UnReadCountInfo>, SingleSource<Integer>>() {
|
||||
@Override
|
||||
public SingleSource<Integer> apply(ServiceResult<UnReadCountInfo> unReadCountInfoServiceResult) throws Exception {
|
||||
if (unReadCountInfoServiceResult.isSuccess()) {
|
||||
UnReadCountInfo unReadCountInfo = unReadCountInfoServiceResult.getData();
|
||||
if (unReadCountInfo != null) {
|
||||
return Single.just(unReadCountInfoServiceResult.getData().getTotal());
|
||||
} else {
|
||||
return Single.just(0);
|
||||
}
|
||||
} else {
|
||||
return Single.just(0);
|
||||
}
|
||||
}
|
||||
}).compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
* 获取首页数据接口V4,2019.02.19改版
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@GET("/home/v4/home")
|
||||
Single<ServiceResult<List<HomeInfo>>> getHomeListV4(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 获取首页分页数据接口V4,2019.02.19改版
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@GET("/home/v4/topic")
|
||||
Single<ServiceResult<HomeMoreData>> getMoreHomeListV4(@Query("uid") String uid,
|
||||
@Query("page") int page,
|
||||
@Query("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 获取首页数据接口
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@GET("/home/v3/home")
|
||||
Single<ServiceResult<List<HomeInfo>>> getHomeList(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 佛系交友
|
||||
*/
|
||||
@GET("/home/v3/findByPermit")
|
||||
Single<ServiceResult<List<HomeRoom>>> loadMakeFriendList();
|
||||
|
||||
/**
|
||||
* 提交反馈
|
||||
*
|
||||
* @param uid
|
||||
* @param feedbackDesc
|
||||
* @param contact
|
||||
* @param ticket
|
||||
* @return
|
||||
*/
|
||||
@POST("/feedback")
|
||||
Single<ServiceResult> commitFeedback(@Query("uid") String uid,
|
||||
@Query("feedbackDesc") String feedbackDesc,
|
||||
@Query("contact") String contact,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
/**
|
||||
* 获取首页tab数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/room/tag/v3/top")
|
||||
Single<ServiceResult<List<TabInfo>>> getMainTabList();
|
||||
|
||||
|
||||
/**
|
||||
* 通过tag获取首页数据
|
||||
*
|
||||
* @param tagId
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GET("/home/v3/tagindex")
|
||||
Single<ServiceResult<ClassifiedRoomInfo>> getMainDataByTab(@Query("tagId") String tagId,
|
||||
@Query("pageNum") String pageNum,
|
||||
@Query("pageSize") String pageSize);
|
||||
|
||||
|
||||
/**
|
||||
* 获取发现页面数据
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@GET("/discovery")
|
||||
Single<ServiceResult<FindInfo>> loadFindPage(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 获取发现页面数据V2
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@GET("/discovery/v2/get")
|
||||
Single<ServiceResult<FindInfo>> loadFindPageV2(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 获取首页KTV 房间列表
|
||||
*
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @param orderType 排序方式(1:最新,2:最热)
|
||||
* @return
|
||||
*/
|
||||
@GET("/room/listKTVRooms")
|
||||
Single<ServiceResult<List<KTVRoom>>> loadKTVList(@Query("page") String page,
|
||||
@Query("pageSize") String pageSize,
|
||||
@Query("orderType") String orderType);
|
||||
|
||||
|
||||
/**
|
||||
* 获取新人列表
|
||||
*
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GET("/user/list/new")
|
||||
Single<ServiceResult<List<UserInfo>>> loadNewUserList(@Query("page") String page,
|
||||
@Query("pageSize") String pageSize);
|
||||
|
||||
|
||||
/**
|
||||
* 导流-获取推荐的房间
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@GET("/user/recommend/room")
|
||||
Single<ServiceResult<UserRecommendRoomInfo>> loadRecommendRoom(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 获取首页房间标签列表
|
||||
*/
|
||||
@GET("/home/v4/titleList")
|
||||
Single<ServiceResult<List<TagListInfo>>> titleList(@Query("uid") long uid);
|
||||
|
||||
/**
|
||||
* 分页获取标题对应列表数据
|
||||
*/
|
||||
@GET("/home/v4/titleIndex")
|
||||
Single<ServiceResult<TitleIndexInfo>> titleIndex(@Query("titleId") long titleId,
|
||||
@Query("page") int page,
|
||||
@Query("pageSize") int pageSize);
|
||||
|
||||
/**
|
||||
* 获取游戏首页可配置模块数据
|
||||
*/
|
||||
@GET("/home/v4/getModuleRooms")
|
||||
Single<ServiceResult<List<HomeInfo>>> getGameHomeRoom();
|
||||
|
||||
/**
|
||||
* 嗨聊派对--随机获取一个牌照房id返回
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/room/getGuildRoomId")
|
||||
Single<ServiceResult<String>> getGuildRoomId(@Field("uid") long uid);
|
||||
|
||||
/**
|
||||
* 添加进异性匹配池
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("game/v4/match/addIsomerism")
|
||||
Single<ServiceResult<String>> addIsomerism(@Field("uid") long uid);
|
||||
|
||||
/**
|
||||
* 移除异性匹配池
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("game/v4/match/removeIsomerism")
|
||||
Single<ServiceResult<String>> removeIsomerism(@Field("uid") long uid);
|
||||
|
||||
/**
|
||||
* 新版首页获取导航栏列表和下拉选择列表
|
||||
*
|
||||
* @param type 1-导航栏 2-首页下方的banner 3 轻寻的banner
|
||||
* @return
|
||||
*/
|
||||
@GET("home/v5/getFirstPageBanner")
|
||||
Single<ServiceResult<HomeBannerInfo>> getHomeBannerInfo(@Query("type") long type);
|
||||
|
||||
|
||||
/**
|
||||
* 上传地理位置信息
|
||||
*
|
||||
* @param uid
|
||||
* @param address
|
||||
* @param adcode
|
||||
* @param longitude
|
||||
* @param latitude
|
||||
* @return
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("user/address/save")
|
||||
Single<ServiceResult<Object>> uploadAddress(@Field("uid") long uid, @Field("address") String address, @Field("adcode") int adcode, @Field("longitude") double longitude, @Field("latitude") double latitude);
|
||||
|
||||
/**
|
||||
* 获取语音派对里面的banner
|
||||
*
|
||||
* @param tabId
|
||||
* @return
|
||||
*/
|
||||
@GET("home/v5/getTabBanner")
|
||||
Single<ServiceResult<ArrayList<BannerInfo>>> getTabBanner(@Query("tabId") String tabId);
|
||||
|
||||
/**
|
||||
* 获取语音派对房间列表(分页)
|
||||
*
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @param tabId
|
||||
* @return
|
||||
*/
|
||||
@GET("home/v5/getTabRoomList")
|
||||
Single<ServiceResult<List<HomeRoom>>> getTabRoomList(@Query("currentPage") int pageIndex, @Query("pageSize") int pageSize, @Query("tabId") String tabId);
|
||||
|
||||
/**
|
||||
* 获取语音派对房间列表(分页)
|
||||
*
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @param tabId
|
||||
* @return
|
||||
*/
|
||||
@GET("home/v6/user/list")
|
||||
Single<ServiceResult<List<RecommendationUserInfo>>> getHomeListV5(@Query("uid") long uid, @Query("page") int pageIndex, @Query("pageSize") int pageSize, @Query("labelType") String tabId);
|
||||
|
||||
/**
|
||||
* 获取互动消息未读数量
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@POST("interactive/unreadCount")
|
||||
Single<ServiceResult<UnReadCountInfo>> getUnreadCount(@Query("uid") long uid);
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.yizhuan.xchat_android_core.home.model;
|
||||
|
||||
import com.yizhuan.xchat_android_core.community.bean.CommunityNoticeInfo;
|
||||
import com.yizhuan.xchat_android_library.base.IMvpBaseView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
public interface ICommunityNoticeModel extends IMvpBaseView {
|
||||
|
||||
Single<List<CommunityNoticeInfo>> getMsg(long uid, Long id, int pageSize);
|
||||
Single<String> delete(long uid);
|
||||
}
|
@@ -0,0 +1,190 @@
|
||||
package com.yizhuan.xchat_android_core.home.model;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.family.bean.HomeBannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.ClassifiedRoomInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.FindInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeItem;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoom;
|
||||
import com.yizhuan.xchat_android_core.home.bean.KTVRoom;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TagListInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TitleIndexInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.RecommendationUserInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserRecommendRoomInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
public interface IHomeModel extends IModel {
|
||||
List<TabInfo> getmTabInfoList();
|
||||
|
||||
/**
|
||||
* 获取首页数据
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
Single<ServiceResult<List<HomeInfo>>> loadHomeList(String uid);
|
||||
|
||||
/**
|
||||
* 3.1.2之后改版,首页v4
|
||||
*
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
Single<ServiceResult<List<HomeInfo>>> loadHomeListV4(String uid);
|
||||
|
||||
/**
|
||||
* 首页加载更多
|
||||
*/
|
||||
Single<List<HomeRoom>> loadMoreHomeData(int page, int pageSize);
|
||||
|
||||
/**
|
||||
* 获取佛系交友的列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Single<ServiceResult<List<HomeRoom>>> loadMakeFriendList();
|
||||
|
||||
/**
|
||||
* 提交反馈
|
||||
*
|
||||
* @param uid
|
||||
* @param feedbackDesc
|
||||
* @param contact
|
||||
* @return
|
||||
*/
|
||||
Single<String> commitFeedback(long uid, String feedbackDesc, String contact);
|
||||
|
||||
/**
|
||||
* 获取首页房间 分类 tab 数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Single<List<TabInfo>> getMainTabData();
|
||||
|
||||
/**
|
||||
* 根据分类 获取房间列表
|
||||
*
|
||||
* @param tagId
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
*/
|
||||
Single<ClassifiedRoomInfo> getMainDataByTab(int tagId, int pageNum, int pageSize);
|
||||
|
||||
Single<FindInfo> loadFindPage(String uid);
|
||||
|
||||
Single<FindInfo> loadFindPageV2(String uid);
|
||||
|
||||
/**
|
||||
* 获取首页KTV 房间列表
|
||||
*
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @param orderType 排序方式(1:最新,2:最热)
|
||||
* @return
|
||||
*/
|
||||
Single<List<KTVRoom>> loadKTVList(String page,
|
||||
String pageSize,
|
||||
String orderType);
|
||||
|
||||
/**
|
||||
* 获取新人列表
|
||||
*
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
Single<List<UserInfo>> loadNewUserList(String page,
|
||||
String pageSize);
|
||||
|
||||
Single<UserRecommendRoomInfo> loadRecommendRoom(String uid);
|
||||
|
||||
/**
|
||||
* 获取首页房间标签列表
|
||||
*/
|
||||
Single<List<TagListInfo>> tagList(long uid);
|
||||
|
||||
/**
|
||||
* 分页获取标题对应列表数据
|
||||
*/
|
||||
Single<TitleIndexInfo> titleIndex(long titleId,
|
||||
int pageNum,
|
||||
int pageSize);
|
||||
|
||||
/**
|
||||
* 获取游戏首页运营配置数据
|
||||
*/
|
||||
Single<List<HomeItem>> getGameHomeInfo();
|
||||
|
||||
/**
|
||||
* 获取嗨聊派对id
|
||||
*/
|
||||
Single<String> getGuildRoomId();
|
||||
|
||||
Single<String> addIsomerism();
|
||||
|
||||
Single<String> removeIsomerism();
|
||||
|
||||
/**
|
||||
* 获取首页banner
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Single<HomeBannerInfo> getHomeBannerInfo();
|
||||
|
||||
/**
|
||||
* 上传用户位置信息
|
||||
* @param uid
|
||||
* @param address
|
||||
* @param adcode
|
||||
* @param longitude
|
||||
* @param latitude
|
||||
* @return
|
||||
*/
|
||||
Single<Object> uploadAddress(long uid, String address, int adcode, double longitude, double latitude);
|
||||
|
||||
/**
|
||||
* 获取男神女神数据和banner信息
|
||||
* @return
|
||||
*/
|
||||
Single<List<RecommendationUserInfo>> getGodList(long uid,int pageIndex,int pageSize,String type);
|
||||
|
||||
/**
|
||||
* 获取男神女神的banner
|
||||
* @return
|
||||
*/
|
||||
Single<ArrayList<BannerInfo>> getGodBannerInfo();
|
||||
|
||||
|
||||
/**
|
||||
* 获取语音派对房间列表(分页)
|
||||
* @param pageIndex
|
||||
* @param pageSize
|
||||
* @param tabId
|
||||
* @return
|
||||
*/
|
||||
Single<List<HomeRoom>> getTabRoomList(int pageIndex, int pageSize, String tabId);
|
||||
|
||||
/**
|
||||
* 获取语音派对里面的banner
|
||||
* @param tabId
|
||||
* @return
|
||||
*/
|
||||
Single<ArrayList<BannerInfo>> getTabBanner(String tabId);
|
||||
|
||||
/**
|
||||
* 轻寻顶部 banner信息
|
||||
* 包含3部分,顶部banner,测一测那个列表,标签页
|
||||
*/
|
||||
Single<HomeBannerInfo> getQxBannerInfo();
|
||||
|
||||
Single<Integer> getUnreadCount(long uid);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,694 @@
|
||||
package com.yizhuan.xchat_android_core.manager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.ktv.event.RemoteVideoEvent;
|
||||
import com.yizhuan.xchat_android_core.statistic.LogFactory;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_library.rxbus.RxBus;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import io.agora.ktvkit.IKTVKitEventHandler;
|
||||
import io.agora.ktvkit.KTVKit;
|
||||
import io.agora.rtc.Constants;
|
||||
import io.agora.rtc.IRtcEngineEventHandler;
|
||||
import io.agora.rtc.RtcEngine;
|
||||
import io.agora.rtc.video.VideoCanvas;
|
||||
|
||||
import static io.agora.rtc.Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO;
|
||||
import static io.agora.rtc.Constants.AUDIO_PROFILE_MUSIC_STANDARD;
|
||||
import static io.agora.rtc.Constants.AUDIO_RECORDING_QUALITY_LOW;
|
||||
import static io.agora.rtc.Constants.AUDIO_SCENARIO_GAME_STREAMING;
|
||||
|
||||
/**
|
||||
* <p> 声网管理类 </p>
|
||||
*
|
||||
* @author jiahui
|
||||
* @date 2017/12/12
|
||||
*/
|
||||
public final class RtcEngineManager {
|
||||
private static volatile RtcEngineManager sEngineManager;
|
||||
private static final Object SYNC_OBJECT = new Object();
|
||||
@Nullable
|
||||
private RtcEngine mRtcEngine;
|
||||
private Map<String, Integer> speakers;
|
||||
/**
|
||||
* 说话列表
|
||||
*/
|
||||
private List<Integer> speakMembersPosition;
|
||||
/**
|
||||
* 队列说话列表
|
||||
*/
|
||||
private List<Integer> speakQueueMembersPosition;
|
||||
private String uid;
|
||||
public boolean isAudienceRole;
|
||||
/**
|
||||
* 麦上是否闭麦,true:闭麦,false:开麦
|
||||
*/
|
||||
public boolean isMute;
|
||||
/**
|
||||
* 听筒是否关闭
|
||||
*/
|
||||
public boolean isRemoteMute;
|
||||
private boolean needRecord;
|
||||
private boolean isOpenAVRoomActivity;
|
||||
private boolean isOpenVoiceMatchActivity;
|
||||
//是否在房间,判断是切换品质还是第一次进
|
||||
private boolean inRoom;
|
||||
private EngineEventHandler eventHandler;
|
||||
|
||||
private static final class Helper {
|
||||
private static final RtcEngineManager INSTANCE = new RtcEngineManager();
|
||||
}
|
||||
|
||||
private RtcEngineManager() {
|
||||
System.out.println("hehehehe" + RtcEngine.getSdkVersion());
|
||||
speakMembersPosition = new ArrayList<>();
|
||||
speakQueueMembersPosition = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static RtcEngineManager get() {
|
||||
return Helper.INSTANCE;
|
||||
}
|
||||
|
||||
public void startRtcEngine(long uid) {
|
||||
RoomInfo curRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
// if (curRoomInfo.getAudioQuality() == RoomInfo.ROOMTYPE_LIGHT_CHAT) {
|
||||
// joinHighQualityChannel(curRoomInfo.getRoomId(), uid,true);
|
||||
// } else {
|
||||
joinChannel(curRoomInfo.getRoomId(), uid);
|
||||
// }
|
||||
if (curRoomInfo.getUid() == uid && curRoomInfo.getType() != RoomInfo.ROOMTYPE_HOME_PARTY) {
|
||||
//设置用户角色为主播,轰趴房不能默认设置房主为主播
|
||||
setRole(Constants.CLIENT_ROLE_BROADCASTER);
|
||||
} else {
|
||||
setRole(Constants.CLIENT_ROLE_AUDIENCE);
|
||||
}
|
||||
}
|
||||
|
||||
public void joinChannel(long channelId, long uid) {
|
||||
initRtcEngine(channelId, uid, AUDIO_PROFILE_MUSIC_STANDARD, AUDIO_SCENARIO_GAME_STREAMING);
|
||||
}
|
||||
|
||||
public void joinHighQualityChannel(long channelId, long uid, boolean record) {
|
||||
this.needRecord = record;
|
||||
initRtcEngine(channelId, uid, AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO, AUDIO_SCENARIO_GAME_STREAMING);
|
||||
}
|
||||
|
||||
public void reJoinChannel(long channelId, long uid) {
|
||||
enterChannel(channelId, (int) uid, AUDIO_PROFILE_MUSIC_STANDARD, AUDIO_SCENARIO_GAME_STREAMING);
|
||||
setRemoteMute(isRemoteMute);
|
||||
setMute(isMute);
|
||||
}
|
||||
|
||||
public void reJoinHighQualityChannel(long channelId, long uid, boolean record) {
|
||||
this.needRecord = record;
|
||||
enterChannel(channelId, (int) uid, AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO, AUDIO_SCENARIO_GAME_STREAMING);
|
||||
setRemoteMute(isRemoteMute);
|
||||
setMute(isMute);
|
||||
}
|
||||
|
||||
private void initRtcEngine(long channelId, long uid, int quality, int audioShowRoom) {
|
||||
this.uid = uid + "";
|
||||
this.isMute = false;
|
||||
this.isRemoteMute = false;
|
||||
enterChannel(channelId, (int) uid, quality, audioShowRoom);
|
||||
}
|
||||
|
||||
private void enterChannel(long channelId, int uid, int quality, int audioShowRoom) {
|
||||
if (eventHandler == null) {
|
||||
eventHandler = new EngineEventHandler(this);
|
||||
}
|
||||
eventHandler.isEnter = true;
|
||||
if (mRtcEngine == null) {
|
||||
try {
|
||||
|
||||
mRtcEngine = RtcEngine.create(BasicConfig.INSTANCE.getAppContext(), XChatConstants.AGORA_KEY, eventHandler);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));
|
||||
}
|
||||
//设置频道模式为直播
|
||||
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
|
||||
mRtcEngine.setAudioProfile(quality, audioShowRoom);
|
||||
mRtcEngine.enableAudioVolumeIndication(600, 3);
|
||||
mRtcEngine.setDefaultAudioRoutetoSpeakerphone(true);
|
||||
mRtcEngine.setExternalVideoSource(true, false, true);
|
||||
mRtcEngine.setRecordingAudioFrameParameters(48000, 2, 2, 960);
|
||||
mRtcEngine.setVideoProfile(Constants.VIDEO_PROFILE_360P, false);
|
||||
mRtcEngine.enableDualStreamMode(true);
|
||||
mRtcEngine.setParameters(String.format(Locale.US, "{\"che.audio.headset.monitoring,true\"}"));
|
||||
mRtcEngine.setParameters(String.format(Locale.US, "{\"che.audio.enable.androidlowlatencymode,true\"}"));
|
||||
mRtcEngine.setLogFile(Environment.getExternalStorageDirectory()
|
||||
+ File.separator + BasicConfig.INSTANCE.getAppContext().getPackageName() + "/log/agora-rtc.log");
|
||||
}
|
||||
//创建并加入频道
|
||||
mRtcEngine.joinChannel(null, String.valueOf(channelId), null, uid);
|
||||
}
|
||||
|
||||
|
||||
public int stopAudioMixing() {
|
||||
if (mRtcEngine != null) {
|
||||
return mRtcEngine.stopAudioMixing();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void resetChannel() {
|
||||
if (mRtcEngine != null) {
|
||||
stopAudioMixing();
|
||||
mRtcEngine.leaveChannel();
|
||||
mRtcEngine = null;
|
||||
}
|
||||
if (handler != null)
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
public void leaveChannel() {
|
||||
if (mRtcEngine != null) {
|
||||
stopAudioMixing();
|
||||
mRtcEngine.leaveChannel();
|
||||
mRtcEngine = null;
|
||||
}
|
||||
if (handler != null)
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
// isAudienceRole = true;
|
||||
isMute = false;
|
||||
isRemoteMute = false;
|
||||
needRecord = false;
|
||||
inRoom = false;
|
||||
}
|
||||
|
||||
public boolean isSpeaking(int position) {
|
||||
if (speakMembersPosition != null) {
|
||||
if (speakMembersPosition.contains(position)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isQueueSpeaking(int position) {
|
||||
if (speakQueueMembersPosition != null) {
|
||||
if (speakQueueMembersPosition.contains(position)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setOpenAVRoomActivity(boolean openAVRoomActivity) {
|
||||
isOpenAVRoomActivity = openAVRoomActivity;
|
||||
setRemoteMute(isRemoteMute);
|
||||
setMute(isMute);
|
||||
}
|
||||
|
||||
public void setOpenVoiceMatchActivity(boolean openVoiceMatchActivity) {
|
||||
isOpenVoiceMatchActivity = openVoiceMatchActivity;
|
||||
setRemoteMute(isRemoteMute);
|
||||
setMute(isMute);
|
||||
}
|
||||
|
||||
//设置静音
|
||||
public void setRemoteMute(boolean mute) {
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.muteAllRemoteAudioStreams(mute || (isOpenVoiceMatchActivity && !isOpenAVRoomActivity));
|
||||
if (result == 0) {
|
||||
isRemoteMute = mute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setRemoteMute(int uid, boolean mute) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.muteRemoteAudioStream(uid, mute);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRemoteMute(ChatRoomMember chatRoomMember, boolean mute) {
|
||||
if (chatRoomMember != null && !TextUtils.isEmpty(chatRoomMember.getAccount())) {
|
||||
String account = chatRoomMember.getAccount();
|
||||
Integer uid = Integer.valueOf(account);
|
||||
if (uid != 0)
|
||||
RtcEngineManager.get().setRemoteMute(uid, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置角色,上麦,下麦(调用)
|
||||
*
|
||||
* @param role CLIENT_ROLE_AUDIENCE: 听众 ,CLIENT_ROLE_BROADCASTER: 主播
|
||||
*/
|
||||
public void setRole(int role) {
|
||||
if (mRtcEngine != null) {
|
||||
//先已是否静音为准
|
||||
mRtcEngine.setClientRole(role);
|
||||
isAudienceRole = role != Constants.CLIENT_ROLE_BROADCASTER;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否能说话,静音,人自己的行为
|
||||
*
|
||||
* @param mute true:静音,false:不静音
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void setMute(boolean mute) {
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.muteLocalAudioStream(mute || (isOpenVoiceMatchActivity && !isOpenAVRoomActivity));
|
||||
if (result == 0) {
|
||||
isMute = mute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Handler handler = new RtcEngineHandler(this);
|
||||
|
||||
private static class RtcEngineHandler extends Handler {
|
||||
private WeakReference<RtcEngineManager> mReference;
|
||||
|
||||
RtcEngineHandler(RtcEngineManager manager) {
|
||||
mReference = new WeakReference<>(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
RtcEngineManager rtcEngineManager = mReference.get();
|
||||
if (rtcEngineManager == null) return;
|
||||
if (msg.what == 0) {
|
||||
if (!RtcEngineManager.get().inRoom) {
|
||||
IMNetEaseManager.get().joinAvRoom();
|
||||
}
|
||||
|
||||
RtcEngineManager.get().inRoom = true;
|
||||
if (rtcEngineManager.needRecord && rtcEngineManager.mRtcEngine != null) {
|
||||
rtcEngineManager.mRtcEngine.startAudioRecording(Environment.getExternalStorageDirectory()
|
||||
+ File.separator + BasicConfig.INSTANCE.getAppContext().getPackageName()
|
||||
+ "/audio/" + System.currentTimeMillis() + ".aac", AUDIO_RECORDING_QUALITY_LOW);
|
||||
}
|
||||
|
||||
} else if (msg.what == 1) {//onAudioVolumeIndication 说话声音音量提示回调
|
||||
IRtcEngineEventHandler.AudioVolumeInfo[] speakers = (IRtcEngineEventHandler.AudioVolumeInfo[]) msg.obj;
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
if (rtcEngineManager.speakQueueMembersPosition.size() > 0) {
|
||||
rtcEngineManager.speakQueueMembersPosition.clear();
|
||||
}
|
||||
if (speakers == null || speakers.length == 0) return;
|
||||
for (IRtcEngineEventHandler.AudioVolumeInfo speaker : speakers) {
|
||||
// 0 代表的是房主,其他代表的是uid
|
||||
int uid = speaker.uid == 0 ? Integer.valueOf(rtcEngineManager.uid) : speaker.uid;
|
||||
int micPosition = AvRoomDataManager.get().getMicPosition(uid);
|
||||
// 如果是房主的话,并且房主的mic位置没有的啊,则把房主的位置设置为-1(兼容ios轻聊房光晕)
|
||||
if (uid == AvRoomDataManager.get().mCurrentRoomInfo.getUid() &&
|
||||
AvRoomDataManager.get().mCurrentRoomInfo.getType() == RoomInfo.ROOMTYPE_LIGHT_CHAT
|
||||
&& micPosition == Integer.MIN_VALUE) {
|
||||
micPosition = -1;
|
||||
}
|
||||
if (micPosition == Integer.MIN_VALUE &&
|
||||
uid == AuthModel.get().getCurrentUid()) {
|
||||
// 如果麦上没有自己,并且自己在说话,要把自己变成听众
|
||||
RtcEngineManager.get().setRole(Constants.CLIENT_ROLE_AUDIENCE);
|
||||
} else if (micPosition == Integer.MIN_VALUE &&
|
||||
uid != AuthModel.get().getCurrentUid()) {
|
||||
// 如果麦上没有这个人,要把他静音
|
||||
RtcEngineManager.get().setRemoteMute(uid, true);
|
||||
}
|
||||
if (micPosition == Integer.MIN_VALUE) continue;
|
||||
rtcEngineManager.speakQueueMembersPosition.add(micPosition);
|
||||
}
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(
|
||||
new RoomEvent().setEvent(RoomEvent.SPEAK_STATE_CHANGE)
|
||||
.setMicPositionList(rtcEngineManager.speakQueueMembersPosition)
|
||||
);
|
||||
} else if (msg.what == 2) {//onUserMuteAudio 用户静音回调
|
||||
Integer uid = (Integer) msg.obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class EngineEventHandler extends IRtcEngineEventHandler {
|
||||
private WeakReference<RtcEngineManager> mReference;
|
||||
private boolean isEnter;
|
||||
|
||||
EngineEventHandler(RtcEngineManager manager) {
|
||||
mReference = new WeakReference<>(manager);
|
||||
isEnter = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
super.onJoinChannelSuccess(channel, uid, elapsed);
|
||||
//声网进入频道成功日志
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_AUDIO_LOG,
|
||||
LogProtocol.Event.EVENT_AUDIO_CHANNEL
|
||||
)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "1")
|
||||
.append("room_id", channel));
|
||||
if (mReference.get() != null && isEnter) {
|
||||
isEnter = false;
|
||||
mReference.get().handler.sendEmptyMessage(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRejoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
super.onRejoinChannelSuccess(channel, uid, elapsed);
|
||||
//声网重新链接频道成功日志
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_AUDIO_LOG,
|
||||
LogProtocol.Event.EVENT_AUDIO_CHANNEL
|
||||
)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "3")
|
||||
.append("room_id", channel));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeaveChannel(RtcStats stats) {
|
||||
super.onLeaveChannel(stats);
|
||||
//声网离开频道成功日志
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_AUDIO_LOG,
|
||||
LogProtocol.Event.EVENT_AUDIO_CHANNEL
|
||||
)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "2"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserJoined(int uid, int elapsed) {
|
||||
super.onUserJoined(uid, elapsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActiveSpeaker(int uid) {
|
||||
super.onActiveSpeaker(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLastmileQuality(int quality) {
|
||||
super.onLastmileQuality(quality);
|
||||
if (quality >= 3) {
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_BAD)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionInterrupted() {
|
||||
super.onConnectionInterrupted();
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_CLOSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionLost() {
|
||||
super.onConnectionLost();
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_CLOSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioVolumeIndication(AudioVolumeInfo[] speakers, int totalVolume) {
|
||||
super.onAudioVolumeIndication(speakers, totalVolume);
|
||||
RtcEngineManager manager = mReference.get();
|
||||
if (manager != null) {
|
||||
Message message = manager.handler.obtainMessage();
|
||||
message.what = 1;
|
||||
message.obj = speakers;
|
||||
manager.handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserMuteAudio(int uid, boolean muted) {
|
||||
super.onUserMuteAudio(uid, muted);
|
||||
RtcEngineManager manager = mReference.get();
|
||||
if (manager != null) {
|
||||
if (muted) {
|
||||
Message message = manager.handler.obtainMessage();
|
||||
message.what = 2;
|
||||
message.obj = uid;
|
||||
manager.handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClientRoleChanged(int oldRole, int newRole) {
|
||||
super.onClientRoleChanged(oldRole, newRole);
|
||||
if (newRole==1)
|
||||
get().setMute(get().isMute);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioMixingFinished() {//伴奏播放已结束回调
|
||||
super.onAudioMixingFinished();
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(
|
||||
new RoomEvent().setEvent(RoomEvent.METHOD_ON_AUDIO_MIXING_FINISHED)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteVideoDecoded(final int uid, int width, int height, int elapsed) {
|
||||
RxBus.get().post(new RemoteVideoEvent(uid));
|
||||
get().remoteUid = uid;
|
||||
}
|
||||
}
|
||||
|
||||
//音乐播放相关---------------begin--------------------------
|
||||
|
||||
public void adjustAudioMixingVolume(int volume) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.adjustAudioMixingVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
public void adjustRecordingSignalVolume(int volume) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.adjustRecordingSignalVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
public int resumeAudioMixing() {
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.resumeAudioMixing();
|
||||
return result;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int pauseAudioMixing() {
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.pauseAudioMixing();
|
||||
return result;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public int startAudioMixing(String filePath, boolean loopback, int cycle) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.stopAudioMixing();
|
||||
int result = 0;
|
||||
try {
|
||||
result = mRtcEngine.startAudioMixing(filePath, loopback, false, cycle);
|
||||
} catch (Exception e) {
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getAudioMixingCurrentPosition() {
|
||||
return mRtcEngine.getAudioMixingCurrentPosition();
|
||||
}
|
||||
|
||||
public int getAudioMixingDuration() {
|
||||
return mRtcEngine.getAudioMixingDuration();
|
||||
}
|
||||
//音乐播放相关---------------end--------------------------
|
||||
|
||||
|
||||
//ktv相关---------------begin--------------------------
|
||||
private boolean isPlaying;
|
||||
private boolean isAccompany = true;
|
||||
private boolean isPush;
|
||||
private boolean isOpenKtv;
|
||||
private boolean isLive;
|
||||
private int remoteUid;
|
||||
private double accompanyVoice = 0.5;
|
||||
private double personVoice = 0.5;
|
||||
@Nullable
|
||||
private KTVKit ktvKit;
|
||||
|
||||
public synchronized void openKtvModel() {
|
||||
if (mRtcEngine == null || isOpenKtv) return;
|
||||
try {
|
||||
ktvKit = KTVKit.create(mRtcEngine, BasicConfig.INSTANCE.getAppContext(), new IKTVKitEventHandler() {
|
||||
@Override
|
||||
public void onPlayerError(int error) {
|
||||
SingleToastUtil.showToast("MV播放出现未知错误,可以点击报错向我们反馈哦~~");
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mRtcEngine.enableVideo();
|
||||
mRtcEngine.enableLocalVideo(false);
|
||||
isOpenKtv = true;
|
||||
}
|
||||
|
||||
public synchronized void closeKtvModel() {
|
||||
if (!isOpenKtv) return;
|
||||
stopPush();
|
||||
isPlaying = false;
|
||||
isOpenKtv = false;
|
||||
isLive = false;
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.disableVideo();
|
||||
}
|
||||
if (ktvKit != null) {
|
||||
KTVKit.destroy();
|
||||
ktvKit = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void stopPush() {
|
||||
if (isPush){
|
||||
isPush = false;
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.muteLocalVideoStream(true);
|
||||
mRtcEngine.enableLocalVideo(false);
|
||||
// mRtcEngine.enableInEarMonitoring(false);
|
||||
}
|
||||
if (ktvKit != null) ktvKit.stopPlayVideoFile();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void startMv(String url) {
|
||||
if (ktvKit == null || mRtcEngine == null || !isOpenKtv || !AvRoomDataManager.get().isOwnerOnMic())
|
||||
return;
|
||||
mRtcEngine.enableLocalVideo(true);
|
||||
//mRtcEngine.enableInEarMonitoring(true);
|
||||
mRtcEngine.muteLocalVideoStream(false);
|
||||
ktvKit.openAndPlayVideoFile(url);
|
||||
setAccompanyVoice(accompanyVoice);
|
||||
setPersonVoice(personVoice);
|
||||
isPlaying = true;
|
||||
isPush = true;
|
||||
isLive = true;
|
||||
}
|
||||
|
||||
public synchronized void setupRemoteVideo(VideoCanvas canvas, int remoteUid) {
|
||||
if (mRtcEngine != null && isOpenKtv) {
|
||||
isPlaying = true;
|
||||
isLive = true;
|
||||
mRtcEngine.setupRemoteVideo(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void playOrPause() {
|
||||
if (ktvKit != null) ktvKit.pause();
|
||||
isPlaying = !isPlaying;
|
||||
}
|
||||
|
||||
public void changeAudioStream() {
|
||||
if (ktvKit != null) ktvKit.switchAudioTrack();
|
||||
isAccompany = !isAccompany;
|
||||
}
|
||||
|
||||
public void setAccompanyVoice(double progress) {
|
||||
if (progress < 0 || progress > 1) {
|
||||
return;
|
||||
}
|
||||
accompanyVoice = progress;
|
||||
if (ktvKit != null) ktvKit.adjustAccompanyVolume(progress);
|
||||
}
|
||||
|
||||
public void setPersonVoice(double progress) {
|
||||
if (progress < 0 || progress > 1) {
|
||||
return;
|
||||
}
|
||||
personVoice = progress;
|
||||
if (ktvKit != null) ktvKit.adjustVoiceVolume(personVoice);
|
||||
}
|
||||
|
||||
public boolean isPlaying() {
|
||||
return isPlaying;
|
||||
}
|
||||
|
||||
public boolean isPush() {
|
||||
return isPush;
|
||||
}
|
||||
|
||||
public boolean isAccompany() {
|
||||
return isAccompany;
|
||||
}
|
||||
|
||||
public boolean isOpenKtv() {
|
||||
return isOpenKtv;
|
||||
}
|
||||
|
||||
public boolean isLive() {
|
||||
return isLive;
|
||||
}
|
||||
|
||||
public void setLive(boolean live) {
|
||||
isLive = live;
|
||||
}
|
||||
|
||||
public int getRemoteUid() {
|
||||
return remoteUid;
|
||||
}
|
||||
|
||||
public double getAccompanyVoice() {
|
||||
return accompanyVoice;
|
||||
}
|
||||
|
||||
public double getPersonVoice() {
|
||||
return personVoice;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public KTVKit getKtvKit() {
|
||||
return ktvKit;
|
||||
}
|
||||
|
||||
public double getPlayPos() {
|
||||
return ktvKit == null ? 0 : ktvKit.getCurrentPosition();
|
||||
}
|
||||
|
||||
public int getPlayDuration() {
|
||||
return ktvKit == null ? 0 : ktvKit.getDuration();
|
||||
}
|
||||
|
||||
//ktv相关---------------end--------------------------
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.yizhuan.xchat_android_core.market_verify;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.LoginTipsInfo;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
public interface IMarketVerifyModel extends IModel {
|
||||
/**
|
||||
* 当前版本当前渠道的市场是否正常审核中
|
||||
* @return
|
||||
*/
|
||||
boolean isMarketChecking();
|
||||
|
||||
/**
|
||||
* 从服务器获取当前市场审核状态
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
Single<Boolean> loadVersionConfigFromServer(String uid);
|
||||
|
||||
void setMarketChecking(boolean isMarketChecking);
|
||||
|
||||
/**
|
||||
* 从服务器登录界面的提示语
|
||||
* @return
|
||||
*/
|
||||
Single<LoginTipsInfo> loadLoginTip();
|
||||
}
|
@@ -0,0 +1,151 @@
|
||||
package com.yizhuan.xchat_android_core.market_verify;
|
||||
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.LoginTipsInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.market_verify.bean.VersionConfig;
|
||||
import com.yizhuan.xchat_android_core.market_verify.event.MarketVerifyUpdateEvent;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
import com.yizhuan.xchat_android_library.utils.AppMetaDataUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class MarketVerifyModel extends BaseModel implements IMarketVerifyModel{
|
||||
//如果是oppo 市场,默认审核状态
|
||||
private final String[] reviewMarkets = new String[]{"oppo"};
|
||||
|
||||
private volatile boolean isMarketChecking = false;
|
||||
private Api api;
|
||||
|
||||
private MarketVerifyModel() {
|
||||
api = RxNet.create(Api.class);
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
//如果是oppo 市场,默认审核状态
|
||||
String channel = AppMetaDataUtil.getChannelID();
|
||||
for (String reviewMarket : reviewMarkets) {
|
||||
if (reviewMarket.equals(channel)) {
|
||||
setMarketChecking(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IMarketVerifyModel get() {
|
||||
return InstanceHolder.instance;
|
||||
}
|
||||
|
||||
private final static class InstanceHolder {
|
||||
private final static IMarketVerifyModel instance = new MarketVerifyModel();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLogin(LoginEvent event){
|
||||
loadVersionConfigFromServer(
|
||||
String.valueOf(AuthModel.get().getCurrentUid())
|
||||
)
|
||||
.subscribe(new SingleObserver<Boolean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean aBoolean) {
|
||||
EventBus.getDefault().post(new MarketVerifyUpdateEvent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarketChecking(boolean isMarketChecking) {
|
||||
this.isMarketChecking = isMarketChecking;
|
||||
}
|
||||
/**
|
||||
* 当前版本当前渠道的市场是否正常审核中
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isMarketChecking() {
|
||||
return isMarketChecking;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从服务器获取当前市场审核状态
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<Boolean> loadVersionConfigFromServer(String uid){
|
||||
return api.loadVersionConfig(
|
||||
uid
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(new Function<ServiceResult<VersionConfig>, SingleSource<? extends Boolean>>() {
|
||||
@Override
|
||||
public SingleSource<? extends Boolean> apply(ServiceResult<VersionConfig> response) throws Exception {
|
||||
if (response.isSuccess()){
|
||||
if (null != response.getData()
|
||||
&& response.getData().getStatus() == VersionConfig.STATUS_MARKET_CHECKING){
|
||||
isMarketChecking = true;
|
||||
}else {
|
||||
isMarketChecking = false;
|
||||
}
|
||||
return Single.just(isMarketChecking);
|
||||
}else {
|
||||
isMarketChecking = false;
|
||||
return Single.error(new Throwable(response.getMessage()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 从服务器登录界面的提示语
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<LoginTipsInfo> loadLoginTip(){
|
||||
return api.loadLoginTip().compose(RxHelper.handleSchAndExce()).compose(RxHelper.handleBeanData());
|
||||
}
|
||||
|
||||
|
||||
private interface Api {
|
||||
|
||||
/**
|
||||
* 获取版本审核配置
|
||||
* @return
|
||||
*/
|
||||
@GET("/version/get")
|
||||
Single<ServiceResult<VersionConfig>> loadVersionConfig(@Query("uid") String uid);
|
||||
|
||||
/**
|
||||
* 获取登录提示
|
||||
* @return
|
||||
*/
|
||||
@GET("/version/get/tips")
|
||||
Single<ServiceResult<LoginTipsInfo>> loadLoginTip();
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.yizhuan.xchat_android_core.market_verify.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
* @Description
|
||||
* @Date 2018/7/30
|
||||
*/
|
||||
@Data
|
||||
public class VersionConfig {
|
||||
|
||||
public static final int STATUS_ONLINE = 1;
|
||||
public final static int STATUS_MARKET_CHECKING = 2;
|
||||
public static final int STATUS_FORCE_UPDATE = 3;
|
||||
public static final int STATUS_RECOMMEND_UPDATE = 4;
|
||||
public static final int STATUS_DELETED = 5;
|
||||
|
||||
//状态(1:线上版本,2:审核中版本,3:强制更新版本,4:建议更新版本,5:已删除版本)
|
||||
private int status;
|
||||
private String versionDesc;//描述信息
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
package com.yizhuan.xchat_android_core.market_verify.event;
|
||||
|
||||
public class MarketVerifyUpdateEvent {
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
package com.yizhuan.xchat_android_core.retry;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleEmitter;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
|
||||
/**
|
||||
* 云信消息重发的一个管理
|
||||
* Created by lvzebiao on 2020/2/19.
|
||||
*/
|
||||
|
||||
public class ImRetryManager {
|
||||
|
||||
private final static String LOG_TAG = "MessageRetry";
|
||||
|
||||
/**
|
||||
* 最多的重试次数
|
||||
*/
|
||||
public static final int MAX_RETRY_COUNT = 3;
|
||||
/**
|
||||
* 重试间隔固定,ms
|
||||
*/
|
||||
public static final long RETRY_DISTANCE_TIME = 30 * 1000;
|
||||
|
||||
public static Single<RetryChatRoomMessage> sendRoomGiftMsg(ChatRoomMessage message) {
|
||||
RetryChatRoomMessage retryChatRoomMessage = new RetryChatRoomMessage();
|
||||
retryChatRoomMessage.setMessage(message);
|
||||
retryChatRoomMessage.setRetryCount(0);
|
||||
return IMNetEaseManager.get().sendChatRoomMessageWithRetry(retryChatRoomMessage,
|
||||
MAX_RETRY_COUNT, RETRY_DISTANCE_TIME, new ReconnectListener() {
|
||||
@Override
|
||||
public void onFailed(int failedCount, String error) {
|
||||
ImRetryManager.log("failed count:" + failedCount + ", error:" + error);
|
||||
if (failedCount == 1) {
|
||||
//首次失败,加埋点
|
||||
String log = "房间礼物消息发送失败, error:" + error;
|
||||
ImRetryManager.log(log);
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.Event.EVENT_ROOM_GIFT_FAILED, log);
|
||||
} else if (failedCount == MAX_RETRY_COUNT + 1) {
|
||||
String log = "房间礼物消息重发失败, error:" + error;
|
||||
ImRetryManager.log(log);
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.Event.EVENT_ROOM_GIFT_RETRY_FAILED, log);
|
||||
}
|
||||
}
|
||||
})
|
||||
.doOnSuccess(param -> {
|
||||
ImRetryManager.log("success and connect count:" + param.getRetryCount());
|
||||
if (param.getRetryCount() > 1) {
|
||||
String log = "房间礼物消息重发成功-区分重连次数:" + (param.getRetryCount() - 1);
|
||||
ImRetryManager.log(log);
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.Event.EVENT_ROOM_GIFT_RETRY_SUCCEED, log);
|
||||
}
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
ImRetryManager.log("final result:" + throwable.getMessage());
|
||||
});
|
||||
}
|
||||
|
||||
public static void log(String log) {
|
||||
LogUtil.e(LOG_TAG, log);
|
||||
}
|
||||
|
||||
public static void logIde(String log) {
|
||||
Log.e(LOG_TAG, log);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package com.yizhuan.xchat_android_core.retry;
|
||||
|
||||
/**
|
||||
* 重发的回调,暂时引入是为了埋点
|
||||
* Created by @lvzebiao on 2020/2/20.
|
||||
*/
|
||||
|
||||
public interface ReconnectListener {
|
||||
/**
|
||||
* 失败的回调
|
||||
* @param failedCount 标识第几次失败
|
||||
*/
|
||||
void onFailed(int failedCount, String error);
|
||||
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.yizhuan.xchat_android_core.retry;
|
||||
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
*
|
||||
* Created by @lvzebiao on 2020/2/20.
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class RetryChatRoomMessage {
|
||||
private ChatRoomMessage message;
|
||||
private int retryCount;
|
||||
}
|
@@ -0,0 +1,152 @@
|
||||
package com.yizhuan.xchat_android_core;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
import com.yizhuan.xchat_android_library.utils.pref.CommonPref;
|
||||
|
||||
/**
|
||||
* 请求接口接口地址
|
||||
*/
|
||||
public class UriProvider {
|
||||
|
||||
public static void init(Env.UriSetting uriSetting, String url) {
|
||||
if (uriSetting == Env.UriSetting.Product) {
|
||||
//生产环境地址
|
||||
initProductUri(url);
|
||||
} else if (uriSetting == Env.UriSetting.Test) {
|
||||
//测试环境地址
|
||||
initTestUri(url);
|
||||
}
|
||||
}
|
||||
|
||||
private static String DEBUG_URL;
|
||||
|
||||
public static void initDevUri(String url) {
|
||||
DEBUG_URL = url;
|
||||
JAVA_WEB_URL = url;
|
||||
IM_SERVER_URL = url;
|
||||
}
|
||||
|
||||
private static void initProductUri(String url) {
|
||||
JAVA_WEB_URL = url;
|
||||
IM_SERVER_URL = url;
|
||||
}
|
||||
|
||||
|
||||
private static void initTestUri(String url) {
|
||||
int enviroment = CommonPref.instance(BasicConfig.INSTANCE.getAppContext()).getInt("enviroment");
|
||||
if (enviroment == 0) {
|
||||
initProductUri(url);//其他使用DEV的配置,就神曲这个跟新一下
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(DEBUG_URL))
|
||||
initDevUri(DEBUG_URL);
|
||||
else
|
||||
initDevUri(url);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认以下生产环境地址
|
||||
*/
|
||||
public static String JAVA_WEB_URL = "http://www.daxiaomao.com";
|
||||
public static String IM_SERVER_URL = "https://www.daxiaomao.com";
|
||||
|
||||
public static String getGroupResourceBaseUri() {
|
||||
return JAVA_WEB_URL.concat("/app/service/resource/list");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getLotteryActivityPage() {
|
||||
return IM_SERVER_URL.concat("/activity/double12/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 贵族订单页面
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
public static String getNobleOrderPage() {
|
||||
return IM_SERVER_URL.concat("/modules/noble/order.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取房间背景(有动效)
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
public static String getRoomBg() {
|
||||
return IM_SERVER_URL.concat("/modules/noble/roomBgList.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取贵族推荐页面
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
public static String getNobleIntroducePage() {
|
||||
return IM_SERVER_URL.concat("/modules/noble/intro.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取贵族个人管理页面
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
public static String getNobleHomePage() {
|
||||
return IM_SERVER_URL.concat("/modules/noble/homepage.html");
|
||||
}
|
||||
|
||||
/** 贵族介绍页 */
|
||||
public static String getNobleIntro() {
|
||||
return "modules/noble/intro.html";
|
||||
}
|
||||
|
||||
/** 等级界面 */
|
||||
public static String getUserLevelUrl() {
|
||||
return "modules/level/levelExper.html";
|
||||
}
|
||||
/** 等级界面 */
|
||||
public static String getUserCUrl() {
|
||||
return "modules/level/levelCharm.html";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 耳伴头条 http://beta.erbanyy.com/modules/headNews/index.html
|
||||
* @return
|
||||
*/
|
||||
public static String getErbanTopMessageUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/headNews/index.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建家族
|
||||
* @return
|
||||
*/
|
||||
public static String getCreateFamilyUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/family/create.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族指南
|
||||
* @return
|
||||
*/
|
||||
public static String getFamilyInstructionUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/family/handbook.html");
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族币获取帮助
|
||||
* @return
|
||||
*/
|
||||
public static String getFamilyCurrencyHelpUrl() {
|
||||
return JAVA_WEB_URL.concat("/modules/family/faq.html");
|
||||
}
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
package com.yizhuan.xchat_android_core.find;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.find.bean.FindWeekStarInfo;
|
||||
import com.yizhuan.xchat_android_core.find.bean.FindInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.GET;
|
||||
|
||||
/**
|
||||
* create by lvzebiao on 2018/9/13
|
||||
*/
|
||||
public class FindModel extends BaseModel implements IFindModel {
|
||||
|
||||
private final Api api = RxNet.create(Api.class);
|
||||
|
||||
private static final class Helper {
|
||||
public static final FindModel INSTANCE = new FindModel();
|
||||
}
|
||||
|
||||
public static FindModel get() {
|
||||
return Helper.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<ServiceResult<List<FindInfo>>> getFindInfo() {
|
||||
return api.getFindInfo()
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<FindWeekStarInfo>> getFindWeekStar() {
|
||||
return api.getFindWeekStar()
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
}
|
||||
|
||||
private interface Api{
|
||||
@GET("week/star/previous")
|
||||
Single<ServiceResult<List<FindWeekStarInfo>>> getFindWeekStar();
|
||||
|
||||
@GET("discovery/items")
|
||||
Single<ServiceResult<List<FindInfo>>> getFindInfo();
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.yizhuan.xchat_android_core.find;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.find.bean.FindInfo;
|
||||
import com.yizhuan.xchat_android_core.find.bean.FindWeekStarInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
/**
|
||||
* create by lvzebiao on 2018/9/13
|
||||
*/
|
||||
public interface IFindModel extends IModel {
|
||||
|
||||
Single<ServiceResult<List<FindInfo>>> getFindInfo();
|
||||
|
||||
Single<List<FindWeekStarInfo>> getFindWeekStar();
|
||||
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package com.yizhuan.xchat_android_core.find.bean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FindInfo {
|
||||
/**
|
||||
* id : 3
|
||||
* name : 邀请好友来玩哈哈
|
||||
* routerType : 14
|
||||
* seqNo : 3
|
||||
* status : 1
|
||||
* createTime : 1535528000000
|
||||
* updateTime : 1535528003000
|
||||
*/
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String subheading;
|
||||
private String icon;
|
||||
private String routerValue;
|
||||
private int routerType;
|
||||
private int seqNo;
|
||||
private int status;
|
||||
private long createTime;
|
||||
private long updateTime;
|
||||
|
||||
}
|
@@ -0,0 +1,292 @@
|
||||
package com.yizhuan.xchat_android_core.find.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FindWeekStarInfo {
|
||||
|
||||
/**
|
||||
* stars : [{"erbanNo":6666,"nick":"虎爷套现85卖靓号","avatar":"https://img.erbanyy.com/FroBcMNb5ya6FzRenQYJd-SN9m1f?imageslim","totalCount":506418,"seqNo":0,"uid":90004445}]
|
||||
* gift : {"giftId":1149,"giftName":"爱情锁","goldPrice":66,"seqNo":10,"nobleId":0,"nobleName":"","isNobleGift":false,"giftType":2,"giftStatus":1,"picUrl":"https://img.erbanyy.com/Fhf25vW7zxeq96Tp510ffEGgDwyc?imageslim","hasVggPic":false,"vggUrl":"","isLatest":true,"isTimeLimit":false,"hasEffect":false,"isWholeServer":false,"notifyStaySecond":0,"isSendMsg":false,"isSkipRoom":false}
|
||||
*/
|
||||
|
||||
private GiftBean gift;
|
||||
private List<StarsBean> stars;
|
||||
|
||||
public GiftBean getGift() {
|
||||
return gift;
|
||||
}
|
||||
|
||||
public void setGift(GiftBean gift) {
|
||||
this.gift = gift;
|
||||
}
|
||||
|
||||
public List<StarsBean> getStars() {
|
||||
return stars;
|
||||
}
|
||||
|
||||
public void setStars(List<StarsBean> stars) {
|
||||
this.stars = stars;
|
||||
}
|
||||
|
||||
public static class GiftBean {
|
||||
/**
|
||||
* giftId : 1149
|
||||
* giftName : 爱情锁
|
||||
* goldPrice : 66
|
||||
* seqNo : 10
|
||||
* nobleId : 0
|
||||
* nobleName :
|
||||
* isNobleGift : false
|
||||
* giftType : 2
|
||||
* giftStatus : 1
|
||||
* picUrl : https://img.erbanyy.com/Fhf25vW7zxeq96Tp510ffEGgDwyc?imageslim
|
||||
* hasVggPic : false
|
||||
* vggUrl :
|
||||
* isLatest : true
|
||||
* isTimeLimit : false
|
||||
* hasEffect : false
|
||||
* isWholeServer : false
|
||||
* notifyStaySecond : 0
|
||||
* isSendMsg : false
|
||||
* isSkipRoom : false
|
||||
*/
|
||||
|
||||
private int giftId;
|
||||
private String giftName;
|
||||
private int goldPrice;
|
||||
private int seqNo;
|
||||
private int nobleId;
|
||||
private String nobleName;
|
||||
private boolean isNobleGift;
|
||||
private int giftType;
|
||||
private int giftStatus;
|
||||
private String picUrl;
|
||||
private boolean hasVggPic;
|
||||
private String vggUrl;
|
||||
private boolean isLatest;
|
||||
private boolean isTimeLimit;
|
||||
private boolean hasEffect;
|
||||
private boolean isWholeServer;
|
||||
private int notifyStaySecond;
|
||||
private boolean isSendMsg;
|
||||
private boolean isSkipRoom;
|
||||
|
||||
public int getGiftId() {
|
||||
return giftId;
|
||||
}
|
||||
|
||||
public void setGiftId(int giftId) {
|
||||
this.giftId = giftId;
|
||||
}
|
||||
|
||||
public String getGiftName() {
|
||||
return giftName;
|
||||
}
|
||||
|
||||
public void setGiftName(String giftName) {
|
||||
this.giftName = giftName;
|
||||
}
|
||||
|
||||
public int getGoldPrice() {
|
||||
return goldPrice;
|
||||
}
|
||||
|
||||
public void setGoldPrice(int goldPrice) {
|
||||
this.goldPrice = goldPrice;
|
||||
}
|
||||
|
||||
public int getSeqNo() {
|
||||
return seqNo;
|
||||
}
|
||||
|
||||
public void setSeqNo(int seqNo) {
|
||||
this.seqNo = seqNo;
|
||||
}
|
||||
|
||||
public int getNobleId() {
|
||||
return nobleId;
|
||||
}
|
||||
|
||||
public void setNobleId(int nobleId) {
|
||||
this.nobleId = nobleId;
|
||||
}
|
||||
|
||||
public String getNobleName() {
|
||||
return nobleName;
|
||||
}
|
||||
|
||||
public void setNobleName(String nobleName) {
|
||||
this.nobleName = nobleName;
|
||||
}
|
||||
|
||||
public boolean isIsNobleGift() {
|
||||
return isNobleGift;
|
||||
}
|
||||
|
||||
public void setIsNobleGift(boolean isNobleGift) {
|
||||
this.isNobleGift = isNobleGift;
|
||||
}
|
||||
|
||||
public int getGiftType() {
|
||||
return giftType;
|
||||
}
|
||||
|
||||
public void setGiftType(int giftType) {
|
||||
this.giftType = giftType;
|
||||
}
|
||||
|
||||
public int getGiftStatus() {
|
||||
return giftStatus;
|
||||
}
|
||||
|
||||
public void setGiftStatus(int giftStatus) {
|
||||
this.giftStatus = giftStatus;
|
||||
}
|
||||
|
||||
public String getPicUrl() {
|
||||
return picUrl;
|
||||
}
|
||||
|
||||
public void setPicUrl(String picUrl) {
|
||||
this.picUrl = picUrl;
|
||||
}
|
||||
|
||||
public boolean isHasVggPic() {
|
||||
return hasVggPic;
|
||||
}
|
||||
|
||||
public void setHasVggPic(boolean hasVggPic) {
|
||||
this.hasVggPic = hasVggPic;
|
||||
}
|
||||
|
||||
public String getVggUrl() {
|
||||
return vggUrl;
|
||||
}
|
||||
|
||||
public void setVggUrl(String vggUrl) {
|
||||
this.vggUrl = vggUrl;
|
||||
}
|
||||
|
||||
public boolean isIsLatest() {
|
||||
return isLatest;
|
||||
}
|
||||
|
||||
public void setIsLatest(boolean isLatest) {
|
||||
this.isLatest = isLatest;
|
||||
}
|
||||
|
||||
public boolean isIsTimeLimit() {
|
||||
return isTimeLimit;
|
||||
}
|
||||
|
||||
public void setIsTimeLimit(boolean isTimeLimit) {
|
||||
this.isTimeLimit = isTimeLimit;
|
||||
}
|
||||
|
||||
public boolean isHasEffect() {
|
||||
return hasEffect;
|
||||
}
|
||||
|
||||
public void setHasEffect(boolean hasEffect) {
|
||||
this.hasEffect = hasEffect;
|
||||
}
|
||||
|
||||
public boolean isIsWholeServer() {
|
||||
return isWholeServer;
|
||||
}
|
||||
|
||||
public void setIsWholeServer(boolean isWholeServer) {
|
||||
this.isWholeServer = isWholeServer;
|
||||
}
|
||||
|
||||
public int getNotifyStaySecond() {
|
||||
return notifyStaySecond;
|
||||
}
|
||||
|
||||
public void setNotifyStaySecond(int notifyStaySecond) {
|
||||
this.notifyStaySecond = notifyStaySecond;
|
||||
}
|
||||
|
||||
public boolean isIsSendMsg() {
|
||||
return isSendMsg;
|
||||
}
|
||||
|
||||
public void setIsSendMsg(boolean isSendMsg) {
|
||||
this.isSendMsg = isSendMsg;
|
||||
}
|
||||
|
||||
public boolean isIsSkipRoom() {
|
||||
return isSkipRoom;
|
||||
}
|
||||
|
||||
public void setIsSkipRoom(boolean isSkipRoom) {
|
||||
this.isSkipRoom = isSkipRoom;
|
||||
}
|
||||
}
|
||||
|
||||
public static class StarsBean {
|
||||
/**
|
||||
* erbanNo : 6666
|
||||
* nick : 虎爷套现85卖靓号
|
||||
* avatar : https://img.erbanyy.com/FroBcMNb5ya6FzRenQYJd-SN9m1f?imageslim
|
||||
* totalCount : 506418
|
||||
* seqNo : 0
|
||||
* uid : 90004445
|
||||
*/
|
||||
|
||||
private int erbanNo;
|
||||
private String nick;
|
||||
private String avatar;
|
||||
private int totalCount;
|
||||
private int seqNo;
|
||||
private int uid;
|
||||
|
||||
public int getErbanNo() {
|
||||
return erbanNo;
|
||||
}
|
||||
|
||||
public void setErbanNo(int erbanNo) {
|
||||
this.erbanNo = erbanNo;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public int getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public void setTotalCount(int totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public int getSeqNo() {
|
||||
return seqNo;
|
||||
}
|
||||
|
||||
public void setSeqNo(int seqNo) {
|
||||
this.seqNo = seqNo;
|
||||
}
|
||||
|
||||
public int getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(int uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,221 @@
|
||||
package com.yizhuan.xchat_android_core.home;
|
||||
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoom;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public class HomeModel extends BaseModel implements IHomeModel {
|
||||
private volatile static IHomeModel instance;
|
||||
private Api api;
|
||||
|
||||
private List<TabInfo> mTabInfoList;
|
||||
|
||||
public static IHomeModel get() {
|
||||
if (instance == null){
|
||||
synchronized (HomeModel.class){
|
||||
if (instance == null){
|
||||
instance = new HomeModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private HomeModel(){
|
||||
api = RxNet.create(Api.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存的房间分类数据
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<TabInfo> getmTabInfoList() {
|
||||
return mTabInfoList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取首页Tab失败
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<List<TabInfo>> getMainTabData() {
|
||||
return api.getMainTabList(AuthModel.get().getCurrentUid())
|
||||
.compose(RxHelper.handleSchedulers())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.doOnSuccess(new Consumer<List<TabInfo>>() {
|
||||
@Override
|
||||
public void accept(List<TabInfo> tabInfos) throws Exception {
|
||||
mTabInfoList = tabInfos;
|
||||
}
|
||||
})
|
||||
.doOnError(new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
Logger.e("获取首页Tab失败......");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取首页数据
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<HomeInfo> getHomeData(final int page, int pageSize) {
|
||||
return api.getMainHotData(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
String.valueOf(page),
|
||||
String.valueOf(pageSize)
|
||||
)
|
||||
.flatMap(new Function<ServiceResult<HomeInfo>, SingleSource<HomeInfo>>() {
|
||||
@Override
|
||||
public SingleSource<HomeInfo> apply(ServiceResult<HomeInfo> result) throws Exception {
|
||||
if (result == null || !result.isSuccess()) {
|
||||
return Single.error(new Throwable(RxHelper.getValidMessage(result)));
|
||||
}
|
||||
HomeInfo homeInfo = result.getData();
|
||||
//如果为null,也需要返回成功,否则加载更多的逻辑就无法执行
|
||||
if (homeInfo == null) {
|
||||
homeInfo = new HomeInfo();
|
||||
}
|
||||
return Single.just(homeInfo);
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈
|
||||
* @param feedbackDesc
|
||||
* @param contact
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<String> commitFeedback(String feedbackDesc, String contact) {
|
||||
return api.commitFeedback(
|
||||
String.valueOf(AuthModel.get().getCurrentUid()),
|
||||
feedbackDesc,
|
||||
contact,
|
||||
AuthModel.get().getTicket()
|
||||
)
|
||||
.flatMap(new Function<ServiceResult, SingleSource<String>>() {
|
||||
@Override
|
||||
public SingleSource<String> apply(ServiceResult serviceResult) throws Exception {
|
||||
if (serviceResult.isSuccess()) {
|
||||
return Single.just("反馈成功");
|
||||
} else {
|
||||
return Single.error(new Throwable(serviceResult.getMessage()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类 获取房间列表
|
||||
* @param tagId
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
*/
|
||||
@Override
|
||||
public Single<List<HomeRoom>> getMainDataByTab(final int tagId, final int pageNum, int pageSize) {
|
||||
return api.getMainDataByTab(
|
||||
String.valueOf(tagId),
|
||||
String.valueOf(pageNum),
|
||||
String.valueOf(pageSize)
|
||||
)
|
||||
.flatMap(new Function<ServiceResult<List<HomeRoom>>, SingleSource<List<HomeRoom>>>() {
|
||||
@Override
|
||||
public SingleSource<List<HomeRoom>> apply(ServiceResult<List<HomeRoom>> listServiceResult) throws Exception {
|
||||
if (listServiceResult.isSuccess()){
|
||||
if (listServiceResult.getData() == null){
|
||||
return Single.just(new ArrayList<HomeRoom>());
|
||||
}
|
||||
return Single.just(listServiceResult.getData());
|
||||
}else {
|
||||
return Single.error(new Throwable(listServiceResult.getMessage()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.compose(RxHelper.handleSchedulers());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private interface Api{
|
||||
/**
|
||||
* 获取首页热门数据
|
||||
*
|
||||
* @param uid
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GET("/home/v2/hotindex")
|
||||
Single<ServiceResult<HomeInfo>> getMainHotData(@Query("uid") String uid,
|
||||
@Query("pageNum") String pageNum,
|
||||
@Query("pageSize") String pageSize);
|
||||
|
||||
/**
|
||||
* 提交反馈
|
||||
*
|
||||
* @param uid
|
||||
* @param feedbackDesc
|
||||
* @param contact
|
||||
* @param ticket
|
||||
* @return
|
||||
*/
|
||||
@POST("/feedback")
|
||||
Single<ServiceResult> commitFeedback(@Query("uid") String uid,
|
||||
@Query("feedbackDesc") String feedbackDesc,
|
||||
@Query("contact") String contact,
|
||||
@Query("ticket") String ticket);
|
||||
|
||||
|
||||
/**
|
||||
* 获取首页tab数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/room/tag/top")
|
||||
Single<ServiceResult<List<TabInfo>>> getMainTabList(@Query("uid") long uid);
|
||||
|
||||
/**
|
||||
* 获取
|
||||
* @param tagId
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@POST("home/v2/tagindex")
|
||||
Single<ServiceResult<List<HomeRoom>>> getMainDataByTab(@Query("tagId") String tagId,
|
||||
@Query("pageNum") String pageNum,
|
||||
@Query("pageSize") String pageSize);
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
package com.yizhuan.xchat_android_core.home;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.HomeRoom;
|
||||
import com.yizhuan.xchat_android_core.home.bean.TabInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
|
||||
public interface IHomeModel extends IModel {
|
||||
/**
|
||||
* 获取缓存的房间分类数据
|
||||
* @return
|
||||
*/
|
||||
List<TabInfo> getmTabInfoList();
|
||||
|
||||
/**
|
||||
* 获取首页Tab失败
|
||||
* @return
|
||||
*/
|
||||
Single<List<TabInfo>> getMainTabData();
|
||||
|
||||
/**
|
||||
* 获取首页数据
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
Single<HomeInfo> getHomeData(int page, int pageSize);
|
||||
|
||||
/**
|
||||
* 反馈
|
||||
* @param feedbackDesc
|
||||
* @param contact
|
||||
* @return
|
||||
*/
|
||||
Single<String> commitFeedback(String feedbackDesc, String contact);
|
||||
|
||||
/**
|
||||
* 根据分类 获取房间列表
|
||||
* @param tagId
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
*/
|
||||
Single<List<HomeRoom>> getMainDataByTab(int tagId, int pageNum, int pageSize);
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2017/8/7.
|
||||
*/
|
||||
@Data
|
||||
public class BannerInfo implements Parcelable {
|
||||
/*
|
||||
bannerId:1 //id
|
||||
bannerName: xx//横幅广告名称
|
||||
bannerPic:xx //横幅图片
|
||||
skipType:xx // 1跳app页面,2跳聊天室,3跳h5页面
|
||||
displayType //1顶部banner 2底部banner
|
||||
skipUri:xx //跳转uri
|
||||
*/
|
||||
private int bannerId;
|
||||
private String bannerName;
|
||||
private String bannerPic;
|
||||
private int skipType;
|
||||
private int displayType;
|
||||
private String skipUri;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BannerInfo{" +
|
||||
"bannerId=" + bannerId +
|
||||
", bannerName='" + bannerName + '\'' +
|
||||
", bannerPic='" + bannerPic + '\'' +
|
||||
", skipType=" + skipType +
|
||||
", skipUri='" + skipUri + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
protected BannerInfo(Parcel in) {
|
||||
bannerId = in.readInt();
|
||||
bannerName = in.readString();
|
||||
bannerPic = in.readString();
|
||||
skipType = in.readInt();
|
||||
skipUri = in.readString();
|
||||
displayType = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(bannerId);
|
||||
dest.writeString(bannerName);
|
||||
dest.writeString(bannerPic);
|
||||
dest.writeInt(skipType);
|
||||
dest.writeString(skipUri);
|
||||
dest.writeInt(displayType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<BannerInfo> CREATOR = new Creator<BannerInfo>() {
|
||||
@Override
|
||||
public BannerInfo createFromParcel(Parcel in) {
|
||||
return new BannerInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BannerInfo[] newArray(int size) {
|
||||
return new BannerInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
/**
|
||||
* Created by huangmeng1 on 2018/1/31.
|
||||
*/
|
||||
|
||||
public class FindInfo {
|
||||
/**
|
||||
* advName : 测试啊
|
||||
* advIcon : http://img.letusmix.com/FvbRJRJgufTpntjatyfL8xx1yBQ5?imageslim
|
||||
* skipType : 3
|
||||
* skipUri : www.baidu.com
|
||||
*/
|
||||
|
||||
private String advName;
|
||||
private String advIcon;
|
||||
private int skipType;
|
||||
private String skipUri;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FindInfo{" +
|
||||
"advName='" + advName + '\'' +
|
||||
", advIcon='" + advIcon + '\'' +
|
||||
", skipType=" + skipType +
|
||||
", skipUri='" + skipUri + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getAdvName() {
|
||||
return advName;
|
||||
}
|
||||
|
||||
public void setAdvName(String advName) {
|
||||
this.advName = advName;
|
||||
}
|
||||
|
||||
public String getAdvIcon() {
|
||||
return advIcon;
|
||||
}
|
||||
|
||||
public void setAdvIcon(String advIcon) {
|
||||
this.advIcon = advIcon;
|
||||
}
|
||||
|
||||
public int getSkipType() {
|
||||
return skipType;
|
||||
}
|
||||
|
||||
public void setSkipType(int skipType) {
|
||||
this.skipType = skipType;
|
||||
}
|
||||
|
||||
public String getSkipUri() {
|
||||
return skipUri;
|
||||
}
|
||||
|
||||
public void setSkipUri(String skipUri) {
|
||||
this.skipUri = skipUri;
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 首页数据 </p>
|
||||
*
|
||||
* @author Administrator
|
||||
* @date 2017/11/22
|
||||
*/
|
||||
public class HomeInfo {
|
||||
public List<BannerInfo> banners;
|
||||
/** 排行数据 */
|
||||
public RankingInfo rankHome;
|
||||
/** 热门推荐 */
|
||||
public List<HomeRoom> hotRooms;
|
||||
/** 房间推荐 */
|
||||
public List<HomeRoom> listRoom;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HomeInfo{" +
|
||||
"banners=" + banners +
|
||||
", rankHome=" + rankHome +
|
||||
", hotRooms=" + hotRooms +
|
||||
", listRoom=" + listRoom +
|
||||
'}';
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 首页热门实体u </p>
|
||||
*
|
||||
* @author Administrator
|
||||
* @date 2017/11/16
|
||||
*/
|
||||
public class HomeItem implements MultiItemEntity, Parcelable {
|
||||
|
||||
public static final int BANNER = 1;
|
||||
public static final int RANKING = 2;
|
||||
public static final int RECOMMEND = 3;
|
||||
public static final int NORMAL = 4;
|
||||
|
||||
|
||||
private int itemType;
|
||||
|
||||
//正常数据
|
||||
public List<HomeRoom> recomList;
|
||||
public List<HomeRoom> homeItemRoomList;
|
||||
public List<BannerInfo> bannerInfoList;
|
||||
public RankingInfo mRankingInfo;
|
||||
|
||||
|
||||
public HomeItem(int itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
|
||||
public HomeItem(int itemType, RankingInfo rankingInfo) {
|
||||
this.itemType = itemType;
|
||||
mRankingInfo = rankingInfo;
|
||||
}
|
||||
|
||||
protected HomeItem(Parcel in) {
|
||||
itemType = in.readInt();
|
||||
recomList = in.createTypedArrayList(HomeRoom.CREATOR);
|
||||
homeItemRoomList = in.createTypedArrayList(HomeRoom.CREATOR);
|
||||
bannerInfoList = in.createTypedArrayList(BannerInfo.CREATOR);
|
||||
mRankingInfo = in.readParcelable(RankingInfo.class.getClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(itemType);
|
||||
dest.writeTypedList(recomList);
|
||||
dest.writeTypedList(homeItemRoomList);
|
||||
dest.writeTypedList(bannerInfoList);
|
||||
dest.writeParcelable(mRankingInfo, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<HomeItem> CREATOR = new Creator<HomeItem>() {
|
||||
@Override
|
||||
public HomeItem createFromParcel(Parcel in) {
|
||||
return new HomeItem(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomeItem[] newArray(int size) {
|
||||
return new HomeItem[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
}
|
@@ -0,0 +1,164 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.chad.library.adapter.base.entity.MultiItemEntity;
|
||||
import com.yizhuan.xchat_android_core.level.UserLevelVo;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author zhouxiangfeng
|
||||
* @date 2017/5/17
|
||||
*/
|
||||
|
||||
public class HomeRoom extends RoomInfo implements Parcelable, MultiItemEntity {
|
||||
|
||||
public static final int BANNER = 1;
|
||||
public static final int NORMAL = 2;
|
||||
|
||||
//性别 1:男 2:女 0 :未知
|
||||
private int gender;
|
||||
|
||||
private String nick;
|
||||
//1普通账号,2官方账号,3机器账号
|
||||
private int defUser;
|
||||
|
||||
private long erbanNo;
|
||||
|
||||
//角标相关的
|
||||
public String badge;
|
||||
|
||||
/** 是否是靓号,1:靓号 */
|
||||
public boolean hasPrettyErbanNo;
|
||||
public NobleInfo nobleUsers;
|
||||
public UserLevelVo userLevelVo;
|
||||
public boolean newUser;
|
||||
private ArrayList<BannerInfo> bannerInfos;
|
||||
|
||||
public HomeRoom() {
|
||||
}
|
||||
|
||||
protected HomeRoom(Parcel in) {
|
||||
super(in);
|
||||
gender = in.readInt();
|
||||
nick = in.readString();
|
||||
defUser = in.readInt();
|
||||
erbanNo = in.readLong();
|
||||
badge = in.readString();
|
||||
hasPrettyErbanNo = in.readByte() != 0;
|
||||
bannerInfos = in.createTypedArrayList(BannerInfo.CREATOR);
|
||||
newUser = in.readByte() != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeInt(gender);
|
||||
dest.writeString(nick);
|
||||
dest.writeInt(defUser);
|
||||
dest.writeLong(erbanNo);
|
||||
dest.writeString(badge);
|
||||
dest.writeByte((byte) (hasPrettyErbanNo ? 1 : 0));
|
||||
dest.writeTypedList(bannerInfos);
|
||||
dest.writeByte((byte) (newUser ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<HomeRoom> CREATOR = new Creator<HomeRoom>() {
|
||||
@Override
|
||||
public HomeRoom createFromParcel(Parcel in) {
|
||||
return new HomeRoom(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HomeRoom[] newArray(int size) {
|
||||
return new HomeRoom[size];
|
||||
}
|
||||
};
|
||||
|
||||
public int getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(int gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public int getDefUser() {
|
||||
return defUser;
|
||||
}
|
||||
|
||||
public void setDefUser(int defUser) {
|
||||
this.defUser = defUser;
|
||||
}
|
||||
|
||||
public long getErbanNo() {
|
||||
return erbanNo;
|
||||
}
|
||||
|
||||
public void setErbanNo(long erbanNo) {
|
||||
this.erbanNo = erbanNo;
|
||||
}
|
||||
|
||||
public String getBadge() {
|
||||
return badge;
|
||||
}
|
||||
|
||||
public void setBadge(String badge) {
|
||||
this.badge = badge;
|
||||
}
|
||||
|
||||
public boolean isHasPrettyErbanNo() {
|
||||
return hasPrettyErbanNo;
|
||||
}
|
||||
|
||||
public void setHasPrettyErbanNo(boolean hasPrettyErbanNo) {
|
||||
this.hasPrettyErbanNo = hasPrettyErbanNo;
|
||||
}
|
||||
|
||||
public NobleInfo getNobleUsers() {
|
||||
return nobleUsers;
|
||||
}
|
||||
|
||||
public void setNobleUsers(NobleInfo nobleUsers) {
|
||||
this.nobleUsers = nobleUsers;
|
||||
}
|
||||
|
||||
public UserLevelVo getUserLevelVo() {
|
||||
return userLevelVo;
|
||||
}
|
||||
|
||||
public void setUserLevelVo(UserLevelVo userLevelVo) {
|
||||
this.userLevelVo = userLevelVo;
|
||||
}
|
||||
|
||||
public ArrayList<BannerInfo> getBannerInfos() {
|
||||
return bannerInfos;
|
||||
}
|
||||
|
||||
public void setBannerInfos(ArrayList<BannerInfo> bannerInfos) {
|
||||
this.bannerInfos = bannerInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemType() {
|
||||
return ListUtils.isListEmpty(bannerInfos)?NORMAL:BANNER;
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by chenran on 2017/10/4.
|
||||
*/
|
||||
|
||||
public class HomeRoomList implements Serializable{
|
||||
private List<HomeRoom> recomRooms;
|
||||
private List<HomeRoom> gameRooms;
|
||||
private List<HomeRoom> chatRooms;
|
||||
|
||||
public List<HomeRoom> getRecomRooms() {
|
||||
return recomRooms;
|
||||
}
|
||||
|
||||
public void setRecomRooms(List<HomeRoom> recomRooms) {
|
||||
this.recomRooms = recomRooms;
|
||||
}
|
||||
|
||||
public List<HomeRoom> getGameRooms() {
|
||||
return gameRooms;
|
||||
}
|
||||
|
||||
public void setGameRooms(List<HomeRoom> gameRooms) {
|
||||
this.gameRooms = gameRooms;
|
||||
}
|
||||
|
||||
public List<HomeRoom> getChatRooms() {
|
||||
return chatRooms;
|
||||
}
|
||||
|
||||
public void setChatRooms(List<HomeRoom> chatRooms) {
|
||||
this.chatRooms = chatRooms;
|
||||
}
|
||||
}
|
@@ -0,0 +1,158 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p> 首页排行信息 </p>
|
||||
* Created by Administrator on 2017/11/8.
|
||||
*/
|
||||
public class RankingInfo implements Parcelable {
|
||||
|
||||
public List<Ranking> starList;
|
||||
public List<Ranking> nobleList;
|
||||
public List<Ranking> roomList;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RankingInfo{" +
|
||||
"starList=" + starList +
|
||||
", nobleList=" + nobleList +
|
||||
", roomList=" + roomList +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class Ranking implements Parcelable {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Ranking{" +
|
||||
"erbanNo=" + erbanNo +
|
||||
", avatar='" + avatar + '\'' +
|
||||
", nick='" + nick + '\'' +
|
||||
", gender=" + gender +
|
||||
", totalNum=" + totalNum +
|
||||
'}';
|
||||
}
|
||||
|
||||
/**
|
||||
* erbanNo : 850379
|
||||
* avatar : https://nos.netease.com/nim/NDI3OTA4NQ==/bmltYV83Nzg4MzQyNDJfMTUwNzIwMzM4NTc2N184YmJlZmQ4ZS01YzdiLTRmMWMtYmFhOC0xMWRlNzg3MzRlMzk=
|
||||
* nick : 阿拉善
|
||||
* gender : 1
|
||||
* totalNum : 9988923
|
||||
*/
|
||||
|
||||
private int erbanNo;
|
||||
private String avatar;
|
||||
private String nick;
|
||||
private int gender;
|
||||
private int totalNum;
|
||||
|
||||
protected Ranking(Parcel in) {
|
||||
erbanNo = in.readInt();
|
||||
avatar = in.readString();
|
||||
nick = in.readString();
|
||||
gender = in.readInt();
|
||||
totalNum = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(erbanNo);
|
||||
dest.writeString(avatar);
|
||||
dest.writeString(nick);
|
||||
dest.writeInt(gender);
|
||||
dest.writeInt(totalNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<Ranking> CREATOR = new Creator<Ranking>() {
|
||||
@Override
|
||||
public Ranking createFromParcel(Parcel in) {
|
||||
return new Ranking(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ranking[] newArray(int size) {
|
||||
return new Ranking[size];
|
||||
}
|
||||
};
|
||||
|
||||
public int getErbanNo() {
|
||||
return erbanNo;
|
||||
}
|
||||
|
||||
public void setErbanNo(int erbanNo) {
|
||||
this.erbanNo = erbanNo;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getNick() {
|
||||
return nick;
|
||||
}
|
||||
|
||||
public void setNick(String nick) {
|
||||
this.nick = nick;
|
||||
}
|
||||
|
||||
public int getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public void setGender(int gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
|
||||
public int getTotalNum() {
|
||||
return totalNum;
|
||||
}
|
||||
|
||||
public void setTotalNum(int totalNum) {
|
||||
this.totalNum = totalNum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected RankingInfo(Parcel in) {
|
||||
starList = in.createTypedArrayList(Ranking.CREATOR);
|
||||
nobleList = in.createTypedArrayList(Ranking.CREATOR);
|
||||
roomList = in.createTypedArrayList(Ranking.CREATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeTypedList(starList);
|
||||
dest.writeTypedList(nobleList);
|
||||
dest.writeTypedList(roomList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<RankingInfo> CREATOR = new Creator<RankingInfo>() {
|
||||
@Override
|
||||
public RankingInfo createFromParcel(Parcel in) {
|
||||
return new RankingInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RankingInfo[] newArray(int size) {
|
||||
return new RankingInfo[size];
|
||||
}
|
||||
};
|
||||
}
|
@@ -0,0 +1,119 @@
|
||||
package com.yizhuan.xchat_android_core.home.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p> tab 标签数据 </p>
|
||||
*
|
||||
* @author Administrator
|
||||
* @date 2017/11/21
|
||||
*/
|
||||
@Data
|
||||
public class TabInfo implements Parcelable, Serializable{
|
||||
|
||||
/**
|
||||
* id : 8
|
||||
* name : 聊天
|
||||
* pict : https://img.erbanyy.com/tag%E8%81%8A%E5%A4%A9.png
|
||||
* seq : 3
|
||||
* type : 1
|
||||
* status : true
|
||||
* istop : true
|
||||
* createTime : 1511155717000
|
||||
*/
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private String pict;
|
||||
private String icon;
|
||||
private int seq;
|
||||
private int type;
|
||||
private boolean status;
|
||||
private boolean istop;
|
||||
private long createTime;
|
||||
|
||||
public TabInfo(int id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public TabInfo(int id, String name,String icon) {
|
||||
this(id, name);
|
||||
this.icon=icon;
|
||||
}
|
||||
|
||||
|
||||
protected TabInfo(Parcel in) {
|
||||
id = in.readInt();
|
||||
name = in.readString();
|
||||
pict = in.readString();
|
||||
seq = in.readInt();
|
||||
type = in.readInt();
|
||||
status = in.readByte() != 0;
|
||||
istop = in.readByte() != 0;
|
||||
createTime = in.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(id);
|
||||
dest.writeString(name);
|
||||
dest.writeString(pict);
|
||||
dest.writeInt(seq);
|
||||
dest.writeInt(type);
|
||||
dest.writeByte((byte) (status ? 1 : 0));
|
||||
dest.writeByte((byte) (istop ? 1 : 0));
|
||||
dest.writeLong(createTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<TabInfo> CREATOR = new Creator<TabInfo>() {
|
||||
@Override
|
||||
public TabInfo createFromParcel(Parcel in) {
|
||||
return new TabInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TabInfo[] newArray(int size) {
|
||||
return new TabInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
public static List<TabInfo> getTabDefaultList() {
|
||||
List<TabInfo> tabInfoList = new ArrayList<>();
|
||||
tabInfoList.add(new TabInfo(1, "新秀","https://img.letusmix.com/xinxiu_tag_icon.png"));
|
||||
tabInfoList.add(new TabInfo(2, "遇见","https://img.letusmix.com/xiehou_tag_icon.png"));
|
||||
tabInfoList.add(new TabInfo(3, "交友","https://img.letusmix.com/jiaoyou_tag_icon.png"));
|
||||
tabInfoList.add(new TabInfo(4, "娱乐","https://img.letusmix.com/yule_tag_icon.png"));
|
||||
tabInfoList.add(new TabInfo(5, "音乐","https://img.letusmix.com/yinyue_tag_icon.png"));
|
||||
tabInfoList.add(new TabInfo(6, "电台","https://img.letusmix.com/diantai_tag_icon.png"));
|
||||
return tabInfoList;
|
||||
}
|
||||
|
||||
|
||||
public static List<TabInfo> getTabCheckVersion() {
|
||||
List<TabInfo> tabInfoList = new ArrayList<>();
|
||||
tabInfoList.add(new TabInfo(16, "邂逅","https://img.letusmix.com/xiehou_tag_icon.png"));
|
||||
return tabInfoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TabInfo{" +
|
||||
"name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,679 @@
|
||||
package com.yizhuan.xchat_android_core.manager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.ktv.event.RemoteVideoEvent;
|
||||
import com.yizhuan.xchat_android_core.statistic.LogFactory;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.LogProtocol;
|
||||
import com.yizhuan.xchat_android_library.rxbus.RxBus;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import io.agora.ktvkit.IKTVKitEventHandler;
|
||||
import io.agora.ktvkit.KTVKit;
|
||||
import io.agora.rtc.Constants;
|
||||
import io.agora.rtc.IRtcEngineEventHandler;
|
||||
import io.agora.rtc.RtcEngine;
|
||||
import io.agora.rtc.video.VideoCanvas;
|
||||
|
||||
import static io.agora.rtc.Constants.AUDIO_PROFILE_DEFAULT;
|
||||
import static io.agora.rtc.Constants.AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO;
|
||||
import static io.agora.rtc.Constants.AUDIO_PROFILE_SPEECH_STANDARD;
|
||||
import static io.agora.rtc.Constants.AUDIO_RECORDING_QUALITY_LOW;
|
||||
import static io.agora.rtc.Constants.AUDIO_SCENARIO_GAME_STREAMING;
|
||||
|
||||
/**
|
||||
* <p> 声网管理类 </p>
|
||||
*
|
||||
* @author jiahui
|
||||
* @date 2017/12/12
|
||||
*/
|
||||
public final class RtcEngineManager {
|
||||
private static volatile RtcEngineManager sEngineManager;
|
||||
private static final Object SYNC_OBJECT = new Object();
|
||||
@Nullable
|
||||
private RtcEngine mRtcEngine;
|
||||
private Map<String, Integer> speakers;
|
||||
/**
|
||||
* 说话列表
|
||||
*/
|
||||
private List<Integer> speakMembersPosition;
|
||||
/**
|
||||
* 队列说话列表
|
||||
*/
|
||||
private List<Integer> speakQueueMembersPosition;
|
||||
private String uid;
|
||||
public boolean isAudienceRole;
|
||||
/**
|
||||
* 麦上是否闭麦,true:闭麦,false:开麦
|
||||
*/
|
||||
public boolean isMute;
|
||||
/**
|
||||
* 听筒是否关闭
|
||||
*/
|
||||
public boolean isRemoteMute;
|
||||
private boolean needRecord;
|
||||
//是否在房间,判断是切换品质还是第一次进
|
||||
private boolean inRoom;
|
||||
private EngineEventHandler eventHandler;
|
||||
|
||||
private static final class Helper {
|
||||
private static final RtcEngineManager INSTANCE = new RtcEngineManager();
|
||||
}
|
||||
|
||||
private RtcEngineManager() {
|
||||
System.out.println("hehehehe" + RtcEngine.getSdkVersion());
|
||||
speakMembersPosition = new ArrayList<>();
|
||||
speakQueueMembersPosition = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static RtcEngineManager get() {
|
||||
return Helper.INSTANCE;
|
||||
}
|
||||
|
||||
public void startRtcEngine(long uid) {
|
||||
RoomInfo curRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
// if (curRoomInfo.getAudioQuality() == RoomInfo.ROOMTYPE_LIGHT_CHAT) {
|
||||
// joinHighQualityChannel(curRoomInfo.getRoomId(), uid,true);
|
||||
// } else {
|
||||
joinChannel(curRoomInfo.getRoomId(), uid);
|
||||
// }
|
||||
if (curRoomInfo.getUid() == uid && curRoomInfo.getType() != RoomInfo.ROOMTYPE_HOME_PARTY) {
|
||||
//设置用户角色为主播,轰趴房不能默认设置房主为主播
|
||||
setRole(Constants.CLIENT_ROLE_BROADCASTER);
|
||||
} else {
|
||||
setRole(Constants.CLIENT_ROLE_AUDIENCE);
|
||||
}
|
||||
}
|
||||
|
||||
public void joinChannel(long channelId, long uid) {
|
||||
initRtcEngine(channelId, uid, AUDIO_PROFILE_DEFAULT, AUDIO_PROFILE_SPEECH_STANDARD);
|
||||
}
|
||||
|
||||
public void joinHighQualityChannel(long channelId, long uid, boolean record) {
|
||||
this.needRecord = record;
|
||||
initRtcEngine(channelId, uid, AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO, AUDIO_SCENARIO_GAME_STREAMING);
|
||||
}
|
||||
|
||||
public void reJoinChannel(long channelId, long uid) {
|
||||
enterChannel(channelId, (int) uid, AUDIO_PROFILE_DEFAULT, AUDIO_PROFILE_SPEECH_STANDARD);
|
||||
setRemoteMute(isRemoteMute);
|
||||
setMute(isMute);
|
||||
}
|
||||
|
||||
public void reJoinHighQualityChannel(long channelId, long uid, boolean record) {
|
||||
this.needRecord = record;
|
||||
enterChannel(channelId, (int) uid, AUDIO_PROFILE_MUSIC_HIGH_QUALITY_STEREO, AUDIO_SCENARIO_GAME_STREAMING);
|
||||
setRemoteMute(isRemoteMute);
|
||||
setMute(isMute);
|
||||
}
|
||||
|
||||
private void initRtcEngine(long channelId, long uid, int quality, int audioShowRoom) {
|
||||
this.uid = uid + "";
|
||||
this.isMute = false;
|
||||
this.isRemoteMute = false;
|
||||
enterChannel(channelId, (int) uid, quality, audioShowRoom);
|
||||
}
|
||||
|
||||
private void enterChannel(long channelId, int uid, int quality, int audioShowRoom) {
|
||||
if (mRtcEngine == null) {
|
||||
try {
|
||||
eventHandler = new EngineEventHandler(this);
|
||||
mRtcEngine = RtcEngine.create(BasicConfig.INSTANCE.getAppContext(), XChatConstants.AGORA_KEY, eventHandler);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));
|
||||
}
|
||||
//设置频道模式为直播
|
||||
mRtcEngine.setChannelProfile(Constants.CHANNEL_PROFILE_LIVE_BROADCASTING);
|
||||
mRtcEngine.setAudioProfile(quality, audioShowRoom);
|
||||
mRtcEngine.enableAudioVolumeIndication(600, 3);
|
||||
mRtcEngine.setDefaultAudioRoutetoSpeakerphone(true);
|
||||
mRtcEngine.setExternalVideoSource(true, false, true);
|
||||
mRtcEngine.setRecordingAudioFrameParameters(48000, 2, 2, 960);
|
||||
mRtcEngine.setVideoProfile(Constants.VIDEO_PROFILE_360P, false);
|
||||
mRtcEngine.enableDualStreamMode(true);
|
||||
mRtcEngine.setParameters(String.format(Locale.US, "{\"che.audio.profile\":{\"scenario\":%d}}", 1));
|
||||
mRtcEngine.setParameters(String.format(Locale.US, "{\"che.audio.headset.monitoring,true\"}"));
|
||||
mRtcEngine.setParameters(String.format(Locale.US, "{\"che.audio.enable.androidlowlatencymode,true\"}"));
|
||||
mRtcEngine.setLogFile(Environment.getExternalStorageDirectory()
|
||||
+ File.separator + BasicConfig.INSTANCE.getAppContext().getPackageName() + "/log/agora-rtc.log");
|
||||
}
|
||||
//创建并加入频道
|
||||
mRtcEngine.joinChannel(null, String.valueOf(channelId), null, uid);
|
||||
}
|
||||
|
||||
|
||||
public int stopAudioMixing() {
|
||||
if (mRtcEngine != null) {
|
||||
return mRtcEngine.stopAudioMixing();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void resetChannel() {
|
||||
if (mRtcEngine != null) {
|
||||
stopAudioMixing();
|
||||
mRtcEngine.leaveChannel();
|
||||
mRtcEngine = null;
|
||||
}
|
||||
if (handler != null)
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
public void leaveChannel() {
|
||||
if (mRtcEngine != null) {
|
||||
stopAudioMixing();
|
||||
mRtcEngine.leaveChannel();
|
||||
mRtcEngine = null;
|
||||
}
|
||||
if (handler != null)
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
// isAudienceRole = true;
|
||||
isMute = false;
|
||||
isRemoteMute = false;
|
||||
needRecord = false;
|
||||
inRoom = false;
|
||||
}
|
||||
|
||||
public boolean isSpeaking(int position) {
|
||||
if (speakMembersPosition != null) {
|
||||
if (speakMembersPosition.contains(position)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isQueueSpeaking(int position) {
|
||||
if (speakQueueMembersPosition != null) {
|
||||
if (speakQueueMembersPosition.contains(position)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//设置静音
|
||||
public void setRemoteMute(boolean mute) {
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.muteAllRemoteAudioStreams(mute);
|
||||
if (result == 0) {
|
||||
isRemoteMute = mute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setRemoteMute(int uid, boolean mute) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.muteRemoteAudioStream(uid, mute);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRemoteMute(ChatRoomMember chatRoomMember, boolean mute) {
|
||||
if (chatRoomMember != null && !TextUtils.isEmpty(chatRoomMember.getAccount())) {
|
||||
String account = chatRoomMember.getAccount();
|
||||
Integer uid = Integer.valueOf(account);
|
||||
if (uid != 0)
|
||||
RtcEngineManager.get().setRemoteMute(uid, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置角色,上麦,下麦(调用)
|
||||
*
|
||||
* @param role CLIENT_ROLE_AUDIENCE: 听众 ,CLIENT_ROLE_BROADCASTER: 主播
|
||||
*/
|
||||
public void setRole(int role) {
|
||||
if (mRtcEngine != null) {
|
||||
//先已是否静音为准
|
||||
mRtcEngine.setClientRole(role);
|
||||
//isAudienceRole = role != Constants.CLIENT_ROLE_BROADCASTER;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否能说话,静音,人自己的行为
|
||||
*
|
||||
* @param mute true:静音,false:不静音
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void setMute(boolean mute) {
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.muteLocalAudioStream(mute);
|
||||
if (result == 0) {
|
||||
isMute = mute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Handler handler = new RtcEngineHandler(this);
|
||||
|
||||
private static class RtcEngineHandler extends Handler {
|
||||
private WeakReference<RtcEngineManager> mReference;
|
||||
|
||||
RtcEngineHandler(RtcEngineManager manager) {
|
||||
mReference = new WeakReference<>(manager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
RtcEngineManager rtcEngineManager = mReference.get();
|
||||
if (rtcEngineManager == null) return;
|
||||
if (msg.what == 0) {
|
||||
if (!RtcEngineManager.get().inRoom) {
|
||||
IMNetEaseManager.get().joinAvRoom();
|
||||
}
|
||||
|
||||
RtcEngineManager.get().inRoom = true;
|
||||
if (rtcEngineManager.needRecord && rtcEngineManager.mRtcEngine != null) {
|
||||
rtcEngineManager.mRtcEngine.startAudioRecording(Environment.getExternalStorageDirectory()
|
||||
+ File.separator + BasicConfig.INSTANCE.getAppContext().getPackageName()
|
||||
+ "/audio/" + System.currentTimeMillis() + ".aac", AUDIO_RECORDING_QUALITY_LOW);
|
||||
}
|
||||
|
||||
} else if (msg.what == 1) {//onAudioVolumeIndication 说话声音音量提示回调
|
||||
IRtcEngineEventHandler.AudioVolumeInfo[] speakers = (IRtcEngineEventHandler.AudioVolumeInfo[]) msg.obj;
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo == null) return;
|
||||
if (rtcEngineManager.speakQueueMembersPosition.size() > 0) {
|
||||
rtcEngineManager.speakQueueMembersPosition.clear();
|
||||
}
|
||||
if (speakers == null || speakers.length == 0) return;
|
||||
for (IRtcEngineEventHandler.AudioVolumeInfo speaker : speakers) {
|
||||
// 0 代表的是房主,其他代表的是uid
|
||||
int uid = speaker.uid == 0 ? Integer.valueOf(rtcEngineManager.uid) : speaker.uid;
|
||||
int micPosition = AvRoomDataManager.get().getMicPosition(uid);
|
||||
// 如果是房主的话,并且房主的mic位置没有的啊,则把房主的位置设置为-1(兼容ios轻聊房光晕)
|
||||
if (uid == AvRoomDataManager.get().mCurrentRoomInfo.getUid() &&
|
||||
AvRoomDataManager.get().mCurrentRoomInfo.getType() == RoomInfo.ROOMTYPE_LIGHT_CHAT
|
||||
&& micPosition == Integer.MIN_VALUE) {
|
||||
micPosition = -1;
|
||||
}
|
||||
if (micPosition == Integer.MIN_VALUE &&
|
||||
uid == AuthModel.get().getCurrentUid()) {
|
||||
// 如果麦上没有自己,并且自己在说话,要把自己变成听众
|
||||
RtcEngineManager.get().setRole(Constants.CLIENT_ROLE_AUDIENCE);
|
||||
} else if (micPosition == Integer.MIN_VALUE &&
|
||||
uid != AuthModel.get().getCurrentUid()) {
|
||||
// 如果麦上没有这个人,要把他静音
|
||||
RtcEngineManager.get().setRemoteMute(uid, true);
|
||||
}
|
||||
if (micPosition == Integer.MIN_VALUE) continue;
|
||||
rtcEngineManager.speakQueueMembersPosition.add(micPosition);
|
||||
}
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(
|
||||
new RoomEvent().setEvent(RoomEvent.SPEAK_STATE_CHANGE)
|
||||
.setMicPositionList(rtcEngineManager.speakQueueMembersPosition)
|
||||
);
|
||||
} else if (msg.what == 2) {//onUserMuteAudio 用户静音回调
|
||||
Integer uid = (Integer) msg.obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class EngineEventHandler extends IRtcEngineEventHandler {
|
||||
private WeakReference<RtcEngineManager> mReference;
|
||||
private boolean isEnter;
|
||||
|
||||
EngineEventHandler(RtcEngineManager manager) {
|
||||
mReference = new WeakReference<>(manager);
|
||||
isEnter = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
super.onJoinChannelSuccess(channel, uid, elapsed);
|
||||
|
||||
//声网进入频道成功日志
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_AUDIO_LOG,
|
||||
LogProtocol.Event.EVENT_AUDIO_CHANNEL
|
||||
)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "1")
|
||||
.append("room_id", channel));
|
||||
if (mReference.get() != null && isEnter) {
|
||||
isEnter = false;
|
||||
mReference.get().handler.sendEmptyMessage(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRejoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
super.onRejoinChannelSuccess(channel, uid, elapsed);
|
||||
//声网重新链接频道成功日志
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_AUDIO_LOG,
|
||||
LogProtocol.Event.EVENT_AUDIO_CHANNEL
|
||||
)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "3")
|
||||
.append("room_id", channel));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLeaveChannel(RtcStats stats) {
|
||||
super.onLeaveChannel(stats);
|
||||
//声网离开频道成功日志
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_VERBOSE,
|
||||
LogProtocol.Topic.TOPIC_AUDIO_LOG,
|
||||
LogProtocol.Event.EVENT_AUDIO_CHANNEL
|
||||
)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "2"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserJoined(int uid, int elapsed) {
|
||||
super.onUserJoined(uid, elapsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActiveSpeaker(int uid) {
|
||||
super.onActiveSpeaker(uid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLastmileQuality(int quality) {
|
||||
super.onLastmileQuality(quality);
|
||||
if (quality >= 3) {
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_BAD)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionInterrupted() {
|
||||
super.onConnectionInterrupted();
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_CLOSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionLost() {
|
||||
super.onConnectionLost();
|
||||
IMNetEaseManager.postRoomEvent(new RoomEvent().setEvent(RoomEvent.RTC_ENGINE_NETWORK_CLOSE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioVolumeIndication(AudioVolumeInfo[] speakers, int totalVolume) {
|
||||
super.onAudioVolumeIndication(speakers, totalVolume);
|
||||
RtcEngineManager manager = mReference.get();
|
||||
if (manager != null) {
|
||||
Message message = manager.handler.obtainMessage();
|
||||
message.what = 1;
|
||||
message.obj = speakers;
|
||||
manager.handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserMuteAudio(int uid, boolean muted) {
|
||||
super.onUserMuteAudio(uid, muted);
|
||||
RtcEngineManager manager = mReference.get();
|
||||
if (manager != null) {
|
||||
if (muted) {
|
||||
Message message = manager.handler.obtainMessage();
|
||||
message.what = 2;
|
||||
message.obj = uid;
|
||||
manager.handler.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClientRoleChanged(int oldRole, int newRole) {
|
||||
super.onClientRoleChanged(oldRole, newRole);
|
||||
if (newRole==1)
|
||||
get().setMute(get().isMute);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAudioMixingFinished() {//伴奏播放已结束回调
|
||||
super.onAudioMixingFinished();
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(
|
||||
new RoomEvent().setEvent(RoomEvent.METHOD_ON_AUDIO_MIXING_FINISHED)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteVideoDecoded(final int uid, int width, int height, int elapsed) {
|
||||
RxBus.get().post(new RemoteVideoEvent(uid));
|
||||
get().remoteUid = uid;
|
||||
}
|
||||
}
|
||||
|
||||
//音乐播放相关---------------begin--------------------------
|
||||
|
||||
public void adjustAudioMixingVolume(int volume) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.adjustAudioMixingVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
public void adjustRecordingSignalVolume(int volume) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.adjustRecordingSignalVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
public int resumeAudioMixing() {
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.resumeAudioMixing();
|
||||
return result;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int pauseAudioMixing() {
|
||||
if (mRtcEngine != null) {
|
||||
int result = mRtcEngine.pauseAudioMixing();
|
||||
return result;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public int startAudioMixing(String filePath, boolean loopback, int cycle) {
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.stopAudioMixing();
|
||||
int result = 0;
|
||||
try {
|
||||
result = mRtcEngine.startAudioMixing(filePath, loopback, false, cycle);
|
||||
} catch (Exception e) {
|
||||
return -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int getAudioMixingCurrentPosition() {
|
||||
return mRtcEngine.getAudioMixingCurrentPosition();
|
||||
}
|
||||
|
||||
public int getAudioMixingDuration() {
|
||||
return mRtcEngine.getAudioMixingDuration();
|
||||
}
|
||||
//音乐播放相关---------------end--------------------------
|
||||
|
||||
|
||||
//ktv相关---------------begin--------------------------
|
||||
private boolean isPlaying;
|
||||
private boolean isAccompany = true;
|
||||
private boolean isPush;
|
||||
private boolean isOpenKtv;
|
||||
private boolean isLive;
|
||||
private int remoteUid;
|
||||
private double accompanyVoice = 0.5;
|
||||
private double personVoice = 0.5;
|
||||
@Nullable
|
||||
private KTVKit ktvKit;
|
||||
|
||||
public synchronized void openKtvModel() {
|
||||
if (mRtcEngine == null || isOpenKtv) return;
|
||||
try {
|
||||
ktvKit = KTVKit.create(mRtcEngine, BasicConfig.INSTANCE.getAppContext(), new IKTVKitEventHandler() {
|
||||
@Override
|
||||
public void onPlayerError(int error) {
|
||||
SingleToastUtil.showToast("MV播放出现未知错误,可以点击报错向我们反馈哦~~");
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mRtcEngine.enableVideo();
|
||||
mRtcEngine.enableLocalVideo(false);
|
||||
isOpenKtv = true;
|
||||
}
|
||||
|
||||
public synchronized void closeKtvModel() {
|
||||
if (!isOpenKtv) return;
|
||||
stopPush();
|
||||
isPlaying = false;
|
||||
isOpenKtv = false;
|
||||
isLive = false;
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.disableVideo();
|
||||
}
|
||||
if (ktvKit != null) {
|
||||
KTVKit.destroy();
|
||||
ktvKit = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void stopPush() {
|
||||
if (isPush){
|
||||
isPush = false;
|
||||
if (mRtcEngine != null) {
|
||||
mRtcEngine.muteLocalVideoStream(true);
|
||||
mRtcEngine.enableLocalVideo(false);
|
||||
// mRtcEngine.enableInEarMonitoring(false);
|
||||
}
|
||||
if (ktvKit != null) ktvKit.stopPlayVideoFile();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void startMv(String url) {
|
||||
if (ktvKit == null || mRtcEngine == null || !isOpenKtv || !AvRoomDataManager.get().isOwnerOnMic())
|
||||
return;
|
||||
mRtcEngine.enableLocalVideo(true);
|
||||
//mRtcEngine.enableInEarMonitoring(true);
|
||||
mRtcEngine.muteLocalVideoStream(false);
|
||||
ktvKit.openAndPlayVideoFile(url);
|
||||
setAccompanyVoice(accompanyVoice);
|
||||
setPersonVoice(personVoice);
|
||||
isPlaying = true;
|
||||
isPush = true;
|
||||
isLive = true;
|
||||
}
|
||||
|
||||
public synchronized void setupRemoteVideo(VideoCanvas canvas, int remoteUid) {
|
||||
if (mRtcEngine != null && isOpenKtv) {
|
||||
isPlaying = true;
|
||||
isLive = true;
|
||||
mRtcEngine.setupRemoteVideo(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void playOrPause() {
|
||||
if (ktvKit != null) ktvKit.pause();
|
||||
isPlaying = !isPlaying;
|
||||
}
|
||||
|
||||
public void changeAudioStream() {
|
||||
if (ktvKit != null) ktvKit.switchAudioTrack();
|
||||
isAccompany = !isAccompany;
|
||||
}
|
||||
|
||||
public void setAccompanyVoice(double progress) {
|
||||
if (progress < 0 || progress > 1) {
|
||||
return;
|
||||
}
|
||||
accompanyVoice = progress;
|
||||
if (ktvKit != null) ktvKit.adjustAccompanyVolume(progress);
|
||||
}
|
||||
|
||||
public void setPersonVoice(double progress) {
|
||||
if (progress < 0 || progress > 1) {
|
||||
return;
|
||||
}
|
||||
personVoice = progress;
|
||||
if (ktvKit != null) ktvKit.adjustVoiceVolume(personVoice);
|
||||
}
|
||||
|
||||
public boolean isPlaying() {
|
||||
return isPlaying;
|
||||
}
|
||||
|
||||
public boolean isPush() {
|
||||
return isPush;
|
||||
}
|
||||
|
||||
public boolean isAccompany() {
|
||||
return isAccompany;
|
||||
}
|
||||
|
||||
public boolean isOpenKtv() {
|
||||
return isOpenKtv;
|
||||
}
|
||||
|
||||
public boolean isLive() {
|
||||
return isLive;
|
||||
}
|
||||
|
||||
public void setLive(boolean live) {
|
||||
isLive = live;
|
||||
}
|
||||
|
||||
public int getRemoteUid() {
|
||||
return remoteUid;
|
||||
}
|
||||
|
||||
public double getAccompanyVoice() {
|
||||
return accompanyVoice;
|
||||
}
|
||||
|
||||
public double getPersonVoice() {
|
||||
return personVoice;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public KTVKit getKtvKit() {
|
||||
return ktvKit;
|
||||
}
|
||||
|
||||
public double getPlayPos() {
|
||||
return ktvKit == null ? 0 : ktvKit.getCurrentPosition();
|
||||
}
|
||||
|
||||
public int getPlayDuration() {
|
||||
return ktvKit == null ? 0 : ktvKit.getDuration();
|
||||
}
|
||||
|
||||
//ktv相关---------------end--------------------------
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.yizhuan.xchat_android_core.version;
|
||||
|
||||
import com.yizhuan.xchat_android_core.base.IModel;
|
||||
import com.yizhuan.xchat_android_core.bean.VersionInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* create by lvzebiao on 2018/9/14
|
||||
*/
|
||||
public interface IVersionModel extends IModel{
|
||||
|
||||
Single<VersionInfo> getVersion(@Query("version") String version);
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user