首次提交
This commit is contained in:
63
.gitignore
vendored
Normal file
63
.gitignore
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
/build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
# Built application files
|
||||||
|
*.apk
|
||||||
|
*.ap_
|
||||||
|
|
||||||
|
# Files for the ART/Dalvik VM
|
||||||
|
*.dex
|
||||||
|
|
||||||
|
# Java class files
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
bin/
|
||||||
|
gen/
|
||||||
|
out/
|
||||||
|
|
||||||
|
# Gradle files
|
||||||
|
.gradle/
|
||||||
|
build/
|
||||||
|
#IMKit/
|
||||||
|
#IMLib/
|
||||||
|
|
||||||
|
# Local configuration file (sdk path, etc)
|
||||||
|
local.properties
|
||||||
|
|
||||||
|
# Proguard folder generated by Eclipse
|
||||||
|
proguard/
|
||||||
|
|
||||||
|
# Log Files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Android Studio Navigation editor temp files
|
||||||
|
.navigation/
|
||||||
|
|
||||||
|
# Android Studio captures folder
|
||||||
|
captures/
|
||||||
|
|
||||||
|
# Intellij
|
||||||
|
*.iml
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# Keystore files
|
||||||
|
#*.jks
|
||||||
|
|
||||||
|
# MacOS
|
||||||
|
.DS_Store
|
||||||
|
*.json
|
||||||
|
*.aab
|
||||||
|
proguardMapping.txt
|
||||||
|
CallKit/
|
||||||
1
LocalAar/.gitignore
vendored
Normal file
1
LocalAar/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
BIN
LocalAar/alipaySdk/alipaySdk-15.6.5-20190718211159-noUtdid.aar
Normal file
BIN
LocalAar/alipaySdk/alipaySdk-15.6.5-20190718211159-noUtdid.aar
Normal file
Binary file not shown.
2
LocalAar/alipaySdk/build.gradle
Normal file
2
LocalAar/alipaySdk/build.gradle
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
configurations.maybeCreate("default")
|
||||||
|
artifacts.add("default", file('alipaySdk-15.6.5-20190718211159-noUtdid.aar'))
|
||||||
35
LocalAar/build.gradle
Normal file
35
LocalAar/build.gradle
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace 'com.example.localaar'
|
||||||
|
compileSdk 32
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdk 24
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
|
implementation 'com.google.android.material:material:1.10.0'
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
|
}
|
||||||
0
LocalAar/consumer-rules.pro
Normal file
0
LocalAar/consumer-rules.pro
Normal file
2
LocalAar/paytypelibrary/build.gradle
Normal file
2
LocalAar/paytypelibrary/build.gradle
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
configurations.maybeCreate("default")
|
||||||
|
artifacts.add("default", file('paytypelibrary3.5.2.aar'))
|
||||||
BIN
LocalAar/paytypelibrary/paytypelibrary3.5.2.aar
Normal file
BIN
LocalAar/paytypelibrary/paytypelibrary3.5.2.aar
Normal file
Binary file not shown.
21
LocalAar/proguard-rules.pro
vendored
Normal file
21
LocalAar/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
1
Muti-Barrage/.gitignore
vendored
Normal file
1
Muti-Barrage/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
35
Muti-Barrage/build.gradle
Normal file
35
Muti-Barrage/build.gradle
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile) {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 30
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 22
|
||||||
|
targetSdkVersion 30
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
|
||||||
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
|
// implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
|
}
|
||||||
|
|
||||||
21
Muti-Barrage/proguard-rules.pro
vendored
Normal file
21
Muti-Barrage/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.orient.tea.barragephoto;
|
||||||
|
|
||||||
|
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.orient.tea.barragephoto.test", appContext.getPackageName());
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Muti-Barrage/src/main/AndroidManifest.xml
Normal file
2
Muti-Barrage/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.orient.tea.barragephoto" />
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.orient.tea.barragephoto.adapter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ViewHolder click Listener
|
||||||
|
*
|
||||||
|
* Created by wangjie on 2019/3/12.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface AdapterListener<T> {
|
||||||
|
// 点击事件
|
||||||
|
void onItemClick(BarrageAdapter.BarrageViewHolder<T> holder, T item);
|
||||||
|
}
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
package com.orient.tea.barragephoto.adapter;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.LayoutRes;
|
||||||
|
|
||||||
|
import com.orient.tea.barragephoto.R;
|
||||||
|
import com.orient.tea.barragephoto.model.DataSource;
|
||||||
|
import com.orient.tea.barragephoto.ui.IBarrageView;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基础的适配器
|
||||||
|
* Created by wangjie on 2019/3/7.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
public abstract class BarrageAdapter<T extends DataSource>
|
||||||
|
implements View.OnClickListener {
|
||||||
|
|
||||||
|
private static final int MSG_CREATE_VIEW = 1;
|
||||||
|
|
||||||
|
// View的点击监听
|
||||||
|
private AdapterListener<T> mAdapterListener;
|
||||||
|
// 类型List
|
||||||
|
private Set<Integer> mTypeList;
|
||||||
|
// 持有的barrageView
|
||||||
|
private IBarrageView barrageView;
|
||||||
|
// 当前的数据
|
||||||
|
private LinkedList<T> mDataList;
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
// 默认的间隔
|
||||||
|
private long interval;
|
||||||
|
// 循环的次数
|
||||||
|
private int repeat;
|
||||||
|
// 当前的
|
||||||
|
private AtomicBoolean isDestroy = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
// 单线程的消息对立
|
||||||
|
private ExecutorService mService = Executors.newSingleThreadExecutor();
|
||||||
|
// 主线程的Handler
|
||||||
|
private BarrageAdapterHandler<T> mHandler = new BarrageAdapterHandler<>(Looper.getMainLooper(), this);
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("WeakerAccess")
|
||||||
|
public BarrageAdapter(AdapterListener<T> adapterListener, Context context) {
|
||||||
|
this.mAdapterListener = adapterListener;
|
||||||
|
this.mTypeList = new HashSet<>();
|
||||||
|
this.mContext = context;
|
||||||
|
this.mDataList = new LinkedList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdapterListener(AdapterListener<T> adapterListener) {
|
||||||
|
this.mAdapterListener = adapterListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setBarrageView(IBarrageView barrageView) {
|
||||||
|
this.barrageView = barrageView;
|
||||||
|
this.interval = barrageView.getInterval();
|
||||||
|
this.repeat = barrageView.getRepeat();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO 数据的增加处理
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建子视图的过程
|
||||||
|
*
|
||||||
|
* @param cacheView 缓存视图
|
||||||
|
*/
|
||||||
|
private void createItemView(T data, View cacheView) {
|
||||||
|
// 1.获取子布局
|
||||||
|
// 2. 创建ViewHolder
|
||||||
|
// 3. 绑定ViewHolder
|
||||||
|
// 4. 返回视图
|
||||||
|
int layoutType = getItemLayout(data);
|
||||||
|
BarrageViewHolder<T> holder = null;
|
||||||
|
if (cacheView != null) {
|
||||||
|
holder = (BarrageViewHolder<T>) cacheView.getTag(R.id.barrage_view_holder);
|
||||||
|
}
|
||||||
|
if (null == holder) {
|
||||||
|
holder = createViewHolder(mContext, layoutType);
|
||||||
|
mTypeList.add(data.getType());
|
||||||
|
}
|
||||||
|
bindViewHolder(holder, data);
|
||||||
|
if (barrageView != null)
|
||||||
|
barrageView.addBarrageItem(holder.getItemView());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建ViewHolder
|
||||||
|
*
|
||||||
|
* @param type 布局类型
|
||||||
|
* @return ViewHolder
|
||||||
|
*/
|
||||||
|
private BarrageViewHolder<T> createViewHolder(Context context, int type) {
|
||||||
|
View root = LayoutInflater.from(context).inflate(type, null);
|
||||||
|
BarrageViewHolder<T> holder = onCreateViewHolder(root, type);
|
||||||
|
|
||||||
|
// 设置点击事件
|
||||||
|
root.setTag(R.id.barrage_view_holder, holder);
|
||||||
|
root.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Log.e("AAAAAAAAAAAAAA","点击事件啦啦啦啦");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真正创建ViewHolder的方法
|
||||||
|
*
|
||||||
|
* @param type 类型
|
||||||
|
* @return ViewHolder
|
||||||
|
*/
|
||||||
|
protected abstract BarrageViewHolder<T> onCreateViewHolder(View root, int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到布局的xml文件
|
||||||
|
*
|
||||||
|
* @return xml文件
|
||||||
|
*/
|
||||||
|
public abstract @LayoutRes
|
||||||
|
int getItemLayout(T t);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定数据
|
||||||
|
*
|
||||||
|
* @param holder BarrageViewHolder
|
||||||
|
* @param data T
|
||||||
|
*/
|
||||||
|
private void bindViewHolder(BarrageViewHolder<T> holder, T data) {
|
||||||
|
if (null == data)
|
||||||
|
return;
|
||||||
|
holder.bind(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Integer> getTypeList() {
|
||||||
|
return mTypeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
// BarrageViewHolder<T> holder = (BarrageViewHolder<T>) v.getTag(R.id.barrage_view_holder);
|
||||||
|
// if (holder != null) {
|
||||||
|
// if (mAdapterListener != null) {
|
||||||
|
// mAdapterListener.onItemClick(holder, holder.mData);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加一组数据
|
||||||
|
*
|
||||||
|
* @param data T
|
||||||
|
*/
|
||||||
|
public void add(T data) {
|
||||||
|
if (data == null)
|
||||||
|
return;
|
||||||
|
mDataList.add(data);
|
||||||
|
mService.submit(new DelayRunnable(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加一组数据
|
||||||
|
*
|
||||||
|
* @param dataList 一组数据
|
||||||
|
*/
|
||||||
|
public void addList(List<T> dataList) {
|
||||||
|
if (dataList == null || dataList.size() == 0)
|
||||||
|
return;
|
||||||
|
int len = dataList.size();
|
||||||
|
mDataList.addAll(dataList);
|
||||||
|
mService.submit(new DelayRunnable(len));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearAll() {
|
||||||
|
if (mDataList == null || mDataList.size() == 0)
|
||||||
|
return;
|
||||||
|
mDataList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
while (!isDestroy.get())
|
||||||
|
isDestroy.compareAndSet(false, true);
|
||||||
|
// 数据清空
|
||||||
|
mDataList.clear();
|
||||||
|
if (!mService.isShutdown())
|
||||||
|
mService.shutdownNow();
|
||||||
|
mHandler.removeCallbacksAndMessages(null);
|
||||||
|
mHandler = null;
|
||||||
|
barrageView = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract static class BarrageViewHolder<T> {
|
||||||
|
public T mData;
|
||||||
|
private View itemView;
|
||||||
|
|
||||||
|
public BarrageViewHolder(View itemView) {
|
||||||
|
this.itemView = itemView;
|
||||||
|
}
|
||||||
|
|
||||||
|
View getItemView() {
|
||||||
|
return itemView;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bind(T data) {
|
||||||
|
mData = data;
|
||||||
|
onBind(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void onBind(T data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 延迟的Runnable
|
||||||
|
*/
|
||||||
|
public class DelayRunnable implements Runnable {
|
||||||
|
|
||||||
|
private int len;
|
||||||
|
|
||||||
|
DelayRunnable(int len) {
|
||||||
|
this.len = len;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (repeat != -1 && repeat > 0) {
|
||||||
|
for (int j = 0; j < repeat; j++) {
|
||||||
|
sendMsg(len);
|
||||||
|
}
|
||||||
|
} else if (repeat == -1) {
|
||||||
|
while (!isDestroy.get()) {
|
||||||
|
sendMsg(len);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendMsg(int len) {
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
mHandler.sendEmptyMessage(MSG_CREATE_VIEW);
|
||||||
|
try {
|
||||||
|
Thread.sleep(interval * 20);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BarrageAdapterHandler<T extends DataSource> extends Handler {
|
||||||
|
private WeakReference<BarrageAdapter> adapterReference;
|
||||||
|
|
||||||
|
BarrageAdapterHandler(Looper looper, BarrageAdapter adapter) {
|
||||||
|
super(looper);
|
||||||
|
adapterReference = new WeakReference<>(adapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
super.handleMessage(msg);
|
||||||
|
|
||||||
|
switch (msg.what) {
|
||||||
|
case MSG_CREATE_VIEW: {
|
||||||
|
T data = (T) adapterReference.get().mDataList.remove();
|
||||||
|
if (data == null)
|
||||||
|
break;
|
||||||
|
if (adapterReference.get().barrageView == null)
|
||||||
|
throw new RuntimeException("please set barrageView,barrageView can't be null");
|
||||||
|
// get from cache
|
||||||
|
View cacheView = adapterReference.get().barrageView.getCacheView(data.getType());
|
||||||
|
adapterReference.get().createItemView(data, cacheView);
|
||||||
|
if (adapterReference.get().repeat != 1)
|
||||||
|
adapterReference.get().mDataList.addLast(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.orient.tea.barragephoto.listener;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简单的监听器
|
||||||
|
*
|
||||||
|
* Created by wangjie on 2019/3/16.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public abstract class SimpleAnimationListener implements Animator.AnimatorListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationCancel(Animator animation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animator animation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.orient.tea.barragephoto.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源接口
|
||||||
|
*
|
||||||
|
* Created by wangjie on 2019/3/7.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface DataSource {
|
||||||
|
// 返回当前的类型
|
||||||
|
int getType();
|
||||||
|
}
|
||||||
@@ -0,0 +1,580 @@
|
|||||||
|
package com.orient.tea.barragephoto.ui;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.ValueAnimator;
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Message;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.SparseArray;
|
||||||
|
import android.view.MotionEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.view.animation.LinearInterpolator;
|
||||||
|
|
||||||
|
import com.orient.tea.barragephoto.R;
|
||||||
|
import com.orient.tea.barragephoto.adapter.BarrageAdapter;
|
||||||
|
import com.orient.tea.barragephoto.listener.SimpleAnimationListener;
|
||||||
|
import com.orient.tea.barragephoto.model.DataSource;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹幕视图
|
||||||
|
* 使用属性动画实现监听事件
|
||||||
|
* <p>
|
||||||
|
* Created by wangjie on 2019/3/7.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SuppressWarnings({"unchecked", "FieldCanBeLocal", "unused", "MismatchedReadAndWriteOfArray"})
|
||||||
|
public class BarrageView extends ViewGroup implements IBarrageView {
|
||||||
|
// TODO
|
||||||
|
// 1. 多类型下的碰撞检测
|
||||||
|
// 2. 测试
|
||||||
|
// 3. 具体行数的设置
|
||||||
|
// 4. 具体的高度设置和位置设置
|
||||||
|
public static final String TAG = "BarrageView";
|
||||||
|
|
||||||
|
// 1 碰撞检测模式 2 随机生成模式
|
||||||
|
public final static int MODEL_COLLISION_DETECTION = 1;
|
||||||
|
public final static int MODEL_RANDOM = 2;
|
||||||
|
// 弹幕的相对位置
|
||||||
|
public final static int GRAVITY_TOP = 1;
|
||||||
|
public final static int GRAVITY_MIDDLE = 2;
|
||||||
|
public final static int GRAVITY_BOTTOM = 4;
|
||||||
|
public final static int GRAVITY_FULL = 7;
|
||||||
|
// 设置最大的缓存View的数量 当达到200的时候回收View
|
||||||
|
public final static int MAX_COUNT = 500;
|
||||||
|
// 速度和波动速度的默认值
|
||||||
|
public final static int DEFAULT_SPEED = 200;
|
||||||
|
public final static int DEFAULT_WAVE_SPEED = 20;
|
||||||
|
|
||||||
|
private BarrageHandler mHandler;
|
||||||
|
// 记录放入缓存的View
|
||||||
|
public int count = 0;
|
||||||
|
// 发送间隔
|
||||||
|
public long interval;
|
||||||
|
// 模式
|
||||||
|
private int model = MODEL_RANDOM;
|
||||||
|
|
||||||
|
// 新增速度 px/100ms
|
||||||
|
private int speed = 200;
|
||||||
|
private int speedWaveValue = 20;
|
||||||
|
// 每一行的速度的储存
|
||||||
|
private int[] speedArray;
|
||||||
|
|
||||||
|
// 是否设置当前动画
|
||||||
|
private boolean cancel = false;
|
||||||
|
|
||||||
|
// 当前的gravity
|
||||||
|
private int gravity = GRAVITY_TOP;
|
||||||
|
// 行数
|
||||||
|
private int barrageLines;
|
||||||
|
// 重复次数
|
||||||
|
private int repeat;
|
||||||
|
// 宽度和高度
|
||||||
|
private int width, height;
|
||||||
|
private List<View> barrageList;
|
||||||
|
private BarrageAdapter mAdapter;
|
||||||
|
// 单行的高度
|
||||||
|
private int singleLineHeight = -1;
|
||||||
|
// 是否阻止事件的下发
|
||||||
|
private boolean isInterceptTouchEvent = false;
|
||||||
|
// 上下弹幕之间的距离
|
||||||
|
private int barrageDistance;
|
||||||
|
// View的缓存
|
||||||
|
private SparseArray<LinkedList<View>> mArray;
|
||||||
|
private Random random = new Random();
|
||||||
|
private CountDownLatch countDownLatch = new CountDownLatch(1);
|
||||||
|
|
||||||
|
|
||||||
|
public BarrageView(Context context) {
|
||||||
|
this(context, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BarrageView(Context context, AttributeSet attrs) {
|
||||||
|
this(context, attrs, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("HandlerLeak")
|
||||||
|
public BarrageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
|
||||||
|
this.barrageList = new ArrayList<>();
|
||||||
|
this.mArray = new SparseArray<>();
|
||||||
|
mHandler = new BarrageHandler(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置适配器
|
||||||
|
*
|
||||||
|
* @param adapter 适配器
|
||||||
|
*/
|
||||||
|
public void setAdapter(BarrageAdapter adapter) {
|
||||||
|
this.mAdapter = adapter;
|
||||||
|
// 相互绑定
|
||||||
|
mAdapter.setBarrageView(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptions(Options options){
|
||||||
|
if(options != null){
|
||||||
|
if(options.config.gravity != -1){
|
||||||
|
this.gravity = options.config.gravity;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(options.config.interval > 0){
|
||||||
|
this.interval = options.config.interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(options.config.speed != 0 && options.config.waveSpeed != 0){
|
||||||
|
this.speed = options.config.speed;
|
||||||
|
this.speedWaveValue = options.config.waveSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(options.config.model != 0){
|
||||||
|
this.model = options.config.model;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(options.config.repeat != 0){
|
||||||
|
this.repeat = options.config.repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isInterceptTouchEvent = options.config.isInterceptTouchEvent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加进缓存
|
||||||
|
*
|
||||||
|
* @param root 缓存的View
|
||||||
|
*/
|
||||||
|
public synchronized void addViewToCaches(int type, View root) {
|
||||||
|
if (mArray.get(type) == null) {
|
||||||
|
LinkedList<View> linkedList = new LinkedList<>();
|
||||||
|
linkedList.add(root);
|
||||||
|
mArray.put(type, linkedList);
|
||||||
|
} else {
|
||||||
|
mArray.get(type).add(root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除视图
|
||||||
|
*
|
||||||
|
* @return 类型
|
||||||
|
*/
|
||||||
|
public synchronized View removeViewFromCaches(int type) {
|
||||||
|
if (mArray.indexOfKey(type) >= 0) {
|
||||||
|
return mArray.get(type).poll();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取内存View的数量
|
||||||
|
*
|
||||||
|
* @return 内存的大小
|
||||||
|
*/
|
||||||
|
public int getCacheSize() {
|
||||||
|
int sum = 0;
|
||||||
|
Set<Integer> mTypeList = mAdapter.getTypeList();
|
||||||
|
for (Integer type : mTypeList) {
|
||||||
|
if (mArray.indexOfKey(type) >= 0) {
|
||||||
|
sum += mArray.get(type).size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||||
|
if (isInterceptTouchEvent)
|
||||||
|
return true;
|
||||||
|
return super.onInterceptTouchEvent(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||||
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
|
measureChildren(widthMeasureSpec, heightMeasureSpec);
|
||||||
|
|
||||||
|
int width = MeasureSpec.getSize(widthMeasureSpec);
|
||||||
|
int height = MeasureSpec.getSize(heightMeasureSpec);
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
//countDownLatch.countDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化一个空的弹幕列表和速度列表
|
||||||
|
*/
|
||||||
|
private void initBarrageListAndSpeedArray() {
|
||||||
|
barrageDistance = DeviceUtils.dp2px(getContext(), 12);
|
||||||
|
/*try {
|
||||||
|
countDownLatch.await();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}*/
|
||||||
|
barrageLines = height / (singleLineHeight + barrageDistance);
|
||||||
|
for (int i = 0; i < barrageLines; i++) {
|
||||||
|
barrageList.add(i, null);
|
||||||
|
}
|
||||||
|
speedArray = new int[barrageLines];
|
||||||
|
for (int i = 0; i < barrageLines; i++) {
|
||||||
|
speedArray[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置单行的高度
|
||||||
|
*/
|
||||||
|
public void setSingleLineHeight(int singleLineHeight) {
|
||||||
|
this.singleLineHeight = singleLineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addBarrageItem(final View view) {
|
||||||
|
// 获取高度和宽度
|
||||||
|
int w = View.MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
|
||||||
|
int h = View.MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
|
||||||
|
view.measure(w, h);
|
||||||
|
final int itemWidth = view.getMeasuredWidth();
|
||||||
|
final int itemHeight = view.getMeasuredHeight();
|
||||||
|
|
||||||
|
if (singleLineHeight == -1) {
|
||||||
|
// 如果没有设置高度 启用添加的第一个Item作为行数
|
||||||
|
// 建议使用最小的Item的高度
|
||||||
|
singleLineHeight = itemHeight;
|
||||||
|
initBarrageListAndSpeedArray();
|
||||||
|
}
|
||||||
|
// 生成动画
|
||||||
|
final ValueAnimator valueAnimator = ValueAnimator.ofInt(width, -itemWidth);
|
||||||
|
|
||||||
|
// 获取最佳的行数
|
||||||
|
final int line = getBestLine(itemHeight);
|
||||||
|
int curSpeed = getSpeed(line, itemWidth);
|
||||||
|
long duration = (int)((float)(width+itemWidth)/(float)curSpeed+1) * 1000;
|
||||||
|
//Log.i(TAG,"duration:"+duration);
|
||||||
|
valueAnimator.setDuration(duration);
|
||||||
|
valueAnimator.setInterpolator(new LinearInterpolator());
|
||||||
|
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationUpdate(ValueAnimator animation) {
|
||||||
|
float value = animation.getAnimatedFraction();
|
||||||
|
//animation.getAnimatedValue()
|
||||||
|
//Log.e(TAG, "value:" + value);
|
||||||
|
if(cancel){
|
||||||
|
valueAnimator.cancel();
|
||||||
|
BarrageView.this.removeView(view);
|
||||||
|
}
|
||||||
|
//view.layout(value, line * (singleLineHeight + barrageDistance) + barrageDistance / 2, value + itemWidth, line * (singleLineHeight + barrageDistance) + barrageDistance / 2 + itemHeight);
|
||||||
|
view.layout((int) (width - (width + itemWidth) * value)
|
||||||
|
, line * (singleLineHeight + barrageDistance) + barrageDistance / 2
|
||||||
|
, (int) (width - (width + itemWidth) * value) + itemWidth
|
||||||
|
, line * (singleLineHeight + barrageDistance) + barrageDistance / 2 + itemHeight);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
valueAnimator.addListener(new SimpleAnimationListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
super.onAnimationEnd(animation);
|
||||||
|
|
||||||
|
BarrageView.this.removeView(view);
|
||||||
|
BarrageAdapter.BarrageViewHolder holder = (BarrageAdapter.BarrageViewHolder) view.getTag(R.id.barrage_view_holder);
|
||||||
|
DataSource d = (DataSource) holder.mData;
|
||||||
|
int type = d.getType();
|
||||||
|
addViewToCaches(type, view);
|
||||||
|
// 通知内存添加缓存
|
||||||
|
mHandler.sendEmptyMessage(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
addView(view);
|
||||||
|
speedArray[line] = curSpeed;
|
||||||
|
// 因为使用缓存View,必须重置位置
|
||||||
|
view.layout(width, line * (singleLineHeight + barrageDistance) + barrageDistance / 2, width + itemWidth, line * (singleLineHeight + barrageDistance) + barrageDistance / 2 + itemHeight);
|
||||||
|
barrageList.set(line, view);
|
||||||
|
valueAnimator.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取速度
|
||||||
|
*
|
||||||
|
* @param line 最佳弹道
|
||||||
|
* @param itemWidth 子View的宽度
|
||||||
|
* @return 速度
|
||||||
|
*/
|
||||||
|
private int getSpeed(int line, int itemWidth) {
|
||||||
|
if (model == MODEL_RANDOM) {
|
||||||
|
return speed - speedWaveValue + random.nextInt(2 * speedWaveValue);
|
||||||
|
} else {
|
||||||
|
int lastSpeed = speedArray[line];
|
||||||
|
View view = barrageList.get(line);
|
||||||
|
int curSpeed;
|
||||||
|
if (view == null) {
|
||||||
|
curSpeed = speed - speedWaveValue + random.nextInt(2 * speedWaveValue);
|
||||||
|
//Log.e(TAG, "View:null" + ",line:" + line + ",speed:" + curSpeed);
|
||||||
|
// 如果当前为空 随机生成一个滑动时间
|
||||||
|
return curSpeed;
|
||||||
|
}
|
||||||
|
int slideLength = (int) (width - view.getX());
|
||||||
|
if (view.getWidth() > slideLength) {
|
||||||
|
// 数据密集的时候跟上面的时间间隔相同
|
||||||
|
//Log.e(TAG, "View:------" + ",line:" + line + ",speed:" + lastSpeed);
|
||||||
|
return lastSpeed;
|
||||||
|
}
|
||||||
|
// 得到上个View剩下的滑动时间
|
||||||
|
int lastLeavedSlidingTime = (int) ((view.getX() + view.getWidth() ) / (float) lastSpeed)+1;
|
||||||
|
//Log.e(TAG,"lastLeavedSlidingTime:"+lastLeavedSlidingTime+",lastLeavedSlidingTime:"+);
|
||||||
|
int fastestSpeed = (width) / lastLeavedSlidingTime;
|
||||||
|
fastestSpeed = Math.min(fastestSpeed, speed + speedWaveValue);
|
||||||
|
if (fastestSpeed <= speed - speedWaveValue) {
|
||||||
|
curSpeed = speed - speedWaveValue;
|
||||||
|
} else
|
||||||
|
curSpeed = speed - speedWaveValue + random.nextInt(fastestSpeed - (speed - speedWaveValue));
|
||||||
|
//Log.e(TAG, "view:" + view.getX() + ",lastLeavedSlidingTime:" + lastLeavedSlidingTime + ",line:" + line + ",speed:" + curSpeed);
|
||||||
|
return curSpeed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最佳的行数
|
||||||
|
*
|
||||||
|
* @param currentItemHeight 当前的高度
|
||||||
|
* @return 最佳行数
|
||||||
|
*/
|
||||||
|
private int getBestLine(int currentItemHeight) {
|
||||||
|
if (currentItemHeight <= singleLineHeight) {
|
||||||
|
return realGetBestLine(1);
|
||||||
|
} else {
|
||||||
|
int v = currentItemHeight / singleLineHeight;
|
||||||
|
if (v * singleLineHeight < currentItemHeight)
|
||||||
|
v++;
|
||||||
|
return realGetBestLine(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真实获取最佳的行数
|
||||||
|
*
|
||||||
|
* @param v 当前View的高度/单行的标准高度
|
||||||
|
* @return 最佳行数
|
||||||
|
*/
|
||||||
|
private int realGetBestLine(int v) {
|
||||||
|
//转换成2进制
|
||||||
|
int gewei = gravity % 2; //个位是
|
||||||
|
int temp = gravity / 2;
|
||||||
|
int shiwei = temp % 2;
|
||||||
|
temp = temp / 2;
|
||||||
|
int baiwei = temp % 2;
|
||||||
|
|
||||||
|
//将所有的行分为三份,前两份行数相同,将第一份的行数四舍五入
|
||||||
|
int firstPart = (int) (barrageLines / 3.0f + 0.5f);
|
||||||
|
|
||||||
|
//构造允许输入行的列表
|
||||||
|
List<Integer> legalLines = new ArrayList<>();
|
||||||
|
if (gewei == 1) {
|
||||||
|
for (int i = 0; i < firstPart; i++)
|
||||||
|
if (i % v == 0)
|
||||||
|
legalLines.add(i);
|
||||||
|
}
|
||||||
|
if (shiwei == 1) {
|
||||||
|
for (int i = firstPart; i < 2 * firstPart; i++)
|
||||||
|
if (i % v == 0)
|
||||||
|
legalLines.add(i);
|
||||||
|
}
|
||||||
|
if (baiwei == 1) {
|
||||||
|
for (int i = 2 * firstPart; i < barrageLines; i++)
|
||||||
|
if (i % v == 0 && i <= barrageLines - v)
|
||||||
|
legalLines.add(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int bestLine = 0;
|
||||||
|
//如果有空行直接结束
|
||||||
|
for (int i = 0; i < barrageLines; i++) {
|
||||||
|
if (barrageList.get(i) == null && i % v == 0) {
|
||||||
|
bestLine = i;
|
||||||
|
if (legalLines.contains(bestLine))
|
||||||
|
return bestLine;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float minSpace = Integer.MAX_VALUE;
|
||||||
|
//没有空行,就找最大空间的
|
||||||
|
for (int i = barrageLines - 1; i >= 0; i--) {
|
||||||
|
if (i % v == 0 && i <= barrageLines - v)
|
||||||
|
if (legalLines.contains(i)) {
|
||||||
|
if (barrageList.get(i).getX() + barrageList.get(i).getWidth() <= minSpace) {
|
||||||
|
minSpace = barrageList.get(i).getX() + barrageList.get(i).getWidth();
|
||||||
|
bestLine = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bestLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroy() {
|
||||||
|
// 停止动画
|
||||||
|
cancel = true;
|
||||||
|
// 清除消息队列,防止内存泄漏
|
||||||
|
mHandler.removeCallbacksAndMessages(null);
|
||||||
|
mAdapter.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缩小缓存长度,减少内存的使用
|
||||||
|
*/
|
||||||
|
public synchronized void shrinkCacheSize() {
|
||||||
|
Set<Integer> mTypeList = mAdapter.getTypeList();
|
||||||
|
for (Integer type : mTypeList) {
|
||||||
|
if (mArray.indexOfKey(type) >= 0) {
|
||||||
|
LinkedList<View> list = mArray.get(type);
|
||||||
|
int len = list.size();
|
||||||
|
while (list.size() > (len / 2.0 + 0.5)) {
|
||||||
|
list.pop();
|
||||||
|
}
|
||||||
|
mArray.put(type, list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getCacheView(int type) {
|
||||||
|
return removeViewFromCaches(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getInterval() {
|
||||||
|
return interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRepeat() {
|
||||||
|
return repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class BarrageHandler extends Handler {
|
||||||
|
private WeakReference<BarrageView> barrageViewReference;
|
||||||
|
|
||||||
|
BarrageHandler(BarrageView barrageView) {
|
||||||
|
this.barrageViewReference = new WeakReference(barrageView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
super.handleMessage(msg);
|
||||||
|
switch (msg.what) {
|
||||||
|
case 0:
|
||||||
|
if (barrageViewReference.get().count < MAX_COUNT) {
|
||||||
|
// 思考一下200是否合适
|
||||||
|
barrageViewReference.get().count++;
|
||||||
|
} else {
|
||||||
|
// 发动gc
|
||||||
|
barrageViewReference.get().shrinkCacheSize();
|
||||||
|
// 计算一下
|
||||||
|
barrageViewReference.get().count = barrageViewReference.get().getCacheSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Config {
|
||||||
|
int gravity = -1;
|
||||||
|
long interval;
|
||||||
|
int speed;
|
||||||
|
int waveSpeed;
|
||||||
|
int model;
|
||||||
|
boolean isInterceptTouchEvent = true;
|
||||||
|
int repeat = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Options{
|
||||||
|
|
||||||
|
Config config;
|
||||||
|
|
||||||
|
public Options() {
|
||||||
|
config = new Config();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 布局位置
|
||||||
|
*
|
||||||
|
* @param gravity 布局位置
|
||||||
|
*/
|
||||||
|
public Options setGravity(int gravity){
|
||||||
|
this.config.gravity = gravity;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 视图发送的间隔
|
||||||
|
*
|
||||||
|
* @param interval 间隔 单位毫秒
|
||||||
|
*/
|
||||||
|
public Options setInterval(long interval) {
|
||||||
|
this.config.interval = interval;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置间隔
|
||||||
|
*
|
||||||
|
* @param speed 弹幕滑动的基础速度
|
||||||
|
* @param waveValue 滑动素的波动值
|
||||||
|
*/
|
||||||
|
public Options setSpeed(int speed, int waveValue) {
|
||||||
|
if (speed < waveValue
|
||||||
|
|| speed <= 0
|
||||||
|
|| waveValue < 0)
|
||||||
|
throw new RuntimeException("duration or wavValue is not correct!");
|
||||||
|
this.config.speed = speed;
|
||||||
|
this.config.waveSpeed = waveValue;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹幕模式 默认随机速度模式
|
||||||
|
*
|
||||||
|
* @param model 模式类型
|
||||||
|
*/
|
||||||
|
public Options setModel(int model) {
|
||||||
|
this.config.model = model;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环次数 默认为1次 可以无限循环
|
||||||
|
*
|
||||||
|
* @param repeat 模式类型
|
||||||
|
*/
|
||||||
|
public Options setRepeat(int repeat) {
|
||||||
|
this.config.repeat = repeat;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置是否阻止事件的下发
|
||||||
|
*/
|
||||||
|
public Options setClick(boolean isInterceptTouchEvent) {
|
||||||
|
this.config.isInterceptTouchEvent = !isInterceptTouchEvent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.orient.tea.barragephoto.ui;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Device Utils
|
||||||
|
*
|
||||||
|
* Created by wangjie on 2019/3/16.
|
||||||
|
*/
|
||||||
|
class DeviceUtils {
|
||||||
|
static int dp2px(Context context, float dpValue) {
|
||||||
|
float scale = context.getResources().getDisplayMetrics().density;
|
||||||
|
return (int) (dpValue * scale + 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
static int sp2px(Context context, float spValue) {
|
||||||
|
float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
|
||||||
|
return (int) (spValue * fontScale + 0.5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.orient.tea.barragephoto.ui;
|
||||||
|
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 弹幕视图的接口
|
||||||
|
* <p>
|
||||||
|
* Created by wangjie on 2019/3/15.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface IBarrageView {
|
||||||
|
// 添加视图
|
||||||
|
void addBarrageItem(View view);
|
||||||
|
|
||||||
|
// 获取是否存在缓存
|
||||||
|
View getCacheView(int type);
|
||||||
|
|
||||||
|
// 发送View间隔 默认为0
|
||||||
|
long getInterval();
|
||||||
|
|
||||||
|
// 循环的次数
|
||||||
|
int getRepeat();
|
||||||
|
}
|
||||||
4
Muti-Barrage/src/main/res/values/ids.xml
Normal file
4
Muti-Barrage/src/main/res/values/ids.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<item name="barrage_view_holder" type="id"/>
|
||||||
|
</resources>
|
||||||
3
Muti-Barrage/src/main/res/values/strings.xml
Normal file
3
Muti-Barrage/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">BarragePhoto</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.orient.tea.barragephoto;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example local unit test, which will execute on the development machine (host).
|
||||||
|
*
|
||||||
|
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||||
|
*/
|
||||||
|
public class ExampleUnitTest {
|
||||||
|
@Test
|
||||||
|
public void addition_isCorrect() throws Exception {
|
||||||
|
assertEquals(4, 2 + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
SudMGPWrapper/.gitignore
vendored
Normal file
1
SudMGPWrapper/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
39
SudMGPWrapper/build.gradle
Normal file
39
SudMGPWrapper/build.gradle
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
plugins {
|
||||||
|
id 'com.android.library'
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 32
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 21
|
||||||
|
targetSdkVersion 32
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
consumerProguardFiles 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
|
||||||
|
// 引入 SudMGPSDK
|
||||||
|
// api project(':SudMGPSDK')
|
||||||
|
api 'tech.sud.mgp:SudMGP:1.3.6.1181'
|
||||||
|
// gson
|
||||||
|
api 'com.google.code.gson:gson:2.8.6'
|
||||||
|
// 依赖okhttp
|
||||||
|
api 'com.squareup.okhttp3:okhttp:4.9.2'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
2
SudMGPWrapper/consumer-rules.pro
Normal file
2
SudMGPWrapper/consumer-rules.pro
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# SudMGPWrapper keep
|
||||||
|
-keep class tech.sud.mgp.SudMGPWrapper.** {*;}
|
||||||
21
SudMGPWrapper/proguard-rules.pro
vendored
Normal file
21
SudMGPWrapper/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
5
SudMGPWrapper/src/main/AndroidManifest.xml
Normal file
5
SudMGPWrapper/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="tech.sud.mgp.SudMGPWrapper">
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.decorator;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.state.SudMGPMGState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏回调数据缓存
|
||||||
|
*/
|
||||||
|
public class SudFSMMGCache {
|
||||||
|
|
||||||
|
private String captainUserId; // 记录当前队长的用户id
|
||||||
|
private SudMGPMGState.MGCommonGameState mgCommonGameStateModel; // 全局游戏状态
|
||||||
|
private boolean isHitBomb = false; // 是否数字炸弹
|
||||||
|
private final HashSet<String> playerInSet = new HashSet<>(); // 记录已经加入了游戏的玩家
|
||||||
|
private final HashSet<String> playerReadySet = new HashSet<>(); // 记录已经准备好的游戏玩家
|
||||||
|
private final HashMap<String, SudMGPMGState.MGCommonPlayerPlaying> playerPlayingMap = new HashMap<>(); // 记录玩家的游戏状态
|
||||||
|
|
||||||
|
// 队长状态 处理
|
||||||
|
public void onPlayerMGCommonPlayerCaptain(String userId, SudMGPMGState.MGCommonPlayerCaptain model) {
|
||||||
|
if (model != null) {
|
||||||
|
if (model.isCaptain) {
|
||||||
|
captainUserId = userId;
|
||||||
|
} else {
|
||||||
|
if (Objects.equals(captainUserId, userId)) {
|
||||||
|
captainUserId = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏状态 处理
|
||||||
|
public void onGameMGCommonGameState(SudMGPMGState.MGCommonGameState model) {
|
||||||
|
mgCommonGameStateModel = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家加入状态处理
|
||||||
|
public void onPlayerMGCommonPlayerIn(String userId, SudMGPMGState.MGCommonPlayerIn model) {
|
||||||
|
if (model != null) {
|
||||||
|
if (model.isIn) {
|
||||||
|
playerInSet.add(userId);
|
||||||
|
} else {
|
||||||
|
playerInSet.remove(userId);
|
||||||
|
playerReadySet.remove(userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家准备状态
|
||||||
|
public void onPlayerMGCommonPlayerReady(String userId, SudMGPMGState.MGCommonPlayerReady model) {
|
||||||
|
if (model != null) {
|
||||||
|
if (model.isReady) {
|
||||||
|
playerReadySet.add(userId);
|
||||||
|
} else {
|
||||||
|
playerReadySet.remove(userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩家游戏状态
|
||||||
|
public void onPlayerMGCommonPlayerPlaying(String userId, SudMGPMGState.MGCommonPlayerPlaying model) {
|
||||||
|
if (model != null) {
|
||||||
|
playerPlayingMap.put(userId, model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关键词状态
|
||||||
|
public void onGameMGCommonKeyWordToHit(SudMGPMGState.MGCommonKeyWordToHit model) {
|
||||||
|
if (model != null) {
|
||||||
|
isHitBomb = model.wordType.equals("number");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回该玩家是否正在游戏中
|
||||||
|
public boolean playerIsPlaying(String userId) {
|
||||||
|
SudMGPMGState.MGCommonPlayerPlaying mgCommonPlayerPlaying = playerPlayingMap.get(userId);
|
||||||
|
if (mgCommonPlayerPlaying != null) {
|
||||||
|
return mgCommonPlayerPlaying.isPlaying;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回该玩家是否已准备
|
||||||
|
public boolean playerIsReady(String userId) {
|
||||||
|
return playerReadySet.contains(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回该玩家是否已加入了游戏
|
||||||
|
public boolean playerIsIn(String userId) {
|
||||||
|
return playerInSet.contains(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前游戏中的人数
|
||||||
|
public int getPlayerInNumber() {
|
||||||
|
return playerInSet.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否数字炸弹
|
||||||
|
public boolean isHitBomb() {
|
||||||
|
return isHitBomb;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 销毁游戏
|
||||||
|
public void destroyMG() {
|
||||||
|
captainUserId = null;
|
||||||
|
mgCommonGameStateModel = null;
|
||||||
|
isHitBomb = false;
|
||||||
|
playerInSet.clear();
|
||||||
|
playerReadySet.clear();
|
||||||
|
playerPlayingMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取队长userId */
|
||||||
|
public String getCaptainUserId() {
|
||||||
|
return captainUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取当前已加入游戏的玩家集合 */
|
||||||
|
public HashSet<String> getPlayerInSet() {
|
||||||
|
return new HashSet<>(playerInSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取当前已准备的玩家集合 */
|
||||||
|
public HashSet<String> getPlayerReadySet() {
|
||||||
|
return new HashSet<>(playerReadySet);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取玩家游戏状态集合 */
|
||||||
|
public HashMap<String, SudMGPMGState.MGCommonPlayerPlaying> getPlayerPlayingMap() {
|
||||||
|
return new HashMap<>(playerPlayingMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回当前游戏的状态,数值参数{@link SudMGPMGState.MGCommonGameState}
|
||||||
|
*/
|
||||||
|
public int getGameState() {
|
||||||
|
if (mgCommonGameStateModel != null) {
|
||||||
|
return mgCommonGameStateModel.gameState;
|
||||||
|
}
|
||||||
|
return SudMGPMGState.MGCommonGameState.UNKNOW;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,843 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.decorator;
|
||||||
|
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.state.SudMGPMGState;
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.utils.ISudFSMStateHandleUtils;
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.utils.SudJsonUtils;
|
||||||
|
import tech.sud.mgp.core.ISudFSMMG;
|
||||||
|
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ISudFSMMG 游戏调APP回调装饰类
|
||||||
|
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG.html
|
||||||
|
*/
|
||||||
|
public class SudFSMMGDecorator implements ISudFSMMG {
|
||||||
|
|
||||||
|
// 回调
|
||||||
|
private SudFSMMGListener sudFSMMGListener;
|
||||||
|
|
||||||
|
// 数据状态封装
|
||||||
|
private final SudFSMMGCache sudFSMMGCache = new SudFSMMGCache();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置回调
|
||||||
|
*
|
||||||
|
* @param listener 监听器
|
||||||
|
*/
|
||||||
|
public void setSudFSMMGListener(SudFSMMGListener listener) {
|
||||||
|
sudFSMMGListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏日志
|
||||||
|
* 最低版本:v1.1.30.xx
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onGameLog(String dataJson) {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onGameLog(dataJson);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏加载进度
|
||||||
|
*
|
||||||
|
* @param stage 阶段:start=1,loading=2,end=3
|
||||||
|
* @param retCode 错误码:0成功
|
||||||
|
* @param progress 进度:[0, 100]
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onGameLoadingProgress(int stage, int retCode, int progress) {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onGameLoadingProgress(stage, retCode, progress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏开始
|
||||||
|
* 最低版本:v1.1.30.xx
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onGameStarted() {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onGameStarted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏销毁
|
||||||
|
* 最低版本:v1.1.30.xx
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onGameDestroyed() {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onGameDestroyed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Code过期,需要实现
|
||||||
|
* APP接入方需要调用handle.success或handle.fail
|
||||||
|
*
|
||||||
|
* @param dataJson {"code":"value"}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onExpireCode(ISudFSMStateHandle handle, String dataJson) {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onExpireCode(handle, dataJson);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取游戏View信息,需要实现
|
||||||
|
* APP接入方需要调用handle.success或handle.fail
|
||||||
|
*
|
||||||
|
* @param handle 操作
|
||||||
|
* @param dataJson {}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onGetGameViewInfo(ISudFSMStateHandle handle, String dataJson) {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onGetGameViewInfo(handle, dataJson);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取游戏Config,需要实现
|
||||||
|
* APP接入方需要调用handle.success或handle.fail
|
||||||
|
*
|
||||||
|
* @param handle 操作
|
||||||
|
* @param dataJson {}
|
||||||
|
* 最低版本:v1.1.30.xx
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onGetGameCfg(ISudFSMStateHandle handle, String dataJson) {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null) {
|
||||||
|
listener.onGetGameCfg(handle, dataJson);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏状态变化
|
||||||
|
* APP接入方需要调用handle.success或handle.fail
|
||||||
|
*
|
||||||
|
* @param handle 操作
|
||||||
|
* @param state 状态命令
|
||||||
|
* @param dataJson 状态值
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onGameStateChange(ISudFSMStateHandle handle, String state, String dataJson) {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null && listener.onGameStateChange(handle, state, dataJson)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (state) {
|
||||||
|
case SudMGPMGState.MG_COMMON_PUBLIC_MESSAGE: // 1. 公屏消息
|
||||||
|
SudMGPMGState.MGCommonPublicMessage mgCommonPublicMessage = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPublicMessage.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonPublicMessage(handle, mgCommonPublicMessage);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_KEY_WORD_TO_HIT: // 2. 关键词状态
|
||||||
|
SudMGPMGState.MGCommonKeyWordToHit mgCommonKeyWordToHit = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonKeyWordToHit.class);
|
||||||
|
sudFSMMGCache.onGameMGCommonKeyWordToHit(mgCommonKeyWordToHit);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonKeyWordToHit(handle, mgCommonKeyWordToHit);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_SETTLE: // 3. 游戏结算状态
|
||||||
|
SudMGPMGState.MGCommonGameSettle mgCommonGameSettle = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSettle.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameSettle(handle, mgCommonGameSettle);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_JOIN_BTN: // 4. 加入游戏按钮点击状态
|
||||||
|
SudMGPMGState.MGCommonSelfClickJoinBtn mgCommonSelfClickJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickJoinBtn.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfClickJoinBtn(handle, mgCommonSelfClickJoinBtn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_CANCEL_JOIN_BTN: // 5. 取消加入(退出)游戏按钮点击状态
|
||||||
|
SudMGPMGState.MGCommonSelfClickCancelJoinBtn selfClickCancelJoinBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickCancelJoinBtn.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfClickCancelJoinBtn(handle, selfClickCancelJoinBtn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_READY_BTN: // 6. 准备按钮点击状态
|
||||||
|
SudMGPMGState.MGCommonSelfClickReadyBtn mgCommonSelfClickReadyBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickReadyBtn.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfClickReadyBtn(handle, mgCommonSelfClickReadyBtn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_CANCEL_READY_BTN: // 7. 取消准备按钮点击状态
|
||||||
|
SudMGPMGState.MGCommonSelfClickCancelReadyBtn mgCommonSelfClickCancelReadyBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickCancelReadyBtn.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfClickCancelReadyBtn(handle, mgCommonSelfClickCancelReadyBtn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_START_BTN: // 8. 开始游戏按钮点击状态
|
||||||
|
SudMGPMGState.MGCommonSelfClickStartBtn mgCommonSelfClickStartBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickStartBtn.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfClickStartBtn(handle, mgCommonSelfClickStartBtn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_SHARE_BTN: // 9. 分享按钮点击状态
|
||||||
|
SudMGPMGState.MGCommonSelfClickShareBtn mgCommonSelfClickShareBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickShareBtn.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfClickShareBtn(handle, mgCommonSelfClickShareBtn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_STATE: // 10. 游戏状态
|
||||||
|
SudMGPMGState.MGCommonGameState mgCommonGameState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameState.class);
|
||||||
|
sudFSMMGCache.onGameMGCommonGameState(mgCommonGameState);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameState(handle, mgCommonGameState);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_CLOSE_BTN: // 11. 结算界面关闭按钮点击状态(2021-12-27新增)
|
||||||
|
SudMGPMGState.MGCommonSelfClickGameSettleCloseBtn mgCommonSelfClickGameSettleCloseBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGameSettleCloseBtn.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfClickGameSettleCloseBtn(handle, mgCommonSelfClickGameSettleCloseBtn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_SETTLE_AGAIN_BTN: // 12. 结算界面再来一局按钮点击状态(2021-12-27新增)
|
||||||
|
SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn mgCommonSelfClickGameSettleAgainBtn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfClickGameSettleAgainBtn(handle, mgCommonSelfClickGameSettleAgainBtn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_SOUND_LIST: // 13. 游戏上报游戏中的声音列表(2021-12-30新增,现在只支持碰碰我最强)
|
||||||
|
SudMGPMGState.MGCommonGameSoundList mgCommonGameSoundList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSoundList.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameSoundList(handle, mgCommonGameSoundList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_SOUND: // 14. 游通知app层播放声音(2021-12-30新增,现在只支持碰碰我最强)
|
||||||
|
SudMGPMGState.MGCommonGameSound mgCommonGameSound = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSound.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameSound(handle, mgCommonGameSound);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_BG_MUSIC_STATE: // 15. 游戏通知app层播放背景音乐状态(2022-01-07新增,现在只支持碰碰我最强)
|
||||||
|
SudMGPMGState.MGCommonGameBgMusicState mgCommonGameBgMusicState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameBgMusicState.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameBgMusicState(handle, mgCommonGameBgMusicState);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_SOUND_STATE: // 16. 游戏通知app层播放音效的状态(2022-01-07新增,现在只支持碰碰我最强)
|
||||||
|
SudMGPMGState.MGCommonGameSoundState mgCommonGameSoundState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSoundState.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameSoundState(handle, mgCommonGameSoundState);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_ASR: // 17. ASR状态(开启和关闭语音识别状态,v1.1.45.xx 版本新增)
|
||||||
|
SudMGPMGState.MGCommonGameASR mgCommonGameASR = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameASR.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameASR(handle, mgCommonGameASR);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_MICROPHONE: // 18. 麦克风状态(2022-02-08新增)
|
||||||
|
SudMGPMGState.MGCommonSelfMicrophone mgCommonSelfMicrophone = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfMicrophone.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfMicrophone(handle, mgCommonSelfMicrophone);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_HEADPHONE: // 19. 耳机(听筒,扬声器)状态(2022-02-08新增)
|
||||||
|
SudMGPMGState.MGCommonSelfHeadphone mgCommonSelfHeadphone = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfHeadphone.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonSelfHeadphone(handle, mgCommonSelfHeadphone);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_APP_COMMON_SELF_X_RESP: // 20. App通用状态操作结果错误码(2022-05-10新增)
|
||||||
|
SudMGPMGState.MGCommonAPPCommonSelfXResp mgCommonAPPCommonSelfXResp = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonAPPCommonSelfXResp.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonAPPCommonSelfXResp(handle, mgCommonAPPCommonSelfXResp);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_ADD_AI_PLAYERS: // 21. 游戏通知app层添加陪玩机器人是否成功(2022-05-17新增)
|
||||||
|
SudMGPMGState.MGCommonGameAddAIPlayers mgCommonGameAddAIPlayers = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameAddAIPlayers.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameAddAIPlayers(handle, mgCommonGameAddAIPlayers);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_NETWORK_STATE: // 22. 游戏通知app层添当前网络连接状态(2022-06-21新增)
|
||||||
|
SudMGPMGState.MGCommonGameNetworkState mgCommonGameNetworkState = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameNetworkState.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameNetworkState(handle, mgCommonGameNetworkState);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_GET_SCORE: // 23. 游戏通知app获取积分
|
||||||
|
SudMGPMGState.MGCommonGameGetScore mgCommonGameScore = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameGetScore.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameGetScore(handle, mgCommonGameScore);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_SET_SCORE: // 24. 游戏通知app带入积分
|
||||||
|
SudMGPMGState.MGCommonGameSetScore mgCommonGameSetScore = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameSetScore.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameSetScore(handle, mgCommonGameSetScore);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_CREATE_ORDER: // 25. 创建订单
|
||||||
|
SudMGPMGState.MGCommonGameCreateOrder mgCommonGameCreateOrder = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameCreateOrder.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameCreateOrder(handle, mgCommonGameCreateOrder);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_PLAYER_ROLE_ID: // 26. 游戏通知app玩家角色(仅对狼人杀有效)
|
||||||
|
SudMGPMGState.MGCommonPlayerRoleId mgCommonPlayerRoleId = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerRoleId.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonPlayerRoleId(handle, mgCommonPlayerRoleId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_DISCO_ACTION: // 1. 元宇宙砂砂舞指令回调
|
||||||
|
SudMGPMGState.MGCommonGameDiscoAction mgCommonGameDiscoAction = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameDiscoAction.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameDiscoAction(handle, mgCommonGameDiscoAction);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_DISCO_ACTION_END: // 2. 元宇宙砂砂舞指令动作结束通知
|
||||||
|
SudMGPMGState.MGCommonGameDiscoActionEnd mgCommonGameDiscoActionEnd = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameDiscoActionEnd.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCommonGameDiscoActionEnd(handle, mgCommonGameDiscoActionEnd);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_CONFIG: // 1. 礼物配置文件(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketConfig mgCustomRocketConfig = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketConfig.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketConfig(handle, mgCustomRocketConfig);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_MODEL_LIST: // 2. 拥有模型列表(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketModelList mgCustomRocketModelList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketModelList.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketModelList(handle, mgCustomRocketModelList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_COMPONENT_LIST: // 3. 拥有组件列表(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketComponentList mgCustomRocketComponentList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketComponentList.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketComponentList(handle, mgCustomRocketComponentList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_USER_INFO: // 4. 获取用户信息(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketUserInfo mgCustomRocketUserInfo = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketUserInfo.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketUserInfo(handle, mgCustomRocketUserInfo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_ORDER_RECORD_LIST: // 5. 订单记录列表(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketOrderRecordList mgCustomRocketOrderRecordList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketOrderRecordList.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketOrderRecordList(handle, mgCustomRocketOrderRecordList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_ROOM_RECORD_LIST: // 6. 展馆内列表(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketRoomRecordList mgCustomRocketRoomRecordList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketRoomRecordList.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketRoomRecordList(handle, mgCustomRocketRoomRecordList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_USER_RECORD_LIST: // 7. 展馆内玩家送出记录(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketUserRecordList mgCustomRocketUserRecordList = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketUserRecordList.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketUserRecordList(handle, mgCustomRocketUserRecordList);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_SET_DEFAULT_MODEL: // 8. 设置默认模型(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketSetDefaultModel mgCustomRocketSetDefaultSeat = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketSetDefaultModel.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketSetDefaultModel(handle, mgCustomRocketSetDefaultSeat);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_DYNAMIC_FIRE_PRICE: // 9. 动态计算一键发送价格(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketDynamicFirePrice mgCustomRocketDynamicFirePrice = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketDynamicFirePrice.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketDynamicFirePrice(handle, mgCustomRocketDynamicFirePrice);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_FIRE_MODEL: // 10. 一键发送(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketFireModel mGCustomRocketFireModel = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketFireModel.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketFireModel(handle, mGCustomRocketFireModel);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_CREATE_MODEL: // 11. 新组装模型(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketCreateModel mgCustomRocketCreateModel = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketCreateModel.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketCreateModel(handle, mgCustomRocketCreateModel);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_REPLACE_COMPONENT: // 12. 模型更换组件(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketReplaceComponent mgCustomRocketReplaceComponent = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketReplaceComponent.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketReplaceComponent(handle, mgCustomRocketReplaceComponent);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_BUY_COMPONENT: // 13. 购买组件(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketBuyComponent mgCustomRocketBuyComponent = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketBuyComponent.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketBuyComponent(handle, mgCustomRocketBuyComponent);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_PLAY_EFFECT_START: // 14. 播放效果开始(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketPlayEffectStart mgCustomRocketPlayEffectStart = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketPlayEffectStart.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketPlayEffectStart(handle, mgCustomRocketPlayEffectStart);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_PLAY_EFFECT_FINISH: // 15. 播放效果完成(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketPlayEffectFinish mgCustomRocketPlayEffectFinish = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketPlayEffectFinish.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketPlayEffectFinish(handle, mgCustomRocketPlayEffectFinish);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_VERIFY_SIGN: // 16. 验证签名合规(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketVerifySign mgCustomRocketVerifySign = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketVerifySign.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketVerifySign(handle, mgCustomRocketVerifySign);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_UPLOAD_MODEL_ICON: // 17. 上传icon(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketUploadModelIcon mgCustomRocketUploadModelIcon = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketUploadModelIcon.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketUploadModelIcon(handle, mgCustomRocketUploadModelIcon);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_PREPARE_FINISH: // 18. 前期准备完成(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketPrepareFinish mgCustomRocketPrepareFinish = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketPrepareFinish.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketPrepareFinish(handle, mgCustomRocketPrepareFinish);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_SHOW_GAME_SCENE: // 19. 火箭主界面已显示(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketShowGameScene mgCustomRocketShowGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketShowGameScene.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketShowGameScene(handle, mgCustomRocketShowGameScene);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_HIDE_GAME_SCENE: // 20. 火箭主界面已隐藏(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketHideGameScene mgCustomRocketHideGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketHideGameScene.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketHideGameScene(handle, mgCustomRocketHideGameScene);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_CLICK_LOCK_COMPONENT: // 21. 点击锁住组件(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketClickLockComponent mgCustomRocketClickLockComponent = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketClickLockComponent.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketClickLockComponent(handle, mgCustomRocketClickLockComponent);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_FLY_CLICK: // 22. 火箭效果飞行点击(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketFlyClick mgCustomRocketFlyClick = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketFlyClick.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketFlyClick(handle, mgCustomRocketFlyClick);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_FLY_END: // 23. 火箭效果飞行结束(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketFlyEnd mgCustomRocketFlyEnd = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketFlyEnd.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketFlyEnd(handle, mgCustomRocketFlyEnd);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_CUSTOM_ROCKET_SET_CLICK_RECT: // 24. 设置点击区域(火箭)
|
||||||
|
SudMGPMGState.MGCustomRocketSetClickRect mgCustomRocketSetClickRect = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCustomRocketSetClickRect.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGCustomRocketSetClickRect(handle, mgCustomRocketSetClickRect);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_BASEBALL_RANKING: // 1. 查询排行榜数据(棒球)
|
||||||
|
SudMGPMGState.MGBaseballRanking mgBaseballRanking = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballRanking.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGBaseballRanking(handle, mgBaseballRanking);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_BASEBALL_MY_RANKING: // 2. 查询我的排名(棒球)
|
||||||
|
SudMGPMGState.MGBaseballMyRanking mgBaseballMyRanking = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballMyRanking.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGBaseballMyRanking(handle, mgBaseballMyRanking);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_BASEBALL_RANGE_INFO: // 3. 查询当前距离我的前后玩家数据(棒球)
|
||||||
|
SudMGPMGState.MGBaseballRangeInfo mgBaseballRangeInfo = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballRangeInfo.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGBaseballRangeInfo(handle, mgBaseballRangeInfo);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_BASEBALL_SET_CLICK_RECT: // 4. 设置app提供给游戏可点击区域(棒球)
|
||||||
|
SudMGPMGState.MGBaseballSetClickRect mgBaseballSetClickRect = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballSetClickRect.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGBaseballSetClickRect(handle, mgBaseballSetClickRect);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_BASEBALL_PREPARE_FINISH: // 5. 前期准备完成(棒球)
|
||||||
|
SudMGPMGState.MGBaseballPrepareFinish mgBaseballPrepareFinish = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballPrepareFinish.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGBaseballPrepareFinish(handle, mgBaseballPrepareFinish);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_BASEBALL_SHOW_GAME_SCENE: // 6. 主界面已显示(棒球)
|
||||||
|
SudMGPMGState.MGBaseballShowGameScene mgBaseballShowGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballShowGameScene.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGBaseballShowGameScene(handle, mgBaseballShowGameScene);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_BASEBALL_HIDE_GAME_SCENE: // 7. 主界面已隐藏(棒球)
|
||||||
|
SudMGPMGState.MGBaseballHideGameScene mgBaseballHideGameScene = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballHideGameScene.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGBaseballHideGameScene(handle, mgBaseballHideGameScene);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_BASEBALL_TEXT_CONFIG: // 8. 获取文本配置数据(棒球)
|
||||||
|
SudMGPMGState.MGBaseballTextConfig mgBaseballTextConfig = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGBaseballTextConfig.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onGameMGBaseballTextConfig(handle, mgBaseballTextConfig);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏玩家状态变化
|
||||||
|
* APP接入方需要调用handle.success或handle.fail
|
||||||
|
*
|
||||||
|
* @param handle 操作
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param state 状态命令
|
||||||
|
* @param dataJson 状态值
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onPlayerStateChange(ISudFSMStateHandle handle, String userId, String state, String dataJson) {
|
||||||
|
SudFSMMGListener listener = sudFSMMGListener;
|
||||||
|
if (listener != null && listener.onPlayerStateChange(handle, userId, state, dataJson)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (state) {
|
||||||
|
case SudMGPMGState.MG_COMMON_PLAYER_IN: // 1.加入状态(已修改)
|
||||||
|
SudMGPMGState.MGCommonPlayerIn mgCommonPlayerIn = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerIn.class);
|
||||||
|
sudFSMMGCache.onPlayerMGCommonPlayerIn(userId, mgCommonPlayerIn);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonPlayerIn(handle, userId, mgCommonPlayerIn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_PLAYER_READY: // 2.准备状态(已修改)
|
||||||
|
SudMGPMGState.MGCommonPlayerReady mgCommonPlayerReady = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerReady.class);
|
||||||
|
sudFSMMGCache.onPlayerMGCommonPlayerReady(userId, mgCommonPlayerReady);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonPlayerReady(handle, userId, mgCommonPlayerReady);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_PLAYER_CAPTAIN: // 3.队长状态(已修改)
|
||||||
|
SudMGPMGState.MGCommonPlayerCaptain mgCommonPlayerCaptain = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerCaptain.class);
|
||||||
|
sudFSMMGCache.onPlayerMGCommonPlayerCaptain(userId, mgCommonPlayerCaptain);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonPlayerCaptain(handle, userId, mgCommonPlayerCaptain);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_PLAYER_PLAYING: // 4.游戏状态(已修改)
|
||||||
|
SudMGPMGState.MGCommonPlayerPlaying mgCommonPlayerPlaying = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerPlaying.class);
|
||||||
|
sudFSMMGCache.onPlayerMGCommonPlayerPlaying(userId, mgCommonPlayerPlaying);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonPlayerPlaying(handle, userId, mgCommonPlayerPlaying);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_PLAYER_ONLINE: // 5.玩家在线状态
|
||||||
|
SudMGPMGState.MGCommonPlayerOnline mgCommonPlayerOnline = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerOnline.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonPlayerOnline(handle, userId, mgCommonPlayerOnline);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_PLAYER_CHANGE_SEAT: // 6.玩家换游戏位状态
|
||||||
|
SudMGPMGState.MGCommonPlayerChangeSeat mgCommonPlayerChangeSeat = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonPlayerChangeSeat.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonPlayerChangeSeat(handle, userId, mgCommonPlayerChangeSeat);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_CLICK_GAME_PLAYER_ICON: // 7. 游戏通知app点击玩家头像
|
||||||
|
SudMGPMGState.MGCommonSelfClickGamePlayerIcon mgCommonSelfClickGamePlayerIcon = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfClickGamePlayerIcon.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonSelfClickGamePlayerIcon(handle, userId, mgCommonSelfClickGamePlayerIcon);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_DIE_STATUS: // 8. 游戏通知app玩家死亡状态(2022-04-24新增)
|
||||||
|
SudMGPMGState.MGCommonSelfDieStatus mgCommonSelfDieStatus = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfDieStatus.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonSelfDieStatus(handle, userId, mgCommonSelfDieStatus);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_TURN_STATUS: // 9. 游戏通知app轮到玩家出手状态(2022-04-24新增)
|
||||||
|
SudMGPMGState.MGCommonSelfTurnStatus mgCommonSelfTurnStatus = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfTurnStatus.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonSelfTurnStatus(handle, userId, mgCommonSelfTurnStatus);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_SELECT_STATUS: // 10. 游戏通知app玩家选择状态(2022-04-24新增)
|
||||||
|
SudMGPMGState.MGCommonSelfSelectStatus mgCommonSelfSelectStatus = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfSelectStatus.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonSelfSelectStatus(handle, userId, mgCommonSelfSelectStatus);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_GAME_COUNTDOWN_TIME: // 11. 游戏通知app层当前游戏剩余时间(2022-05-23新增,目前UMO生效)
|
||||||
|
SudMGPMGState.MGCommonGameCountdownTime mgCommonGameCountdownTime = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonGameCountdownTime.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonGameCountdownTime(handle, userId, mgCommonGameCountdownTime);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_COMMON_SELF_OB_STATUS: // 12. 游戏通知app层当前玩家死亡后变成ob视角(2022-08-23新增,目前狼人杀生效)
|
||||||
|
SudMGPMGState.MGCommonSelfObStatus mgCommonSelfObStatus = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGCommonSelfObStatus.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGCommonSelfObStatus(handle, userId, mgCommonSelfObStatus);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_DG_SELECTING: // 1. 选词中状态(已修改)
|
||||||
|
SudMGPMGState.MGDGSelecting mgdgSelecting = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGSelecting.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGDGSelecting(handle, userId, mgdgSelecting);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_DG_PAINTING: // 2. 作画中状态(已修改)
|
||||||
|
SudMGPMGState.MGDGPainting mgdgPainting = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGPainting.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGDGPainting(handle, userId, mgdgPainting);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_DG_ERRORANSWER: // 3. 显示错误答案状态(已修改)
|
||||||
|
SudMGPMGState.MGDGErroranswer mgdgErroranswer = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGErroranswer.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGDGErroranswer(handle, userId, mgdgErroranswer);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_DG_TOTALSCORE: // 4. 显示总积分状态(已修改)
|
||||||
|
SudMGPMGState.MGDGTotalscore mgdgTotalscore = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGTotalscore.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGDGTotalscore(handle, userId, mgdgTotalscore);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SudMGPMGState.MG_DG_SCORE: // 5. 本次获得积分状态(已修改)
|
||||||
|
SudMGPMGState.MGDGScore mgdgScore = SudJsonUtils.fromJson(dataJson, SudMGPMGState.MGDGScore.class);
|
||||||
|
if (listener == null) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
} else {
|
||||||
|
listener.onPlayerMGDGScore(handle, userId, mgdgScore);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取队长userId */
|
||||||
|
public String getCaptainUserId() {
|
||||||
|
return sudFSMMGCache.getCaptainUserId();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回该玩家是否正在游戏中
|
||||||
|
public boolean playerIsPlaying(String userId) {
|
||||||
|
return sudFSMMGCache.playerIsPlaying(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回该玩家是否已准备
|
||||||
|
public boolean playerIsReady(String userId) {
|
||||||
|
return sudFSMMGCache.playerIsReady(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回该玩家是否已加入了游戏
|
||||||
|
public boolean playerIsIn(String userId) {
|
||||||
|
return sudFSMMGCache.playerIsIn(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前游戏中的人数
|
||||||
|
public int getPlayerInNumber() {
|
||||||
|
return sudFSMMGCache.getPlayerInNumber();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否数字炸弹
|
||||||
|
public boolean isHitBomb() {
|
||||||
|
return sudFSMMGCache.isHitBomb();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 销毁游戏
|
||||||
|
public void destroyMG() {
|
||||||
|
sudFSMMGCache.destroyMG();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回当前游戏的状态,数值参数{@link SudMGPMGState.MGCommonGameState}
|
||||||
|
*/
|
||||||
|
public int getGameState() {
|
||||||
|
return sudFSMMGCache.getGameState();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取缓存的状态 */
|
||||||
|
public SudFSMMGCache getSudFSMMGCache() {
|
||||||
|
return sudFSMMGCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,740 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.decorator;
|
||||||
|
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.state.SudMGPMGState;
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.utils.ISudFSMStateHandleUtils;
|
||||||
|
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link SudFSMMGDecorator} 回调定义
|
||||||
|
*/
|
||||||
|
public interface SudFSMMGListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏日志
|
||||||
|
* 最低版本:v1.1.30.xx
|
||||||
|
*/
|
||||||
|
default void onGameLog(String str) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏加载进度
|
||||||
|
*
|
||||||
|
* @param stage 阶段:start=1,loading=2,end=3
|
||||||
|
* @param retCode 错误码:0成功
|
||||||
|
* @param progress 进度:[0, 100]
|
||||||
|
*/
|
||||||
|
default void onGameLoadingProgress(int stage, int retCode, int progress) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏开始,需要实现
|
||||||
|
* 最低版本:v1.1.30.xx
|
||||||
|
*/
|
||||||
|
void onGameStarted();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏销毁,需要实现
|
||||||
|
* 最低版本:v1.1.30.xx
|
||||||
|
*/
|
||||||
|
void onGameDestroyed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Code过期,需要实现
|
||||||
|
* APP接入方需要调用handle.success或handle.fail
|
||||||
|
*
|
||||||
|
* @param dataJson {"code":"value"}
|
||||||
|
*/
|
||||||
|
void onExpireCode(ISudFSMStateHandle handle, String dataJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取游戏View信息,需要实现
|
||||||
|
* APP接入方需要调用handle.success或handle.fail
|
||||||
|
*
|
||||||
|
* @param handle
|
||||||
|
* @param dataJson {}
|
||||||
|
*/
|
||||||
|
void onGetGameViewInfo(ISudFSMStateHandle handle, String dataJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取游戏Config,需要实现
|
||||||
|
* APP接入方需要调用handle.success或handle.fail
|
||||||
|
*
|
||||||
|
* @param handle
|
||||||
|
* @param dataJson {}
|
||||||
|
* 最低版本:v1.1.30.xx
|
||||||
|
*/
|
||||||
|
void onGetGameCfg(ISudFSMStateHandle handle, String dataJson);
|
||||||
|
|
||||||
|
// region 游戏回调APP 通用状态
|
||||||
|
// 参考文档:https://github.com/SudTechnology/sud-mgp-doc/blob/main/Client/MG%20FSM/%E9%80%9A%E7%94%A8%E7%8A%B6%E6%80%81-%E7%8E%A9%E5%AE%B6.md
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.游戏公屏消息
|
||||||
|
* mg_common_public_message
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonPublicMessage(ISudFSMStateHandle handle, SudMGPMGState.MGCommonPublicMessage model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 关键词状态
|
||||||
|
* mg_common_key_word_to_hit
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonKeyWordToHit(ISudFSMStateHandle handle, SudMGPMGState.MGCommonKeyWordToHit model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 游戏结算状态
|
||||||
|
* mg_common_game_settle
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameSettle(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSettle model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 加入游戏按钮点击状态
|
||||||
|
* mg_common_self_click_join_btn
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfClickJoinBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickJoinBtn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 取消加入(退出)游戏按钮点击状态
|
||||||
|
* mg_common_self_click_cancel_join_btn
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfClickCancelJoinBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickCancelJoinBtn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. 准备按钮点击状态
|
||||||
|
* mg_common_self_click_ready_btn
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfClickReadyBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickReadyBtn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7. 取消准备按钮点击状态
|
||||||
|
* mg_common_self_click_cancel_ready_btn
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfClickCancelReadyBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickCancelReadyBtn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8. 开始游戏按钮点击状态
|
||||||
|
* mg_common_self_click_start_btn
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfClickStartBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickStartBtn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9. 分享按钮点击状态
|
||||||
|
* mg_common_self_click_share_btn
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfClickShareBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickShareBtn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10. 游戏状态
|
||||||
|
* mg_common_game_state
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameState model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11. 结算界面关闭按钮点击状态(2021-12-27新增)
|
||||||
|
* mg_common_self_click_game_settle_close_btn
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfClickGameSettleCloseBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickGameSettleCloseBtn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12. 结算界面再来一局按钮点击状态(2021-12-27新增)
|
||||||
|
* mg_common_self_click_game_settle_again_btn
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfClickGameSettleAgainBtn(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfClickGameSettleAgainBtn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13. 游戏上报游戏中的声音列表(2021-12-30新增,现在只支持碰碰我最强)
|
||||||
|
* mg_common_game_sound_list
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameSoundList(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSoundList model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14. 游通知app层播放声音(2021-12-30新增,现在只支持碰碰我最强)
|
||||||
|
* mg_common_game_sound
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameSound(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSound model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15. 游戏通知app层播放背景音乐状态(2022-01-07新增,现在只支持碰碰我最强)
|
||||||
|
* mg_common_game_bg_music_state
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameBgMusicState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameBgMusicState model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16. 游戏通知app层播放音效的状态(2022-01-07新增,现在只支持碰碰我最强)
|
||||||
|
* mg_common_game_sound_state
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameSoundState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSoundState model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17. ASR状态(开启和关闭语音识别状态,v1.1.45.xx 版本新增)
|
||||||
|
* mg_common_game_asr
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameASR(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameASR model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18. 麦克风状态(2022-02-08新增)
|
||||||
|
* mg_common_self_microphone
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfMicrophone(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfMicrophone model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 19. 耳机(听筒,扬声器)状态(2022-02-08新增)
|
||||||
|
* mg_common_self_headphone
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonSelfHeadphone(ISudFSMStateHandle handle, SudMGPMGState.MGCommonSelfHeadphone model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 20. App通用状态操作结果错误码(2022-05-10新增)
|
||||||
|
* mg_common_app_common_self_x_resp
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonAPPCommonSelfXResp(ISudFSMStateHandle handle, SudMGPMGState.MGCommonAPPCommonSelfXResp model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 21. 游戏通知app层添加陪玩机器人是否成功(2022-05-17新增)
|
||||||
|
* mg_common_game_add_ai_players
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameAddAIPlayers(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameAddAIPlayers model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 22. 游戏通知app层添当前网络连接状态(2022-06-21新增)
|
||||||
|
* mg_common_game_network_state
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameNetworkState(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameNetworkState model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 23. 游戏通知app获取积分
|
||||||
|
* mg_common_game_score
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameGetScore(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameGetScore model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 24. 游戏通知app带入积分
|
||||||
|
* mg_common_game_set_score
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameSetScore(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameSetScore model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 25. 创建订单
|
||||||
|
* mg_common_game_create_order
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameCreateOrder(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameCreateOrder model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 26. 游戏通知app玩家角色(仅对狼人杀有效)
|
||||||
|
* mg_common_player_role_id
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonPlayerRoleId(ISudFSMStateHandle handle, SudMGPMGState.MGCommonPlayerRoleId model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
// endregion 游戏回调APP 通用状态
|
||||||
|
|
||||||
|
// region 游戏回调APP 玩家状态
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1.加入状态(已修改)
|
||||||
|
* mg_common_player_in
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonPlayerIn(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerIn model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2.准备状态(已修改)
|
||||||
|
* mg_common_player_ready
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonPlayerReady(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerReady model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3.队长状态(已修改)
|
||||||
|
* mg_common_player_captain
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonPlayerCaptain(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerCaptain model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4.游戏状态(已修改)
|
||||||
|
* mg_common_player_playing
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonPlayerPlaying(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerPlaying model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5.玩家在线状态
|
||||||
|
* mg_common_player_online
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonPlayerOnline(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerOnline model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6.玩家换游戏位状态
|
||||||
|
* mg_common_player_change_seat
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonPlayerChangeSeat(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonPlayerChangeSeat model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7. 游戏通知app点击玩家头像
|
||||||
|
* mg_common_self_click_game_player_icon
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonSelfClickGamePlayerIcon(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfClickGamePlayerIcon model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8. 游戏通知app玩家死亡状态(2022-04-24新增)
|
||||||
|
* mg_common_self_die_status
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonSelfDieStatus(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfDieStatus model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9. 游戏通知app轮到玩家出手状态(2022-04-24新增)
|
||||||
|
* mg_common_self_turn_status
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonSelfTurnStatus(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfTurnStatus model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10. 游戏通知app玩家选择状态(2022-04-24新增)
|
||||||
|
* mg_common_self_select_status
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonSelfSelectStatus(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfSelectStatus model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11. 游戏通知app层当前游戏剩余时间(2022-05-23新增,目前UMO生效)
|
||||||
|
* mg_common_game_countdown_time
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonGameCountdownTime(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonGameCountdownTime model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12. 游戏通知app层当前玩家死亡后变成ob视角(2022-08-23新增,目前狼人杀生效)
|
||||||
|
* mg_common_self_ob_status
|
||||||
|
*/
|
||||||
|
default void onPlayerMGCommonSelfObStatus(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGCommonSelfObStatus model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion 游戏回调APP 玩家状态
|
||||||
|
|
||||||
|
// region 游戏回调APP 玩家状态 你画我猜
|
||||||
|
// 参考文档:https://github.com/SudTechnology/sud-mgp-doc/blob/main/Client/MG%20FSM/%E4%BD%A0%E7%94%BB%E6%88%91%E7%8C%9C.md
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 选词中状态(已修改)
|
||||||
|
* mg_dg_selecting
|
||||||
|
*/
|
||||||
|
default void onPlayerMGDGSelecting(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGSelecting model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 作画中状态(已修改)
|
||||||
|
* mg_dg_painting
|
||||||
|
*/
|
||||||
|
default void onPlayerMGDGPainting(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGPainting model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 显示错误答案状态(已修改)
|
||||||
|
* mg_dg_erroranswer
|
||||||
|
*/
|
||||||
|
default void onPlayerMGDGErroranswer(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGErroranswer model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 显示总积分状态(已修改)
|
||||||
|
* mg_dg_totalscore
|
||||||
|
*/
|
||||||
|
default void onPlayerMGDGTotalscore(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGTotalscore model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 本次获得积分状态(已修改)
|
||||||
|
* mg_dg_score
|
||||||
|
*/
|
||||||
|
default void onPlayerMGDGScore(ISudFSMStateHandle handle, String userId, SudMGPMGState.MGDGScore model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion 游戏回调APP 玩家状态 你画我猜
|
||||||
|
|
||||||
|
// region 游戏回调APP 通用状态 元宇宙砂砂舞
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 元宇宙砂砂舞指令回调
|
||||||
|
* mg_common_game_disco_action
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameDiscoAction(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameDiscoAction model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 元宇宙砂砂舞指令动作结束通知
|
||||||
|
* mg_common_game_disco_action_end
|
||||||
|
*/
|
||||||
|
default void onGameMGCommonGameDiscoActionEnd(ISudFSMStateHandle handle, SudMGPMGState.MGCommonGameDiscoActionEnd model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
// endregion 游戏回调APP 通用状态 元宇宙砂砂舞
|
||||||
|
|
||||||
|
// region 游戏回调APP 通用状态 定制火箭
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 礼物配置文件(火箭)
|
||||||
|
* mg_custom_rocket_config
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketConfig(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketConfig model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 拥有模型列表(火箭)
|
||||||
|
* mg_custom_rocket_model_list
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketModelList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketModelList model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 拥有组件列表(火箭)
|
||||||
|
* mg_custom_rocket_component_list
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketComponentList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketComponentList model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 获取用户信息(火箭)
|
||||||
|
* mg_custom_rocket_user_info
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketUserInfo(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketUserInfo model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 订单记录列表(火箭)
|
||||||
|
* mg_custom_rocket_order_record_list
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketOrderRecordList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketOrderRecordList model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. 展馆内列表(火箭)
|
||||||
|
* mg_custom_rocket_room_record_list
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketRoomRecordList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketRoomRecordList model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7. 展馆内玩家送出记录(火箭)
|
||||||
|
* mg_custom_rocket_user_record_list
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketUserRecordList(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketUserRecordList model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8. 设置默认模型(火箭)
|
||||||
|
* mg_custom_rocket_set_default_model
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketSetDefaultModel(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketSetDefaultModel model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9. 动态计算一键发送价格(火箭)
|
||||||
|
* mg_custom_rocket_dynamic_fire_price
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketDynamicFirePrice(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketDynamicFirePrice model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10. 一键发送(火箭)
|
||||||
|
* mg_custom_rocket_fire_model
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketFireModel(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketFireModel model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11. 新组装模型(火箭)
|
||||||
|
* mg_custom_rocket_create_model
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketCreateModel(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketCreateModel model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12. 模型更换组件(火箭)
|
||||||
|
* mg_custom_rocket_replace_component
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketReplaceComponent(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketReplaceComponent model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13. 购买组件(火箭)
|
||||||
|
* mg_custom_rocket_buy_component
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketBuyComponent(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketBuyComponent model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14. 播放效果开始(火箭)
|
||||||
|
* mg_custom_rocket_play_effect_start
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketPlayEffectStart(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketPlayEffectStart model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15. 播放效果完成(火箭)
|
||||||
|
* mg_custom_rocket_play_effect_finish
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketPlayEffectFinish(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketPlayEffectFinish model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16. 验证签名合规(火箭)
|
||||||
|
* mg_custom_rocket_verify_sign
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketVerifySign(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketVerifySign model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17. 上传icon(火箭)
|
||||||
|
* mg_custom_rocket_upload_model_icon
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketUploadModelIcon(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketUploadModelIcon model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18. 前期准备完成(火箭)
|
||||||
|
* mg_custom_rocket_prepare_finish
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketPrepareFinish(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketPrepareFinish model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 19. 火箭主界面已显示(火箭)
|
||||||
|
* mg_custom_rocket_show_game_scene
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketShowGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketShowGameScene model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 20. 火箭主界面已隐藏(火箭)
|
||||||
|
* mg_custom_rocket_hide_game_scene
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketHideGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketHideGameScene model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 21. 点击锁住组件(火箭)
|
||||||
|
* mg_custom_rocket_click_lock_component
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketClickLockComponent(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketClickLockComponent model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 22. 火箭效果飞行点击(火箭)
|
||||||
|
* mg_custom_rocket_fly_click
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketFlyClick(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketFlyClick model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 23. 火箭效果飞行结束(火箭)
|
||||||
|
* mg_custom_rocket_fly_end
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketFlyEnd(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketFlyEnd model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 24. 设置点击区域(火箭)
|
||||||
|
* mg_custom_rocket_set_click_rect
|
||||||
|
*/
|
||||||
|
default void onGameMGCustomRocketSetClickRect(ISudFSMStateHandle handle, SudMGPMGState.MGCustomRocketSetClickRect model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
// endregion 游戏回调APP 通用状态 定制火箭
|
||||||
|
|
||||||
|
// region 游戏回调APP 通用状态 棒球
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 查询排行榜数据(棒球)
|
||||||
|
* mg_baseball_ranking
|
||||||
|
*/
|
||||||
|
default void onGameMGBaseballRanking(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballRanking model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 查询我的排名(棒球)
|
||||||
|
* mg_baseball_my_ranking
|
||||||
|
*/
|
||||||
|
default void onGameMGBaseballMyRanking(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballMyRanking model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 查询当前距离我的前后玩家数据(棒球)
|
||||||
|
* mg_baseball_range_info
|
||||||
|
*/
|
||||||
|
default void onGameMGBaseballRangeInfo(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballRangeInfo model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 设置app提供给游戏可点击区域(棒球)
|
||||||
|
* mg_baseball_set_click_rect
|
||||||
|
*/
|
||||||
|
default void onGameMGBaseballSetClickRect(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballSetClickRect model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 前期准备完成(棒球)
|
||||||
|
* mg_baseball_prepare_finish
|
||||||
|
*/
|
||||||
|
default void onGameMGBaseballPrepareFinish(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballPrepareFinish model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. 主界面已显示(棒球)
|
||||||
|
* mg_baseball_show_game_scene
|
||||||
|
*/
|
||||||
|
default void onGameMGBaseballShowGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballShowGameScene model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7. 主界面已隐藏(棒球)
|
||||||
|
* mg_baseball_hide_game_scene
|
||||||
|
*/
|
||||||
|
default void onGameMGBaseballHideGameScene(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballHideGameScene model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8. 获取文本配置数据(棒球)
|
||||||
|
* mg_baseball_text_config
|
||||||
|
*/
|
||||||
|
default void onGameMGBaseballTextConfig(ISudFSMStateHandle handle, SudMGPMGState.MGBaseballTextConfig model) {
|
||||||
|
ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
}
|
||||||
|
// endregion 游戏回调APP 通用状态 棒球
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏状态变化
|
||||||
|
* 透传游戏向App发送的游戏通用状态消息
|
||||||
|
* **********使用此方法可先看下此方法的使用逻辑*************
|
||||||
|
*
|
||||||
|
* @param handle 回调操作
|
||||||
|
* @param state 状态命令
|
||||||
|
* @param dataJson 状态值
|
||||||
|
* @return 返回true,表示由此方法接管该状态处理,此时需注意调用:ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
*/
|
||||||
|
default boolean onGameStateChange(ISudFSMStateHandle handle, String state, String dataJson) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏玩家状态变化
|
||||||
|
* 透传游戏向App发送的玩家状态变化
|
||||||
|
* **********使用此方法可先看下此方法的使用逻辑*************
|
||||||
|
*
|
||||||
|
* @param handle 回调操作
|
||||||
|
* @param userId 用户Id
|
||||||
|
* @param state 状态命令
|
||||||
|
* @param dataJson 状态值
|
||||||
|
* @return 返回true,表示由此方法接管该状态处理,此时需注意调用:ISudFSMStateHandleUtils.handleSuccess(handle);
|
||||||
|
*/
|
||||||
|
default boolean onPlayerStateChange(ISudFSMStateHandle handle, String userId, String state, String dataJson) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,446 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.decorator;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.state.SudMGPAPPState;
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.utils.SudJsonUtils;
|
||||||
|
import tech.sud.mgp.core.ISudFSTAPP;
|
||||||
|
import tech.sud.mgp.core.ISudListenerNotifyStateChange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ISudFSTAPP的装饰类,接近于业务
|
||||||
|
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSTAPP.html
|
||||||
|
* 注意:
|
||||||
|
* 1,向游戏侧发送状态之后,不能立即调用destroyMG()方法,也不能立即finish Activity。例如:{@link SudFSTAPPDecorator#notifyAPPCommonSelfEnd()}
|
||||||
|
*/
|
||||||
|
public class SudFSTAPPDecorator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP调用游戏的接口
|
||||||
|
*/
|
||||||
|
private ISudFSTAPP iSudFSTAPP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置app调用sdk的对象
|
||||||
|
*
|
||||||
|
* @param iSudFSTAPP
|
||||||
|
*/
|
||||||
|
public void setISudFSTAPP(ISudFSTAPP iSudFSTAPP) {
|
||||||
|
this.iSudFSTAPP = iSudFSTAPP;
|
||||||
|
}
|
||||||
|
|
||||||
|
// region 状态通知,ISudFSTAPP.notifyStateChange
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 1. 加入状态
|
||||||
|
*
|
||||||
|
* @param isIn true 加入游戏,false 退出游戏
|
||||||
|
* @param seatIndex 加入的游戏位(座位号) 默认传seatIndex = -1 随机加入,seatIndex 从0开始,不可大于座位数
|
||||||
|
* @param isSeatRandom 默认为ture, 带有游戏位(座位号)的时候,如果游戏位(座位号)已经被占用,是否随机分配一个空位坐下 isSeatRandom=true 随机分配空位坐下,isSeatRandom=false 不随机分配
|
||||||
|
* @param teamId 不支持分队的游戏:数值填1;支持分队的游戏:数值填1或2(两支队伍);
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonSelfIn(boolean isIn, int seatIndex, boolean isSeatRandom, int teamId) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonSelfIn state = new SudMGPAPPState.APPCommonSelfIn();
|
||||||
|
state.isIn = isIn;
|
||||||
|
state.seatIndex = seatIndex;
|
||||||
|
state.isSeatRandom = isSeatRandom;
|
||||||
|
state.teamId = teamId;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_IN, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 2. 准备状态
|
||||||
|
* 用户(本人)准备/取消准备
|
||||||
|
*
|
||||||
|
* @param isReady true 准备,false 取消准备
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonSelfReady(boolean isReady) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonSelfReady state = new SudMGPAPPState.APPCommonSelfReady();
|
||||||
|
state.isReady = isReady;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_READY, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 3. 游戏状态 模型
|
||||||
|
* 用户游戏状态,如果用户在游戏中,建议:
|
||||||
|
* a.空出屏幕中心区:
|
||||||
|
* 关闭全屏礼物特效;
|
||||||
|
* b.部分强操作类小游戏(spaceMax为true),尽量收缩原生UI,给游戏留出尽量大的操作空间:
|
||||||
|
* 收缩公屏;
|
||||||
|
* 收缩麦位;
|
||||||
|
* 如果不在游戏中,则恢复。
|
||||||
|
*
|
||||||
|
* @param isPlaying true 开始游戏,false 结束游戏
|
||||||
|
* @param reportGameInfoExtras string类型,Https服务回调report_game_info参数,最大长度1024字节,超过则截断(2022-01-21)
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonSelfPlaying(boolean isPlaying, String reportGameInfoExtras, String reportGameInfoKey) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonSelfPlaying state = new SudMGPAPPState.APPCommonSelfPlaying();
|
||||||
|
state.isPlaying = isPlaying;
|
||||||
|
state.reportGameInfoExtras = reportGameInfoExtras;
|
||||||
|
state.reportGameInfoKey = reportGameInfoKey;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_PLAYING, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 4. 队长状态
|
||||||
|
* 用户是否为队长,队长在游戏中会有开始游戏的权利。
|
||||||
|
* 发送此状态后,会把队长身份转移到另一名用户身上。
|
||||||
|
* 注意:必须是队长发送才有效果。可通过{@link SudFSMMGDecorator#getCaptainUserId()}拿到当前队长id
|
||||||
|
*
|
||||||
|
* @param curCaptainUID 必填,指定队长uid
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonSelfCaptain(String curCaptainUID) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonSelfCaptain state = new SudMGPAPPState.APPCommonSelfCaptain();
|
||||||
|
state.curCaptainUID = curCaptainUID;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_CAPTAIN, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 5. 踢人
|
||||||
|
* 用户(本人,队长)踢其他玩家;
|
||||||
|
* 队长才能踢人;
|
||||||
|
*
|
||||||
|
* @param kickedUID 被踢用户uid
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonSelfKick(String kickedUID) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonSelfKick state = new SudMGPAPPState.APPCommonSelfKick();
|
||||||
|
state.kickedUID = kickedUID;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_KICK, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 6. 结束游戏
|
||||||
|
* 用户(本人,队长)结束(本局)游戏
|
||||||
|
* 注意:必须是队长发送才有效果。可通过{@link SudFSMMGDecorator#getCaptainUserId()}拿到当前队长id
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonSelfEnd() {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonSelfEnd state = new SudMGPAPPState.APPCommonSelfEnd();
|
||||||
|
// 使用iSudFSTAPP.notifyStateChange方法向游戏侧发送状态时,因为大部分状态都需要通过网络向后端发送状态指令
|
||||||
|
// 所以如果发送状态后,马上就销毁游戏或者Activity,那么状态指令大概率会不生效
|
||||||
|
// *** 如果要确保指令能到达后端,那么发送指令后不要立即destroyMG()或finish Activity,可在发送后delay一定时间(如300 or 500 ms)再销毁
|
||||||
|
// *** 如果不在乎指令是否能成功到达,可忽略delay
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_END, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 9. 麦克风状态
|
||||||
|
* 用户(本人)麦克风状态,建议:
|
||||||
|
* 进入房间后初始通知一次;
|
||||||
|
* 每次变更(开麦/闭麦/禁麦/解麦)通知一次;
|
||||||
|
*
|
||||||
|
* @param isOn true 开麦,false 闭麦
|
||||||
|
* @param isDisabled true 被禁麦,false 未被禁麦
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonSelfMicrophone(boolean isOn, boolean isDisabled) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonSelfMicrophone state = new SudMGPAPPState.APPCommonSelfMicrophone();
|
||||||
|
state.isOn = isOn;
|
||||||
|
state.isDisabled = isDisabled;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_MICROPHONE, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 10. 文字命中状态
|
||||||
|
* 用户(本人)聊天信息命中关键词状态,建议:
|
||||||
|
* 精确匹配;
|
||||||
|
* 首次聊天内容命中关键词之后,后续聊天内容不翻转成未命中;
|
||||||
|
* 直至小游戏侧关键词更新,再将状态翻转为未命中;
|
||||||
|
*
|
||||||
|
* @param isHit true 命中,false 未命中
|
||||||
|
* @param keyWord 单个关键词, 兼容老版本
|
||||||
|
* @param text 返回转写文本
|
||||||
|
* @param wordType text:文本包含匹配; number:数字等于匹配
|
||||||
|
* @param keyWordList 命中关键词,可以包含多个关键词
|
||||||
|
* @param numberList 在number模式下才有,返回转写的多个数字
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonSelfTextHitState(boolean isHit, String keyWord, String text,
|
||||||
|
String wordType, List<String> keyWordList, List<Integer> numberList) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonSelfTextHitState state = new SudMGPAPPState.APPCommonSelfTextHitState();
|
||||||
|
state.isHit = isHit;
|
||||||
|
state.keyWord = keyWord;
|
||||||
|
state.text = text;
|
||||||
|
state.wordType = wordType;
|
||||||
|
state.keyWordList = keyWordList;
|
||||||
|
state.numberList = numberList;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_SELF_TEXT_HIT, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 11. 打开或关闭背景音乐(2021-12-27新增)
|
||||||
|
*
|
||||||
|
* @param isOpen true 打开背景音乐,false 关闭背景音乐
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonOpenBgMusic(boolean isOpen) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonOpenBgMusic state = new SudMGPAPPState.APPCommonOpenBgMusic();
|
||||||
|
state.isOpen = isOpen;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_OPEN_BG_MUSIC, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 12. 打开或关闭音效(2021-12-27新增)
|
||||||
|
*
|
||||||
|
* @param isOpen true 打开音效,false 关闭音效
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonOpenSound(boolean isOpen) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonOpenSound state = new SudMGPAPPState.APPCommonOpenSound();
|
||||||
|
state.isOpen = isOpen;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_OPEN_SOUND, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 13. 打开或关闭游戏中的振动效果(2021-12-27新增)
|
||||||
|
*
|
||||||
|
* @param isOpen 打开振动效果,false 关闭振动效果
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonOpenVibrate(boolean isOpen) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonOpenVibrate state = new SudMGPAPPState.APPCommonOpenVibrate();
|
||||||
|
state.isOpen = isOpen;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_OPEN_VIBRATE, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 14. 设置游戏的音量大小(2021-12-31新增)
|
||||||
|
*
|
||||||
|
* @param volume 音量大小 0 到 100
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonGameSoundVolume(int volume) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonGameSoundVolume state = new SudMGPAPPState.APPCommonGameSoundVolume();
|
||||||
|
state.volume = volume;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_SOUND_VOLUME, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 15. 设置游戏玩法选项(2022-05-10新增)
|
||||||
|
*
|
||||||
|
* @param ludo ludo游戏
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonGameSettingSelectInfo(SudMGPAPPState.Ludo ludo) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonGameSettingSelectInfo state = new SudMGPAPPState.APPCommonGameSettingSelectInfo();
|
||||||
|
state.ludo = ludo;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_SETTING_SELECT_INFO, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 16. 设置游戏中的AI玩家(2022-05-11新增)
|
||||||
|
* 队长设置才有效
|
||||||
|
*
|
||||||
|
* @param aiPlayers AI玩家
|
||||||
|
* @param isReady 机器人加入后是否自动准备 1:自动准备,0:不自动准备 默认为1
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonGameAddAIPlayers(List<SudMGPAPPState.AIPlayers> aiPlayers, int isReady) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonGameAddAIPlayers state = new SudMGPAPPState.APPCommonGameAddAIPlayers();
|
||||||
|
state.aiPlayers = aiPlayers;
|
||||||
|
state.isReady = isReady;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_ADD_AI_PLAYERS, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 17. app在收到游戏断开连接通知后,通知游戏重试连接(2022-06-21新增,暂时支持ludo)
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonGameReconnect() {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonGameReconnect state = new SudMGPAPPState.APPCommonGameReconnect();
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_RECONNECT, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 18. app返回玩家当前积分
|
||||||
|
*/
|
||||||
|
public void notifyAPPCommonGameScore(long score) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.APPCommonGameScore state = new SudMGPAPPState.APPCommonGameScore();
|
||||||
|
state.score = score;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_SCORE, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// endregion 状态通知,ISudFSTAPP.notifyStateChange
|
||||||
|
|
||||||
|
// region 生命周期
|
||||||
|
public void startMG() {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
iSudFSTAPP.startMG();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pauseMG() {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
iSudFSTAPP.pauseMG();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playMG() {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
iSudFSTAPP.playMG();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopMG() {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
iSudFSTAPP.stopMG();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void destroyMG() {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
iSudFSTAPP.destroyMG();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion 生命周期
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新code
|
||||||
|
*
|
||||||
|
* @param code
|
||||||
|
* @param listener
|
||||||
|
*/
|
||||||
|
public void updateCode(String code, ISudListenerNotifyStateChange listener) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
iSudFSTAPP.updateCode(code, listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 音频流数据
|
||||||
|
*/
|
||||||
|
public void pushAudio(ByteBuffer buffer, int bufferLength) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
iSudFSTAPP.pushAudio(buffer, bufferLength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// region 元宇宙砂砂舞
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送
|
||||||
|
* 1. 元宇宙砂砂舞相关设置
|
||||||
|
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/APPFST/CommonStateForDisco.html
|
||||||
|
*
|
||||||
|
* @param actionId 必传的参数,用于指定类型的序号,不同序号用于区分游戏内的不同功能,不传则会判断为无效指令,具体序号代表的功能见下表
|
||||||
|
* @param cooldown 持续时间,单位秒,部分功能有持续时间就需要传对应的数值,不传或传错则会按各自功能的默认值处理(见下表)
|
||||||
|
* @param isTop 是否置顶,针对部分功能可排队置顶(false:不置顶;true:置顶;默认为false)
|
||||||
|
* @param field1 额外参数1,针对部分功能有具体的意义
|
||||||
|
* @param field2 额外参数2,针对部分功能有具体的意义
|
||||||
|
*/
|
||||||
|
public void notifyAppCommonGameDiscoAction(int actionId, Integer cooldown, Boolean isTop, String field1, String field2) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
SudMGPAPPState.AppCommonGameDiscoAction state = new SudMGPAPPState.AppCommonGameDiscoAction();
|
||||||
|
state.actionId = actionId;
|
||||||
|
state.cooldown = cooldown;
|
||||||
|
state.isTop = isTop;
|
||||||
|
state.field1 = field1;
|
||||||
|
state.field2 = field2;
|
||||||
|
iSudFSTAPP.notifyStateChange(SudMGPAPPState.APP_COMMON_GAME_DISCO_ACTION, SudJsonUtils.toJson(state), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// endregion 元宇宙砂砂舞
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP状态通知给小游戏
|
||||||
|
*
|
||||||
|
* @param state 状态标识
|
||||||
|
* @param dataJson 数据
|
||||||
|
* @param listener 回调监听
|
||||||
|
*/
|
||||||
|
public void notifyStateChange(String state, String dataJson, ISudListenerNotifyStateChange listener) {
|
||||||
|
ISudFSTAPP iSudFSTAPP = this.iSudFSTAPP;
|
||||||
|
if (iSudFSTAPP != null) {
|
||||||
|
iSudFSTAPP.notifyStateChange(state, dataJson, listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP状态通知给小游戏
|
||||||
|
*
|
||||||
|
* @param state 状态标识
|
||||||
|
* @param dataJson 数据
|
||||||
|
*/
|
||||||
|
public void notifyStateChange(String state, String dataJson) {
|
||||||
|
notifyStateChange(state, dataJson, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP状态通知给小游戏
|
||||||
|
*
|
||||||
|
* @param state 状态标识
|
||||||
|
* @param obj 数据
|
||||||
|
*/
|
||||||
|
public void notifyStateChange(String state, Object obj) {
|
||||||
|
notifyStateChange(state, SudJsonUtils.toJson(obj), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.model;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏配置模型
|
||||||
|
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG/onGetGameCfg.html
|
||||||
|
*/
|
||||||
|
public class GameConfigModel implements Serializable {
|
||||||
|
|
||||||
|
public int gameMode = 1; // 游戏模式(每个游戏默认模式是1,不填是1)
|
||||||
|
public int gameCPU = 0; // 游戏CPU(值为0和1;0:CPU正常功耗,1:CPU低功耗;默认是0,CPU正常功耗)
|
||||||
|
public int gameSoundControl = 0; // 游戏中声音的播放是否被app层接管(值为0和1;0:游戏播放声音,1:app层播放声音,游戏中不播放任何声音;默认是0)
|
||||||
|
public int gameSoundVolume = 100; // 游戏中音量的大小(值为0到100;默认是100)
|
||||||
|
public GameUi ui = new GameUi(); // 对游戏ui界面的配置,可定制ui界面的显示与不显示
|
||||||
|
|
||||||
|
// 游戏配置中,ui部分
|
||||||
|
public static class GameUi implements Serializable {
|
||||||
|
public GameSettle gameSettle = new GameSettle(); // 结算界面
|
||||||
|
public GamePing ping = new GamePing(); // 界面中的ping值
|
||||||
|
public GameVersion version = new GameVersion(); // 界面中的版本信息值
|
||||||
|
public GameLevel level = new GameLevel(); // 大厅中的段位信息
|
||||||
|
public GameLobbySettingBtn lobby_setting_btn = new GameLobbySettingBtn(); // 大厅的设置按钮
|
||||||
|
public GameLobbyHelpBtn lobby_help_btn = new GameLobbyHelpBtn(); // 大厅的帮助按钮
|
||||||
|
public GameLobbyPlayers lobby_players = new GameLobbyPlayers(); // 大厅玩家展示位
|
||||||
|
public GameLobbyPlayerCaptainIcon lobby_player_captain_icon = new GameLobbyPlayerCaptainIcon(); // 大厅玩家展示位上队长标识
|
||||||
|
public GameLobbyPlayerKickoutIcon lobby_player_kickout_icon = new GameLobbyPlayerKickoutIcon(); // 大厅玩家展示位上踢人标识
|
||||||
|
public GameLobbyRule lobby_rule = new GameLobbyRule(); // 大厅的玩法规则描述文字
|
||||||
|
public GameLobbyGameSetting lobby_game_setting = new GameLobbyGameSetting(); // 玩法设置
|
||||||
|
public GameJoinBtn join_btn = new GameJoinBtn(); // 加入按钮
|
||||||
|
public GameCancelJoinBtn cancel_join_btn = new GameCancelJoinBtn(); // 取消加入按钮
|
||||||
|
public GameReadyBtn ready_btn = new GameReadyBtn(); // 准备按钮
|
||||||
|
public GameCancelReadyBtn cancel_ready_btn = new GameCancelReadyBtn(); // 取消准备按钮
|
||||||
|
public GameStartBtn start_btn = new GameStartBtn(); // 开始按钮
|
||||||
|
public GameShareBtn share_btn = new GameShareBtn(); // 分享
|
||||||
|
public GameSttingBtn game_setting_btn = new GameSttingBtn(); // 游戏场景中的设置按钮
|
||||||
|
public GameHelpBtn game_help_btn = new GameHelpBtn(); // 游戏场景中的帮助按钮
|
||||||
|
public GameSettleCloseBtn game_settle_close_btn = new GameSettleCloseBtn(); // 游戏结算界面中的关闭按钮
|
||||||
|
public GameSettleAgainBtn game_settle_again_btn = new GameSettleAgainBtn(); // 游戏结算界面中的再来一局按钮
|
||||||
|
public GameBg game_bg = new GameBg();// 是否隐藏背景图,包括大厅和战斗
|
||||||
|
public BlockChangeSeat block_change_seat = new BlockChangeSeat(); // 自定义阻止换座位
|
||||||
|
public GameSettingSelectPnl game_setting_select_pnl = new GameSettingSelectPnl(); // 大厅中的玩法选择设置面板
|
||||||
|
public GameManagedImage game_managed_image = new GameManagedImage(); // 游戏中的托管图标
|
||||||
|
public GameTableImage game_table_image = new GameTableImage(); // 游戏中牌桌背景图 (注:只对某些带牌桌类游戏有作用)
|
||||||
|
public GameCountdownTime game_countdown_time = new GameCountdownTime(); // 游戏中游戏倒计时显示 (注:现在只针对umo生效)
|
||||||
|
public GameSelectedTips game_selected_tips = new GameSelectedTips(); // 游戏中所选择的玩法提示文字 (注:现在只针对ludo生效)
|
||||||
|
public NFTAvatar nft_avatar = new NFTAvatar(); // 控制NFT头像的开关
|
||||||
|
public GameOpening game_opening = new GameOpening(); // 控制开场动画的开关
|
||||||
|
public GameMvp game_mvp = new GameMvp(); // 游戏结算前的mvp动画
|
||||||
|
public UmoIcon umo_icon = new UmoIcon(); // 游戏中动画和头像右上角的UMO图标
|
||||||
|
public Logo logo = new Logo(); // 大厅中的logo
|
||||||
|
public GamePlayers game_players = new GamePlayers(); // 游戏中的游戏位
|
||||||
|
}
|
||||||
|
|
||||||
|
// 结算界面
|
||||||
|
public static class GameSettle implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏结算界面(false: 显示; true: 隐藏,默认为 false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 界面中的ping值
|
||||||
|
public static class GamePing implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏ping值(false: 显示;true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 界面中的版本信息值
|
||||||
|
public static class GameVersion implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏版本信息(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅中的段位信息
|
||||||
|
public static class GameLevel implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏段位信息(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅的设置按钮
|
||||||
|
public static class GameLobbySettingBtn implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏大厅的设置按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅的帮助按钮
|
||||||
|
public static class GameLobbyHelpBtn implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏大厅的帮助按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅玩家展示位
|
||||||
|
public static class GameLobbyPlayers implements Serializable {
|
||||||
|
public boolean custom = false; // 大厅玩家展示位头像点击加入(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||||
|
public boolean hide = false; // 是否隐藏大厅玩家展示位(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅玩家展示位上队长标识
|
||||||
|
public static class GameLobbyPlayerCaptainIcon implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏大厅玩家展示位上队长标识(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅玩家展示位上踢人标识
|
||||||
|
public static class GameLobbyPlayerKickoutIcon implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏大厅玩家展示位上踢人标识(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅的玩法规则描述文字
|
||||||
|
public static class GameLobbyRule implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏大厅的玩法规则描述文字(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 玩法设置
|
||||||
|
public static class GameLobbyGameSetting implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏玩法设置(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加入按钮
|
||||||
|
public static class GameJoinBtn implements Serializable {
|
||||||
|
public boolean custom = false; // 加入按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||||
|
public boolean hide = false; // 是否隐藏加入按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消加入按钮
|
||||||
|
public static class GameCancelJoinBtn implements Serializable {
|
||||||
|
public boolean custom = false; // 取消加入按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||||
|
public boolean hide = false; // 是否隐藏取消加入按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 准备按钮
|
||||||
|
public static class GameReadyBtn implements Serializable {
|
||||||
|
public boolean custom = false; // 准备按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||||
|
public boolean hide = false; // 是否隐藏准备按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消准备按钮
|
||||||
|
public static class GameCancelReadyBtn implements Serializable {
|
||||||
|
public boolean custom = false; // 取消准备按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||||
|
public boolean hide = false; // 是否隐藏取消准备按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始游戏按钮
|
||||||
|
public static class GameStartBtn implements Serializable {
|
||||||
|
public boolean custom = false; // 开始游戏按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||||
|
public boolean hide = false; // 是否隐藏开始游戏按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分享按钮
|
||||||
|
public static class GameShareBtn implements Serializable {
|
||||||
|
public boolean custom = false; // 分享按钮(false: 游戏处理逻辑; true: 游戏只通知按钮点击事件,不处理;默认为false)
|
||||||
|
public boolean hide = true; // 是否隐藏分享按钮(false: 显示; true: 隐藏,默认为true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏场景中的设置按钮
|
||||||
|
public static class GameSttingBtn implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏游戏场景中的设置按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏场景中的帮助按钮
|
||||||
|
public static class GameHelpBtn implements Serializable {
|
||||||
|
public boolean hide = false; // 是否隐藏游戏场景中的帮助按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏结算界面中的关闭按钮
|
||||||
|
public static class GameSettleCloseBtn implements Serializable {
|
||||||
|
public boolean custom = false; // 游戏结算界面中的关闭按钮(false: 关闭结算界面返回大厅; true: 游戏通知按钮点击事件,并关闭结算界面返回大厅;默认为false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏结算界面中的再来一局按钮
|
||||||
|
public static class GameSettleAgainBtn implements Serializable {
|
||||||
|
// 游戏结算界面中的再来一局按钮
|
||||||
|
// (false: 关闭结算界面返回大厅并将玩家设置为准备状态; true: 游戏通知按钮点击事件,并关闭结算界面返回大厅(不将玩家设置为准备状态);默认为false)
|
||||||
|
public boolean custom = false;
|
||||||
|
|
||||||
|
// 是否隐藏结算界面中的『再来一局』按钮(false: 显示; true: 隐藏,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否隐藏背景图,包括大厅和战斗
|
||||||
|
// !!!这里只隐藏加载完成后的背景图,加载中背景图如需隐藏则调用:{SudMGP.getCfg().setShowLoadingGameBg(false); }
|
||||||
|
public static class GameBg implements Serializable {
|
||||||
|
//(false: 显示; true: 隐藏,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 自定义阻止换座位
|
||||||
|
public static class BlockChangeSeat implements Serializable {
|
||||||
|
//(false: 可以换座位; true: 不可以换座位;默认为false)
|
||||||
|
public boolean custom = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅中的玩法选择设置面板
|
||||||
|
public static class GameSettingSelectPnl implements Serializable {
|
||||||
|
// 是否隐藏大厅中的玩法选择设置面板(false: 显示; true: 隐藏,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏中的托管图标
|
||||||
|
public static class GameManagedImage implements Serializable {
|
||||||
|
// 是否隐藏游戏中的托管图标(false: 显示; true: 隐藏,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏中牌桌背景图 (注:只对某些带牌桌类游戏有作用)
|
||||||
|
public static class GameTableImage implements Serializable {
|
||||||
|
// 是否隐藏游戏牌桌背景图(false: 显示; true: 隐藏,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏中游戏倒计时显示 (注:现在只针对umo生效)
|
||||||
|
public static class GameCountdownTime implements Serializable {
|
||||||
|
// 是否隐藏游戏中游戏倒计时显示(false: 显示; true: 隐藏,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏中所选择的玩法提示文字 (注:现在只针对ludo生效)
|
||||||
|
public static class GameSelectedTips implements Serializable {
|
||||||
|
// 是否隐藏游戏中所选择的玩法提示文字显示(false: 显示; true: 隐藏,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 控制NFT头像的开关
|
||||||
|
public static class NFTAvatar implements Serializable {
|
||||||
|
// true隐藏 false显示
|
||||||
|
public boolean hide = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 控制开场动画的开关
|
||||||
|
public static class GameOpening implements Serializable {
|
||||||
|
// true隐藏 false显示
|
||||||
|
public boolean hide = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏结算前的mvp动画
|
||||||
|
public static class GameMvp implements Serializable {
|
||||||
|
// true隐藏 false显示
|
||||||
|
public boolean hide = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏中动画和头像右上角的UMO图标
|
||||||
|
public static class UmoIcon implements Serializable {
|
||||||
|
// 是否隐藏游戏中动画和头像右上角的UMO图标并改为UNO(false: 不隐藏,依然显示UMO; true: 隐藏,改为显示UNO,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大厅中的logo
|
||||||
|
public static class Logo implements Serializable {
|
||||||
|
// 是否隐藏大厅中的logo(false: 不隐藏; true: 隐藏,默认为false)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 游戏中的游戏位
|
||||||
|
public static class GamePlayers implements Serializable {
|
||||||
|
// 是否隐藏游戏中的游戏位(false: 不隐藏; true: 隐藏,默认为false,暂时只支持你画我猜)
|
||||||
|
public boolean hide = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏视图
|
||||||
|
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/API/ISudFSMMG/onGetGameViewInfo.html
|
||||||
|
*/
|
||||||
|
public class GameViewInfoModel {
|
||||||
|
// 返回码
|
||||||
|
public int ret_code;
|
||||||
|
|
||||||
|
// 返回消息
|
||||||
|
public String ret_msg;
|
||||||
|
|
||||||
|
// 游戏View的大小
|
||||||
|
public GameViewSizeModel view_size = new GameViewSizeModel();
|
||||||
|
|
||||||
|
// 游戏安全操作区域
|
||||||
|
public GameViewRectModel view_game_rect = new GameViewRectModel();
|
||||||
|
|
||||||
|
public static class GameViewSizeModel {
|
||||||
|
// 游戏View的宽 (单位像素)
|
||||||
|
public int width;
|
||||||
|
|
||||||
|
// 游戏View的高 (单位像素)
|
||||||
|
public int height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class GameViewRectModel {
|
||||||
|
// 相对于view_size左边框偏移(单位像素)
|
||||||
|
public int left;
|
||||||
|
// 相对于view_size上边框偏移(单位像素)
|
||||||
|
public int top;
|
||||||
|
// 相对于view_size右边框偏移(单位像素)
|
||||||
|
public int right;
|
||||||
|
// 相对于view_size下边框偏移(单位像素)
|
||||||
|
public int bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mg2app,状态响应
|
||||||
|
*/
|
||||||
|
public class MGStateResponse {
|
||||||
|
|
||||||
|
// 返回码,成功
|
||||||
|
public static final int SUCCESS = 0;
|
||||||
|
|
||||||
|
public int ret_code; // 返回码
|
||||||
|
public String ret_msg; // 返回消息
|
||||||
|
}
|
||||||
@@ -0,0 +1,845 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.state;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP to MG 的通用状态定义
|
||||||
|
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/APPFST/
|
||||||
|
*/
|
||||||
|
public class SudMGPAPPState implements Serializable {
|
||||||
|
|
||||||
|
// region 通用状态
|
||||||
|
/**
|
||||||
|
* 1. 加入状态
|
||||||
|
* 最低版本: v1.1.30.xx
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_IN = "app_common_self_in";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 加入状态 模型
|
||||||
|
* 用户(本人)加入游戏/退出游戏
|
||||||
|
* 正确流程:
|
||||||
|
* 1.isIn=true: 加入游戏=>准备游戏=>开始游戏;
|
||||||
|
* 2.isIn=false: 结束=>取消准备=>退出游戏;
|
||||||
|
*/
|
||||||
|
public static class APPCommonSelfIn implements Serializable {
|
||||||
|
// rue 加入游戏,false 退出游戏
|
||||||
|
public boolean isIn;
|
||||||
|
|
||||||
|
// 加入的游戏位(座位号) 默认传seatIndex = -1 随机加入,seatIndex 从0开始,不可大于座位数
|
||||||
|
public int seatIndex;
|
||||||
|
|
||||||
|
// 默认为ture, 带有游戏位(座位号)的时候,如果游戏位(座位号)已经被占用,是否随机分配一个空位坐下 isSeatRandom=true 随机分配空位坐下,isSeatRandom=false 不随机分配
|
||||||
|
public boolean isSeatRandom;
|
||||||
|
|
||||||
|
// 不支持分队的游戏:数值填1;支持分队的游戏:数值填1或2(两支队伍);
|
||||||
|
public int teamId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 准备状态
|
||||||
|
* 最低版本: v1.1.30.xx
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_READY = "app_common_self_ready";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 准备状态 模型
|
||||||
|
* 用户(本人)准备/取消准备
|
||||||
|
*/
|
||||||
|
public static class APPCommonSelfReady implements Serializable {
|
||||||
|
// true 准备,false 取消准备
|
||||||
|
public boolean isReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 游戏状态
|
||||||
|
* 最低版本: v1.1.30.xx
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_PLAYING = "app_common_self_playing";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 游戏状态 模型
|
||||||
|
* 用户游戏状态,如果用户在游戏中,建议:
|
||||||
|
* a.空出屏幕中心区:
|
||||||
|
* 关闭全屏礼物特效;
|
||||||
|
* b.部分强操作类小游戏(spaceMax为true),尽量收缩原生UI,给游戏留出尽量大的操作空间:
|
||||||
|
* 收缩公屏;
|
||||||
|
* 收缩麦位;
|
||||||
|
* 如果不在游戏中,则恢复。
|
||||||
|
*/
|
||||||
|
public static class APPCommonSelfPlaying implements Serializable {
|
||||||
|
// true 开始游戏,false 结束游戏
|
||||||
|
public boolean isPlaying;
|
||||||
|
|
||||||
|
// string类型,Https服务回调report_game_info参数,最大长度1024字节,超过则截断(2022-01-21)
|
||||||
|
public String reportGameInfoExtras;
|
||||||
|
|
||||||
|
// string类型,最大长度64字节,接入方服务端,可以根据这个字段来查询一局游戏的数据
|
||||||
|
public String reportGameInfoKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 队长状态
|
||||||
|
* 最低版本: v1.1.30.xx
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_CAPTAIN = "app_common_self_captain";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 队长状态 模型
|
||||||
|
* 用户是否为队长,队长在游戏中会有开始游戏的权利。
|
||||||
|
*/
|
||||||
|
public static class APPCommonSelfCaptain implements Serializable {
|
||||||
|
// 必填,指定队长uid
|
||||||
|
public String curCaptainUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 踢人
|
||||||
|
* v1.1.30.xx
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_KICK = "app_common_self_kick";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 踢人 模型
|
||||||
|
* 用户(本人,队长)踢其他玩家;
|
||||||
|
* 队长才能踢人;
|
||||||
|
*/
|
||||||
|
public static class APPCommonSelfKick implements Serializable {
|
||||||
|
// 被踢用户uid
|
||||||
|
public String kickedUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. 结束游戏
|
||||||
|
* v1.1.30.xx
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_END = "app_common_self_end";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. 结束游戏 模型
|
||||||
|
* 用户(本人,队长)结束(本局)游戏
|
||||||
|
*/
|
||||||
|
public static class APPCommonSelfEnd implements Serializable {
|
||||||
|
// 当前不需要传参
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7. 房间状态(depreated 已废弃v1.1.30.xx)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_ROOM = "app_common_self_room";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8. 麦位状态(depreated 已废弃v1.1.30.xx)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_SEAT = "app_common_self_seat";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9. 麦克风状态
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_MICROPHONE = "app_common_self_microphone";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9. 麦克风状态 模型
|
||||||
|
* 用户(本人)麦克风状态,建议:
|
||||||
|
* 进入房间后初始通知一次;
|
||||||
|
* 每次变更(开麦/闭麦/禁麦/解麦)通知一次;
|
||||||
|
*/
|
||||||
|
public static class APPCommonSelfMicrophone implements Serializable {
|
||||||
|
// true 开麦,false 闭麦
|
||||||
|
public boolean isOn;
|
||||||
|
|
||||||
|
// true 被禁麦,false 未被禁麦
|
||||||
|
public boolean isDisabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10. 文字命中状态
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_SELF_TEXT_HIT = "app_common_self_text_hit";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10. 文字命中状态 模型
|
||||||
|
* 用户(本人)聊天信息命中关键词状态,建议:
|
||||||
|
* 精确匹配;
|
||||||
|
* 首次聊天内容命中关键词之后,后续聊天内容不翻转成未命中;
|
||||||
|
* 直至小游戏侧关键词更新,再将状态翻转为未命中;
|
||||||
|
*/
|
||||||
|
public static class APPCommonSelfTextHitState implements Serializable {
|
||||||
|
// true 命中,false 未命中
|
||||||
|
public boolean isHit;
|
||||||
|
|
||||||
|
// 单个关键词, 兼容老版本
|
||||||
|
public String keyWord;
|
||||||
|
|
||||||
|
// 返回转写文本
|
||||||
|
public String text;
|
||||||
|
|
||||||
|
// text:文本包含匹配; number:数字等于匹配
|
||||||
|
public String wordType;
|
||||||
|
|
||||||
|
// 命中关键词,可以包含多个关键词
|
||||||
|
public List<String> keyWordList;
|
||||||
|
|
||||||
|
// 在number模式下才有,返回转写的多个数字
|
||||||
|
public List<Integer> numberList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11. 打开或关闭背景音乐(2021-12-27新增)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_OPEN_BG_MUSIC = "app_common_open_bg_music";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11. 打开或关闭背景音乐(2021-12-27新增) 模型
|
||||||
|
*/
|
||||||
|
public static class APPCommonOpenBgMusic implements Serializable {
|
||||||
|
// true 打开背景音乐,false 关闭背景音乐
|
||||||
|
public boolean isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12. 打开或关闭音效(2021-12-27新增)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_OPEN_SOUND = "app_common_open_sound";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12. 打开或关闭音效(2021-12-27新增) 模型
|
||||||
|
*/
|
||||||
|
public static class APPCommonOpenSound implements Serializable {
|
||||||
|
// true 打开音效,false 关闭音效
|
||||||
|
public boolean isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13. 打开或关闭游戏中的振动效果(2021-12-27新增)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_OPEN_VIBRATE = "app_common_open_vibrate";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13. 打开或关闭游戏中的振动效果(2021-12-27新增)模型
|
||||||
|
*/
|
||||||
|
public static class APPCommonOpenVibrate implements Serializable {
|
||||||
|
// true 打开振动效果,false 关闭振动效果
|
||||||
|
public boolean isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14. 设置游戏的音量大小(2021-12-31新增)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_GAME_SOUND_VOLUME = "app_common_game_sound_volume";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14. 设置游戏的音量大小(2021-12-31新增)模型
|
||||||
|
*/
|
||||||
|
public static class APPCommonGameSoundVolume implements Serializable {
|
||||||
|
// 音量大小 0 到 100
|
||||||
|
public int volume;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15. 设置游戏玩法选项(2022-05-10新增)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_GAME_SETTING_SELECT_INFO = "app_common_game_setting_select_info";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15. 设置游戏玩法选项(2022-05-10新增) 模型
|
||||||
|
*/
|
||||||
|
public static class APPCommonGameSettingSelectInfo implements Serializable {
|
||||||
|
public Ludo ludo; // 游戏名称
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Ludo implements Serializable {
|
||||||
|
public int mode; // mode: 默认赛制,0: 快速, 1: 经典;
|
||||||
|
public int chessNum; // chessNum: 默认棋子数量, 2: 对应2颗棋子; 4: 对应4颗棋子;
|
||||||
|
public int item; // item: 默认道具, 1: 有道具, 0: 没有道具
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16. 设置游戏中的AI玩家(2022-05-11新增)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_GAME_ADD_AI_PLAYERS = "app_common_game_add_ai_players";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16. 设置游戏中的AI玩家(2022-05-11新增) 模型
|
||||||
|
*/
|
||||||
|
public static class APPCommonGameAddAIPlayers implements Serializable {
|
||||||
|
public List<AIPlayers> aiPlayers; // AI玩家
|
||||||
|
public int isReady = 1; // 机器人加入后是否自动准备 1:自动准备,0:不自动准备 默认为1
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AIPlayers implements Serializable {
|
||||||
|
public String userId; // 玩家id
|
||||||
|
public String avatar; // 头像url
|
||||||
|
public String name; // 名字
|
||||||
|
public String gender; // 性别 male:男,female:女
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17. app在收到游戏断开连接通知后,通知游戏重试连接(2022-06-21新增,暂时支持ludo)
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_GAME_RECONNECT = "app_common_game_reconnect";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17. app在收到游戏断开连接通知后,通知游戏重试连接(2022-06-21新增,暂时支持ludo) 模型
|
||||||
|
*/
|
||||||
|
public static class APPCommonGameReconnect implements Serializable {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18. app返回玩家当前积分
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_GAME_SCORE = "app_common_game_score";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18. app返回玩家当前积分
|
||||||
|
*/
|
||||||
|
public static class APPCommonGameScore implements Serializable {
|
||||||
|
public long score; // 玩家当前积分
|
||||||
|
}
|
||||||
|
// endregion 通用状态
|
||||||
|
|
||||||
|
// region 元宇宙砂砂舞
|
||||||
|
/**
|
||||||
|
* 1. 元宇宙砂砂舞相关设置
|
||||||
|
* 参考文档:https://docs.sud.tech/zh-CN/app/Client/APPFST/CommonStateForDisco.html
|
||||||
|
*/
|
||||||
|
public static final String APP_COMMON_GAME_DISCO_ACTION = "app_common_game_disco_action";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 元宇宙砂砂舞相关设置 模型
|
||||||
|
*/
|
||||||
|
public static class AppCommonGameDiscoAction implements Serializable {
|
||||||
|
public int actionId; // 必传的参数,用于指定类型的序号,不同序号用于区分游戏内的不同功能,不传则会判断为无效指令,具体序号代表的功能见下表
|
||||||
|
public Integer cooldown; // 持续时间,单位秒,部分功能有持续时间就需要传对应的数值,不传或传错则会按各自功能的默认值处理(见下表)
|
||||||
|
public Boolean isTop; // 是否置顶,针对部分功能可排队置顶(false:不置顶;true:置顶;默认为false)
|
||||||
|
public String field1; // 额外参数1,针对部分功能有具体的意义
|
||||||
|
public String field2; // 额外参数2,针对部分功能有具体的意义
|
||||||
|
}
|
||||||
|
// endregion 元宇宙砂砂舞
|
||||||
|
|
||||||
|
// region 定制火箭
|
||||||
|
/**
|
||||||
|
* 1. 礼物配置文件回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_CONFIG = "app_custom_rocket_config";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 礼物配置文件回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketConfig implements Serializable {
|
||||||
|
public int maxSeat; // 最大机位
|
||||||
|
public double firePrice; // 发射的静态价格
|
||||||
|
public int isDynamicPrice; // 发射价格是否动态开关 0:静态 1动态
|
||||||
|
public String gameIntroduce; // 玩法介绍
|
||||||
|
public String monetaryUnit; // 货币的单位
|
||||||
|
public long serverTime; // 服务器时间戳,单位秒
|
||||||
|
public List<String> filterModel; // 过滤不显示的模块(默认是为空)
|
||||||
|
public List<String> filterLayer; // 过滤不显示的页面(默认是为空)
|
||||||
|
public List<ComponentModel> componentList; // 组件列表 1套装,2主仓,3尾翼,4头像,5签名,6颜色
|
||||||
|
public List<HeadModel> headList; // 组件列表
|
||||||
|
public List<ExtraModel> extraList; // 专属配置
|
||||||
|
|
||||||
|
public static class ComponentModel {
|
||||||
|
public String componentId; // 组件的ID
|
||||||
|
public int type; // 1套装,2主仓,3尾翼
|
||||||
|
public String name; // 显示名称(商城+装配间+购买记录+...)
|
||||||
|
public double price; // 价格
|
||||||
|
public int isForever; // 永久:0非永久 1永久
|
||||||
|
public long validTime; // 有效期:单位是秒
|
||||||
|
public String imageId; // 图片ID
|
||||||
|
public int isLock; // 锁:0不锁 1锁
|
||||||
|
public int isShow; // 展示:0不展示 1展示
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class HeadModel {
|
||||||
|
public String componentId; // 组件的ID
|
||||||
|
public int type; // 4头像(商城+装配间+购买记录+...)
|
||||||
|
public String name; // 显示名称
|
||||||
|
public double price; // 价格 暂时不考虑小数
|
||||||
|
public int isForever; // 永久:0非永久 1永久
|
||||||
|
public long validTime; // 有效期:单位是秒
|
||||||
|
public String userId; // 用户的userId
|
||||||
|
public String nickname; // 昵称
|
||||||
|
public int sex; // 性别 0:男 1:女
|
||||||
|
public String url; // 头像URL
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ExtraModel {
|
||||||
|
public String componentId; // 组件的ID
|
||||||
|
public int type; // 5签名,6颜色
|
||||||
|
public String name; // 显示名称(商城+装配间+购买记录+...)
|
||||||
|
public double price; // 价格
|
||||||
|
public int isForever; // 永久:0非永久 1永久
|
||||||
|
public long validTime; // 有效期:单位是秒
|
||||||
|
public String desc; // 描述
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 拥有模型列表回调(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_MODEL_LIST = "app_custom_rocket_model_list";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 拥有模型列表回调(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketModelList implements Serializable {
|
||||||
|
public String defaultModelId; // 默认模型
|
||||||
|
public int isScreenshot; // 截图:0不截图 1截图(app上传失败或者过期时,被动截图)
|
||||||
|
public List<Model> list;
|
||||||
|
|
||||||
|
public static class Model {
|
||||||
|
public String modelId; // 模型Id
|
||||||
|
public int isAvatar; // 可以换装:0不可以 1可以
|
||||||
|
public String serviceFlag; // 服务标识
|
||||||
|
public List<ComponentModel> componentList; // 列表
|
||||||
|
|
||||||
|
public static class ComponentModel {
|
||||||
|
public String itemId; // 唯一标识
|
||||||
|
public int type; // 类型
|
||||||
|
public String value; // 值
|
||||||
|
public int isForever; // 永久:0非永久 1永久
|
||||||
|
public long validTime; // 有效期时间戳:单位是秒
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 拥有组件列表回调(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_COMPONENT_LIST = "app_custom_rocket_component_list";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 拥有组件列表回调(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketComponentList implements Serializable {
|
||||||
|
public List<ComponentModel> defaultList; // 默认组件列表
|
||||||
|
public List<ComponentModel> list; // 组件列表
|
||||||
|
|
||||||
|
public static class ComponentModel {
|
||||||
|
public String itemId; // 唯一标识
|
||||||
|
public int type; // 类型
|
||||||
|
public String value; // 值
|
||||||
|
public int isForever; // 永久:0非永久 1永久
|
||||||
|
public long validTime; // 有效期时间戳:单位是秒
|
||||||
|
public long date; // 购买时间:1970年1月1日开始。时间戳:单位是秒
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 获取用户信息回调(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_USER_INFO = "app_custom_rocket_user_info";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. 获取用户信息回调(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketUserInfo implements Serializable {
|
||||||
|
public int resultCode; // 0: 请求成功,1:请求失败
|
||||||
|
public String error; // 错误描述
|
||||||
|
public List<CustomRocketUserInfoModel> userList; // 用户信息列表
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 订单记录列表回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_ORDER_RECORD_LIST = "app_custom_rocket_order_record_list";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. 订单记录列表回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketOrderRecordList implements Serializable {
|
||||||
|
public int pageIndex; // 第几页
|
||||||
|
public int pageCount; // 总页数
|
||||||
|
public List<ComponentModel> list; // 列表
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定制火箭,订单组件 模型
|
||||||
|
*/
|
||||||
|
public static class ComponentModel {
|
||||||
|
public int type; // 类型
|
||||||
|
public String value; // 值
|
||||||
|
public int isForever; // 永久:0非永久 1永久
|
||||||
|
public long validTime; // 有效期时间戳:单位是秒
|
||||||
|
public long date; // 有效期时间戳:单位是秒
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. 展馆内列表回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_ROOM_RECORD_LIST = "app_custom_rocket_room_record_list";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. 展馆内列表回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketRoomRecordList implements Serializable {
|
||||||
|
public int pageIndex; // 第几页
|
||||||
|
public int pageCount; // 总页数
|
||||||
|
public List<RoomRecordModel> list; // 列表
|
||||||
|
|
||||||
|
public static class RoomRecordModel {
|
||||||
|
public CustomRocketUserInfoModel fromUser; // 送礼人
|
||||||
|
public int number; // 火箭数量
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7. 展馆内玩家送出记录回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_USER_RECORD_LIST = "app_custom_rocket_user_record_list";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 7. 展馆内玩家送出记录回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketUserRecordList implements Serializable {
|
||||||
|
public int pageIndex; // 第几页
|
||||||
|
public int pageCount; // 总页数
|
||||||
|
public CustomRocketUserInfoModel fromUser; // 送礼人
|
||||||
|
public List<UserRecordModel> list; // 列表
|
||||||
|
|
||||||
|
public static class UserRecordModel {
|
||||||
|
public long date; // 订单时间戳: 单位是秒
|
||||||
|
public int number; // 个数
|
||||||
|
public CustomRocketUserInfoModel toUser; // 收礼人
|
||||||
|
public List<ComponentModel> componentList; // 列表
|
||||||
|
|
||||||
|
public static class ComponentModel {
|
||||||
|
public int type; // 类型
|
||||||
|
public String value; // 值
|
||||||
|
public int isForever; // 永久:0非永久 1永久
|
||||||
|
public long validTime; // 有效期时间戳:单位是秒
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8. 设置默认模型(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_SET_DEFAULT_MODEL = "app_custom_rocket_set_default_model";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 8. 设置默认模型(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketSetDefaultModel implements Serializable {
|
||||||
|
public int resultCode; // 0: 请求成功,1:请求失败
|
||||||
|
public String error; // 错误描述
|
||||||
|
public Data data; // 数据
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
public String modelId; // 默认模型
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9. 动态计算一键发送价格回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_DYNAMIC_FIRE_PRICE = "app_custom_rocket_dynamic_fire_price";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 9. 动态计算一键发送价格回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketDynamicFirePrice implements Serializable {
|
||||||
|
public int resultCode; // 0: 请求成功,1:请求失败
|
||||||
|
public String error; // 错误描述
|
||||||
|
public Data data; // 数据
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
public double price; // 发送的价格
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10. 一键发送回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_FIRE_MODEL = "app_custom_rocket_fire_model";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 10. 一键发送回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketFireModel implements Serializable {
|
||||||
|
public int resultCode; // 0: 请求成功,1:请求失败
|
||||||
|
public String error; // 错误描述
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11. 新组装模型 回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_CREATE_MODEL = "app_custom_rocket_create_model";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 11. 新组装模型 回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketCreateModel implements Serializable {
|
||||||
|
public int resultCode; // 0: 请求成功,1:请求失败
|
||||||
|
public String error; // 错误描述
|
||||||
|
public Data data;
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
public String modelId; // 模型Id
|
||||||
|
public int isAvatar; // 可以换装:0不可以 1可以
|
||||||
|
public String serviceFlag; // 服务标识
|
||||||
|
public List<ComponentModel> componentList;
|
||||||
|
|
||||||
|
public static class ComponentModel {
|
||||||
|
public String itemId; // 模型Id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12. 更换组件 回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_REPLACE_COMPONENT = "app_custom_rocket_replace_component";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 12. 更换组件 回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketReplaceComponent implements Serializable {
|
||||||
|
public int resultCode; // 0: 请求成功,1:请求失败
|
||||||
|
public String error; // 错误描述
|
||||||
|
public Data data;
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
public String modelId; // 模型Id
|
||||||
|
public List<ComponentModel> componentList;
|
||||||
|
|
||||||
|
public static class ComponentModel {
|
||||||
|
public String itemId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13. 购买组件 回调
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_BUY_COMPONENT = "app_custom_rocket_buy_component";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 13. 购买组件 回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketBuyComponent implements Serializable {
|
||||||
|
public int resultCode; // 0: 请求成功,1:请求失败
|
||||||
|
public String error; // 错误描述
|
||||||
|
public Data data;
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
public List<ComponentModel> componentList;
|
||||||
|
|
||||||
|
public static class ComponentModel {
|
||||||
|
public String itemId; // 唯一标识
|
||||||
|
public int type; // 类型
|
||||||
|
public String value; // 值
|
||||||
|
public int isForever; // 永久:0非永久 1永久
|
||||||
|
public long validTime; // 有效期时间戳:单位是秒
|
||||||
|
public long date; // 有效期时间戳:单位是秒
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14. app播放火箭发射动效(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_PLAY_MODEL_LIST = "app_custom_rocket_play_model_list";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 14. app播放火箭发射动效(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketPlayModelList implements Serializable {
|
||||||
|
public String orderId; // 订单号
|
||||||
|
public List<ComponentModel> componentList; // 组件列表
|
||||||
|
|
||||||
|
public static class ComponentModel {
|
||||||
|
public int type; // 类型
|
||||||
|
public String value; // 值
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15. app推送主播信息(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_NEW_USER_INFO = "app_custom_rocket_new_user_info";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 15. app推送主播信息(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketNewUserInfo implements Serializable {
|
||||||
|
public List<CustomRocketUserInfoModel> userList; // 用户信息列表
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16. 验证签名合规(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_VERIFY_SIGN = "app_custom_rocket_verify_sign";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16. 验证签名合规(火箭) 回调 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketVerifySign implements Serializable {
|
||||||
|
public int resultCode; // 0: 请求成功,1:请求失败
|
||||||
|
public String error; // 错误描述
|
||||||
|
public Data data;
|
||||||
|
|
||||||
|
public static class Data {
|
||||||
|
public String sign; // 验证的签名
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17. app主动调起火箭主界面(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_SHOW_GAME_SCENE = "app_custom_rocket_show_game_scene";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 17. app主动调起火箭主界面(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketShowGameScene implements Serializable {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18. app主动隐藏火箭主界面(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_HIDE_GAME_SCENE = "app_custom_rocket_hide_game_scene";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 18. app主动隐藏火箭主界面(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketHideGameScene implements Serializable {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 19. app推送解锁组件(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_UNLOCK_COMPONENT = "app_custom_rocket_unlock_component";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 19. app推送解锁组件(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketUnlockComponent implements Serializable {
|
||||||
|
public int type; // 组件类型
|
||||||
|
public String componentId; // 组件ID
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 20. app推送火箭效果飞行点击(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_FLY_CLICK = "app_custom_rocket_fly_click";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 20. app推送火箭效果飞行点击(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketFlyClick implements Serializable {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 21. app推送关闭火箭播放效果(火箭)
|
||||||
|
*/
|
||||||
|
public static final String APP_CUSTOM_ROCKET_CLOSE_PLAY_EFFECT = "app_custom_rocket_close_play_effect";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 21. app推送关闭火箭播放效果(火箭) 模型
|
||||||
|
*/
|
||||||
|
public static class AppCustomRocketClosePlayEffect implements Serializable {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定制火箭,用户信息 模型
|
||||||
|
*/
|
||||||
|
public static class CustomRocketUserInfoModel {
|
||||||
|
public String userId; // 用户的userId
|
||||||
|
public String nickname; // 昵称
|
||||||
|
public int sex; // 性别 0:男 1:女
|
||||||
|
public String url; // 头像URL
|
||||||
|
}
|
||||||
|
// endregion 定制火箭
|
||||||
|
|
||||||
|
// region 棒球
|
||||||
|
/**
|
||||||
|
* 1. 下发游戏客户端查询排行榜数据(棒球)
|
||||||
|
*/
|
||||||
|
public static final String APP_BASEBALL_RANKING = "app_baseball_ranking";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1. 下发游戏客户端查询排行榜数据(棒球) 模型
|
||||||
|
*/
|
||||||
|
public static class AppBaseballRanking implements Serializable {
|
||||||
|
public List<AppBaseballPlayerInfo> data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 下发游戏客户端查询我的排名数据(棒球)
|
||||||
|
*/
|
||||||
|
public static final String APP_BASEBALL_MY_RANKING = "app_baseball_my_ranking";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 2. 下发游戏客户端查询我的排名数据(棒球) 模型
|
||||||
|
*/
|
||||||
|
public static class AppBaseballMyRanking implements Serializable {
|
||||||
|
public AppBaseballPlayerInfo data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 下发游戏客户端查询排在自己前后的玩家数据(棒球)
|
||||||
|
*/
|
||||||
|
public static final String APP_BASEBALL_RANGE_INFO = "app_baseball_range_info";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 3. 下发游戏客户端查询排在自己前后的玩家数据(棒球) 模型
|
||||||
|
*/
|
||||||
|
public static class AppBaseballRangeInfo implements Serializable {
|
||||||
|
public AppBaseballPlayerInfo before; // 前一名
|
||||||
|
public AppBaseballPlayerInfo after; // 后一名
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. app主动调起主界面(棒球)
|
||||||
|
*/
|
||||||
|
public static final String APP_BASEBALL_SHOW_GAME_SCENE = "app_baseball_show_game_scene";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 4. app主动调起主界面(棒球) 模型
|
||||||
|
*/
|
||||||
|
public static class AppBaseballShowGameScene implements Serializable {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. app主动隐藏主界面(棒球)
|
||||||
|
*/
|
||||||
|
public static final String APP_BASEBALL_HIDE_GAME_SCENE = "app_baseball_hide_game_scene";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 5. app主动隐藏主界面(棒球) 模型
|
||||||
|
*/
|
||||||
|
public static class AppBaseballHideGameScene implements Serializable {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. app推送需要的文本数据(棒球)
|
||||||
|
*/
|
||||||
|
public static final String APP_BASEBALL_TEXT_CONFIG = "app_baseball_text_config";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 6. app推送需要的文本数据(棒球) 模型
|
||||||
|
*/
|
||||||
|
public static class AppBaseballTextConfig implements Serializable {
|
||||||
|
public String mode1;
|
||||||
|
public String mode2;
|
||||||
|
public String mode3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AppBaseballPlayerInfo implements Serializable {
|
||||||
|
public String playerId; // 玩家Id
|
||||||
|
public String name; // 玩家昵称
|
||||||
|
public String avatar; // 头像
|
||||||
|
public long distance; // 距离
|
||||||
|
public int rank; // 排名
|
||||||
|
}
|
||||||
|
// endregion 棒球
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.utils;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.state.SudMGPMGState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游戏通用状态工具类
|
||||||
|
*/
|
||||||
|
public class GameCommonStateUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析公屏消息
|
||||||
|
*
|
||||||
|
* @param publicMessage
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String parseMGCommonPublicMessage(SudMGPMGState.MGCommonPublicMessage publicMessage, String languageCode) {
|
||||||
|
if (publicMessage == null || publicMessage.msg == null || publicMessage.msg.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (SudMGPMGState.MGCommonPublicMessage.MGCommonPublicMessageMsg msgModel : publicMessage.msg) {
|
||||||
|
switch (msgModel.phrase) {
|
||||||
|
case 1:
|
||||||
|
String text = parseI18nText(languageCode, msgModel.text);
|
||||||
|
if (text != null) {
|
||||||
|
sb.append(text);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (msgModel.user != null && msgModel.user.name != null) {
|
||||||
|
sb.append(msgModel.user.name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前的语言码,选择对应语言的文字
|
||||||
|
*
|
||||||
|
* @param languageCode 语言代码
|
||||||
|
* @param model 游戏发过来的文本对象
|
||||||
|
* @return 返回选择的字符串
|
||||||
|
*/
|
||||||
|
public static String parseI18nText(String languageCode, SudMGPMGState.MGCommonPublicMessage.MGCommonPublicMessageMsgText model) {
|
||||||
|
if (model == null) return null;
|
||||||
|
if (languageCode == null) return model.defaultStr;
|
||||||
|
|
||||||
|
// 精准匹配
|
||||||
|
String text = i18nPrecise(languageCode, model);
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(text)) {
|
||||||
|
// 如果未匹配到,则尝试模糊匹配
|
||||||
|
if (isMatchLanguage(languageCode, "zh")) {
|
||||||
|
return model.zh_CN;
|
||||||
|
}
|
||||||
|
return model.en_US;
|
||||||
|
} else {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 精准匹配 */
|
||||||
|
private static String i18nPrecise(String languageCode, SudMGPMGState.MGCommonPublicMessage.MGCommonPublicMessageMsgText model) {
|
||||||
|
switch (languageCode) {
|
||||||
|
case "zh-CN":
|
||||||
|
return model.zh_CN;
|
||||||
|
case "zh-HK":
|
||||||
|
return model.zh_HK;
|
||||||
|
case "zh-MO":
|
||||||
|
return model.zh_MO;
|
||||||
|
case "zh-SG":
|
||||||
|
return model.zh_SG;
|
||||||
|
case "zh-TW":
|
||||||
|
return model.zh_TW;
|
||||||
|
case "en-US":
|
||||||
|
return model.en_US;
|
||||||
|
case "en-GB":
|
||||||
|
return model.en_GB;
|
||||||
|
case "ms-BN":
|
||||||
|
return model.ms_BN;
|
||||||
|
case "ms-MY":
|
||||||
|
return model.ms_MY;
|
||||||
|
case "vi-VN":
|
||||||
|
return model.vi_VN;
|
||||||
|
case "id-ID":
|
||||||
|
return model.id_ID;
|
||||||
|
case "es-ES":
|
||||||
|
return model.es_ES;
|
||||||
|
case "ja-JP":
|
||||||
|
return model.ja_JP;
|
||||||
|
case "ko-KR":
|
||||||
|
return model.ko_KR;
|
||||||
|
case "th-TH":
|
||||||
|
return model.th_TH;
|
||||||
|
case "ar-SA":
|
||||||
|
return model.ar_SA;
|
||||||
|
case "ur-PK":
|
||||||
|
return model.ur_PK;
|
||||||
|
case "tr-TR":
|
||||||
|
return model.tr_TR;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否是该语言
|
||||||
|
*/
|
||||||
|
private static boolean isMatchLanguage(String languageCode, String matchLanguageCode) {
|
||||||
|
if (languageCode != null && matchLanguageCode != null) {
|
||||||
|
return matchLanguageCode.equals(languageCode) || languageCode.startsWith(matchLanguageCode + "-");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © Sud.Tech
|
||||||
|
* https://sud.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
package tech.sud.mgp.SudMGPWrapper.utils;
|
||||||
|
|
||||||
|
import tech.sud.mgp.core.ISudFSMStateHandle;
|
||||||
|
import tech.sud.mgp.SudMGPWrapper.state.MGStateResponse;
|
||||||
|
|
||||||
|
public class ISudFSMStateHandleUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调游戏,成功
|
||||||
|
*
|
||||||
|
* @param handle
|
||||||
|
*/
|
||||||
|
public static void handleSuccess(ISudFSMStateHandle handle) {
|
||||||
|
MGStateResponse response = new MGStateResponse();
|
||||||
|
response.ret_code = MGStateResponse.SUCCESS;
|
||||||
|
response.ret_msg = "success";
|
||||||
|
handle.success(SudJsonUtils.toJson(response));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package tech.sud.mgp.SudMGPWrapper.utils;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json解析工具
|
||||||
|
*/
|
||||||
|
public class SudJsonUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析json
|
||||||
|
*
|
||||||
|
* @return 如果解析出错,则返回空对象
|
||||||
|
*/
|
||||||
|
public static <T> T fromJson(final String json, final Class<T> type) {
|
||||||
|
try {
|
||||||
|
return getGson().fromJson(json, type);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象解析成json
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String toJson(final Object object) {
|
||||||
|
return getGson().toJson(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Gson getGson() {
|
||||||
|
return InnerClass.gson;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class InnerClass {
|
||||||
|
public static Gson gson = new GsonBuilder().serializeNulls().disableHtmlEscaping().create();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
2
app/.gitignore
vendored
Normal file
2
app/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/build
|
||||||
|
/release
|
||||||
138
app/build.gradle
Normal file
138
app/build.gradle
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'com.mob.sdk'
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
apply plugin: 'kotlin-kapt'
|
||||||
|
MobSDK {
|
||||||
|
appKey "3635416c7fadb"
|
||||||
|
appSecret "c6e8c85e5b8d90220a063cdfda7d0096"
|
||||||
|
ShareSDK {
|
||||||
|
loopShare true
|
||||||
|
devInfo {
|
||||||
|
Wechat {
|
||||||
|
appId "wx3858bffeddfb91b8"
|
||||||
|
appSecret "0b59b165268b63ba6446d1dc55a21f38"
|
||||||
|
}
|
||||||
|
QQ {
|
||||||
|
appId "102046191"
|
||||||
|
appKey "dT8ZbR4TfdOuBF4e"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
|
||||||
|
compileSdkVersion 33
|
||||||
|
buildToolsVersion "30.0.2"
|
||||||
|
aaptOptions {
|
||||||
|
cruncherEnabled = false
|
||||||
|
useNewCruncher = false
|
||||||
|
}
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.yuyin.mier"
|
||||||
|
minSdkVersion 22
|
||||||
|
targetSdkVersion 33
|
||||||
|
|
||||||
|
versionCode 42
|
||||||
|
versionName "1.3.3"
|
||||||
|
dataBinding {
|
||||||
|
//noinspection DataBindingWithoutKapt
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
javaCompileOptions {
|
||||||
|
annotationProcessorOptions {
|
||||||
|
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
multiDexEnabled true
|
||||||
|
ndk {
|
||||||
|
abiFilters /*'armeabi-v7a',*/ 'arm64-v8a', 'x86' , 'x86_64'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
signingConfigs {
|
||||||
|
debug {
|
||||||
|
storeFile file("../mier.jks")
|
||||||
|
storePassword "123456"
|
||||||
|
keyAlias "key0"
|
||||||
|
keyPassword "123456"
|
||||||
|
}
|
||||||
|
|
||||||
|
release {
|
||||||
|
storeFile file("../mier.jks")
|
||||||
|
storePassword "123456"
|
||||||
|
keyAlias "key0"
|
||||||
|
keyPassword "123456"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
jniLibs.srcDirs = ['libs']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories { flatDir { dirs 'libs' } }
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
// minifyEnabled true
|
||||||
|
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = '11'
|
||||||
|
}
|
||||||
|
// 打包 start
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.all {
|
||||||
|
def fileName
|
||||||
|
def date = new Date()
|
||||||
|
def formattedDate = date.format('yyyyMMdd-HHmmss')
|
||||||
|
if (variant.buildType.name == 'release') {
|
||||||
|
fileName = "余音派对-v${variant.mergedFlavor.versionName}_release_${formattedDate}.apk"
|
||||||
|
} else if (variant.buildType.name == 'debug') {
|
||||||
|
fileName = "余音派对-v${variant.mergedFlavor.versionName}_debug_${formattedDate}.apk"
|
||||||
|
}
|
||||||
|
outputFileName = fileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 打包 end
|
||||||
|
dataBinding {
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
lint {
|
||||||
|
baseline = file("lint-baseline.xml")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加AAR元数据兼容性配置
|
||||||
|
dependenciesInfo {
|
||||||
|
includeInApk = false
|
||||||
|
includeInBundle = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
|
|
||||||
|
implementation fileTree(dir: '../lib_base/libs', include: ['.jar', '.aar'] )
|
||||||
|
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
|
||||||
|
api 'com.alibaba:arouter-api:1.4.1'
|
||||||
|
kapt 'com.alibaba:arouter-compiler:1.2.2'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
implementation project(':lib_base')
|
||||||
|
implementation project(':module_live')
|
||||||
|
implementation project(':module_community')
|
||||||
|
implementation project(path:':LocalAar:alipaySdk')
|
||||||
|
implementation project(path:':LocalAar:paytypelibrary')
|
||||||
|
|
||||||
|
}
|
||||||
642
app/lint-baseline.xml
Normal file
642
app/lint-baseline.xml
Normal file
@@ -0,0 +1,642 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<issues format="6" by="lint 7.4.2" type="baseline" client="gradle" dependencies="false" name="AGP (7.4.2)" variant="fatal" version="7.4.2">
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`MyRoomActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" android:name="com.yuyin.mier.module_my.room.MyRoomActivity""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="60"
|
||||||
|
column="27"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`SignedArtistActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" android:name="com.yuyin.mier.module_my.auction.SignedArtistActivity""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="66"
|
||||||
|
column="27"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`ChangeInviterActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" android:name="com.yuyin.mier.module_my.vip.ChangeInviterActivity""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="69"
|
||||||
|
column="27"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`VipActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" android:name="com.yuyin.mier.module_my.vip.VipActivity""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="72"
|
||||||
|
column="27"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`BindPhoneActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" android:name="com.yuyin.mier.module_my.set.BindPhoneActivity""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="83"
|
||||||
|
column="27"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`LunchActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" android:name="com.yuyin.mier.LunchActivity""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="86"
|
||||||
|
column="27"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`UserGiftWallActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.homepage.UserGiftWallActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="95"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`MainActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" android:name="com.yuyin.mier.module_home.MainActivity""
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="98"
|
||||||
|
column="27"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`MoneyMainActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.MoneyMainActivity" /> <!-- <activity android:name="com.yuyin.gouniyuyin_20220109.module_my.log.duihuan.DuiHuanLogActivity" /> -->"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="100"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`ZhuanZengLogActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.log.zhuanzeng.ZhuanZengLogActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="102"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`BindAliActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.bindali.BindAliActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="103"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`TiXianActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.tixian.TiXianActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="104"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`GiftLogSubActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.giftlog.sub.GiftLogSubActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="105"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`GiftLogActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.giftlog.GiftLogActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="106"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`ModifyDataActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.edituser.ModifyDataActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="107"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`FeedBackActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.feedback.FeedBackActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="108"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`PayPsActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.payps.PayPsActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="109"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`SetActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.set.SetActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="110"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`ShouCangRoomActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.shoucang.ShouCangRoomActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="111"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`UserHomePageActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.homepage.UserHomePageActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="113"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`DengJiActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.dengji.DengJiActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="114"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`SearchResultActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.search.SearchResultActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="115"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`SearchHisActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.search.SearchHisActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="116"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`RealNameActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.real_name.RealNameActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="117"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`BlackListActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_home.tab.xiaoxi.black.BlackListActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="118"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`MyZhuangBanActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.zhuangban.MyZhuangBanActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="123"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`TeQuanActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.tequan.TeQuanActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="124"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`DuiHuanActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.zuan.DuiHuanActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="125"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`BindAliActivity2` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.bindali2.BindAliActivity2" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="126"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`PassActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.pass.PassActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="127"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`AboutActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.set.AboutActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="128"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`YaoQingActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.YaoQingActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="129"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`MyZhuangBanShangChengActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.zhuangban.MyZhuangBanShangChengActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="133"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`ChongZhiActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.chongzhi.ChongZhiActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="161"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`MessageOfficeActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_home.tab.xiaoxi.xitong.MessageOfficeActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="162"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`GHMainActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.gh.main.GHMainActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="163"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`GHHomeActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.gh.home.GHHomeActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="164"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`GHSQActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.gh.shenqing.GHSQActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="165"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`BindZLActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_login.ui.bindZL.BindZLActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="166"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`JiFenLogActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.log.jifen.JiFenLogActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="167"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`QianLogActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.log.qian.QianLogActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="168"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`FriendListActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.zhuangban.FriendListActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="169"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`MoneyDetailActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.MoneyDetailActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="170"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`PeerageActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.peerage.PeerageActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="171"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`TiXianLogActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.log.tixian.TiXianLogActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="172"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`DuiHuanLogActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.log.duihuan.DuiHuanLogActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="173"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`CPActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.cp.CPActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="174"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`LogoutActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.set.LogoutActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="175"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`TeenModeActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_home.tab.home.teen.TeenModeActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="176"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`TeenModeChangeActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_home.tab.home.teen.TeenModeChangeActivity" />"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="177"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`MoneyContainerActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.zuan.MoneyContainerActivity"/>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="178"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`GongHuiDeatileActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.gh.deatile.GongHuiDeatileActivity"/>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="179"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`GHBuTieActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.gh.deatile.GHBuTieActivity"/>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="180"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`CPRoomActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_home.cproom.CPRoomActivity"/>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="181"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`WxKeFuAt` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.set.WxKeFuAt"/>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="182"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`TiXianNewActivity` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.tixian.TiXianNewActivity"/>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="183"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="Instantiatable"
|
||||||
|
message="`TxDeatileAt` must extend android.app.Activity"
|
||||||
|
errorLine1=" <activity android:name="com.yuyin.mier.module_my.money.tixian.TxDeatileAt"/>"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="src/main/AndroidManifest.xml"
|
||||||
|
line="184"
|
||||||
|
column="33"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
<issue
|
||||||
|
id="ExpiredTargetSdkVersion"
|
||||||
|
message="Google Play requires that apps target API level 31 or higher.
"
|
||||||
|
errorLine1=" targetSdkVersion 30"
|
||||||
|
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
|
||||||
|
<location
|
||||||
|
file="build.gradle"
|
||||||
|
line="36"
|
||||||
|
column="9"/>
|
||||||
|
</issue>
|
||||||
|
|
||||||
|
</issues>
|
||||||
22
app/proguard-rules.pro
vendored
Normal file
22
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# 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
|
||||||
|
-keep class io.agora.**{*;}
|
||||||
188
app/src/main/AndroidManifest.xml
Normal file
188
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="com.yuyin.mier">
|
||||||
|
|
||||||
|
<queries>
|
||||||
|
<package android:name="com.tencent.mm" />
|
||||||
|
<package android:name="com.eg.android.AlipayGphone" /> <!-- 支付宝 -->
|
||||||
|
</queries> <!-- 这个权限用于进行网络定位 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 这个权限用于访问GPS定位 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 获取运营商信息,用于支持提供运营商信息相关的接口 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 这个权限用于获取wifi的获取权限,wifi信息会用来进行网络定位 -->
|
||||||
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 写入扩展存储,向扩展卡写入数据,用于写入离线定位数据 -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 访问网络,网络定位需要上网 -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- The Agora SDK requires Bluetooth permissions in case users are using Bluetooth devices. -->
|
||||||
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||||
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <!-- 控制呼吸灯,振动器等,用于新消息提醒 -->
|
||||||
|
<uses-permission android:name="android.permission.FLASHLIGHT" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" /> <!-- SDK 权限申明, 第三方 APP 接入时,请将 com.netease.nim.demo 替换为自己的包名 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 获取网络状态 -->
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" /> <!-- 网络通信 -->
|
||||||
|
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- 获取设备信息 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 获取MAC地址 -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 读写sdcard,storage等等 -->
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <!-- 允许程序录制音频 -->
|
||||||
|
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name="com.yuyin.lib_base.App"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@mipmap/ic_launcher_app"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:largeHeap="true"
|
||||||
|
android:requestLegacyExternalStorage="true"
|
||||||
|
android:resizeableActivity="false"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_app"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/AppTheme_MAIN"
|
||||||
|
android:usesCleartextTraffic="true"
|
||||||
|
tools:replace="android:icon,android:theme,android:allowBackup"
|
||||||
|
tools:targetApi="n">
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.module_my.room.MyRoomActivity"
|
||||||
|
android:exported="true" />
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.module_login.ui.ForgetActivity"
|
||||||
|
android:exported="true" />
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.module_my.auction.SignedArtistActivity"
|
||||||
|
android:exported="true" />
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.module_my.vip.ChangeInviterActivity"
|
||||||
|
android:exported="true" />
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.module_my.vip.VipActivity"
|
||||||
|
android:exported="true" />
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="design_width_in_dp"
|
||||||
|
android:value="375" />
|
||||||
|
<meta-data
|
||||||
|
android:name="design_height_in_dp"
|
||||||
|
android:value="812" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.module_my.set.BindPhoneActivity"
|
||||||
|
android:exported="true" />
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.LunchActivity"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:exported="true"
|
||||||
|
android:theme="@style/main_SplashThemeImage">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.homepage.UserGiftWallActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_login.ui.ModuleLoginMainActivity" />
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.module_home.MainActivity"
|
||||||
|
android:configChanges="fontScale" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.MoneyMainActivity" /> <!-- <activity android:name="com.yuyin.gouniyuyin_20220109.module_my.log.duihuan.DuiHuanLogActivity" /> -->
|
||||||
|
<!-- <activity android:name="com.yuyin.gouniyuyin_20220109.module_my.log.tixian.TiXianLogActivity" /> -->
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.log.zhuanzeng.ZhuanZengLogActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.bindali.BindAliActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.tixian.TiXianActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.giftlog.sub.GiftLogSubActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.giftlog.GiftLogActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.edituser.ModifyDataActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.feedback.FeedBackActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.payps.PayPsActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.set.SetActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.shoucang.ShouCangRoomActivity" />
|
||||||
|
<!-- <activity android:name=".module_my.followfans.FollowFansActivity" />-->
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.homepage.UserHomePageActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.dengji.DengJiActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.search.SearchResultActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.search.SearchHisActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.real_name.RealNameActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_home.tab.xiaoxi.black.BlackListActivity" />
|
||||||
|
<!-- <activity-->
|
||||||
|
<!-- android:name=".com.yuyin.lib_base.MessageActivity"-->
|
||||||
|
<!-- android:screenOrientation="portrait"-->
|
||||||
|
<!-- android:windowSoftInputMode="stateHidden|adjustResize" />-->
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.zhuangban.MyZhuangBanActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.tequan.TeQuanActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.zuan.DuiHuanActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.bindali2.BindAliActivity2" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.pass.PassActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.set.AboutActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.YaoQingActivity" />
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.module_my.zhuangban.MyZhuangBanActivity"
|
||||||
|
tools:ignore="DuplicateActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.zhuangban.MyZhuangBanShangChengActivity" />
|
||||||
|
<activity
|
||||||
|
android:name="com.chuanglan.shanyan_sdk.view.CmccLoginActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="behind" />
|
||||||
|
|
||||||
|
<activity-alias
|
||||||
|
android:name="com.cmic.sso.sdk.activity.LoginAuthActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="behind"
|
||||||
|
android:targetActivity="com.chuanglan.shanyan_sdk.view.CmccLoginActivity" />
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.chuanglan.shanyan_sdk.view.ShanYanOneKeyActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="behind" />
|
||||||
|
<activity
|
||||||
|
android:name="com.chuanglan.shanyan_sdk.view.CTCCPrivacyProtocolActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="behind" />
|
||||||
|
<activity
|
||||||
|
android:name="com.yuyin.mier.wxapi.WXPayEntryActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleTop" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.chongzhi.ChongZhiActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_home.tab.xiaoxi.xitong.MessageOfficeActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.gh.main.GHMainActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.gh.home.GHHomeActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.gh.shenqing.GHSQActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_login.ui.bindZL.BindZLActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.log.jifen.JiFenLogActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.log.qian.QianLogActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.zhuangban.FriendListActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.MoneyDetailActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.peerage.PeerageActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.log.tixian.TiXianLogActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.log.duihuan.DuiHuanLogActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.cp.CPActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.set.LogoutActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_home.tab.home.teen.TeenModeActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_home.tab.home.teen.TeenModeChangeActivity" />
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.zuan.MoneyContainerActivity"/>
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.gh.deatile.GongHuiDeatileActivity"/>
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.gh.deatile.GHBuTieActivity"/>
|
||||||
|
<activity android:name="com.yuyin.mier.module_home.cproom.CPRoomActivity"/>
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.set.WxKeFuAt"/>
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.tixian.TiXianNewActivity"/>
|
||||||
|
<activity android:name="com.yuyin.mier.module_my.money.tixian.TxDeatileAt"/>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
115
app/src/main/java/com/yuyin/mier/LunchActivity.kt
Normal file
115
app/src/main/java/com/yuyin/mier/LunchActivity.kt
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
package com.yuyin.mier
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.kongzue.dialog.v3.MessageDialog
|
||||||
|
import com.tencent.qcloud.tuicore.util.SPUtils
|
||||||
|
import com.xuexiang.xupdate.XUpdate
|
||||||
|
import com.xuexiang.xupdate.entity.UpdateEntity
|
||||||
|
import com.yuyin.lib_base.App
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.base.BaseActivity
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.lib_base.base.UserManager
|
||||||
|
import com.yuyin.lib_base.model.ConfigBean
|
||||||
|
import kotlinx.android.synthetic.main.activity_launch.*
|
||||||
|
|
||||||
|
class LunchActivity : BaseActivity<BaseViewModel>() {
|
||||||
|
private var mContext: Context? = null
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
if (!isTaskRoot) {
|
||||||
|
finish()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置透明状态栏
|
||||||
|
*/
|
||||||
|
private fun setStatusBar() {
|
||||||
|
// val window: Window = window
|
||||||
|
// window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||||
|
// window.decorView.systemUiVisibility =
|
||||||
|
// View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||||
|
// window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||||
|
// window.statusBarColor = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.configBean.observe(this) {
|
||||||
|
SPUtils.getInstance().put("config",Gson().toJson(it))
|
||||||
|
if (it.version_is_force_update > 0) {
|
||||||
|
updateAPP(it)
|
||||||
|
return@observe
|
||||||
|
}
|
||||||
|
App.configBean = it
|
||||||
|
Handler().postDelayed({
|
||||||
|
if (UserManager.IS_LOGIN) {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MAIN).navigation()
|
||||||
|
finish()
|
||||||
|
} else {
|
||||||
|
ARouter.getInstance().build(AroutUtil.LOGIN_MAIN).navigation()
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
// requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||||
|
// this.window.setFlags(
|
||||||
|
// WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
|
// WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||||
|
// )
|
||||||
|
// setStatusBar()
|
||||||
|
return R.layout.activity_launch
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
mContext = this
|
||||||
|
// Glide.with(this).load(R.mipmap.splash).into(img)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
val code = getVersionCode()
|
||||||
|
viewModel.get_system_base_config("$code", "1")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun update(configBean: ConfigBean) {
|
||||||
|
MessageDialog.show(
|
||||||
|
this,
|
||||||
|
"提示",
|
||||||
|
configBean.version_note,
|
||||||
|
"去更新"
|
||||||
|
).setOnOkButtonClickListener { baseDialog, v ->
|
||||||
|
val uri: Uri = Uri.parse(configBean.version_down_url)
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||||
|
startActivity(intent)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun updateAPP(configBean: ConfigBean) {
|
||||||
|
val updateEntity = UpdateEntity()
|
||||||
|
updateEntity.downloadUrl = configBean.version_down_url
|
||||||
|
updateEntity.versionCode = 3
|
||||||
|
updateEntity.versionName = configBean.version_app
|
||||||
|
updateEntity.updateContent = configBean.version_note
|
||||||
|
updateEntity.isForce = configBean.version_is_force_update == 2
|
||||||
|
updateEntity.isHasUpdate = true
|
||||||
|
XUpdate.newBuild(this).supportBackgroundUpdate(false) //
|
||||||
|
.promptWidthRatio(0.8f).build().update(updateEntity)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
|
||||||
|
class BaseIndicatorAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_indicator) {
|
||||||
|
private var selectPosition: Int = 0
|
||||||
|
|
||||||
|
override fun convert(helper: BaseViewHolder, item: String?) {
|
||||||
|
helper.setText(R.id.tv_content,item)
|
||||||
|
val select = helper.layoutPosition == selectPosition
|
||||||
|
helper.getView<TextView>(R.id.tv_content).isSelected = select
|
||||||
|
helper.getView<ImageView>(R.id.v_view).isSelected = select
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setSelectPosition(index: Int) {
|
||||||
|
notifyItemChanged(selectPosition)
|
||||||
|
notifyItemChanged(index)
|
||||||
|
selectPosition = index
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
27
app/src/main/java/com/yuyin/mier/adapter/CPTxListAdapter.kt
Normal file
27
app/src/main/java/com/yuyin/mier/adapter/CPTxListAdapter.kt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.model.MyCpTxBean
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
|
||||||
|
class CPTxListAdapter :
|
||||||
|
BaseQuickAdapter<MyCpTxBean, BaseViewHolder>(R.layout.item_cp_room) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: MyCpTxBean) {
|
||||||
|
GlideUtil.loadImglogo(mContext, item.cp_tx_img, helper.getView(R.id.iv_cp_gift))
|
||||||
|
if(item.is_using=="1"){
|
||||||
|
helper.setVisible(R.id.iv_cp_use,true)
|
||||||
|
}else{
|
||||||
|
helper.setGone(R.id.iv_cp_use,false)
|
||||||
|
}
|
||||||
|
helper.setText(R.id.tv_cp_level, "LV."+item.level)
|
||||||
|
.setText(R.id.tv_name_cp, item.cp_tx_title)
|
||||||
|
// if(item.js_suo=="1"){
|
||||||
|
// helper.getView<RelativeLayout>(R.id.rl_cp).alpha=1.0f
|
||||||
|
// }else{
|
||||||
|
// helper.getView<RelativeLayout>(R.id.rl_cp).alpha=0.6f
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
28
app/src/main/java/com/yuyin/mier/adapter/CPTxkListAdapter.kt
Normal file
28
app/src/main/java/com/yuyin/mier/adapter/CPTxkListAdapter.kt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.model.MyCpTxBean
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
|
||||||
|
class CPTxkListAdapter :
|
||||||
|
BaseQuickAdapter<MyCpTxBean, BaseViewHolder>(R.layout.item_cp_room) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: MyCpTxBean) {
|
||||||
|
GlideUtil.loadImglogo(mContext, item.head_decorate_img, helper.getView(R.id.iv_cp_gift))
|
||||||
|
if(item.is_using=="1"){
|
||||||
|
helper.setVisible(R.id.iv_cp_use,true)
|
||||||
|
}else{
|
||||||
|
helper.setGone(R.id.iv_cp_use,false)
|
||||||
|
}
|
||||||
|
helper.setText(R.id.tv_cp_level, "LV."+item.level)
|
||||||
|
.setText(R.id.tv_name_cp, item.head_decorate_title)
|
||||||
|
|
||||||
|
if(item.js_suo=="1"){
|
||||||
|
helper.getView<View>(R.id.rl_cp).alpha=1.0f
|
||||||
|
}else{
|
||||||
|
helper.getView<View>(R.id.rl_cp).alpha=0.6f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
65
app/src/main/java/com/yuyin/mier/adapter/GHListAdapter.kt
Normal file
65
app/src/main/java/com/yuyin/mier/adapter/GHListAdapter.kt
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.makeramen.roundedimageview.RoundedImageView
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.GHListBean
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class GHListAdapter :
|
||||||
|
BaseQuickAdapter<GHListBean, BaseViewHolder>(R.layout.item_gonghui, ArrayList()) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: GHListBean) {
|
||||||
|
GlideUtil.loadImglogo(mContext, item.cover, helper.getView<ImageView>(R.id.img1))
|
||||||
|
helper.setText(R.id.tv_text, item.guild_name)
|
||||||
|
.setText(R.id.tv_hot, item.total_gift_total_price)
|
||||||
|
.setText(R.id.tv_personal,"人数"+ item.num.toString() )
|
||||||
|
helper.setText(R.id.tv_num, (helper.position + 1).toString())
|
||||||
|
|
||||||
|
var img1 = helper.getView<RoundedImageView>(R.id.img1)
|
||||||
|
|
||||||
|
if (helper.position < 3) {
|
||||||
|
helper.setGone(R.id.ll, true)
|
||||||
|
helper.setGone(R.id.tv_num, false)
|
||||||
|
helper.setVisible(R.id.view_line, false)
|
||||||
|
when (helper.position) {
|
||||||
|
0 -> {
|
||||||
|
// img1.setBorderColor(Color.parseColor("#FF8601"))
|
||||||
|
// helper.setTextColor(R.id.tv_num, Color.parseColor("#FF8601"))
|
||||||
|
// helper.setTextColor(R.id.tv_text, Color.parseColor("#FF8601"))
|
||||||
|
// helper.setTextColor(R.id.tv_personal, Color.parseColor("#FF8601"))
|
||||||
|
helper.setImageResource(R.id.iv, R.mipmap.gh1)
|
||||||
|
// helper.setBackgroundRes(R.id.root_view, R.mipmap.gonghui_listbg1)
|
||||||
|
}
|
||||||
|
|
||||||
|
1 -> {
|
||||||
|
// img1.setBorderColor(Color.parseColor("#609CFF"))
|
||||||
|
// helper.setTextColor(R.id.tv_num, Color.parseColor("#609CFF"))
|
||||||
|
// helper.setTextColor(R.id.tv_text, Color.parseColor("#609CFF"))
|
||||||
|
// helper.setTextColor(R.id.tv_personal, Color.parseColor("#609CFF"))
|
||||||
|
helper.setImageResource(R.id.iv, R.mipmap.gh2)
|
||||||
|
// helper.setBackgroundRes(R.id.root_view, R.mipmap.gonghui_listbg2)
|
||||||
|
}
|
||||||
|
|
||||||
|
2 -> {
|
||||||
|
// img1.setBorderColor(Color.parseColor("#F59364"))
|
||||||
|
// helper.setTextColor(R.id.tv_num, Color.parseColor("#F59364"))
|
||||||
|
// helper.setTextColor(R.id.tv_text, Color.parseColor("#F59364"))
|
||||||
|
// helper.setTextColor(R.id.tv_personal, Color.parseColor("#F59364"))
|
||||||
|
helper.setImageResource(R.id.iv, R.mipmap.gh3)
|
||||||
|
// helper.setBackgroundRes(R.id.root_view, R.mipmap.gonghui_listbg3)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// img1.setBorderColor(Color.parseColor("#00F59364"))
|
||||||
|
helper.setTextColor(R.id.tv_num, Color.parseColor("#333333"))
|
||||||
|
helper.setGone(R.id.ll, false)
|
||||||
|
helper.setGone(R.id.tv_num, true)
|
||||||
|
// helper.setVisible(R.id.view_line,true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.GHRoomListBean
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
|
class GHRoomListAdapter :
|
||||||
|
BaseQuickAdapter<GHRoomListBean, BaseViewHolder>(R.layout.item_gonghui_room, ArrayList()) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: GHRoomListBean) {
|
||||||
|
GlideUtil.loadImglogo(mContext, item.room_cover, helper.getView<ImageView>(R.id.cover))
|
||||||
|
helper.setText(R.id.tv_name, item.room_name).setText(R.id.tv_id, "ID:" + item.room_number)
|
||||||
|
.setText(R.id.tv_num, item.total_gift_total_price)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.GHUserListBean
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
|
class GHSQUserListAdapter :
|
||||||
|
BaseQuickAdapter<GHUserListBean, BaseViewHolder>(R.layout.item_gonghui_user, ArrayList()) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: GHUserListBean) {
|
||||||
|
GlideUtil.loadImglogo(mContext, item.head_pic, helper.getView<ImageView>(R.id.cover))
|
||||||
|
helper.setText(R.id.tv_name, item.nick_name).setText(R.id.tv_id, item.uid)
|
||||||
|
.setText(R.id.tv_hot_value,item.total_gift_total_price)
|
||||||
|
helper.addOnClickListener(R.id.cover)
|
||||||
|
helper.addOnClickListener(R.id.tvNO)
|
||||||
|
helper.addOnClickListener(R.id.tvYes)
|
||||||
|
helper.setGone(R.id.tvNO, true)
|
||||||
|
helper.setGone(R.id.tvYes, true)
|
||||||
|
helper.setGone(R.id.tv_remove, false)
|
||||||
|
helper.setGone(R.id.tv_hot_value, false)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.widget.ImageView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.GHUserListBean
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
|
class GHUserListAdapter :
|
||||||
|
BaseQuickAdapter<GHUserListBean, BaseViewHolder>(R.layout.item_gonghui_user, ArrayList()) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: GHUserListBean) {
|
||||||
|
var type = 0
|
||||||
|
GlideUtil.loadImglogo(mContext, item.head_pic, helper.getView<ImageView>(R.id.cover))
|
||||||
|
helper.setText(R.id.tv_name, item.nick_name).setText(R.id.tv_id, item.uid)
|
||||||
|
.setText(R.id.tv_hot_value, item.total_gift_total_price)
|
||||||
|
helper.addOnClickListener(R.id.cover)
|
||||||
|
helper.addOnClickListener(R.id.tvNO)
|
||||||
|
helper.addOnClickListener(R.id.tvYes)
|
||||||
|
helper.addOnClickListener(R.id.tv_remove)
|
||||||
|
|
||||||
|
helper.setGone(R.id.iv_hz, helper.position == 0)
|
||||||
|
|
||||||
|
if (Const.GH_REMOVE) {
|
||||||
|
helper.setGone(R.id.tv_remove, helper.position != 0)
|
||||||
|
} else {
|
||||||
|
helper.setGone(R.id.tv_remove, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.RoomListBean
|
||||||
|
|
||||||
|
class HomePagerHotAdapter :
|
||||||
|
BaseQuickAdapter<RoomListBean, BaseViewHolder>(R.layout.item_home_pager_hot) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: RoomListBean) {
|
||||||
|
|
||||||
|
GlideUtil.loadImglogo(mContext, item.room_cover, helper.getView(R.id.room_cover))
|
||||||
|
helper.setText(R.id.tv_value, item.hot_value)
|
||||||
|
.setText(R.id.tv_type, item.category_name)
|
||||||
|
.setText(R.id.tv_name, item.room_name)
|
||||||
|
.setText(R.id.tv_id, "ID " + item.room_number)
|
||||||
|
|
||||||
|
|
||||||
|
when (item.category_name) {
|
||||||
|
"男神" -> {
|
||||||
|
helper.setBackgroundRes(R.id.ll_type, R.mipmap.item_home_pager_hot_tag2)
|
||||||
|
}
|
||||||
|
"女神" -> {
|
||||||
|
helper.setBackgroundRes(R.id.ll_type, R.mipmap.item_home_pager_hot_tag1)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
helper.setBackgroundRes(R.id.ll_type, R.mipmap.item_home_pager_hot_tag3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (item.room_micro_list.isNotEmpty()) {
|
||||||
|
GlideUtil.loadImglogo(
|
||||||
|
mContext,
|
||||||
|
item.room_micro_list[0].head_pic,
|
||||||
|
helper.getView(R.id.civ1)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.room_micro_list.size > 1) {
|
||||||
|
GlideUtil.loadImglogo(
|
||||||
|
mContext,
|
||||||
|
item.room_micro_list[1].head_pic,
|
||||||
|
helper.getView(R.id.civ2)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.room_micro_list.size > 2) {
|
||||||
|
GlideUtil.loadImglogo(
|
||||||
|
mContext,
|
||||||
|
item.room_micro_list[2].head_pic,
|
||||||
|
helper.getView(R.id.civ3)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.RoomListBean
|
||||||
|
|
||||||
|
class HomePagerTopAdapter :
|
||||||
|
BaseQuickAdapter<RoomListBean, BaseViewHolder>(R.layout.item_home_pager_top) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: RoomListBean) {
|
||||||
|
GlideUtil.loadImglogo(mContext, item.room_cover, helper.getView(R.id.room_cover))
|
||||||
|
helper.setText(R.id.tv_value, item.hot_value)
|
||||||
|
.setText(R.id.tv_type, item.category_name)
|
||||||
|
.setText(R.id.tv_name, item.room_name)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.yuyin.mier.adapter;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.yuyin.lib_base.model.CategorRoomBean;
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.yuyin.mier.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class HomeRoomTypeAdapter extends BaseQuickAdapter<CategorRoomBean, BaseViewHolder> {
|
||||||
|
public int getSelectPos() {
|
||||||
|
return selectPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelectPos(int selectPos) {
|
||||||
|
this.selectPos = selectPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int selectPos = 0;
|
||||||
|
|
||||||
|
public HomeRoomTypeAdapter() {
|
||||||
|
super(R.layout.item_home_room_type, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, CategorRoomBean item) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_text, item.getCategory_name());
|
||||||
|
helper.setGone(R.id.v_left, helper.getPosition() == selectPos);
|
||||||
|
helper.setGone(R.id.v_right, helper.getPosition() == selectPos);
|
||||||
|
TextView textView = helper.getView(R.id.tv_text);
|
||||||
|
textView.setTextColor(helper.getPosition() == selectPos ? Color.parseColor("#36DCD9") : Color.parseColor("#666666"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
app/src/main/java/com/yuyin/mier/adapter/LeverListAdapter.kt
Normal file
16
app/src/main/java/com/yuyin/mier/adapter/LeverListAdapter.kt
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.Level
|
||||||
|
|
||||||
|
class LeverListAdapter : BaseQuickAdapter<Level, BaseViewHolder>(R.layout.item_lever) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: Level) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_lever, item.level.toString())
|
||||||
|
.setText(R.id.tv_value, item.number.toString())
|
||||||
|
GlideUtil.loadImglogo(mContext, item.image, helper.getView(R.id.iv_dengji))
|
||||||
|
}
|
||||||
|
}
|
||||||
78
app/src/main/java/com/yuyin/mier/adapter/MsgAdapter.kt
Normal file
78
app/src/main/java/com/yuyin/mier/adapter/MsgAdapter.kt
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.tencent.qcloud.tuikit.tuiconversation.bean.ConversationInfo
|
||||||
|
import com.tencent.qcloud.tuikit.tuiconversation.classicui.util.TUIConversationUtils
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.lib_base.util.TimeUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class MsgAdapter : BaseQuickAdapter<ConversationInfo, BaseViewHolder>(R.layout.item_message) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: ConversationInfo) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_nick_name, item.conversation.showName)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (item.lastMessage != null) {
|
||||||
|
if (item.lastMessage.textElem != null) {
|
||||||
|
helper.setText(R.id.tv_content, item.lastMessage.textElem.text)
|
||||||
|
} else if (item.lastMessage.customElem != null) {
|
||||||
|
helper.setText(R.id.tv_content, item.lastMessage.customElem.description)
|
||||||
|
} else {
|
||||||
|
helper.setText(R.id.tv_content, "")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GlideUtil.loadImglogo(mContext, item.conversation.faceUrl, helper.getView(R.id.ci_head))
|
||||||
|
if (item.unRead > 0) {
|
||||||
|
helper.setText(R.id.tv_num, item.unRead.toString())
|
||||||
|
helper.setVisible(R.id.tv_num, true)
|
||||||
|
} else {
|
||||||
|
helper.setVisible(R.id.tv_num, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
helper.itemView.setOnClickListener {
|
||||||
|
TUIConversationUtils.startChatActivity(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_time, TimeUtil.toDateYmdHan3(item.lastMessageTime))
|
||||||
|
|
||||||
|
|
||||||
|
// V2TIMManager.getConversationManager()
|
||||||
|
// .pinConversation(item.conversationId, true, object : V2TIMCallback {
|
||||||
|
// override fun onSuccess() {
|
||||||
|
// Log.i("imsdk", "success")
|
||||||
|
// Collections.swap(datas, 1, position)
|
||||||
|
// proxyNotifyDataSetChanged()
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onError(code: Int, desc: String) {
|
||||||
|
// Log.i("imsdk", "failure, code:$code, desc:$desc")
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
|
||||||
|
// holder.dataBinding.tvDelete.setOnClickListener {
|
||||||
|
// // 删除消息
|
||||||
|
// V2TIMManager.getConversationManager()
|
||||||
|
// .deleteConversation(
|
||||||
|
// item.conversationId,
|
||||||
|
// object : V2TIMCallback {
|
||||||
|
// override fun onSuccess() {
|
||||||
|
// Log.i("imsdk", "success")
|
||||||
|
// datas.removeAt(position)
|
||||||
|
// notifyItemRemoved(position)
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onError(code: Int, desc: String) {
|
||||||
|
// Log.i("imsdk", "failure, code:$code, desc:$desc")
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
28
app/src/main/java/com/yuyin/mier/adapter/MyListAdapter.java
Normal file
28
app/src/main/java/com/yuyin/mier/adapter/MyListAdapter.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.yuyin.mier.adapter;
|
||||||
|
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.yuyin.lib_base.model.MyListBean;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.yuyin.mier.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MyListAdapter extends BaseQuickAdapter<MyListBean, BaseViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
|
public MyListAdapter() {
|
||||||
|
super(R.layout.item_my_list, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, MyListBean item) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_title, item.getTitle());
|
||||||
|
Glide.with(mContext).load(item.getImg()).into((ImageView) helper.getView(R.id.iv_img));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
28
app/src/main/java/com/yuyin/mier/adapter/MyListAdapter2.java
Normal file
28
app/src/main/java/com/yuyin/mier/adapter/MyListAdapter2.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.yuyin.mier.adapter;
|
||||||
|
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.yuyin.lib_base.model.MyListBean;
|
||||||
|
import com.yuyin.mier.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class MyListAdapter2 extends BaseQuickAdapter<MyListBean, BaseViewHolder> {
|
||||||
|
|
||||||
|
|
||||||
|
public MyListAdapter2() {
|
||||||
|
super(R.layout.item_my_list2, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, MyListBean item) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_title, item.getTitle());
|
||||||
|
Glide.with(mContext).load(item.getImg()).into((ImageView) helper.getView(R.id.iv_img));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.util.TimeUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.OffiMessageBean
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 官方消息列表
|
||||||
|
*/
|
||||||
|
class OfficeListAdapter :
|
||||||
|
BaseQuickAdapter<OffiMessageBean, BaseViewHolder>(R.layout.item_message_office, ArrayList()) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: OffiMessageBean) {
|
||||||
|
helper
|
||||||
|
.setText(R.id.textTime, TimeUtil.chatTimee2(item.add_time))
|
||||||
|
.setText(R.id.tv_content, item.content)
|
||||||
|
.setText(R.id.tv_title1, item.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.model.PhotoMemory
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
|
||||||
|
class PhoneMemoryAdapter : BaseQuickAdapter<PhotoMemory, BaseViewHolder>(R.layout.item_photo_memory) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: PhotoMemory) {
|
||||||
|
helper.addOnClickListener(R.id.iv_delete)
|
||||||
|
helper.setText(R.id.tv_photo, item.photo)
|
||||||
|
GlideUtil.loadImglogo(mContext, item.head_pic, helper.getView(R.id.iv_head))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.text.TextUtils
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.AdapterView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.lib_base.util.img.FullScreenUtil
|
||||||
|
import com.yuyin.lib_base.view.MyGridView
|
||||||
|
import com.yuyin.module_community.adapter.OneImageYuanJiaoAdapter
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.RoomZoneList
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 官方消息列表
|
||||||
|
*/
|
||||||
|
class RoomZoneListAdapter :
|
||||||
|
BaseQuickAdapter<RoomZoneList, BaseViewHolder>(R.layout.item_room_zone, ArrayList()) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: RoomZoneList) {
|
||||||
|
GlideUtil.loadImglogo(mContext, item.head_pic, helper.getView(R.id.img))
|
||||||
|
helper
|
||||||
|
.setText(
|
||||||
|
R.id.tvTimeAddress,
|
||||||
|
item.zone_time
|
||||||
|
)
|
||||||
|
.setText(R.id.tvName, item.nick_name)
|
||||||
|
.setText(R.id.tvText, item.content)
|
||||||
|
helper.addOnClickListener(R.id.tvRoom)
|
||||||
|
helper.addOnClickListener(R.id.tvHome)
|
||||||
|
helper.addOnClickListener(R.id.img)
|
||||||
|
|
||||||
|
if (item.rid == "0") {
|
||||||
|
helper.getView<View>(R.id.tvRoom).visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
helper.getView<View>(R.id.tvRoom).visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(item.content)) {
|
||||||
|
helper.getView<View>(R.id.tvText).visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
helper.getView<View>(R.id.tvText).visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
val oneImageYuanJiaoAdapter = OneImageYuanJiaoAdapter(mContext)
|
||||||
|
val recyclerView = helper.getView<MyGridView>(R.id.dy_image_recyc)
|
||||||
|
recyclerView.numColumns = 3
|
||||||
|
recyclerView.adapter = oneImageYuanJiaoAdapter
|
||||||
|
oneImageYuanJiaoAdapter.getList_adapter().clear()
|
||||||
|
for (j in item.images.indices) {
|
||||||
|
oneImageYuanJiaoAdapter.getList_adapter().add(item.images[j])
|
||||||
|
}
|
||||||
|
oneImageYuanJiaoAdapter.notifyDataSetChanged()
|
||||||
|
recyclerView.onItemClickListener =
|
||||||
|
AdapterView.OnItemClickListener { parent: AdapterView<*>?, view: View?, position: Int, id: Long ->
|
||||||
|
FullScreenUtil.showFullScreenDialog(
|
||||||
|
mContext,
|
||||||
|
position,
|
||||||
|
oneImageYuanJiaoAdapter.getList_adapter()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
30
app/src/main/java/com/yuyin/mier/adapter/SceneFlowAdapter.kt
Normal file
30
app/src/main/java/com/yuyin/mier/adapter/SceneFlowAdapter.kt
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
|
||||||
|
class SceneFlowAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_scene_flow) {
|
||||||
|
|
||||||
|
private var selectPosition = 0
|
||||||
|
override fun convert(helper: BaseViewHolder, item: String?) {
|
||||||
|
|
||||||
|
helper.setText(R.id.tv_name, item)
|
||||||
|
val isSelected = helper.layoutPosition === selectPosition
|
||||||
|
if (isSelected) {
|
||||||
|
helper.getView<TextView>(R.id.tv_name).isSelected = true
|
||||||
|
} else {
|
||||||
|
helper.getView<TextView>(R.id.tv_name).isSelected = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setSelectPosition(index: Int) {
|
||||||
|
notifyItemChanged(selectPosition)
|
||||||
|
notifyItemChanged(index)
|
||||||
|
selectPosition = index
|
||||||
|
}
|
||||||
|
}
|
||||||
68
app/src/main/java/com/yuyin/mier/adapter/TeQuanAdapter.java
Normal file
68
app/src/main/java/com/yuyin/mier/adapter/TeQuanAdapter.java
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
package com.yuyin.mier.adapter;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
|
import com.yuyin.module_live.R;
|
||||||
|
import com.yuyin.module_live.model.TeQuanBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TeQuanAdapter extends BaseQuickAdapter<TeQuanBean, BaseViewHolder> {
|
||||||
|
|
||||||
|
public TeQuanAdapter(List<TeQuanBean> data) {
|
||||||
|
super(R.layout.item_tequan, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void convert(BaseViewHolder helper, TeQuanBean item) {
|
||||||
|
Glide.with(mContext).load(item.getLevel_image()).into((ImageView) helper.getView(R.id.ivTitle1));
|
||||||
|
helper.setText(R.id.tvTitle1, "等级" + item.getLevel() + "特权");
|
||||||
|
|
||||||
|
if (item.getMan_mount_decorate() != null && !TextUtils.isEmpty(item.getMan_mount_decorate().getTitle())) {
|
||||||
|
helper.setGone(R.id.tv_text1, true)
|
||||||
|
.setGone(R.id.iv_img1, true);
|
||||||
|
helper.setText(R.id.tv_text1, item.getMan_mount_decorate().getTitle());
|
||||||
|
Glide.with(mContext).load(item.getMan_mount_decorate().getBase_image()).into((ImageView) helper.getView(R.id.iv_img1));
|
||||||
|
} else {
|
||||||
|
helper.setGone(R.id.tv_text1, false)
|
||||||
|
.setGone(R.id.iv_img1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getMan_head_decorate() != null && !TextUtils.isEmpty(item.getMan_head_decorate().getTitle())) {
|
||||||
|
helper.setGone(R.id.tv_text2, true)
|
||||||
|
.setGone(R.id.iv_img2, true);
|
||||||
|
helper.setText(R.id.tv_text2, item.getMan_head_decorate().getTitle());
|
||||||
|
Glide.with(mContext).load(item.getMan_head_decorate().getBase_image()).into((ImageView) helper.getView(R.id.iv_img2));
|
||||||
|
} else {
|
||||||
|
helper.setGone(R.id.tv_text2, false)
|
||||||
|
.setGone(R.id.iv_img2, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getWoman_mount_decorate() != null && !TextUtils.isEmpty(item.getWoman_mount_decorate().getTitle())) {
|
||||||
|
helper.setGone(R.id.tv_text3, true)
|
||||||
|
.setGone(R.id.iv_img3, true);
|
||||||
|
helper.setText(R.id.tv_text3, item.getWoman_mount_decorate().getTitle());
|
||||||
|
Glide.with(mContext).load(item.getWoman_mount_decorate().getBase_image()).into((ImageView) helper.getView(R.id.iv_img3));
|
||||||
|
} else {
|
||||||
|
helper.setGone(R.id.tv_text3, false)
|
||||||
|
.setGone(R.id.iv_img3, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.getWoman_head_decorate() != null && !TextUtils.isEmpty(item.getWoman_head_decorate().getTitle())) {
|
||||||
|
helper.setGone(R.id.tv_text4, true)
|
||||||
|
.setGone(R.id.iv_img4, true);
|
||||||
|
helper.setText(R.id.tv_text4, item.getWoman_head_decorate().getTitle());
|
||||||
|
Glide.with(mContext).load(item.getWoman_head_decorate().getBase_image()).into((ImageView) helper.getView(R.id.iv_img4));
|
||||||
|
} else {
|
||||||
|
helper.setGone(R.id.tv_text4, false)
|
||||||
|
.setGone(R.id.iv_img4, false);
|
||||||
|
}
|
||||||
|
helper.setGone(R.id.ivAdd1, !TextUtils.isEmpty(item.getMan_mount_decorate().getTitle()) && !TextUtils.isEmpty(item.getMan_head_decorate().getTitle()));
|
||||||
|
helper.setGone(R.id.ivAdd2, !TextUtils.isEmpty(item.getWoman_mount_decorate().getTitle()) && !TextUtils.isEmpty(item.getWoman_head_decorate().getTitle()));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
27
app/src/main/java/com/yuyin/mier/adapter/VipPriceAdapter.kt
Normal file
27
app/src/main/java/com/yuyin/mier/adapter/VipPriceAdapter.kt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.yuyin.mier.adapter
|
||||||
|
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.TextView
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_my.model.Vip
|
||||||
|
|
||||||
|
class VipPriceAdapter : BaseQuickAdapter<Vip, BaseViewHolder>(R.layout.item_vip) {
|
||||||
|
|
||||||
|
override fun convert(helper: BaseViewHolder, item: Vip) {
|
||||||
|
helper.setText(R.id.tv_select1,item.name)
|
||||||
|
.setText(R.id.tv_select11,item.price)
|
||||||
|
if(item.isSelect){
|
||||||
|
helper.getView<LinearLayout>(R.id.ll_select1).isSelected=true
|
||||||
|
helper.getView<TextView>(R.id.tv_select1).isSelected=true
|
||||||
|
helper.getView<TextView>(R.id.tv_select11).isSelected=true
|
||||||
|
}else{
|
||||||
|
helper.getView<LinearLayout>(R.id.ll_select1).isSelected=false
|
||||||
|
helper.getView<TextView>(R.id.tv_select1).isSelected=false
|
||||||
|
helper.getView<TextView>(R.id.tv_select11).isSelected=false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
381
app/src/main/java/com/yuyin/mier/module_home/MainActivity.kt
Normal file
381
app/src/main/java/com/yuyin/mier/module_home/MainActivity.kt
Normal file
@@ -0,0 +1,381 @@
|
|||||||
|
package com.yuyin.mier.module_home
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.KeyEvent
|
||||||
|
import android.view.View
|
||||||
|
import android.view.animation.Animation
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
|
import android.view.animation.RotateAnimation
|
||||||
|
import android.widget.RadioGroup
|
||||||
|
import android.widget.Toast
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.blankj.utilcode.util.LogUtils
|
||||||
|
import com.kongzue.dialog.v3.MessageDialog
|
||||||
|
import com.tencent.imsdk.v2.*
|
||||||
|
import com.tencent.qcloud.tuicore.TUILogin
|
||||||
|
import com.tencent.qcloud.tuicore.interfaces.TUICallback
|
||||||
|
import com.tencent.qcloud.tuicore.interfaces.TUILoginConfig
|
||||||
|
import com.tencent.qcloud.tuikit.tuiconversation.config.TUIConversationConfig
|
||||||
|
import com.yuyin.lib_base.App
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil.MAIN_MAIN
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingActivity
|
||||||
|
import com.yuyin.lib_base.base.UserManager
|
||||||
|
import com.yuyin.lib_base.model.EnterRoomInfo
|
||||||
|
import com.yuyin.lib_base.model.FirstEvent
|
||||||
|
import com.yuyin.lib_base.model.UserBean
|
||||||
|
import com.yuyin.lib_base.util.FragmentUtils
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.lib_base.view.CircularImage
|
||||||
|
import com.yuyin.lib_base.view.floatingview.EnFloatingView
|
||||||
|
import com.yuyin.lib_base.view.floatingview.FloatingMagnetView
|
||||||
|
import com.yuyin.lib_base.view.floatingview.FloatingView
|
||||||
|
import com.yuyin.lib_base.view.floatingview.MagnetViewListener
|
||||||
|
import com.yuyin.module_live.ui.room.AdminRoomActivity
|
||||||
|
import com.yuyin.mier.BR
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.adapter.MyListAdapter
|
||||||
|
import com.yuyin.mier.databinding.ActivityMainBinding
|
||||||
|
import com.yuyin.mier.module_home.tab.center.CenterFragment
|
||||||
|
import com.yuyin.mier.module_home.tab.dynamic.MainCommunityFragment
|
||||||
|
import com.yuyin.mier.module_home.tab.home.HomePagerFragment
|
||||||
|
import com.yuyin.mier.module_home.tab.home.MainHomeFragment
|
||||||
|
import com.yuyin.mier.module_home.tab.home.teen.AdolescentModelDialog
|
||||||
|
import com.yuyin.mier.module_home.tab.home.teen.TeenModeActivity
|
||||||
|
import com.yuyin.mier.module_home.tab.my.MyFragment
|
||||||
|
import com.yuyin.mier.module_home.tab.xiaoxi.MessageFragment
|
||||||
|
|
||||||
|
import kotlinx.android.synthetic.main.activity_main.*
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
||||||
|
@Route(path = MAIN_MAIN)
|
||||||
|
open class MainActivity : BaseDataBindingActivity<MainViewModel, ActivityMainBinding>(),
|
||||||
|
RadioGroup.OnCheckedChangeListener {
|
||||||
|
|
||||||
|
private lateinit var mAdapter: MyListAdapter
|
||||||
|
var mainFaXianFragment = MyFragment()
|
||||||
|
var mainMessageFragment = MessageFragment()
|
||||||
|
var mainCenterFragment = CenterFragment()
|
||||||
|
var homeFragment = MainHomeFragment()
|
||||||
|
var mainCommunityFragment = MainCommunityFragment()
|
||||||
|
|
||||||
|
val homePagerFragment = HomePagerFragment()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
EventBus.getDefault().register(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCheckedChanged(p0: RadioGroup?, checkedId: Int) {
|
||||||
|
when (checkedId) {
|
||||||
|
R.id.radio_my -> {
|
||||||
|
FragmentUtils.addOrShowFragmentToActivity(
|
||||||
|
supportFragmentManager,
|
||||||
|
mainFaXianFragment, R.id.frameLayout_main
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.radio_rank -> {
|
||||||
|
FragmentUtils.addOrShowFragmentToActivity(
|
||||||
|
supportFragmentManager,
|
||||||
|
mainCommunityFragment, R.id.frameLayout_main
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.radio_message -> {
|
||||||
|
FragmentUtils.addOrShowFragmentToActivity(
|
||||||
|
supportFragmentManager,
|
||||||
|
mainMessageFragment, R.id.frameLayout_main
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
R.id.radio_home ->
|
||||||
|
FragmentUtils.addOrShowFragmentToActivity(
|
||||||
|
supportFragmentManager,
|
||||||
|
mainCenterFragment, R.id.frameLayout_main
|
||||||
|
)
|
||||||
|
|
||||||
|
R.id.radio_center -> {
|
||||||
|
FragmentUtils.addOrShowFragmentToActivity(
|
||||||
|
supportFragmentManager,
|
||||||
|
mainCenterFragment, R.id.frameLayout_main
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var exitTime: Long = 0
|
||||||
|
|
||||||
|
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK && event.action == KeyEvent.ACTION_DOWN) {
|
||||||
|
if (System.currentTimeMillis() - exitTime > 2000) {
|
||||||
|
"再按一次退出程序".showToast()
|
||||||
|
exitTime = System.currentTimeMillis()
|
||||||
|
} else {
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, event)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
super.onStop()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
EventBus.getDefault().unregister(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
FloatingView.get().attach(this)
|
||||||
|
|
||||||
|
val code = getVersionCode()
|
||||||
|
viewModel.get_system_base_config("$code", "1")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRestart() {
|
||||||
|
super.onRestart()
|
||||||
|
// LogUtils.debugInfo("====onRestart");
|
||||||
|
if (App.isStart && App.isTop) {
|
||||||
|
backToRoom()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
|
||||||
|
viewModel.userInfoData.observe(this) {
|
||||||
|
loginIM(it)
|
||||||
|
// val info = V2TIMUserFullInfo()
|
||||||
|
// info.setNickname(it.nick_name)
|
||||||
|
// info.faceUrl = it.head_pic
|
||||||
|
// info.selfSignature = it.autograph
|
||||||
|
// V2TIMManager.getInstance().setSelfInfo(info, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.configBean.observe(this) {
|
||||||
|
|
||||||
|
App.configBean = it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.activity_main
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
mDataBinding.radioGroup.setOnCheckedChangeListener(this)
|
||||||
|
mDataBinding.radioGroup.check(R.id.radio_home) //使用了viewpager 去掉
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
viewModel.loadUserInfo()
|
||||||
|
viewModel.is_private_chat()
|
||||||
|
changeMsg()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
if (!App.isStart && intent.getStringExtra("quite_room") == null) {
|
||||||
|
val adolescentModelDialog = AdolescentModelDialog(this)
|
||||||
|
adolescentModelDialog.getBinding().btnConfirm.setOnClickListener {
|
||||||
|
startActivity(Intent(this, TeenModeActivity::class.java))
|
||||||
|
adolescentModelDialog.dismiss()
|
||||||
|
}
|
||||||
|
adolescentModelDialog.getBinding().btnCancel.setOnClickListener {
|
||||||
|
adolescentModelDialog.dismiss()
|
||||||
|
}
|
||||||
|
adolescentModelDialog.getBinding().ivQsms.setOnClickListener {
|
||||||
|
adolescentModelDialog.dismiss()
|
||||||
|
}
|
||||||
|
adolescentModelDialog.show()
|
||||||
|
} else if (intent.getStringExtra("quite_room") != null) {
|
||||||
|
|
||||||
|
if (intent.getStringExtra("type") == "1") {
|
||||||
|
MessageDialog.show(
|
||||||
|
this,
|
||||||
|
"温馨提示",
|
||||||
|
"房间类型已更改,是否重新进入该房间",
|
||||||
|
"确定",
|
||||||
|
"取消"
|
||||||
|
).setOnOkButtonClickListener { baseDialog, v ->
|
||||||
|
viewModel.enterRoom(intent.getStringExtra("quite_room").toString(), "", this)
|
||||||
|
baseDialog.doDismiss()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MessageDialog.show(
|
||||||
|
this,
|
||||||
|
"温馨提示",
|
||||||
|
"房间已关闭",
|
||||||
|
"确定",
|
||||||
|
).setOnOkButtonClickListener { baseDialog, v ->
|
||||||
|
baseDialog.doDismiss()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
mDataBinding.setVariable(BR.act, this)
|
||||||
|
|
||||||
|
V2TIMManager.getMessageManager()
|
||||||
|
.addAdvancedMsgListener(object : V2TIMAdvancedMsgListener() {
|
||||||
|
|
||||||
|
override fun onRecvNewMessage(msg: V2TIMMessage?) {
|
||||||
|
super.onRecvNewMessage(msg)
|
||||||
|
changeMsg()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public fun receiveMsg(event: FirstEvent) {
|
||||||
|
when (event.tag) {
|
||||||
|
Const.LOGOUT -> {
|
||||||
|
if (App.isStart) {
|
||||||
|
App.roomActivity?.finish()
|
||||||
|
}
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
Const.FANHUIZHUYE -> { //显示悬浮窗
|
||||||
|
Log.e("aaaaa", "receiveMsg: showFlow")
|
||||||
|
val enterRoom: EnterRoomInfo = event.enterRoom
|
||||||
|
showFlow(enterRoom.room_cover)
|
||||||
|
}
|
||||||
|
|
||||||
|
Const.XUANFUYINCANG -> { //显示悬浮窗
|
||||||
|
FloatingView.get().remove()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public fun receiveUnreadCount(msg: String) {
|
||||||
|
LogUtils.e(msg)
|
||||||
|
// if (msg == "更新消息红点") {
|
||||||
|
changeMsg()
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun showFlow(msg: String) {
|
||||||
|
FloatingView.get().add()
|
||||||
|
val view: EnFloatingView = FloatingView.get().view
|
||||||
|
val imgHeader = view.findViewById<CircularImage>(R.id.imgHeader)
|
||||||
|
val img1 = view.findViewById<View>(R.id.img1)
|
||||||
|
val img2 = view.findViewById<View>(R.id.img2)
|
||||||
|
img1.isSelected = true
|
||||||
|
loadImage(imgHeader, msg, R.mipmap.ic_launcher_app)
|
||||||
|
|
||||||
|
img2.setOnClickListener(View.OnClickListener { v: View? ->
|
||||||
|
if (App.isStart) {
|
||||||
|
App.isStart = false
|
||||||
|
App.roomActivity?.finish()
|
||||||
|
FloatingView.get().remove()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
FloatingView.get().listener(object : MagnetViewListener {
|
||||||
|
override fun onRemove(magnetView: FloatingMagnetView?) {
|
||||||
|
Toast.makeText(this@MainActivity, "我没了", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(magnetView: FloatingMagnetView?) {
|
||||||
|
startActivity(Intent(this@MainActivity, AdminRoomActivity::class.java))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
val rotateAnimation = RotateAnimation(
|
||||||
|
0f, 360f,
|
||||||
|
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f
|
||||||
|
)
|
||||||
|
rotateAnimation.duration = 3000
|
||||||
|
rotateAnimation.fillAfter = true
|
||||||
|
rotateAnimation.repeatMode = Animation.RESTART
|
||||||
|
//让旋转动画一直转,不停顿的重点
|
||||||
|
rotateAnimation.interpolator = LinearInterpolator()
|
||||||
|
rotateAnimation.repeatCount = -1
|
||||||
|
imgHeader.startAnimation(rotateAnimation)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loginIM(user: UserBean) {
|
||||||
|
//在线状态
|
||||||
|
TUIConversationConfig.getInstance().isShowUserStatus = false
|
||||||
|
val config = TUILoginConfig()
|
||||||
|
config.logLevel = V2TIMSDKConfig.V2TIM_LOG_INFO
|
||||||
|
|
||||||
|
LogUtils.e("当前账号", user.uid)
|
||||||
|
TUILogin.login(
|
||||||
|
App.instance!!.applicationContext,
|
||||||
|
/*GsonUtils.fromJson<ConfigBean>(
|
||||||
|
SPUtils.getInstance().getString("config"),
|
||||||
|
ConfigBean::class.java
|
||||||
|
).tencentyun_im_appid.toInt()*/1600078180, //1600039760 正式服
|
||||||
|
user.uid,
|
||||||
|
UserManager.user.user_sig,
|
||||||
|
object : TUICallback() {
|
||||||
|
override fun onSuccess() {
|
||||||
|
LogUtils.e("IM登陆成功")
|
||||||
|
val info = V2TIMUserFullInfo()
|
||||||
|
info.setNickname(user.nick_name)
|
||||||
|
info.faceUrl = user.head_pic
|
||||||
|
info.selfSignature = user.autograph
|
||||||
|
V2TIMManager.getInstance().setSelfInfo(info, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(errorCode: Int, errorMessage: String?) {
|
||||||
|
LogUtils.e(errorCode, errorMessage)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
V2TIMManager.getInstance()
|
||||||
|
.addIMSDKListener(object : V2TIMSDKListener() {
|
||||||
|
override fun onKickedOffline() {
|
||||||
|
super.onKickedOffline()
|
||||||
|
Log.i("imsdk", "success")
|
||||||
|
EventBus.getDefault().post(FirstEvent("指定发送", Const.LOGOUT))
|
||||||
|
UserManager.layout()
|
||||||
|
ARouter.getInstance().build(AroutUtil.LOGIN_MAIN).withInt("sign", 1)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun changeMsg() {
|
||||||
|
|
||||||
|
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(object :
|
||||||
|
V2TIMValueCallback<Long> {
|
||||||
|
override fun onSuccess(p0: Long?) {
|
||||||
|
if (p0!! > 0) {
|
||||||
|
mDataBinding.tvUnhed.text = p0.toString()
|
||||||
|
mDataBinding.tvUnhed.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
mDataBinding.tvUnhed.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(p0: Int, p1: String?) {
|
||||||
|
LogUtils.e(p0, p1)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.yuyin.mier.module_home
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.yuyin.lib_base.App
|
||||||
|
import com.yuyin.lib_base.Const.ROOM_TYPE
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.lib_base.model.CategorRoomBean
|
||||||
|
import com.yuyin.mier.repository.CommonRepository
|
||||||
|
|
||||||
|
class MainViewModel : BaseViewModel() {
|
||||||
|
var repository = CommonRepository()
|
||||||
|
var roomCategories = MutableLiveData<List<CategorRoomBean>>()
|
||||||
|
|
||||||
|
fun loadRoomCategories() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.roomCategories(ROOM_TYPE)
|
||||||
|
roomCategories.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取用户基本信息详情
|
||||||
|
fun get_base_user_infoSss(uid: String) {
|
||||||
|
launchUI {
|
||||||
|
var data = baseRepository.get_base_user_info(uid)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun is_private_chat() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.is_private_chat()
|
||||||
|
App.is_private_chat = result.data.is_private_chat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
package com.yuyin.mier.module_home.cproom
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.util.Log
|
||||||
|
import com.tencent.qgame.animplayer.AnimView
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingActivity
|
||||||
|
import com.yuyin.lib_base.base.UserManager
|
||||||
|
import com.yuyin.lib_base.model.MyCpTxBean
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.lib_base.view.ItemDecoration
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.adapter.CPTxListAdapter
|
||||||
|
import com.yuyin.mier.adapter.CPTxkListAdapter
|
||||||
|
import com.yuyin.mier.databinding.ActivityCpRoomBinding
|
||||||
|
import com.zhy.http.okhttp.OkHttpUtils
|
||||||
|
import com.zhy.http.okhttp.callback.FileCallBack
|
||||||
|
import kotlinx.android.synthetic.main.activity_cp_room.*
|
||||||
|
import okhttp3.Call
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
class CPRoomActivity : BaseDataBindingActivity<CPRoomViewModel, ActivityCpRoomBinding>() {
|
||||||
|
|
||||||
|
lateinit var cpTxListAdapter: CPTxListAdapter
|
||||||
|
lateinit var cpTxkListAdapter: CPTxkListAdapter
|
||||||
|
var tabIndex = 0
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.CPBean.observe(this) {
|
||||||
|
tv_level.text = "LV." + it.cp_level
|
||||||
|
viewModel.my_cp_txk("1")
|
||||||
|
cp_man_name.text = it.u_nick_name
|
||||||
|
cp_woman_name.text = it.receive_nick_name
|
||||||
|
cp_man_value.text = it.cp_value.toString()
|
||||||
|
cp_woman_value.text = it.next_cp_value
|
||||||
|
GlideUtil.loadImglogo(this, it.u_head_pic, cp_head_nan)
|
||||||
|
GlideUtil.loadImglogo(this, it.receive_head_pic, cp_head_nv)
|
||||||
|
playTX(it.u_avatar_play_image, cp_man, Int.MAX_VALUE)
|
||||||
|
playTX(it.receive_avatar_play_image, cp_woman, Int.MAX_VALUE)
|
||||||
|
|
||||||
|
}
|
||||||
|
viewModel.CPTxBean.observe(this) {
|
||||||
|
if (tabIndex == 0) {
|
||||||
|
cpTxkListAdapter.setNewData(it)
|
||||||
|
rcy_tx.adapter = cpTxkListAdapter
|
||||||
|
} else {
|
||||||
|
cpTxListAdapter.setNewData(it)
|
||||||
|
rcy_tx.adapter = cpTxListAdapter
|
||||||
|
}
|
||||||
|
if (rcy_tx.itemDecorationCount == 0) {
|
||||||
|
rcy_tx.addItemDecoration(ItemDecoration(this,0,5f,5f))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
viewModel.setDecorateDate.observe(this) {
|
||||||
|
if (tabIndex == 0) {
|
||||||
|
viewModel.my_cp_txk("1")
|
||||||
|
} else {
|
||||||
|
viewModel.my_cp_txk("9")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.activity_cp_room
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
cpTxkListAdapter = CPTxkListAdapter()
|
||||||
|
cpTxListAdapter = CPTxListAdapter()
|
||||||
|
GlideUtil.loadImglogo(this, UserManager.user.head_pic, cp_head_nan)
|
||||||
|
cp_man_name.text = UserManager.user.nick_name
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
viewModel.my_cp()
|
||||||
|
viewModel.my_cp_txk("1")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
cpTxListAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
val dataBean: MyCpTxBean = adapter.data[position] as MyCpTxBean
|
||||||
|
if (dataBean.js_suo == "1") {
|
||||||
|
if (dataBean.is_using == "1") {
|
||||||
|
viewModel.cancel_user_decorate(dataBean.udid)
|
||||||
|
} else {
|
||||||
|
playTX(dataBean.cp_tx_play_img, cp_tx, 1)
|
||||||
|
viewModel.set_user_decorate(dataBean.udid)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"当前特效未解锁".showToast()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
cpTxkListAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
val dataBean: MyCpTxBean = adapter.data[position] as MyCpTxBean
|
||||||
|
viewModel.my_cp()
|
||||||
|
|
||||||
|
if (dataBean.js_suo == "1") {
|
||||||
|
if (dataBean.is_using == "1") {
|
||||||
|
viewModel.cancel_user_decorate(dataBean.udid)
|
||||||
|
} else {
|
||||||
|
viewModel.set_user_decorate(dataBean.udid)
|
||||||
|
if (viewModel.CPBean.value!!.uid == UserManager.user.uid.toString()) {
|
||||||
|
cp_man.stopPlay()
|
||||||
|
cp_man.clearAnimation()
|
||||||
|
playTX(dataBean.head_decorate_play_img, cp_man, Int.MAX_VALUE)
|
||||||
|
} else {
|
||||||
|
cp_woman.stopPlay()
|
||||||
|
cp_woman.clearAnimation()
|
||||||
|
playTX(dataBean.head_decorate_play_img, cp_woman, Int.MAX_VALUE)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"当前头像框未解锁".showToast()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
tv_txk.setOnClickListener {
|
||||||
|
tabIndex = 0
|
||||||
|
tv_txk.setTextColor(Color.parseColor("#333333"))
|
||||||
|
tv_rctx.setTextColor(Color.parseColor("#999999"))
|
||||||
|
viewModel.my_cp_txk("1")
|
||||||
|
}
|
||||||
|
|
||||||
|
tv_rctx.setOnClickListener {
|
||||||
|
tabIndex = 1
|
||||||
|
tv_txk.setTextColor(Color.parseColor("#999999"))
|
||||||
|
tv_rctx.setTextColor(Color.parseColor("#333333"))
|
||||||
|
viewModel.my_cp_txk("9")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun playTX(url: String, animView: AnimView, count: Int) {
|
||||||
|
OkHttpUtils.get().url(url).build().execute(object : FileCallBack(
|
||||||
|
cacheDir.absolutePath, url.substring(url.lastIndexOf("/")) //
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun onError(
|
||||||
|
call: Call?, e: java.lang.Exception?, id: Int
|
||||||
|
) {
|
||||||
|
Log.d("sssssssssss", e.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResponse(response: File?, id: Int) {
|
||||||
|
response?.let {
|
||||||
|
animView.startPlay(response)
|
||||||
|
animView.setLoop(count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// if (!FileUtils.isFileExists(
|
||||||
|
// cacheDir?.absolutePath + url.substring(
|
||||||
|
// url.lastIndexOf(
|
||||||
|
// "/"
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// ) {
|
||||||
|
// OkHttpUtils
|
||||||
|
// .get()
|
||||||
|
// .url(url)
|
||||||
|
// .build()
|
||||||
|
// .execute(object : FileCallBack(
|
||||||
|
// cacheDir?.absolutePath,
|
||||||
|
// url.substring(url.lastIndexOf("/")) //
|
||||||
|
// ) {
|
||||||
|
//
|
||||||
|
// override fun onError(
|
||||||
|
// call: Call?,
|
||||||
|
// e: java.lang.Exception?,
|
||||||
|
// id: Int
|
||||||
|
// ) {
|
||||||
|
// Log.d("sssssssssss", e.toString())
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// override fun onResponse(response: File?, id: Int) {
|
||||||
|
// response?.let {
|
||||||
|
// animView.setLoop(count)
|
||||||
|
// animView.startPlay(response)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// } else {
|
||||||
|
// LogUtils.e("有缓存")
|
||||||
|
// animView.setLoop(count)
|
||||||
|
// animView.startPlay(
|
||||||
|
// File(
|
||||||
|
// cacheDir?.absolutePath + url.substring(
|
||||||
|
// url.lastIndexOf(
|
||||||
|
// "/"
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.yuyin.mier.module_home.cproom
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.lib_base.model.MyCpBean
|
||||||
|
import com.yuyin.lib_base.model.MyCpTxBean
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.mier.repository.CommonRepository
|
||||||
|
|
||||||
|
class CPRoomViewModel : BaseViewModel() {
|
||||||
|
|
||||||
|
var repository = CommonRepository()
|
||||||
|
var CPBean = MutableLiveData<MyCpBean>()
|
||||||
|
var setDecorateDate = MutableLiveData<Any>()
|
||||||
|
|
||||||
|
fun my_cp() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.my_cp()
|
||||||
|
CPBean.value=result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var CPTxBean= MutableLiveData<ArrayList<MyCpTxBean>>()
|
||||||
|
|
||||||
|
fun my_cp_txk(type:String) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.my_cp_txk(type)
|
||||||
|
CPTxBean.value=result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun set_user_decorate(udid: String) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.set_user_decorate(udid)
|
||||||
|
result.msg.showToast()
|
||||||
|
setDecorateDate.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun cancel_user_decorate(udid: String) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.cancel_user_decorate(udid)
|
||||||
|
result.msg.showToast()
|
||||||
|
setDecorateDate.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
347
app/src/main/java/com/yuyin/mier/module_home/model/MainBean.kt
Normal file
347
app/src/main/java/com/yuyin/mier/module_home/model/MainBean.kt
Normal file
@@ -0,0 +1,347 @@
|
|||||||
|
package com.yuyin.mier.module_home.model
|
||||||
|
|
||||||
|
import java.io.Serializable
|
||||||
|
|
||||||
|
|
||||||
|
data class Mic(
|
||||||
|
var head_pic: String = "",
|
||||||
|
var uid: Int = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data class GHSet(
|
||||||
|
var is_deacon: String = "",
|
||||||
|
var quit_money: String = "",
|
||||||
|
var guild_name: String = "",
|
||||||
|
var is_join_guild: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data class GHMain(
|
||||||
|
var list: ArrayList<GHListBean> = ArrayList()
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GHRoomMain(
|
||||||
|
var is_deacon: String = "",
|
||||||
|
var list: ArrayList<GHRoomListBean> = ArrayList(),
|
||||||
|
val total_gift_price: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GHDeatileBean(
|
||||||
|
var id: String = "",
|
||||||
|
var guild_special_id: String = "",
|
||||||
|
var uid: String = "",
|
||||||
|
var guild_name: String = "",
|
||||||
|
var cover: String = "",
|
||||||
|
var intro: String = "",
|
||||||
|
var money: String = "",
|
||||||
|
var num: String = "",
|
||||||
|
var add_time: Long = 0,
|
||||||
|
var contribution_value: String = "",
|
||||||
|
var last_week_income: String = "",
|
||||||
|
var this_week_income: String = "",
|
||||||
|
var last_week_income_money: String = "",
|
||||||
|
val ghz: GHDeatileHzBean,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GHDeatileHzBean(
|
||||||
|
var uid: String = "",
|
||||||
|
var nick_name: String = "",
|
||||||
|
var head_pic: String = "",
|
||||||
|
var special_uid: String = "",
|
||||||
|
var noblity_image: String = "",
|
||||||
|
var charm_level_image: String = "",
|
||||||
|
var contribution_level_image: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GHUserMain(
|
||||||
|
var is_deacon: String = "",
|
||||||
|
var list: ArrayList<GHUserListBean> = ArrayList(),
|
||||||
|
val total_gift_price: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GHListBean(
|
||||||
|
var guild_id: String = "",
|
||||||
|
var guild_name: String = "",
|
||||||
|
var cover: String = "",
|
||||||
|
var total_gift_total_price: String = "",
|
||||||
|
val num: Int = 0
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GHRoomListBean(
|
||||||
|
var rid: String = "",
|
||||||
|
var room_owner_uid: String = "",
|
||||||
|
var room_name: String = "",
|
||||||
|
var room_cover: String = "",
|
||||||
|
var total_gift_total_price: String = "",
|
||||||
|
val room_number: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class GHUserListBean(
|
||||||
|
var id: String = "",
|
||||||
|
var uid: String = "",
|
||||||
|
var guild_id: String = "",
|
||||||
|
var nick_name: String = "",
|
||||||
|
var head_pic: String = "",
|
||||||
|
var total_gift_total_price: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class RoomZoneList(
|
||||||
|
var uid: String = "",
|
||||||
|
var rid: String = "",
|
||||||
|
var nick_name: String = "",
|
||||||
|
var head_pic: String = "",
|
||||||
|
var sex: String = "",
|
||||||
|
var zid: String = "",
|
||||||
|
var content: String = "",
|
||||||
|
var zone_time: String = "",
|
||||||
|
var last_operate_time: String = "",
|
||||||
|
var distance: String = "",
|
||||||
|
var images: ArrayList<String> = ArrayList(),
|
||||||
|
)
|
||||||
|
|
||||||
|
data class BlackList(
|
||||||
|
val room_black_list: ArrayList<BlackBean>,
|
||||||
|
val room_visitor_list: ArrayList<BlackBean>,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
data class BlackBean(
|
||||||
|
var uid: String = "",
|
||||||
|
var nick_name: String = "",
|
||||||
|
var head_pic: String = "",
|
||||||
|
var sex: String = "",
|
||||||
|
val special_uid: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class userWithdrawalListBean(
|
||||||
|
var all: String = "",
|
||||||
|
val detail: ArrayList<userWithdrawalBean> = ArrayList(),
|
||||||
|
)
|
||||||
|
|
||||||
|
data class userWithdrawalBean(
|
||||||
|
var rid: String = "",
|
||||||
|
var wid: String = "",
|
||||||
|
var type: String = "",
|
||||||
|
var general_money: String = "",
|
||||||
|
var money: String = "",
|
||||||
|
var server_money: String = "",
|
||||||
|
var surplus_money: String = "",
|
||||||
|
var status: String = "",
|
||||||
|
var deal_type: String = "",
|
||||||
|
var remarke: String = "",
|
||||||
|
var account: String = "",
|
||||||
|
var add_time: Long = 0,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class RoomListBean(
|
||||||
|
var rid: String = "",
|
||||||
|
var room_number: String = "",
|
||||||
|
var tid: String = "",
|
||||||
|
var cate_id: String = "",
|
||||||
|
var room_name: String = "",
|
||||||
|
var room_cover: String = "",
|
||||||
|
var is_need_password: String = "",
|
||||||
|
var is_hot: String = "",
|
||||||
|
var hot_value: String = "",
|
||||||
|
var is_online: String = "",
|
||||||
|
var visitor_num: String = "",
|
||||||
|
var room_status: String = "",
|
||||||
|
var is_top: String = "",
|
||||||
|
var base64_nick_name: String = "",
|
||||||
|
var sex: String = "",
|
||||||
|
var nick_name: String = "",
|
||||||
|
var category_name: String = "",
|
||||||
|
var base64_room_name: String = "",
|
||||||
|
var game_list: String = "",
|
||||||
|
var head_pic: String = "",
|
||||||
|
var room_frame_base_image: String = "",
|
||||||
|
var room_frame_play_image: String = "",
|
||||||
|
var room_micro: String = "",
|
||||||
|
var room_owner_uid: Int = 0,
|
||||||
|
var special_uid: Int = 0,
|
||||||
|
var today_hot_value: Int = 0,
|
||||||
|
val room_visitor_list: ArrayList<Mic> = arrayListOf(),
|
||||||
|
var room_micro_member: ArrayList<Mic> = arrayListOf(),
|
||||||
|
var game_ico_list: ArrayList<Mic> = arrayListOf(),
|
||||||
|
var room_micro_list: ArrayList<Mic> = arrayListOf()
|
||||||
|
)
|
||||||
|
|
||||||
|
data class SearchBean(
|
||||||
|
val user: ArrayList<SearchUserBean> = ArrayList(),
|
||||||
|
val room: ArrayList<SearchRoomBean> = ArrayList()
|
||||||
|
)
|
||||||
|
|
||||||
|
data class SearchUserBean(
|
||||||
|
val uid: String = "",
|
||||||
|
val head_pic: String = "",
|
||||||
|
val special_uid: String = "",
|
||||||
|
val nick_name: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class SearchRoomBean(
|
||||||
|
val rid: String = "",
|
||||||
|
val room_number: String = "",
|
||||||
|
val room_name: String = "",
|
||||||
|
val room_cover: String = "",
|
||||||
|
val uid: String = "",
|
||||||
|
val head_pic: String = "",
|
||||||
|
val special_uid: String = "",
|
||||||
|
val nick_name: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class BannerBean(
|
||||||
|
val bid: String = "",
|
||||||
|
val aid: String = "",
|
||||||
|
val image: String = "",
|
||||||
|
val sort: String = "",
|
||||||
|
val url: String = "",
|
||||||
|
val type: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class OffiMessageBean(
|
||||||
|
val mid: String = "",
|
||||||
|
val title: String = "",
|
||||||
|
val type: String = "",
|
||||||
|
val content: String = "",
|
||||||
|
val id: String = "",
|
||||||
|
val is_read: String = "",
|
||||||
|
val add_time: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class OffiMessageSub1Bean(
|
||||||
|
val aid: String = "",
|
||||||
|
val type: String = "",
|
||||||
|
val uid: String = "",
|
||||||
|
val recived_uid: String = "",
|
||||||
|
val status: String = "",
|
||||||
|
val deal_time: String = "",
|
||||||
|
//下面开始订单消息的字段
|
||||||
|
val oid: String = "",
|
||||||
|
val is_player: Int = 0,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data class HomeScene(
|
||||||
|
|
||||||
|
var sex_type: String = "",
|
||||||
|
var age_type: String = "",
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data class LeverBean(
|
||||||
|
val level_list: List<Level>, val user_info: UserInfo, val user_level_info: UserLevelInfo
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Level(
|
||||||
|
val image: String, val level: Int, val number: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
data class UserInfo(
|
||||||
|
val base64_nick_name: String,
|
||||||
|
val charm_level_image: String,
|
||||||
|
val contribution_level_image: String,
|
||||||
|
val head_pic: String,
|
||||||
|
val nick_name: String,
|
||||||
|
val uid: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
data class UserLevelInfo(
|
||||||
|
val next_level: Int,
|
||||||
|
val next_level_image: String,
|
||||||
|
val next_value: Int,
|
||||||
|
val now_level: Int,
|
||||||
|
val now_level_image: String,
|
||||||
|
val now_value: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data class IsPrivateChat(
|
||||||
|
var is_private_chat: Int = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
data class DaySignBean(
|
||||||
|
val sign_log: List<DaySignBeanInfo>,
|
||||||
|
val sign_num: String = "",
|
||||||
|
val today_sign: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class SignSuccesBean(
|
||||||
|
val award: String = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
data class DaySignBeanInfo(
|
||||||
|
val is_sign: Int = 0,
|
||||||
|
val award: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class NobilityInfo(
|
||||||
|
val image: String,
|
||||||
|
val lid: Int,
|
||||||
|
val name: String,
|
||||||
|
val change_value: String,
|
||||||
|
val pay_price: String,
|
||||||
|
val day_num: String,
|
||||||
|
val renew_coin: String,
|
||||||
|
val pay_coin: String,
|
||||||
|
val renew_price: String,
|
||||||
|
var play_image: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class NobilityPower(
|
||||||
|
val id: Int,
|
||||||
|
val image: String,
|
||||||
|
val images: String,
|
||||||
|
val content: String,
|
||||||
|
val name: String,
|
||||||
|
val checked_icon: String,
|
||||||
|
val is_power: Int,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class UserNobility(
|
||||||
|
val is_nobility: Int,
|
||||||
|
val nobility_type: String,
|
||||||
|
val noblity_end_time: Int,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class NobilityListBean(
|
||||||
|
val image: String, val name: String, val change_value: Int, val lid: Int
|
||||||
|
) : Serializable
|
||||||
|
|
||||||
|
data class NobilityInfoBean(
|
||||||
|
val nobility_info: NobilityInfo,
|
||||||
|
val nobility_power_list: List<NobilityPower>,
|
||||||
|
val user_nobility: UserNobility,
|
||||||
|
val user_nobility_end_time: Long
|
||||||
|
)
|
||||||
|
|
||||||
|
data class NobilityPayBean(
|
||||||
|
val order_id: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class MyRoomList(
|
||||||
|
val rid: Int,
|
||||||
|
val room_cover: String,
|
||||||
|
val room_name: String,
|
||||||
|
val room_number: Int,
|
||||||
|
val user_type: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data class WeekHomeBean(
|
||||||
|
val uid: String = "",
|
||||||
|
val receive_uid: String = "",
|
||||||
|
val total_gift_num: String = "",
|
||||||
|
val gid: String = "",
|
||||||
|
val gift_price: String = "",
|
||||||
|
val gift_name: String = "",
|
||||||
|
val head_pic: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
data class TopCpBean(
|
||||||
|
val u_head_pic: String = "",
|
||||||
|
val receive_head_pic: String = "",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,366 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.Typeface
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
|
import androidx.fragment.app.FragmentPagerAdapter
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.google.android.material.tabs.TabLayout
|
||||||
|
import com.youth.banner.BannerConfig
|
||||||
|
import com.yuyin.lib_base.App
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import com.yuyin.lib_base.adapter.MyPagerAdapter
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingFragment
|
||||||
|
import com.yuyin.lib_base.base.UserManager
|
||||||
|
import com.yuyin.lib_base.model.UserBean
|
||||||
|
import com.yuyin.lib_base.ui.X5WebViewActivity
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.lib_base.view.GlideImageLoader
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.FragmentCenterBinding
|
||||||
|
import com.yuyin.mier.module_home.cproom.CPRoomActivity
|
||||||
|
import com.yuyin.mier.module_home.model.BannerBean
|
||||||
|
import com.yuyin.mier.module_home.tab.center.sign.SginDialog
|
||||||
|
import com.yuyin.mier.module_home.tab.center.sign.SginSuccessDialog
|
||||||
|
import com.yuyin.mier.module_home.tab.center.sub.HomeRecomAdapter
|
||||||
|
import com.yuyin.mier.module_home.tab.center.sub.RoomListFragment
|
||||||
|
import com.yuyin.module_live.ui.rank.WeekRankActivity
|
||||||
|
import kotlinx.android.synthetic.main.fragment_center.*
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class CenterFragment : BaseDataBindingFragment<MainCenterViewModel, FragmentCenterBinding>() {
|
||||||
|
|
||||||
|
lateinit var adapter: HomeRecomAdapter
|
||||||
|
private val fsRes: ArrayList<Fragment> = ArrayList<Fragment>() //fragment集合
|
||||||
|
private val titleRes = ArrayList<String>() //tab标题集合
|
||||||
|
private var mUserBean: UserBean? = null
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
/*viewModel.TopCpBean.observe(this){
|
||||||
|
if(it!=null){
|
||||||
|
GlideUtil.loadImglogo(context as AppCompatActivity,it.u_head_pic,rv_nan)
|
||||||
|
GlideUtil.loadImglogo(context as AppCompatActivity,it.receive_head_pic,rv_nv)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
viewModel.WeekHomeList.observe(this){
|
||||||
|
if(it.size>0){
|
||||||
|
GlideUtil.loadImglogo(context as AppCompatActivity,it[0].head_pic,iv_week1)
|
||||||
|
}
|
||||||
|
if(it.size>1){
|
||||||
|
GlideUtil.loadImglogo(context as AppCompatActivity,it[1].head_pic,iv_week2)
|
||||||
|
}
|
||||||
|
if(it.size>2){
|
||||||
|
GlideUtil.loadImglogo(context as AppCompatActivity,it[2].head_pic,iv_week3)
|
||||||
|
}
|
||||||
|
if(it.size>3){
|
||||||
|
GlideUtil.loadImglogo(context as AppCompatActivity,it[3].head_pic,iv_week4)
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
viewModel.userInfoData.observe(this) {
|
||||||
|
mUserBean = it
|
||||||
|
}
|
||||||
|
viewModel.bannerListBean.observe(this) {
|
||||||
|
if (it == null) return@observe
|
||||||
|
initBanner(it)
|
||||||
|
}
|
||||||
|
viewModel.roomData.observe(requireActivity()) {
|
||||||
|
adapter.list.clear()
|
||||||
|
adapter.list.addAll(it)
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
viewModel.roomCategories.observe(this) {
|
||||||
|
titleRes.add("推荐")
|
||||||
|
fsRes.add(RoomListFragment.getInstance(Const.ROOM_TYPE_HOT, -1))
|
||||||
|
for (i in it.indices) {
|
||||||
|
titleRes.add(it[i].category_name)
|
||||||
|
fsRes.add(RoomListFragment.getInstance(Const.ROOM_TYPE_COMM, it[i].cate_id.toInt()))
|
||||||
|
}
|
||||||
|
// //设置数据
|
||||||
|
// mDataBinding.tabLayout.setTabData(titleRes.toTypedArray())
|
||||||
|
// mDataBinding.viewpager.adapter = MyPagerAdapter(
|
||||||
|
// childFragmentManager, fsRes
|
||||||
|
// )
|
||||||
|
mAdapter = MyPagerAdapter(childFragmentManager, fsRes, titleRes)
|
||||||
|
mDataBinding.viewpager.adapter = mAdapter
|
||||||
|
mDataBinding.tabLayout.setSelectedTabIndicatorHeight(0)
|
||||||
|
mDataBinding.tabLayout.setupWithViewPager(mDataBinding.viewpager)
|
||||||
|
mDataBinding.viewpager.offscreenPageLimit = fsRes.size
|
||||||
|
//设置自定义tab
|
||||||
|
setCustomViews()
|
||||||
|
mDataBinding.tabLayout.addOnTabSelectedListener(object :
|
||||||
|
TabLayout.OnTabSelectedListener {
|
||||||
|
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||||
|
val text = tab?.customView?.findViewById<TextView>(R.id.tv_name)
|
||||||
|
val v_view = tab?.customView?.findViewById<ImageView>(R.id.v_view)
|
||||||
|
text?.setTextColor(Color.parseColor("#333333"))
|
||||||
|
text?.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
|
||||||
|
text?.typeface = Typeface.DEFAULT_BOLD
|
||||||
|
v_view?.isSelected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTabUnselected(tab: TabLayout.Tab?) {
|
||||||
|
val text = tab?.customView?.findViewById<TextView>(R.id.tv_name)
|
||||||
|
val v_view = tab?.customView?.findViewById<ImageView>(R.id.v_view)
|
||||||
|
text?.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
|
||||||
|
text?.typeface = Typeface.DEFAULT
|
||||||
|
text?.setTextColor(Color.parseColor("#666666"))
|
||||||
|
v_view?.isSelected = false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTabReselected(tab: TabLayout.Tab?) {
|
||||||
|
// val text = tab?.customView?.findViewById<TextView>(R.id.tv_name)
|
||||||
|
// val v_view = tab?.customView?.findViewById<ImageView>(R.id.v_view)
|
||||||
|
// v_view?.isSelected = false
|
||||||
|
// text?.setTextColor(Color.parseColor("#666666"))
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
//设置自定义tab
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.roomRandom.observe(this) {
|
||||||
|
viewModel.enterRoom(it.rid, "", context as AppCompatActivity)
|
||||||
|
}
|
||||||
|
viewModel.signDayList.observe(this) {
|
||||||
|
if (it.today_sign == "2") { //未签到
|
||||||
|
SginDialog(context as AppCompatActivity,viewModel,it).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.signSucces.observe(this){
|
||||||
|
SginSuccessDialog(context as AppCompatActivity,viewModel,it.award).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun setCustomViews() {
|
||||||
|
val mSelectedTabPosition = mDataBinding.tabLayout.selectedTabPosition
|
||||||
|
for (i in titleRes.indices) {
|
||||||
|
mDataBinding.tabLayout.getTabAt(i)!!.customView = getTabView(i, mSelectedTabPosition)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun getTabView(index: Int, mSelectedTabPosition: Int): View {
|
||||||
|
//自定义View布局
|
||||||
|
val view: View = LayoutInflater.from(context).inflate(R.layout.item_tablayout_header3, null)
|
||||||
|
val title = view.findViewById<View>(R.id.tv_name) as TextView
|
||||||
|
val v_view = view.findViewById<ImageView>(R.id.v_view)
|
||||||
|
title.text = titleRes[index]
|
||||||
|
title.isSelected = index == mSelectedTabPosition
|
||||||
|
v_view.isSelected = index == mSelectedTabPosition
|
||||||
|
if (index == mSelectedTabPosition) {
|
||||||
|
title.setTextColor(Color.parseColor("#333333"))
|
||||||
|
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
|
||||||
|
title.typeface = Typeface.DEFAULT_BOLD
|
||||||
|
} else {
|
||||||
|
title.setTextColor(Color.parseColor("#666666"))
|
||||||
|
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14f)
|
||||||
|
title.typeface = Typeface.DEFAULT
|
||||||
|
}
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private lateinit var mAdapter: com.yuyin.lib_base.adapter.MyPagerAdapter
|
||||||
|
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_center
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
adapter = HomeRecomAdapter(activity, -2)
|
||||||
|
mDataBinding.rvView.adapter = adapter
|
||||||
|
val gridLayoutManager = LinearLayoutManager(activity, LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
mDataBinding.rvView.layoutManager = gridLayoutManager
|
||||||
|
adapter.setOnItemClickListener { bean, position ->
|
||||||
|
viewModel.enterRoom(bean.rid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
if(App.isShangJia){
|
||||||
|
iv_search.setImageResource(R.mipmap.search_ic2)
|
||||||
|
}else{
|
||||||
|
iv_search.setImageResource(R.mipmap.search_ic)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun resubData(cate_id: String) {
|
||||||
|
(fsRes[1] as RoomListFragment).resubData(cate_id)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
|
||||||
|
viewModel.loadRoomData(getMap())
|
||||||
|
viewModel.loadRoomCategories()
|
||||||
|
|
||||||
|
// viewModel.now_week_rank_four()
|
||||||
|
// viewModel.top_cp()
|
||||||
|
if (!App.isStart && requireActivity().intent.getStringExtra("quite_room") == null) {
|
||||||
|
viewModel.user_day_sign_log()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
viewModel.loadUserInfo()
|
||||||
|
viewModel.getBannerList()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
mDataBinding.ivXqf.setOnClickListener {
|
||||||
|
viewModel.now_room_category("37")
|
||||||
|
}
|
||||||
|
mDataBinding.ivJbt.setOnClickListener {
|
||||||
|
viewModel.now_room_category("19")
|
||||||
|
}
|
||||||
|
mDataBinding.ivYxt.setOnClickListener {
|
||||||
|
viewModel.now_room_category("35")
|
||||||
|
}
|
||||||
|
mDataBinding.ivCp.setOnClickListener {
|
||||||
|
val intent = Intent(activity, CPRoomActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
mDataBinding.ivWeek.setOnClickListener {
|
||||||
|
val intent = Intent(activity, WeekRankActivity::class.java)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
mDataBinding.ivRoom.setOnClickListener {
|
||||||
|
if (mUserBean == null) return@setOnClickListener
|
||||||
|
when (mUserBean!!.is_real) {
|
||||||
|
"2" -> ARouter.getInstance().build(AroutUtil.PLAY_REAL_NAME).navigation()
|
||||||
|
"1" -> {
|
||||||
|
if (mUserBean!!.rid == "0") {
|
||||||
|
"房间信息读取失败...".showToast()
|
||||||
|
} else {
|
||||||
|
viewModel.enterRoom(mUserBean!!.rid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"3" -> "实名认证审核中...".showToast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivSearch.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_SEARCH_MAIN).navigation()
|
||||||
|
}
|
||||||
|
mDataBinding.llSousuo.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_SEARCH_MAIN).navigation()
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivRank.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.LIVE_RANK).withInt("selectTab", 0).navigation()
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivNewRoom.setOnClickListener {
|
||||||
|
viewModel.now_room_category("18")
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivAuctionRoom.setOnClickListener {
|
||||||
|
viewModel.now_room_category("28")
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivKsong.setOnClickListener {
|
||||||
|
viewModel.now_room_category("27")
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivFriend.setOnClickListener {
|
||||||
|
viewModel.now_room_category("29")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initBanner(data: List<BannerBean>) {
|
||||||
|
val imgurls: MutableList<String> = ArrayList()
|
||||||
|
for (list in data) {
|
||||||
|
imgurls.add(list.image)
|
||||||
|
}
|
||||||
|
//设置图片加载器
|
||||||
|
mDataBinding.banner.setImageLoader(GlideImageLoader())
|
||||||
|
//设置图片集合
|
||||||
|
mDataBinding.banner.setImages(imgurls)
|
||||||
|
//设置指示器位置(当banner模式中有指示器时)
|
||||||
|
mDataBinding.banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR)
|
||||||
|
mDataBinding.banner.setIndicatorGravity(BannerConfig.CENTER)
|
||||||
|
//设置自动轮播,默认为true
|
||||||
|
mDataBinding.banner.isAutoPlay(true)
|
||||||
|
//banner设置方法全部调用完毕时最后调用
|
||||||
|
mDataBinding.banner.start()
|
||||||
|
mDataBinding.banner.setOnBannerListener {
|
||||||
|
when (data[it].type) {
|
||||||
|
"1" -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
"2" -> {
|
||||||
|
context?.let { it1 -> X5WebViewActivity.forward(it1, data[it].url, "") }
|
||||||
|
}
|
||||||
|
"3" -> {
|
||||||
|
viewModel.enterRoom(data[it].aid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
"4" -> {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", data[it].aid).navigation()
|
||||||
|
}
|
||||||
|
"5" -> {
|
||||||
|
context?.let { it1 ->
|
||||||
|
X5WebViewActivity.forward(
|
||||||
|
it1, data[it].url + "?login_token=" + UserManager.user.login_token, ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mDataBinding.banner.setOnClickListener {
|
||||||
|
when (data[0].type) {
|
||||||
|
"1" -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
"2" -> {
|
||||||
|
context?.let { it1 -> X5WebViewActivity.forward(it1, data[0].url, "") }
|
||||||
|
}
|
||||||
|
"3" -> {
|
||||||
|
viewModel.enterRoom(data[0].aid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
"4" -> {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", data[0].aid).navigation()
|
||||||
|
}
|
||||||
|
"5" -> {
|
||||||
|
context?.let { it1 ->
|
||||||
|
X5WebViewActivity.forward(
|
||||||
|
it1, data[0].url + "?login_token=" + UserManager.user.login_token, ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyPagerAdapter(fm: FragmentManager, private val fs: ArrayList<Fragment>) :
|
||||||
|
FragmentPagerAdapter(fm) {
|
||||||
|
override fun getCount(): Int = fs.size
|
||||||
|
|
||||||
|
override fun getItem(i: Int): Fragment {
|
||||||
|
return fs[i]
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getMap(): MutableMap<String, String> {
|
||||||
|
val map: MutableMap<String, String> = HashMap()
|
||||||
|
map["tid"] = Const.ROOM_TYPE
|
||||||
|
map["is_top"] = "2"
|
||||||
|
// map["is_hot"] = "2"
|
||||||
|
map["page"] = "1"
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,260 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import com.yuyin.mier.module_home.model.BannerBean
|
||||||
|
import com.yuyin.mier.module_home.model.RoomListBean
|
||||||
|
import com.yuyin.mier.repository.CommonRepository
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.lib_base.base.UserManager
|
||||||
|
import com.yuyin.lib_base.model.CategorRoomBean
|
||||||
|
import com.yuyin.lib_base.model.RankTopThreeBean
|
||||||
|
import com.yuyin.lib_base.model.Wxmodel
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.mier.module_home.model.DaySignBean
|
||||||
|
import com.yuyin.mier.module_home.model.MyRoomList
|
||||||
|
import com.yuyin.mier.module_home.model.SignSuccesBean
|
||||||
|
import com.yuyin.mier.module_home.model.TopCpBean
|
||||||
|
import com.yuyin.mier.module_home.model.WeekHomeBean
|
||||||
|
import com.yuyin.mier.module_my.model.InviteInfoBean
|
||||||
|
import com.yuyin.mier.module_my.model.RenewalAmountBean
|
||||||
|
import com.yuyin.mier.module_my.model.UserRoomVisitor
|
||||||
|
import com.yuyin.mier.module_my.model.VIPData
|
||||||
|
import com.yuyin.module_live.model.RankListBean
|
||||||
|
import com.yuyin.module_live.model.SignedArtistBean
|
||||||
|
import com.yuyin.module_live.repository.LiveRepository
|
||||||
|
|
||||||
|
class MainCenterViewModel : BaseViewModel() {
|
||||||
|
var repository = CommonRepository()
|
||||||
|
|
||||||
|
var rankTopThreeBean = MutableLiveData<RankTopThreeBean>()
|
||||||
|
|
||||||
|
var roomData = MutableLiveData<List<RoomListBean>>()
|
||||||
|
|
||||||
|
var roomData2 = MutableLiveData<List<RoomListBean>>()
|
||||||
|
|
||||||
|
var openVerify = MutableLiveData<Any>()
|
||||||
|
|
||||||
|
var roomCategories = MutableLiveData<List<CategorRoomBean>>()
|
||||||
|
fun loadRoomCategories() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.roomCategories(Const.ROOM_TYPE)
|
||||||
|
roomCategories.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadRoomData(map: MutableMap<String, String>) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.getRoomList(map)
|
||||||
|
roomData.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadRoomData2(map: MutableMap<String, String>) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.getRoomList(map)
|
||||||
|
roomData2.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var bannerListBean = MutableLiveData<List<BannerBean>>()
|
||||||
|
fun getBannerList() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.get_banner_list()
|
||||||
|
bannerListBean.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun get_user_rank_top() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.get_user_rank_top()
|
||||||
|
rankTopThreeBean.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun user_open_verify_token() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.user_open_verify_token()
|
||||||
|
openVerify.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var liveRepository = LiveRepository()
|
||||||
|
var rankDataTop = MutableLiveData<List<RankListBean>>()
|
||||||
|
fun loadRankData(rid: String, time: String, type: String) {
|
||||||
|
launchUI {
|
||||||
|
val result = liveRepository.get_room_rank(rid, time, type)
|
||||||
|
rankDataTop.value = result.data.list
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val vipData = MutableLiveData<VIPData>()
|
||||||
|
fun get_vip_list() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.get_vip_list()
|
||||||
|
vipData.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun pay_vip_order(
|
||||||
|
vid: String, pay_type: String
|
||||||
|
) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.pay_vip_order(vid, pay_type)
|
||||||
|
result.msg.showToast()
|
||||||
|
get_vip_list()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var sendCodeClick: MutableLiveData<Boolean> = MutableLiveData(true)
|
||||||
|
|
||||||
|
var sendCode: MutableLiveData<String> = MutableLiveData()
|
||||||
|
|
||||||
|
var phone: MutableLiveData<String> = MutableLiveData()
|
||||||
|
var code: MutableLiveData<String> = MutableLiveData()
|
||||||
|
|
||||||
|
fun verification(captcha_code: String, captcha_key: String) {
|
||||||
|
if (phone.value.isNullOrEmpty()) {
|
||||||
|
"请输入手机号".showToast()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (sendCodeClick.value == false) return
|
||||||
|
sendCodeClick.value = false
|
||||||
|
sendCode.value = "发送"
|
||||||
|
launchUI {
|
||||||
|
val result = repository.verification(phone.value.toString(), "2",captcha_code,captcha_key)
|
||||||
|
result.msg.showToast()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val inviteInfoBean = MutableLiveData<InviteInfoBean>()
|
||||||
|
fun get_update_invite_info() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.get_update_invite_info()
|
||||||
|
inviteInfoBean.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var weixin = MutableLiveData<Wxmodel>()
|
||||||
|
var alipay = MutableLiveData<String>()
|
||||||
|
|
||||||
|
fun update_user_inviter(
|
||||||
|
user_id: String, sms_code: String, pay_type: String
|
||||||
|
) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.update_user_inviter(user_id, sms_code, pay_type)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val roomRandom = MutableLiveData<UserRoomVisitor>()
|
||||||
|
fun now_room_category(rid: String) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.now_room_category(rid)
|
||||||
|
roomRandom.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var renewalAmountBean = MutableLiveData<RenewalAmountBean>()
|
||||||
|
fun user_renewal_contract_status(id: String) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.user_renewal_contract_status(id)
|
||||||
|
result.data.id = id
|
||||||
|
renewalAmountBean.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun user_renewal_contract(id: String) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.user_renewal_contract(id)
|
||||||
|
result.data
|
||||||
|
get_user_contract_list(UserManager.user.uid.toString(), "1", "20")
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val signedArtist = MutableLiveData<List<SignedArtistBean>>()
|
||||||
|
fun get_user_contract_list(
|
||||||
|
uid: String, page: String, page_limit: String
|
||||||
|
) {
|
||||||
|
|
||||||
|
launchUI {
|
||||||
|
val result = liveRepository.get_user_contract_list(uid, page, page_limit)
|
||||||
|
signedArtist.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun user_cancel_contract(id: String, uid: String) {
|
||||||
|
launchUI {
|
||||||
|
repository.user_cancel_contract(id)
|
||||||
|
get_user_contract_list(uid, "1", "20")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val myRoomList = MutableLiveData<ArrayList<MyRoomList>>()
|
||||||
|
fun get_user_room_power_list() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.get_user_room_power_list()
|
||||||
|
myRoomList.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun user_retire_room_power(rid: String, user_type: String) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.user_retire_room_power(rid, user_type)
|
||||||
|
get_user_room_power_list()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val WeekHomeList = MutableLiveData<ArrayList<WeekHomeBean>>()
|
||||||
|
fun now_week_rank_four() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.now_week_rank_four()
|
||||||
|
WeekHomeList.value=result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val TopCpBean = MutableLiveData<TopCpBean>()
|
||||||
|
fun top_cp() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.top_cp()
|
||||||
|
TopCpBean.value=result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var signDayList = MutableLiveData<DaySignBean>()
|
||||||
|
var signSucces = MutableLiveData<SignSuccesBean>()
|
||||||
|
fun user_day_sign_log() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.user_day_sign_log()
|
||||||
|
signDayList.value=result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var signDayList2 = MutableLiveData<DaySignBean>()
|
||||||
|
fun user_day_sign_log2() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.user_day_sign_log()
|
||||||
|
signDayList2.value=result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun user_day_sign() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.user_day_sign()
|
||||||
|
signSucces.value=result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center.sign
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.DialogSignBinding
|
||||||
|
import com.yuyin.mier.module_home.model.DaySignBean
|
||||||
|
import com.yuyin.mier.module_home.tab.center.MainCenterViewModel
|
||||||
|
import kotlinx.android.synthetic.main.day_sgin.view.*
|
||||||
|
import kotlinx.android.synthetic.main.day_sgin2.view.*
|
||||||
|
|
||||||
|
class SginDialog(context: Context, val main: MainCenterViewModel, val it: DaySignBean) :
|
||||||
|
Dialog(context) {
|
||||||
|
|
||||||
|
private lateinit var mBinding: DialogSignBinding
|
||||||
|
|
||||||
|
init {
|
||||||
|
initDailog(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initDailog(context: Context) {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_sign, null, false)
|
||||||
|
setContentView(mBinding.getRoot())
|
||||||
|
val win = this.window
|
||||||
|
val params = win!!.attributes
|
||||||
|
params.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
params.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
params.gravity = Gravity.CENTER
|
||||||
|
params.horizontalMargin = 10f
|
||||||
|
win.attributes = params
|
||||||
|
win.setBackgroundDrawable(context.resources.getDrawable(com.yuyin.lib_base.R.color.translant))
|
||||||
|
|
||||||
|
mBinding.tvSignTime.text = "已累计签到" + it.sign_num + "天"
|
||||||
|
if (it.today_sign == "1") {
|
||||||
|
mBinding.btnSign.setImageResource(R.mipmap.sign_icon7)
|
||||||
|
} else {
|
||||||
|
mBinding.btnSign.setImageResource(R.mipmap.sign_icon5)
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.day1.tv_day.text = "1"
|
||||||
|
mBinding.day1.tv_sigin_price.text = it.sign_log[0].award + "金币"
|
||||||
|
// mBinding.day1.sign_now.visibility = if (it.sign_log[0].is_sign == 1) View.VISIBLE else View.GONE
|
||||||
|
mBinding.day1.ll_sign.isSelected = if (it.sign_log[0].is_sign == 1) true else false
|
||||||
|
|
||||||
|
mBinding.day2.tv_day.text = "2"
|
||||||
|
mBinding.day2.tv_sigin_price.text = it.sign_log[1].award + "金币"
|
||||||
|
// mBinding.day2.sign_now.visibility = if (it.sign_log[1].is_sign == 1) View.VISIBLE else View.GONE
|
||||||
|
mBinding.day2.ll_sign.isSelected = if (it.sign_log[1].is_sign == 1) true else false
|
||||||
|
|
||||||
|
mBinding.day3.tv_day.text = "3"
|
||||||
|
mBinding.day3.tv_sigin_price.text = it.sign_log[2].award + "金币"
|
||||||
|
// mBinding.day3.sign_now.visibility = if (it.sign_log[2].is_sign == 1) View.VISIBLE else View.GONE
|
||||||
|
mBinding.day3.ll_sign.isSelected = if (it.sign_log[2].is_sign == 1) true else false
|
||||||
|
|
||||||
|
mBinding.day4.tv_day.text = "4"
|
||||||
|
mBinding.day4.tv_sigin_price.text = it.sign_log[3].award + "金币"
|
||||||
|
// mBinding.day4.sign_now.visibility = if (it.sign_log[3].is_sign == 1) View.VISIBLE else View.GONE
|
||||||
|
mBinding.day4.ll_sign.isSelected = if (it.sign_log[3].is_sign == 1) true else false
|
||||||
|
|
||||||
|
mBinding.day5.tv_day.text = "5"
|
||||||
|
mBinding.day5.tv_sigin_price.text = it.sign_log[4].award + "金币"
|
||||||
|
// mBinding.day5.sign_now.visibility = if (it.sign_log[4].is_sign == 1) View.VISIBLE else View.GONE
|
||||||
|
mBinding.day5.ll_sign.isSelected = if (it.sign_log[4].is_sign == 1) true else false
|
||||||
|
|
||||||
|
mBinding.day6.tv_day.text = "6"
|
||||||
|
mBinding.day6.tv_sigin_price.text = it.sign_log[5].award + "金币"
|
||||||
|
// mBinding.day6.sign_now.visibility = if (it.sign_log[5].is_sign == 1) View.VISIBLE else View.GONE
|
||||||
|
mBinding.day6.ll_sign.isSelected = if (it.sign_log[5].is_sign == 1) true else false
|
||||||
|
|
||||||
|
mBinding.day7.tv_day2.text = "7"
|
||||||
|
mBinding.day7.tv_sigin_price2.text = it.sign_log[6].award + "金币"
|
||||||
|
|
||||||
|
if (it.sign_log[6].is_sign == 1){
|
||||||
|
mBinding.day7.tv_sigin_price2.setTextColor(Color.parseColor("#FFFFFF"))
|
||||||
|
// mBinding.day7.sign_now2.visibility = View.VISIBLE
|
||||||
|
mBinding.day7.ll_sign2.isSelected = true
|
||||||
|
}else{
|
||||||
|
mBinding.day7.tv_sigin_price2.setTextColor(Color.parseColor("#333333"))
|
||||||
|
// mBinding.day7.sign_now2.visibility = View.GONE
|
||||||
|
mBinding.day7.ll_sign2.isSelected = false
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.btnSign.setOnClickListener { its ->
|
||||||
|
dismiss()
|
||||||
|
if (it.today_sign == "2") {
|
||||||
|
main.user_day_sign()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center.sign
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.DialogSignSuccesBinding
|
||||||
|
import com.yuyin.mier.module_home.tab.center.MainCenterViewModel
|
||||||
|
|
||||||
|
class SginSuccessDialog(context: Context, val main: MainCenterViewModel, val award:String) :
|
||||||
|
Dialog(context) {
|
||||||
|
private lateinit var mBinding: DialogSignSuccesBinding
|
||||||
|
init {
|
||||||
|
initDailog(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initDailog(context: Context) {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_sign_succes, null, false)
|
||||||
|
setContentView(mBinding.getRoot())
|
||||||
|
val win = this.window
|
||||||
|
val params = win!!.attributes
|
||||||
|
params.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
params.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
params.gravity = Gravity.CENTER
|
||||||
|
win.attributes = params
|
||||||
|
win.setBackgroundDrawable(context.resources.getDrawable(com.yuyin.lib_base.R.color.translant))
|
||||||
|
mBinding.tvSignPrice.text="签到成功 金币"+award
|
||||||
|
mBinding!!.btnSign.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center.sub;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.yuyin.lib_base.adapter.RefreshAdapter;
|
||||||
|
import com.yuyin.mier.R;
|
||||||
|
import com.yuyin.mier.module_home.model.RoomListBean;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class HomeRecomAdapter extends RefreshAdapter<RoomListBean> {
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
|
||||||
|
private int TYPE_N = -2;
|
||||||
|
public int TYPE_O = -3;
|
||||||
|
private int type = 0;
|
||||||
|
|
||||||
|
private View.OnClickListener mOnClickListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param context
|
||||||
|
* @param type -1全部0推荐1热门2其它(目前包含-1,0)
|
||||||
|
*/
|
||||||
|
public HomeRecomAdapter(Context context, int type) {
|
||||||
|
super(context);
|
||||||
|
this.context = context;
|
||||||
|
this.type = type;
|
||||||
|
mOnClickListener = new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (!canClick()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Object tag = v.getTag();
|
||||||
|
if (tag != null) {
|
||||||
|
int position = (int) tag;
|
||||||
|
if (mOnItemClickListener != null) {
|
||||||
|
mOnItemClickListener.onItemClick(mList.get(position), position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
if (viewType == TYPE_N)
|
||||||
|
return new Vh(mInflater.inflate(R.layout.item_main_home_recom_hot2, parent, false), viewType);
|
||||||
|
return new Vh(mInflater.inflate(R.layout.item_main_home_recom_hot, parent, false), viewType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(RecyclerView.ViewHolder vh, int position) {
|
||||||
|
((Vh) vh).setData(mList.get(position), position);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Vh extends RecyclerView.ViewHolder {
|
||||||
|
int viewType;
|
||||||
|
ImageView mCover, riv;
|
||||||
|
TextView tv_title, tv_title2;
|
||||||
|
TextView tv_num;
|
||||||
|
TextView tv_type, tv_id, tv_vis_num,tv_name;
|
||||||
|
View iv_lianghao;
|
||||||
|
RecyclerView riv_person;
|
||||||
|
|
||||||
|
|
||||||
|
public Vh(View itemView, int viewType) {
|
||||||
|
super(itemView);
|
||||||
|
this.viewType = viewType;
|
||||||
|
mCover = itemView.findViewById(R.id.cover);
|
||||||
|
riv = itemView.findViewById(R.id.riv);
|
||||||
|
tv_title = itemView.findViewById(R.id.tv_title);
|
||||||
|
tv_title2 = itemView.findViewById(R.id.tv_title2);
|
||||||
|
tv_num = itemView.findViewById(R.id.tv_num);
|
||||||
|
tv_type = itemView.findViewById(R.id.tv_type);
|
||||||
|
tv_id = itemView.findViewById(R.id.tv_id);
|
||||||
|
iv_lianghao = itemView.findViewById(R.id.iv_lianghao);
|
||||||
|
tv_vis_num = itemView.findViewById(R.id.tv_vis_num);
|
||||||
|
riv_person = itemView.findViewById(R.id.riv_person);
|
||||||
|
tv_name = itemView.findViewById(R.id.tv_name);
|
||||||
|
itemView.setOnClickListener(mOnClickListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setData(RoomListBean bean, int position) {
|
||||||
|
itemView.setTag(position);
|
||||||
|
/*int sss = new Random().nextInt(4);
|
||||||
|
int[] bg22 = {R.mipmap.home_list_img21, R.mipmap.home_list_img22, R.mipmap.home_list_img23,
|
||||||
|
R.mipmap.home_list_img24, R.mipmap.home_list_img25, R.mipmap.home_list_img26,
|
||||||
|
R.mipmap.home_list_img27, R.mipmap.home_list_img28, R.mipmap.home_list_img29};
|
||||||
|
|
||||||
|
if (bean.getCategory_name().equals("交友")) {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[0]));
|
||||||
|
tv_type.setText("");
|
||||||
|
} else if (bean.getCategory_name().equals("点歌")) {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[1]));
|
||||||
|
tv_type.setText("");
|
||||||
|
} else if (bean.getCategory_name().equals("相亲")) {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[2]));
|
||||||
|
tv_type.setText("");
|
||||||
|
} else if (bean.getCategory_name().equals("游戏")) {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[3]));
|
||||||
|
tv_type.setText("");
|
||||||
|
} else if (bean.getCategory_name().equals("酒吧")) {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[4]));
|
||||||
|
tv_type.setText("");
|
||||||
|
} else if (bean.getCategory_name().equals("互娱")) {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[5]));
|
||||||
|
tv_type.setText("");
|
||||||
|
} else if (bean.getCategory_name().equals("拍卖")) {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[6]));
|
||||||
|
tv_type.setText("");
|
||||||
|
} else if (bean.getCategory_name().equals("K歌")) {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[7]));
|
||||||
|
tv_type.setText("");
|
||||||
|
} else {
|
||||||
|
tv_type.setBackground(mContext.getResources().getDrawable(bg22[8]));
|
||||||
|
tv_type.setText("" + bean.getCategory_name());
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (tv_type!= null) tv_type.setText("" + bean.getCategory_name());
|
||||||
|
|
||||||
|
if (tv_id != null) {
|
||||||
|
// if (bean.getSpecial_uid() == 0) {
|
||||||
|
// iv_lianghao.setVisibility(View.GONE);
|
||||||
|
tv_id.setText(bean.getRoom_number());
|
||||||
|
// } else {
|
||||||
|
// iv_lianghao.setVisibility(View.VISIBLE);
|
||||||
|
// tv_id.setText("ID:" + bean.getSpecial_uid());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
if (riv != null) {
|
||||||
|
Glide.with(context).load(bean.getHead_pic()).into(riv);
|
||||||
|
}
|
||||||
|
if (mCover != null)
|
||||||
|
Glide.with(context).load(bean.getRoom_cover())
|
||||||
|
.error(R.mipmap.ic_launcher_app).into(mCover);
|
||||||
|
if (tv_title2 != null) tv_title2.setText("" + bean.getCategory_name());
|
||||||
|
if (tv_num != null) tv_num.setText("" + bean.getHot_value());
|
||||||
|
if (tv_title != null) tv_title.setText("" + bean.getRoom_name());
|
||||||
|
if (tv_vis_num != null) tv_vis_num.setText(bean.getVisitor_num() + "人");
|
||||||
|
|
||||||
|
if (tv_name != null) tv_name.setText(bean.getNick_name());
|
||||||
|
|
||||||
|
if (riv_person != null) {
|
||||||
|
LinearLayoutManager layoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, true);
|
||||||
|
riv_person.setLayoutManager(layoutManager);
|
||||||
|
|
||||||
|
PersonAdapter personAdapter = new PersonAdapter();
|
||||||
|
riv_person.setAdapter(personAdapter);
|
||||||
|
if (riv_person.getItemDecorationCount() == 0) {
|
||||||
|
riv_person.addItemDecoration(itemDecoration);
|
||||||
|
}
|
||||||
|
personAdapter.setNewData(bean.getRoom_micro_list());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RecyclerView.ItemDecoration itemDecoration = new RecyclerView.ItemDecoration() {
|
||||||
|
@Override
|
||||||
|
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||||
|
if (parent.getChildPosition(view) != 0) {
|
||||||
|
outRect.right = -15;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center.sub
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.Mic
|
||||||
|
|
||||||
|
class PersonAdapter :
|
||||||
|
BaseQuickAdapter<Mic, BaseViewHolder>(R.layout.item_person, arrayListOf()) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: Mic) {
|
||||||
|
// helper
|
||||||
|
// .setText(R.id.tv_name, item.send_user_info.nick_name)
|
||||||
|
Glide.with(mContext).load(item.head_pic).error(R.mipmap.ic_launcher_app)
|
||||||
|
.placeholder(R.mipmap.ic_launcher_app).into(helper.getView(R.id.head))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center.sub
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingFragment
|
||||||
|
import com.yuyin.lib_base.view.ItemDecoration
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.FragmentRoomListBinding
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class RoomListFragment : BaseDataBindingFragment<RoomListViewModel, FragmentRoomListBinding>() {
|
||||||
|
var cateId: String = ""
|
||||||
|
lateinit var adapter: HomeRecomAdapter
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getInstance(tag_type: Int, cateId: Int): RoomListFragment {
|
||||||
|
val fragment = RoomListFragment()
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putInt("tag_type", tag_type)
|
||||||
|
bundle.putInt("cateId", cateId)
|
||||||
|
fragment.arguments = bundle
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.roomData.observe(requireActivity(), {
|
||||||
|
if (page == 1)
|
||||||
|
adapter.list.clear()
|
||||||
|
adapter.list.addAll(it)
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
})
|
||||||
|
viewModel.getFinally().observe(requireActivity(), {
|
||||||
|
mDataBinding.srlView.finishLoadMore()
|
||||||
|
mDataBinding.srlView.finishRefresh()
|
||||||
|
})
|
||||||
|
// viewModel.roomCategories.observe(this, {
|
||||||
|
// cateId = it[0].cate_id
|
||||||
|
// viewModel.loadRoomData(getMap())
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
fun resubData(cate_id: String) {
|
||||||
|
cateId = cate_id
|
||||||
|
viewModel.loadRoomData(getMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_room_list
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
page = 1
|
||||||
|
viewModel.loadRoomData(getMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
val type = requireArguments().getInt("tag_type")
|
||||||
|
adapter = HomeRecomAdapter(activity, -3)
|
||||||
|
// val decoration = ItemDecoration(context, 0x00000000, 7F, 7F)
|
||||||
|
// decoration.isOnlySetItemOffsetsButNoDraw = true
|
||||||
|
// mDataBinding.rvView.addItemDecoration(decoration)
|
||||||
|
|
||||||
|
mDataBinding.rvView.adapter = adapter
|
||||||
|
val gridLayoutManager = GridLayoutManager(this.context, 2)
|
||||||
|
// gridLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
|
||||||
|
// override fun getSpanSize(position: Int): Int {
|
||||||
|
// if (position < 6) {
|
||||||
|
// return 2
|
||||||
|
// }
|
||||||
|
//// if (position < 10) {
|
||||||
|
//// return 4
|
||||||
|
//// }
|
||||||
|
// return 3
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
mDataBinding.rvView.layoutManager = gridLayoutManager
|
||||||
|
if (mDataBinding.rvView.itemDecorationCount == 0) {
|
||||||
|
mDataBinding.rvView.addItemDecoration(ItemDecoration(context, 0x00000000, 7F, 10F))
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter.setOnItemClickListener { bean, position ->
|
||||||
|
viewModel.enterRoom(bean.rid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == Const.ROOM_TYPE_HOT) {
|
||||||
|
// mDataBinding.ivRightShow.visibility = View.GONE
|
||||||
|
viewModel.loadRoomData(getMap())
|
||||||
|
} else {
|
||||||
|
// mDataBinding.ivRightShow.visibility = View.VISIBLE
|
||||||
|
// viewModel.loadRoomCategories()
|
||||||
|
viewModel.loadRoomData(getMap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
|
||||||
|
|
||||||
|
mDataBinding.srlView.setOnRefreshLoadMoreListener(object : OnRefreshLoadMoreListener {
|
||||||
|
override fun onRefresh(refreshLayout: RefreshLayout) {
|
||||||
|
page = 1
|
||||||
|
viewModel.loadRoomData(getMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadMore(refreshLayout: RefreshLayout) {
|
||||||
|
page++
|
||||||
|
viewModel.loadRoomData(getMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var page = 1
|
||||||
|
private fun getMap(): MutableMap<String, String> {
|
||||||
|
val map: MutableMap<String, String> = HashMap()
|
||||||
|
val type = requireArguments().getInt("tag_type")
|
||||||
|
cateId = requireArguments().getInt("cateId").toString()
|
||||||
|
map["tid"] = Const.ROOM_TYPE
|
||||||
|
when (type) {
|
||||||
|
Const.ROOM_TYPE_ALL -> {
|
||||||
|
}
|
||||||
|
|
||||||
|
Const.ROOM_TYPE_TOP -> {
|
||||||
|
map["is_top"] = "2"
|
||||||
|
}
|
||||||
|
|
||||||
|
Const.ROOM_TYPE_HOT -> {
|
||||||
|
map["is_hot"] = "2"
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
if (cateId != "-1")
|
||||||
|
map["cate_id"] = cateId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map["page"] = page.toString()
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center.sub
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.lib_base.model.CategorRoomBean
|
||||||
|
import com.yuyin.mier.module_home.model.BannerBean
|
||||||
|
import com.yuyin.mier.module_home.model.RoomListBean
|
||||||
|
import com.yuyin.mier.repository.CommonRepository
|
||||||
|
|
||||||
|
class RoomListViewModel : BaseViewModel() {
|
||||||
|
var repository = CommonRepository()
|
||||||
|
|
||||||
|
var roomData = MutableLiveData<List<RoomListBean>>()
|
||||||
|
fun loadRoomData(map: MutableMap<String, String>) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.getRoomList(map)
|
||||||
|
roomData.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var roomData2 = MutableLiveData<List<RoomListBean>>()
|
||||||
|
fun loadRoomData2(map: MutableMap<String, String>) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.getRoomList(map)
|
||||||
|
roomData2.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var roomData3 = MutableLiveData<List<RoomListBean>>()
|
||||||
|
fun loadRoomData3(map: MutableMap<String, String>) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.getRoomList(map)
|
||||||
|
roomData3.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var roomCategories = MutableLiveData<List<CategorRoomBean>>()
|
||||||
|
fun loadRoomCategories() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.roomCategories(Const.ROOM_TYPE)
|
||||||
|
roomCategories.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var bannerListBean = MutableLiveData<List<BannerBean>>()
|
||||||
|
fun getBannerList() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.get_banner_list()
|
||||||
|
bannerListBean.value = result.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,230 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.center.sub
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.youth.banner.BannerConfig
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import com.yuyin.lib_base.adapter.MyPagerAdapter
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModelFragment
|
||||||
|
import com.yuyin.lib_base.ui.X5WebViewActivity
|
||||||
|
import com.yuyin.lib_base.view.GlideImageLoader
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.BannerBean
|
||||||
|
import kotlinx.android.synthetic.main.fragment_room_type.*
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class RoomTypeFragment : BaseViewModelFragment<RoomListViewModel>() {
|
||||||
|
lateinit var adapter2: HomeRecomAdapter
|
||||||
|
lateinit var adapter: HomeRecomAdapter
|
||||||
|
private val fsRes: ArrayList<Fragment> = ArrayList<Fragment>() //fragment集合
|
||||||
|
private val titleRes = ArrayList<String>() //tab标题集合
|
||||||
|
private lateinit var mAdapter: MyPagerAdapter
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_room_type
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
adapter2 = HomeRecomAdapter(activity, 0)
|
||||||
|
rv_view2.adapter = adapter2
|
||||||
|
val gridLayoutManager2 = LinearLayoutManager(activity, RecyclerView.HORIZONTAL,false)
|
||||||
|
rv_view2.layoutManager = gridLayoutManager2
|
||||||
|
adapter2.setOnItemClickListener { bean, position ->
|
||||||
|
viewModel.enterRoom(bean.rid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
|
||||||
|
adapter = HomeRecomAdapter(activity, -3)
|
||||||
|
rv_view.adapter = adapter
|
||||||
|
val gridLayoutManager = GridLayoutManager(activity,2)
|
||||||
|
rv_view.layoutManager = gridLayoutManager
|
||||||
|
adapter.setOnItemClickListener { bean, position ->
|
||||||
|
viewModel.enterRoom(bean.rid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
// viewModel.loadRoomCategories()
|
||||||
|
viewModel.getBannerList()
|
||||||
|
viewModel.loadRoomData2(getMap1())
|
||||||
|
viewModel.loadRoomData3(getMap2())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun initBanner(data: List<BannerBean>) {
|
||||||
|
val imgurls: MutableList<String> = ArrayList()
|
||||||
|
for (list in data) {
|
||||||
|
imgurls.add(list.image)
|
||||||
|
}
|
||||||
|
//设置图片加载器
|
||||||
|
banner.setImageLoader(GlideImageLoader())
|
||||||
|
//设置图片集合
|
||||||
|
banner.setImages(imgurls)
|
||||||
|
//设置指示器位置(当banner模式中有指示器时)
|
||||||
|
banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR)
|
||||||
|
banner.setIndicatorGravity(BannerConfig.CENTER)
|
||||||
|
//设置自动轮播,默认为true
|
||||||
|
banner.isAutoPlay(true)
|
||||||
|
//banner设置方法全部调用完毕时最后调用
|
||||||
|
banner.start()
|
||||||
|
banner.setOnBannerListener {
|
||||||
|
when (data[it].type) {
|
||||||
|
"1" -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
"2" -> {
|
||||||
|
context?.let { it1 -> X5WebViewActivity.forward(it1, data[it].url, "") }
|
||||||
|
}
|
||||||
|
"3" -> {
|
||||||
|
viewModel.enterRoom(data[it].aid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
"4" -> {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", data[it].aid)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
banner.setOnClickListener {
|
||||||
|
when (data[0].type) {
|
||||||
|
"1" -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
"2" -> {
|
||||||
|
context?.let { it1 -> X5WebViewActivity.forward(it1, data[0].url, "") }
|
||||||
|
}
|
||||||
|
"3" -> {
|
||||||
|
viewModel.enterRoom(data[0].aid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
"4" -> {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", data[0].aid)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.roomData2.observe(requireActivity(), {
|
||||||
|
adapter2.list.clear()
|
||||||
|
adapter2.list.addAll(it)
|
||||||
|
adapter2.notifyDataSetChanged()
|
||||||
|
})
|
||||||
|
viewModel.roomData3.observe(requireActivity(), {
|
||||||
|
adapter.list.clear()
|
||||||
|
adapter.list.addAll(it)
|
||||||
|
adapter.notifyDataSetChanged()
|
||||||
|
})
|
||||||
|
viewModel.bannerListBean.observe(this, {
|
||||||
|
if (it == null) return@observe
|
||||||
|
initBanner(it)
|
||||||
|
})
|
||||||
|
viewModel.roomCategories.observe(this, {
|
||||||
|
titleRes.add("热门")
|
||||||
|
fsRes.add(RoomListFragment.getInstance(Const.ROOM_TYPE_HOT, -1))
|
||||||
|
// for(i in it.indices){
|
||||||
|
// titleRes.add(it[i].category_name)
|
||||||
|
// fsRes.add(RoomListFragment.getInstance(Const.ROOM_TYPE_COMM,it[i].cate_id.toInt()))
|
||||||
|
// }
|
||||||
|
mAdapter = MyPagerAdapter(childFragmentManager, fsRes, titleRes)
|
||||||
|
|
||||||
|
// view_pager.adapter = mAdapter
|
||||||
|
// tabLayout.setupWithViewPager(view_pager)
|
||||||
|
// view_pager.offscreenPageLimit = fsRes.size
|
||||||
|
// //设置自定义tab
|
||||||
|
// setCustomViews()
|
||||||
|
|
||||||
|
view_pager.adapter = mAdapter
|
||||||
|
tabLayout.setViewPager(view_pager)
|
||||||
|
tabLayout.setSnapOnTabClick(true)
|
||||||
|
view_pager.offscreenPageLimit = fsRes.size
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 热门,房间
|
||||||
|
// */
|
||||||
|
// private void loadRecommentData() {
|
||||||
|
// //热门推荐
|
||||||
|
// RxUtils.loading(commonModel.is_popular(), this)
|
||||||
|
// .subscribe(new ErrorHandleSubscriber<RecommenRoomBean>(mErrorHandler) {
|
||||||
|
// @Override
|
||||||
|
// public void onNext(RecommenRoomBean categorRoomBean) {
|
||||||
|
// RecomFragment recomFragment = (RecomFragment) mFragments.get(0);
|
||||||
|
// recomFragment.setPopularData(categorRoomBean);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// //密聊推荐
|
||||||
|
// RxUtils.loading(commonModel.secret_chat(), this)
|
||||||
|
// .subscribe(new ErrorHandleSubscriber<RecommenRoomBean>(mErrorHandler) {
|
||||||
|
// @Override
|
||||||
|
// public void onNext(RecommenRoomBean categorRoomBean) {
|
||||||
|
// RecomFragment recomFragment = (RecomFragment) mFragments.get(0);
|
||||||
|
// recomFragment.setSecretData(categorRoomBean);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
/**
|
||||||
|
* 设置每个TabLayout的自定义View
|
||||||
|
* 注意:TabLayout和Viewpager配合使用的时候必须先mViewPager.setAdapter(),再初始化该方法,然后addOnTabSelectedListener;因为adapter刷新会让mCustomViewView空,
|
||||||
|
*/
|
||||||
|
fun setCustomViews() {
|
||||||
|
// val mSelectedTabPosition = tabLayout.selectedTabPosition
|
||||||
|
// for (i in titleRes.indices) {
|
||||||
|
// tabLayout.getTabAt(i)!!.customView = getTabView(i, mSelectedTabPosition)
|
||||||
|
// // if (i == mSelectedTabPosition) {
|
||||||
|
//// changeTabSelect(mTab);
|
||||||
|
//// } else {
|
||||||
|
//// changeTabNormal(mTab);
|
||||||
|
//// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提供TabLayout的View
|
||||||
|
* 根据index返回不同的View
|
||||||
|
* 主意:默认选中的View要返回选中状态的样式
|
||||||
|
*/
|
||||||
|
private fun getTabView(index: Int, mSelectedTabPosition: Int): View? {
|
||||||
|
//自定义View布局
|
||||||
|
val view: View = LayoutInflater.from(context).inflate(R.layout.item_tablayout_header, null)
|
||||||
|
val title = view.findViewById<View>(R.id.tv_name) as TextView
|
||||||
|
val v_view = view.findViewById<View>(R.id.v_view)
|
||||||
|
title.text = titleRes.get(index)
|
||||||
|
title.isSelected = index == mSelectedTabPosition
|
||||||
|
v_view.isSelected = index == mSelectedTabPosition
|
||||||
|
title.textSize = if (index == mSelectedTabPosition) 14f else 14f
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
var page = 1
|
||||||
|
|
||||||
|
private fun getMap1(): MutableMap<String, String> {
|
||||||
|
val map: MutableMap<String, String> = HashMap()
|
||||||
|
map["tid"] = Const.ROOM_TYPE
|
||||||
|
map["is_top"] = "2"
|
||||||
|
// map["is_hot"] = "2"
|
||||||
|
map["page"] = page.toString()
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
private fun getMap2(): MutableMap<String, String> {
|
||||||
|
val map: MutableMap<String, String> = HashMap()
|
||||||
|
map["tid"] = Const.ROOM_TYPE
|
||||||
|
// map["is_top"] = "2"
|
||||||
|
map["is_hot"] = "2"
|
||||||
|
map["page"] = page.toString()
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.dynamic
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.Typeface
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.viewpager.widget.ViewPager
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.flyco.tablayout.listener.CustomTabEntity
|
||||||
|
import com.flyco.tablayout.listener.OnTabSelectListener
|
||||||
|
import com.yuyin.lib_base.adapter.MyPagerAdapter
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModelFragment
|
||||||
|
import com.yuyin.module_community.ui.main.DynamicFragment
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import kotlinx.android.synthetic.main.fragment_community.*
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class MainCommunityFragment : BaseViewModelFragment<BaseViewModel>() {
|
||||||
|
|
||||||
|
|
||||||
|
private val fsRes: ArrayList<Fragment> = ArrayList<Fragment>() //fragment集合
|
||||||
|
private val titleRes = ArrayList<String>() //tab标题集合
|
||||||
|
private val dataTab: MutableList<CustomTabEntity> =
|
||||||
|
ArrayList<CustomTabEntity>() //CommonTabLayout 所需数据集合
|
||||||
|
|
||||||
|
private lateinit var mAdapter: MyPagerAdapter
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_community
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
titleRes.add("最新")
|
||||||
|
titleRes.add("推荐")
|
||||||
|
titleRes.add("关注")
|
||||||
|
|
||||||
|
// 初始化 Fragment
|
||||||
|
fsRes.add(DynamicFragment().getInstance("1"))
|
||||||
|
fsRes.add(DynamicFragment().getInstance("2"))
|
||||||
|
fsRes.add(DynamicFragment().getInstance("3"))
|
||||||
|
|
||||||
|
// 初始化图标
|
||||||
|
val icon1 = arrayOf(R.mipmap.zuiixn1, R.mipmap.tuijian1, R.mipmap.guanzhi1)
|
||||||
|
val icon2 = arrayOf(R.mipmap.zuiixn2, R.mipmap.tuijian2, R.mipmap.guanzhi2)
|
||||||
|
|
||||||
|
// 添加 Tab 数据
|
||||||
|
for (i in titleRes.indices) {
|
||||||
|
dataTab.add(object : CustomTabEntity {
|
||||||
|
override fun getTabTitle(): String = ""
|
||||||
|
override fun getTabSelectedIcon(): Int = icon1[i]
|
||||||
|
override fun getTabUnselectedIcon(): Int = icon2[i]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置 TabLayout 数据
|
||||||
|
tab_layout.setTabData(dataTab as ArrayList<CustomTabEntity>)
|
||||||
|
view_pager.offscreenPageLimit = dataTab.size
|
||||||
|
// 设置 ViewPager 适配器
|
||||||
|
mAdapter = MyPagerAdapter(childFragmentManager, fsRes, titleRes)
|
||||||
|
view_pager.adapter = mAdapter
|
||||||
|
|
||||||
|
// 手动实现联动
|
||||||
|
view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
||||||
|
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
|
||||||
|
override fun onPageScrollStateChanged(state: Int) {}
|
||||||
|
override fun onPageSelected(position: Int) {
|
||||||
|
tab_layout.currentTab = position
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// 设置 Tab 选择监听
|
||||||
|
tab_layout.setOnTabSelectListener(object : OnTabSelectListener {
|
||||||
|
override fun onTabSelect(position: Int) {
|
||||||
|
view_pager.currentItem = position
|
||||||
|
}
|
||||||
|
override fun onTabReselect(position: Int) {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
iv_fabu.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.COMMUNITY_FABU).navigation()
|
||||||
|
}
|
||||||
|
|
||||||
|
//TabLayout监听
|
||||||
|
tab_layout.setOnTabSelectListener(object : OnTabSelectListener {
|
||||||
|
override fun onTabSelect(position: Int) {
|
||||||
|
//显示相应的item界面
|
||||||
|
view_pager.currentItem = position
|
||||||
|
}
|
||||||
|
override fun onTabReselect(position: Int) {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun setCustomViews() {
|
||||||
|
/*val mSelectedTabPosition = tab_layout.selectedTabPosition
|
||||||
|
for (i in titleRes.indices) {
|
||||||
|
tab_layout.getTabAt(i)!!.customView = getTabView(i, mSelectedTabPosition)
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun getTabView(index: Int, mSelectedTabPosition: Int): View {
|
||||||
|
//自定义View布局
|
||||||
|
val view: View = LayoutInflater.from(context).inflate(R.layout.item_tablayout_header5, null)
|
||||||
|
val title = view.findViewById<View>(R.id.tv_name) as TextView
|
||||||
|
// val v_view = view.findViewById<ImageView>(R.id.v_view)
|
||||||
|
title.text = titleRes[index]
|
||||||
|
title.isSelected = index == mSelectedTabPosition
|
||||||
|
// v_view.isSelected = index == mSelectedTabPosition
|
||||||
|
if (index == mSelectedTabPosition) {
|
||||||
|
title.setTextColor(Color.parseColor("#111111"))
|
||||||
|
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20f)
|
||||||
|
title.typeface = Typeface.DEFAULT_BOLD
|
||||||
|
} else {
|
||||||
|
title.setTextColor(Color.parseColor("#666666"))
|
||||||
|
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
|
||||||
|
title.typeface = Typeface.DEFAULT
|
||||||
|
}
|
||||||
|
|
||||||
|
return view
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingFragment
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.adapter.RoomZoneListAdapter
|
||||||
|
import com.yuyin.mier.databinding.FragmentHomeBinding
|
||||||
|
import com.yuyin.mier.module_home.model.HomeScene
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
import org.greenrobot.eventbus.Subscribe
|
||||||
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
|
|
||||||
|
class HomeFragment : BaseDataBindingFragment<MainHomeViewModel, FragmentHomeBinding>() {
|
||||||
|
lateinit var roomZoneListAdapter: RoomZoneListAdapter
|
||||||
|
|
||||||
|
var age_type = ""
|
||||||
|
var sex_type = ""
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.getFinally().observe(this) {
|
||||||
|
mDataBinding.srlView.finishRefresh()
|
||||||
|
mDataBinding.srlView.finishLoadMore()
|
||||||
|
}
|
||||||
|
viewModel.roomZoneList.observe(this) {
|
||||||
|
if (page == 1) roomZoneListAdapter.data.clear()
|
||||||
|
roomZoneListAdapter.addData(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var type = "1"
|
||||||
|
private var page = 1
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getInstance(type: String): HomeFragment {
|
||||||
|
val fragment = HomeFragment()
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("type", type)
|
||||||
|
fragment.arguments = bundle
|
||||||
|
return fragment
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_home
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
mDataBinding.rvView.layoutManager = LinearLayoutManager(activity)
|
||||||
|
roomZoneListAdapter = RoomZoneListAdapter()
|
||||||
|
mDataBinding.rvView.adapter = roomZoneListAdapter
|
||||||
|
EventBus.getDefault().register(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
type = requireArguments().getString("type", "1")
|
||||||
|
viewModel.get_room_zone_list(getMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
roomZoneListAdapter.setOnItemChildClickListener { adapter, view, position ->
|
||||||
|
when (view.id) {
|
||||||
|
R.id.img -> {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", roomZoneListAdapter.data.get(position).uid)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
R.id.tvRoom -> {
|
||||||
|
viewModel.enterRoom(
|
||||||
|
roomZoneListAdapter.data.get(position).rid, "",
|
||||||
|
requireActivity() as AppCompatActivity
|
||||||
|
)
|
||||||
|
}
|
||||||
|
R.id.tvHome -> {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", roomZoneListAdapter.data.get(position).uid)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mDataBinding.srlView.setOnRefreshLoadMoreListener(object : OnRefreshLoadMoreListener {
|
||||||
|
override fun onRefresh(refreshLayout: RefreshLayout) {
|
||||||
|
page = 1
|
||||||
|
viewModel.get_room_zone_list(getMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadMore(refreshLayout: RefreshLayout) {
|
||||||
|
page++
|
||||||
|
viewModel.get_room_zone_list(getMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
EventBus.getDefault().unregister(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
fun getSelectType(event: HomeScene){
|
||||||
|
sex_type = event.sex_type
|
||||||
|
age_type = event.age_type
|
||||||
|
page = 1
|
||||||
|
viewModel.get_room_zone_list(getMap())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getMap(): HashMap<String, String> {
|
||||||
|
var map = HashMap<String, String>()
|
||||||
|
map["page"] = page.toString()
|
||||||
|
map["zone_type"] = type
|
||||||
|
map["sex_type"] = sex_type
|
||||||
|
map["age_type"] = age_type
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,277 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
|
||||||
|
import com.youth.banner.BannerConfig
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingFragment
|
||||||
|
import com.yuyin.lib_base.base.UserManager
|
||||||
|
import com.yuyin.lib_base.ui.X5WebViewActivity
|
||||||
|
import com.yuyin.lib_base.util.GlideUtil
|
||||||
|
import com.yuyin.lib_base.view.GlideImageLoader
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.adapter.HomePagerHotAdapter
|
||||||
|
import com.yuyin.mier.adapter.HomePagerTopAdapter
|
||||||
|
import com.yuyin.mier.databinding.FragmentHomePagerBinding
|
||||||
|
import com.yuyin.mier.module_home.model.BannerBean
|
||||||
|
import com.yuyin.mier.module_home.tab.center.MainCenterViewModel
|
||||||
|
import com.yuyin.mier.search.SearchHisActivity
|
||||||
|
import java.util.ArrayList
|
||||||
|
import java.util.HashMap
|
||||||
|
|
||||||
|
|
||||||
|
class HomePagerFragment : BaseDataBindingFragment<MainCenterViewModel, FragmentHomePagerBinding>() {
|
||||||
|
|
||||||
|
lateinit var homePagerTopAdapter: HomePagerTopAdapter
|
||||||
|
|
||||||
|
lateinit var homePagerHotAdapter: HomePagerHotAdapter
|
||||||
|
|
||||||
|
private var page = 1
|
||||||
|
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
|
||||||
|
viewModel.roomData2.observe(this) {
|
||||||
|
homePagerTopAdapter.setNewData(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
viewModel.roomData.observe(this) {
|
||||||
|
if (page == 1) {
|
||||||
|
homePagerHotAdapter.setNewData(it)
|
||||||
|
} else {
|
||||||
|
homePagerHotAdapter.addData(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
viewModel.getFinally().observe(this) {
|
||||||
|
|
||||||
|
mDataBinding.smart.finishLoadMore()
|
||||||
|
mDataBinding.smart.finishRefresh()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.bannerListBean.observe(this) {
|
||||||
|
initBanner(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
viewModel.rankDataTop.observe(this) {
|
||||||
|
|
||||||
|
if (it.isNullOrEmpty()) {
|
||||||
|
mDataBinding.ivRankHead1.setImageResource(R.mipmap.ic_launcher_app)
|
||||||
|
mDataBinding.tvRankValue1.text = "0"
|
||||||
|
mDataBinding.tvRankNickName1.text = "虚位以待"
|
||||||
|
|
||||||
|
mDataBinding.topRingHead.setImageResource(R.mipmap.ic_launcher_app)
|
||||||
|
mDataBinding.topRingValue.text = "0"
|
||||||
|
mDataBinding.topRingNickName.text = "虚位以待"
|
||||||
|
|
||||||
|
|
||||||
|
} else if (it.isNotEmpty()) {
|
||||||
|
|
||||||
|
|
||||||
|
GlideUtil.loadImglogo(requireContext(), it[0].head_pic, mDataBinding.ivRankHead1)
|
||||||
|
mDataBinding.tvRankValue1.text = it[0].contribution_value.toString()
|
||||||
|
mDataBinding.tvRankNickName1.text = it[0].nick_name
|
||||||
|
|
||||||
|
|
||||||
|
GlideUtil.loadImglogo(requireContext(), it[0].head_pic, mDataBinding.topRingHead)
|
||||||
|
mDataBinding.topRingValue.text = it[0].contribution_value.toString()
|
||||||
|
mDataBinding.topRingNickName.text = it[0].nick_name
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it.size < 2 || it.isNullOrEmpty()) {
|
||||||
|
mDataBinding.ivRankHead2.setImageResource(R.mipmap.ic_launcher_app)
|
||||||
|
mDataBinding.tvRankValue2.text = "0"
|
||||||
|
mDataBinding.tvRankNickName2.text = "虚位以待"
|
||||||
|
} else if (it.size > 1) {
|
||||||
|
GlideUtil.loadImglogo(requireContext(), it[1].head_pic, mDataBinding.ivRankHead2)
|
||||||
|
mDataBinding.tvRankValue2.text = it[1].contribution_value
|
||||||
|
mDataBinding.tvRankNickName2.text = it[1].nick_name
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it.size < 3 || it.isNullOrEmpty()) {
|
||||||
|
mDataBinding.ivRankHead3.setImageResource(R.mipmap.ic_launcher_app)
|
||||||
|
mDataBinding.tvRankValue3.text = "0"
|
||||||
|
mDataBinding.tvRankNickName3.text = "虚位以待"
|
||||||
|
} else if (it.size > 2) {
|
||||||
|
GlideUtil.loadImglogo(requireContext(), it[2].head_pic, mDataBinding.ivRankHead3)
|
||||||
|
mDataBinding.tvRankValue3.text = it[2].contribution_value
|
||||||
|
mDataBinding.tvRankNickName3.text = it[2].nick_name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
return R.layout.fragment_home_pager
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
|
||||||
|
mDataBinding.rvTop.layoutManager = GridLayoutManager(requireContext(), 3)
|
||||||
|
homePagerTopAdapter = HomePagerTopAdapter()
|
||||||
|
mDataBinding.rvTop.adapter = homePagerTopAdapter
|
||||||
|
|
||||||
|
mDataBinding.rvHot.layoutManager = LinearLayoutManager(requireContext())
|
||||||
|
homePagerHotAdapter = HomePagerHotAdapter()
|
||||||
|
mDataBinding.rvHot.adapter = homePagerHotAdapter
|
||||||
|
|
||||||
|
viewModel.loadRoomData(getHotMap())
|
||||||
|
viewModel.loadRoomData2(getTopMap())
|
||||||
|
viewModel.getBannerList()
|
||||||
|
viewModel.loadRankData("", "1", "1")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
|
||||||
|
mDataBinding.constraint.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.LIVE_RANK).withInt("selectTab", 0).navigation()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mDataBinding.ivSearch.setOnClickListener {
|
||||||
|
startActivity(Intent(requireContext(), SearchHisActivity::class.java))
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivRank.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.LIVE_RANK).withInt("selectTab", 0).navigation()
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.smart.setOnRefreshLoadMoreListener(object : OnRefreshLoadMoreListener {
|
||||||
|
override fun onRefresh(refreshLayout: RefreshLayout) {
|
||||||
|
page = 1
|
||||||
|
viewModel.loadRoomData(getHotMap())
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onLoadMore(refreshLayout: RefreshLayout) {
|
||||||
|
page++
|
||||||
|
viewModel.loadRoomData(getHotMap())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
homePagerTopAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
viewModel.enterRoom(
|
||||||
|
homePagerTopAdapter.data[position].rid.toString(), "",
|
||||||
|
requireActivity() as AppCompatActivity
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
homePagerHotAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
viewModel.enterRoom(
|
||||||
|
homePagerHotAdapter.data[position].rid.toString(), "",
|
||||||
|
requireActivity() as AppCompatActivity
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun initBanner(data: List<BannerBean>) {
|
||||||
|
val imgurls: MutableList<String> = ArrayList()
|
||||||
|
for (list in data) {
|
||||||
|
imgurls.add(list.image)
|
||||||
|
}
|
||||||
|
//设置图片加载器
|
||||||
|
mDataBinding.banner.setImageLoader(GlideImageLoader())
|
||||||
|
//设置图片集合
|
||||||
|
mDataBinding.banner.setImages(imgurls)
|
||||||
|
//设置指示器位置(当banner模式中有指示器时)
|
||||||
|
mDataBinding.banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR)
|
||||||
|
mDataBinding.banner.setIndicatorGravity(BannerConfig.CENTER)
|
||||||
|
//设置自动轮播,默认为true
|
||||||
|
mDataBinding.banner.isAutoPlay(true)
|
||||||
|
//banner设置方法全部调用完毕时最后调用
|
||||||
|
mDataBinding.banner.start()
|
||||||
|
mDataBinding.banner.setOnBannerListener {
|
||||||
|
when (data[it].type) {
|
||||||
|
"1" -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
"2" -> {
|
||||||
|
context?.let { it1 -> X5WebViewActivity.forward(it1, data[it].url, "") }
|
||||||
|
}
|
||||||
|
"3" -> {
|
||||||
|
viewModel.enterRoom(data[it].aid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
"4" -> {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", data[it].aid)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
"5" -> {
|
||||||
|
context?.let { it1 ->
|
||||||
|
X5WebViewActivity.forward(
|
||||||
|
it1,
|
||||||
|
data[it].url + "?login_token=" + UserManager.user.login_token,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mDataBinding.banner.setOnClickListener {
|
||||||
|
when (data[0].type) {
|
||||||
|
"1" -> {
|
||||||
|
|
||||||
|
}
|
||||||
|
"2" -> {
|
||||||
|
context?.let { it1 -> X5WebViewActivity.forward(it1, data[0].url, "") }
|
||||||
|
}
|
||||||
|
"3" -> {
|
||||||
|
viewModel.enterRoom(data[0].aid, "", activity as AppCompatActivity)
|
||||||
|
}
|
||||||
|
"4" -> {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", data[0].aid)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
"5" -> {
|
||||||
|
context?.let { it1 ->
|
||||||
|
X5WebViewActivity.forward(
|
||||||
|
it1,
|
||||||
|
data[0].url + "?login_token=" + UserManager.user.login_token,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun getHotMap(): MutableMap<String, String> {
|
||||||
|
val map: MutableMap<String, String> = HashMap()
|
||||||
|
map["tid"] = Const.ROOM_TYPE
|
||||||
|
map["is_hot"] = "2"
|
||||||
|
map["page"] = page.toString()
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun getTopMap(): MutableMap<String, String> {
|
||||||
|
val map: MutableMap<String, String> = HashMap()
|
||||||
|
map["tid"] = Const.ROOM_TYPE
|
||||||
|
map["is_top"] = "2"
|
||||||
|
map["page"] = "1"
|
||||||
|
return map
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import com.yuyin.lib_base.adapter.MyPagerAdapter
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingFragment
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.FragmentHomeMainBinding
|
||||||
|
import com.yuyin.mier.module_home.model.HomeScene
|
||||||
|
import com.yuyin.mier.search.SearchHisActivity
|
||||||
|
import com.yuyin.mier.view.SceneDialog
|
||||||
|
import kotlinx.android.synthetic.main.fragment_home_main.*
|
||||||
|
import org.greenrobot.eventbus.EventBus
|
||||||
|
|
||||||
|
class MainHomeFragment : BaseDataBindingFragment<MainHomeViewModel, FragmentHomeMainBinding>() {
|
||||||
|
private val titleList: ArrayList<String> = ArrayList()
|
||||||
|
private val mFragments: ArrayList<Fragment> = ArrayList()
|
||||||
|
private var mAdapter: MyPagerAdapter? = null
|
||||||
|
override fun startObserve() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_home_main
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
titleList.add("推荐")
|
||||||
|
mFragments.add(HomeFragment.getInstance("1"))
|
||||||
|
titleList.add("在线")
|
||||||
|
mFragments.add(HomeFragment.getInstance("2"))
|
||||||
|
mAdapter = MyPagerAdapter(childFragmentManager, mFragments, titleList)
|
||||||
|
view_pager.adapter = mAdapter
|
||||||
|
tab_layout.setViewPager(view_pager)
|
||||||
|
tab_layout.setSnapOnTabClick(true)
|
||||||
|
view_pager.offscreenPageLimit = mFragments.size
|
||||||
|
tab_layout.currentTab = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
|
||||||
|
mDataBinding.scene.setOnClickListener {
|
||||||
|
|
||||||
|
var sceneDialog = SceneDialog(requireContext())
|
||||||
|
|
||||||
|
sceneDialog.setOnReturnSectListener(object : SceneDialog.OnReturnSectListener {
|
||||||
|
override fun getType(sex_type: String, age_type: String) {
|
||||||
|
EventBus.getDefault().post(HomeScene(sex_type, age_type))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
sceneDialog.show()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.search.setOnClickListener {
|
||||||
|
|
||||||
|
startActivity(Intent(requireContext(), SearchHisActivity::class.java))
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.mier.module_home.model.RoomZoneList
|
||||||
|
import com.yuyin.mier.repository.CommonRepository
|
||||||
|
|
||||||
|
class MainHomeViewModel : BaseViewModel() {
|
||||||
|
var repository = CommonRepository()
|
||||||
|
var roomZoneList = MutableLiveData<ArrayList<RoomZoneList>>()
|
||||||
|
|
||||||
|
fun get_room_zone_list(map: MutableMap<String, String>) {
|
||||||
|
launchUI {
|
||||||
|
var result = repository.get_room_zone_list(map)
|
||||||
|
roomZoneList.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home.teen
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.DialogAdolescentModelBinding
|
||||||
|
|
||||||
|
class AdolescentModelDialog(context: Context) : Dialog(context) {
|
||||||
|
private lateinit var binding: DialogAdolescentModelBinding
|
||||||
|
|
||||||
|
init {
|
||||||
|
|
||||||
|
initDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initDialog() {
|
||||||
|
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
binding = DataBindingUtil.inflate(inflater, R.layout.dialog_adolescent_model, null, false)
|
||||||
|
setContentView(binding.root)
|
||||||
|
val win = this.window
|
||||||
|
val params = win?.attributes
|
||||||
|
params?.gravity = Gravity.CENTER
|
||||||
|
params?.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
params?.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
win?.attributes = params
|
||||||
|
win?.setBackgroundDrawableResource(android.R.color.transparent)
|
||||||
|
|
||||||
|
initView()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getBinding(): DialogAdolescentModelBinding {
|
||||||
|
|
||||||
|
return binding
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home.teen
|
||||||
|
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingActivity
|
||||||
|
import com.yuyin.lib_base.ui.X5WebViewActivity
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.ActivityTeenModeBinding
|
||||||
|
|
||||||
|
class TeenModeActivity : BaseDataBindingActivity<TeenModeViewModel, ActivityTeenModeBinding>() {
|
||||||
|
|
||||||
|
|
||||||
|
lateinit var passwordDialog: TeenPasswordDialog
|
||||||
|
override fun startObserve() {
|
||||||
|
|
||||||
|
viewModel.userInfoData.observe(this) {
|
||||||
|
|
||||||
|
if (it.is_teenager == 1) {
|
||||||
|
mDataBinding.tvOpen.text = "关闭"
|
||||||
|
mDataBinding.tvTeenType.text = "青少年模式已开启"
|
||||||
|
mDataBinding.ivIcon.setImageResource(R.mipmap.teen_model_ic2)
|
||||||
|
passwordDialog = TeenPasswordDialog(this,1,viewModel)
|
||||||
|
} else {
|
||||||
|
mDataBinding.tvOpen.text = "开启"
|
||||||
|
mDataBinding.tvTeenType.text = "青少年模式已关闭"
|
||||||
|
mDataBinding.ivIcon.setImageResource(R.mipmap.teen_model_ic)
|
||||||
|
passwordDialog = TeenPasswordDialog(this,0,viewModel)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
return R.layout.activity_teen_mode
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
// mDataBinding.toolbar.findViewById<TextView>(R.id.tv_main_title).text = "青少年模式"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
|
||||||
|
viewModel.loadUserInfo()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
|
||||||
|
// mDataBinding.changePsd.setOnClickListener {
|
||||||
|
//
|
||||||
|
// val intent = Intent(this, TeenModeChangeActivity::class.java)
|
||||||
|
// intent.putExtra("type", "2")
|
||||||
|
// ActivityUtils.startActivity(intent)
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
|
mDataBinding.tvAgreement.setOnClickListener {
|
||||||
|
X5WebViewActivity.forward(this, Const.PAGE_ERTONG, "《语音儿童个人信息保护规则》")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mDataBinding.tvOpen.setOnClickListener {
|
||||||
|
//
|
||||||
|
// if (viewModel.userInfoData.value?.is_real == "2") {
|
||||||
|
// "未实名认证不能开启青少年模式".showToast()
|
||||||
|
// return@setOnClickListener
|
||||||
|
// }
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!mDataBinding.checkbox.isChecked) {
|
||||||
|
"请同意儿童个人信息保护规则".showToast()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
passwordDialog.show()
|
||||||
|
|
||||||
|
// val intent = Intent(this, TeenModeChangeActivity::class.java)
|
||||||
|
// if (mDataBinding.tvTeenType.text.toString() == "青少年模式已关闭") {
|
||||||
|
// intent.putExtra("type", "1")
|
||||||
|
// } else {
|
||||||
|
// intent.putExtra("type", "3")
|
||||||
|
// }
|
||||||
|
// ActivityUtils.startActivity(intent)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home.teen
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import com.blankj.utilcode.util.ActivityUtils
|
||||||
|
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingActivity
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.ActivityTeenModeChangeBinding
|
||||||
|
|
||||||
|
class TeenModeChangeActivity :
|
||||||
|
BaseDataBindingActivity<TeenModeViewModel, ActivityTeenModeChangeBinding>() {
|
||||||
|
|
||||||
|
private var type = ""
|
||||||
|
|
||||||
|
private var set_pass = ""
|
||||||
|
|
||||||
|
private var confirm_pass = ""
|
||||||
|
|
||||||
|
private var old_pass = ""
|
||||||
|
|
||||||
|
private var new_pass = ""
|
||||||
|
|
||||||
|
private var close_pass = ""
|
||||||
|
|
||||||
|
override fun startObserve() {
|
||||||
|
/*viewModel.success.observe(this) {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MAIN).navigation()
|
||||||
|
finish()
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
viewModel.verifySucceeded.observe(this) {
|
||||||
|
// ARouter.getInstance().build(AroutUtil.MAIN_MAIN).navigation()
|
||||||
|
// finish()
|
||||||
|
val intent = Intent(this, TeenModeChangeActivity::class.java)
|
||||||
|
intent.putExtra("type", "1")
|
||||||
|
ActivityUtils.startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
/*viewModel.getError().observe(this){
|
||||||
|
if (it is ApiException){
|
||||||
|
if (it.code == 201){
|
||||||
|
mDataBinding.etContent.clear()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int {
|
||||||
|
return R.layout.activity_teen_mode_change
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
type = intent.getStringExtra("type").toString()
|
||||||
|
/*when (type) {
|
||||||
|
"1" -> {
|
||||||
|
mDataBinding.tvTop.text = "设置密码"
|
||||||
|
mDataBinding.tvPassTip.text = "关闭青少年模式时,需输入该密码"
|
||||||
|
}
|
||||||
|
"2" -> {
|
||||||
|
mDataBinding.tvTop.text = "验证密码"
|
||||||
|
mDataBinding.llComplaint.visibility = View.VISIBLE
|
||||||
|
mDataBinding.pass.visibility = View.GONE
|
||||||
|
mDataBinding.tvPassTip.text = "关闭青少年模式,请输入开启时设置的密码"
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
mDataBinding.tvTop.text = "验证密码"
|
||||||
|
mDataBinding.llComplaintTip.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
|
||||||
|
/*mDataBinding.etContent.setOnInputFinishListener {
|
||||||
|
|
||||||
|
if (type == "1") {
|
||||||
|
|
||||||
|
if (mDataBinding.tvTitle.text.toString() == "输入密码") {
|
||||||
|
set_pass = mDataBinding.etContent.content
|
||||||
|
mDataBinding.tvTitle.text = "确认密码"
|
||||||
|
mDataBinding.etContent.clear()
|
||||||
|
} else {
|
||||||
|
confirm_pass = mDataBinding.etContent.content
|
||||||
|
viewModel.open_teen_mode("1", set_pass, set_pass)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (type == "2") {
|
||||||
|
|
||||||
|
if (mDataBinding.tvTitle.text.toString() == "请输入旧密码") {
|
||||||
|
old_pass = mDataBinding.etContent.content
|
||||||
|
mDataBinding.tvTitle.text = "请输入新密码"
|
||||||
|
mDataBinding.etContent.clear()
|
||||||
|
} else {
|
||||||
|
new_pass = mDataBinding.etContent.content
|
||||||
|
viewModel.open_teen_mode("2", new_pass, old_pass)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (mDataBinding.tvTitle.text.toString() == "输入密码") {
|
||||||
|
close_pass = mDataBinding.etContent.content
|
||||||
|
viewModel.close_teen_mode("1", close_pass)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*mDataBinding.tvComplaint.setOnClickListener {
|
||||||
|
val intent = Intent(this, TeenModeChangeActivity::class.java)
|
||||||
|
intent.putExtra("type", "2")
|
||||||
|
ActivityUtils.startActivity(intent)
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
mDataBinding.tvNext.setOnClickListener {
|
||||||
|
|
||||||
|
if (mDataBinding.etNickname.text.isEmpty()) {
|
||||||
|
|
||||||
|
"请输入真实姓名".showToast()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mDataBinding.etCard.text.isEmpty()) {
|
||||||
|
"请输入身份证号".showToast()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.edit_teen_mode(
|
||||||
|
mDataBinding.etCard.text.toString(),
|
||||||
|
mDataBinding.etNickname.text.toString(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home.teen
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.mier.repository.CommonRepository
|
||||||
|
|
||||||
|
class TeenModeViewModel : BaseViewModel() {
|
||||||
|
|
||||||
|
private val repository = CommonRepository()
|
||||||
|
|
||||||
|
|
||||||
|
var success = MutableLiveData<Any>()
|
||||||
|
|
||||||
|
fun open_teen_mode(
|
||||||
|
type: String,
|
||||||
|
password: String,
|
||||||
|
again_password: String
|
||||||
|
) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.open_teen_mode(type, password, again_password)
|
||||||
|
result.msg.showToast()
|
||||||
|
success.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun close_teen_mode(
|
||||||
|
type: String,
|
||||||
|
password: String,
|
||||||
|
) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.close_teen_mode(type, password)
|
||||||
|
result.msg.showToast()
|
||||||
|
success.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val verifySucceeded = MutableLiveData<Any>()
|
||||||
|
fun edit_teen_mode(
|
||||||
|
card_id: String,
|
||||||
|
real_name: String,
|
||||||
|
) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.edit_teen_mode(card_id, real_name)
|
||||||
|
verifySucceeded.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.home.teen
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Intent
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
|
import androidx.databinding.DataBindingUtil
|
||||||
|
import com.blankj.utilcode.util.ActivityUtils
|
||||||
|
import com.yuyin.lib_base.http.ApiException
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.databinding.DialogTeenPasswordBinding
|
||||||
|
|
||||||
|
class TeenPasswordDialog(val context: TeenModeActivity, val mType: Int, val viewModel: TeenModeViewModel) :
|
||||||
|
Dialog(context) {
|
||||||
|
private lateinit var binding: DialogTeenPasswordBinding
|
||||||
|
|
||||||
|
init {
|
||||||
|
initDialog()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initDialog() {
|
||||||
|
val inflater = LayoutInflater.from(context)
|
||||||
|
binding = DataBindingUtil.inflate(inflater, R.layout.dialog_teen_password, null, false)
|
||||||
|
setContentView(binding.root)
|
||||||
|
val win = this.window
|
||||||
|
val params = win?.attributes
|
||||||
|
params?.gravity = Gravity.CENTER
|
||||||
|
params?.width = WindowManager.LayoutParams.MATCH_PARENT
|
||||||
|
params?.height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
win?.attributes = params
|
||||||
|
win?.setBackgroundDrawableResource(android.R.color.transparent)
|
||||||
|
initView()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getBinding(): DialogTeenPasswordBinding {
|
||||||
|
return binding
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun initView() {
|
||||||
|
viewModel.success.observe(context){
|
||||||
|
dismiss()
|
||||||
|
context.finish()
|
||||||
|
}
|
||||||
|
viewModel.getError().observe(context) {
|
||||||
|
if (it is ApiException) {
|
||||||
|
if (it.code == 201) {
|
||||||
|
binding.etContent.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mType == 0) {
|
||||||
|
binding.tv1.visibility = View.VISIBLE
|
||||||
|
binding.llComplaintTip.visibility = View.GONE
|
||||||
|
binding.tvTitle.text = "请设置密码开启"
|
||||||
|
} else {
|
||||||
|
binding.tv1.visibility = View.GONE
|
||||||
|
binding.llComplaintTip.visibility = View.VISIBLE
|
||||||
|
binding.tvTitle.text = "请输入密码关闭"
|
||||||
|
|
||||||
|
binding.tvComplaint.setOnClickListener {
|
||||||
|
val intent = Intent(context, TeenModeChangeActivity::class.java)
|
||||||
|
intent.putExtra("type", "2")
|
||||||
|
ActivityUtils.startActivity(intent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.btnAgree.setOnClickListener {
|
||||||
|
var set_pass = binding.etContent.content
|
||||||
|
if (set_pass.isEmpty() || set_pass.length < 4) {
|
||||||
|
"请输入密码".showToast()
|
||||||
|
return@setOnClickListener
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mType == 0) {
|
||||||
|
viewModel.open_teen_mode("1", set_pass, set_pass)
|
||||||
|
} else {
|
||||||
|
viewModel.close_teen_mode("1", set_pass)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.btnRefuse.setOnClickListener {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.my
|
||||||
|
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
|
||||||
|
class MainMyViewModel : BaseViewModel() {
|
||||||
|
}
|
||||||
@@ -0,0 +1,249 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.my
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.view.View
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.blankj.utilcode.util.ClipboardUtils
|
||||||
|
import com.yuyin.lib_base.App
|
||||||
|
import com.yuyin.lib_base.Const
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingFragment
|
||||||
|
import com.yuyin.lib_base.base.UserManager
|
||||||
|
import com.yuyin.lib_base.model.UserBean
|
||||||
|
import com.yuyin.lib_base.util.showToast
|
||||||
|
import com.yuyin.lib_base.view.WebViewActivity
|
||||||
|
import com.yuyin.mier.BR
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.adapter.MyListAdapter
|
||||||
|
import com.yuyin.mier.adapter.MyListAdapter2
|
||||||
|
import com.yuyin.mier.databinding.FragmentMyBinding
|
||||||
|
import com.yuyin.mier.module_home.tab.center.MainCenterViewModel
|
||||||
|
import com.yuyin.mier.module_home.tab.center.sign.SginDialog
|
||||||
|
import com.yuyin.mier.module_my.YaoQingActivity
|
||||||
|
import com.yuyin.mier.module_my.auction.SignedArtistActivity
|
||||||
|
import com.yuyin.mier.module_my.cp.CPActivity
|
||||||
|
import com.yuyin.mier.module_my.edituser.ModifyDataActivity
|
||||||
|
import com.yuyin.mier.module_my.peerage.PeerageActivity
|
||||||
|
import com.yuyin.mier.module_my.room.MyRoomActivity
|
||||||
|
import com.yuyin.mier.module_my.set.WxKeFuAt
|
||||||
|
import com.yuyin.mier.module_my.vip.VipActivity
|
||||||
|
import kotlinx.android.synthetic.main.activity_user_homepage.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_my.*
|
||||||
|
|
||||||
|
class MyFragment : BaseDataBindingFragment<MainCenterViewModel, FragmentMyBinding>() {
|
||||||
|
private lateinit var mAdapter: MyListAdapter
|
||||||
|
private lateinit var mAdapter2: MyListAdapter2
|
||||||
|
private var mUserBean: UserBean? = null
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.userInfoData.observe(this) {
|
||||||
|
App.guild_id = it.guild_id
|
||||||
|
App.rid = it.rid
|
||||||
|
mUserBean = it
|
||||||
|
|
||||||
|
loadImage(mDataBinding.ivHead, it.head_pic, R.mipmap.ic_launcher_app)
|
||||||
|
|
||||||
|
// loadImage(mDataBinding.ivCover, it.head_pic, R.mipmap.ic_launcher_app)
|
||||||
|
|
||||||
|
loadImage(mDataBinding.ivJuewei, it.nobility_image)
|
||||||
|
|
||||||
|
if (it.nobility_image.isNotEmpty()) {
|
||||||
|
mDataBinding.ivJuewei.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
mDataBinding.ivJuewei.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.textCP.text = it.cp_num.toString()
|
||||||
|
|
||||||
|
loadImage(
|
||||||
|
mDataBinding.ivGongxian, it.contribution_level_image, R.mipmap.no_tu
|
||||||
|
)
|
||||||
|
|
||||||
|
loadImage(
|
||||||
|
mDataBinding.ivMeili, it.charm_level_image, R.mipmap.no_tu
|
||||||
|
)
|
||||||
|
// if (it.is)
|
||||||
|
if (it.vid > 0) {
|
||||||
|
mDataBinding.vipIsOpen.setBackgroundResource(R.mipmap.my_peeg2)
|
||||||
|
} else {
|
||||||
|
mDataBinding.vipIsOpen.setBackgroundResource(R.mipmap.my_peeg)
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivUsername.text = it.nick_name
|
||||||
|
if (it.special_uid == "0") {
|
||||||
|
mDataBinding.textVip.text = "" + it.uid
|
||||||
|
loadImage(mDataBinding.ivLianghao, R.mipmap.common_id_img1)
|
||||||
|
} else {
|
||||||
|
mDataBinding.textVip.text = "ID:" + it.special_uid
|
||||||
|
loadImage(mDataBinding.ivLianghao, R.mipmap.common_id_img2)
|
||||||
|
}
|
||||||
|
mDataBinding.textCollection.text = it.follow_num
|
||||||
|
mDataBinding.textFans.text = it.fans_num
|
||||||
|
mDataBinding.textShouCang.text = it.collect_room_num
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel.signDayList.observe(this) {
|
||||||
|
SginDialog(context as AppCompatActivity,viewModel,it).show()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_my
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
viewModel.loadUserInfo()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
mAdapter = MyListAdapter()
|
||||||
|
mAdapter.setNewData(Const.myList1)
|
||||||
|
mDataBinding.recyclerView1.layoutManager = GridLayoutManager(context, 4)
|
||||||
|
mDataBinding.recyclerView1.adapter = mAdapter
|
||||||
|
|
||||||
|
mAdapter2 = MyListAdapter2()
|
||||||
|
mAdapter2.setNewData(Const.myList2)
|
||||||
|
mDataBinding.recyclerView2.layoutManager = GridLayoutManager(context, 2)
|
||||||
|
mDataBinding.recyclerView2.adapter = mAdapter2
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
|
||||||
|
|
||||||
|
mDataBinding.setVariable(BR.act, this)
|
||||||
|
|
||||||
|
|
||||||
|
mDataBinding.ivEdit.setOnClickListener {
|
||||||
|
// ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
// .withString("from_id", UserManager.user.uid.toString()).navigation()
|
||||||
|
startActivity(Intent(requireContext(), ModifyDataActivity::class.java))
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivUsername.setOnClickListener {
|
||||||
|
startActivity(Intent(requireContext(), ModifyDataActivity::class.java))
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivHead.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", UserManager.user.uid.toString()).navigation()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mDataBinding.ivCopy.setOnClickListener {
|
||||||
|
ClipboardUtils.copyText(viewModel.userInfoData.value!!.uid.toString())
|
||||||
|
"复制成功".showToast()
|
||||||
|
}
|
||||||
|
|
||||||
|
mAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
if (mAdapter.getItem(position) == null) return@setOnItemClickListener
|
||||||
|
val title = mAdapter.getItem(position)!!.title
|
||||||
|
listClick(title)
|
||||||
|
}
|
||||||
|
mAdapter2.setOnItemClickListener { adapter, view, position ->
|
||||||
|
if (mAdapter2.getItem(position) == null) return@setOnItemClickListener
|
||||||
|
val title = mAdapter2.getItem(position)!!.title
|
||||||
|
listClick(title)
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivAdd.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE)
|
||||||
|
.withString("from_id", UserManager.user.uid.toString()).navigation()
|
||||||
|
}
|
||||||
|
|
||||||
|
mDataBinding.ivSetting.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MY_COMM_SET).navigation()
|
||||||
|
}
|
||||||
|
mDataBinding.ivQiandao.setOnClickListener {
|
||||||
|
viewModel.user_day_sign_log()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun listClick(title: String) {
|
||||||
|
when (title) {
|
||||||
|
"我的房间" -> {
|
||||||
|
if (mUserBean == null) return
|
||||||
|
when (mUserBean!!.is_real) {
|
||||||
|
"2" -> ARouter.getInstance().build(AroutUtil.PLAY_REAL_NAME).navigation()
|
||||||
|
"1" -> {
|
||||||
|
// if (mUserBean!!.rid == "0") {
|
||||||
|
// "房间信息读取失败...".showToast()
|
||||||
|
// } else {
|
||||||
|
|
||||||
|
|
||||||
|
// viewModel.enterRoom(mUserBean!!.rid, "", activity as AppCompatActivity)
|
||||||
|
// }
|
||||||
|
|
||||||
|
startActivity(Intent(requireContext(),MyRoomActivity::class.java))
|
||||||
|
}
|
||||||
|
"3" -> "实名认证审核中...".showToast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"我的装扮" -> ARouter.getInstance().build(AroutUtil.MY_COMM_ZHUANGBAN).navigation()
|
||||||
|
"装扮商城" -> ARouter.getInstance().build(AroutUtil.MY_COMM_ZHUANGBAN_SHANGCHENG)
|
||||||
|
.navigation()
|
||||||
|
"实名认证" -> {
|
||||||
|
if (mUserBean == null) return
|
||||||
|
when (mUserBean!!.is_real) {
|
||||||
|
"2" -> ARouter.getInstance().build(AroutUtil.PLAY_REAL_NAME).navigation()
|
||||||
|
"1" -> "已认证...".showToast()
|
||||||
|
"3" -> "实名认证审核中...".showToast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"我的钱包" -> ARouter.getInstance().build(AroutUtil.MAIN_MY_MONEY).navigation()
|
||||||
|
"我的等级" -> ARouter.getInstance().build(AroutUtil.MY_COMM_DENGJI).withString("type", "0")
|
||||||
|
.navigation()
|
||||||
|
"魅力等级" -> ARouter.getInstance().build(AroutUtil.MY_COMM_DENGJI).withString("type", "1")
|
||||||
|
.navigation()
|
||||||
|
"等级" -> ARouter.getInstance().build(AroutUtil.MY_COMM_DENGJI).navigation()
|
||||||
|
|
||||||
|
"礼物记录" -> ARouter.getInstance().build(AroutUtil.MAIN_MY_GIFT_LOG)
|
||||||
|
.withString("type", "1").withString("title", "礼物收入记录").navigation()
|
||||||
|
"赠送记录" -> ARouter.getInstance().build(AroutUtil.MAIN_MY_GIFT_LOG)
|
||||||
|
.withString("type", "2").withString("title", "礼物赠送记录").navigation()
|
||||||
|
"帮助反馈" -> ARouter.getInstance().build(AroutUtil.MY_COMM_FEEDBACK).navigation()
|
||||||
|
"系统设置" -> ARouter.getInstance().build(AroutUtil.MY_COMM_SET).navigation()
|
||||||
|
"我的公会" -> ARouter.getInstance().build(AroutUtil.GHMainActivity).navigation()
|
||||||
|
"邀请好友" -> {
|
||||||
|
var intent = Intent(activity, YaoQingActivity::class.java)
|
||||||
|
intent.putExtra("reg_code", mUserBean?.reg_code)
|
||||||
|
intent.putExtra("reg_url", mUserBean?.reg_url)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
//
|
||||||
|
"关注" -> ARouter.getInstance().build(AroutUtil.LIB_FOLLOW_FANS).withInt("selectTab", 0)
|
||||||
|
.navigation()
|
||||||
|
"粉丝" -> ARouter.getInstance().build(AroutUtil.LIB_FOLLOW_FANS).withInt("selectTab", 1)
|
||||||
|
.navigation()
|
||||||
|
"收藏" -> ARouter.getInstance().build(AroutUtil.MAIN_MY_SHOUCANG).navigation()
|
||||||
|
"我的爵位" -> {
|
||||||
|
startActivity(Intent(requireContext(), PeerageActivity::class.java))
|
||||||
|
}
|
||||||
|
"CP" -> {
|
||||||
|
startActivity(Intent(requireContext(), CPActivity::class.java))
|
||||||
|
}
|
||||||
|
"开通会员" -> {
|
||||||
|
startActivity(Intent(requireContext(), VipActivity::class.java))
|
||||||
|
}
|
||||||
|
|
||||||
|
"签约艺人" -> {
|
||||||
|
startActivity(Intent(requireContext(), SignedArtistActivity::class.java))
|
||||||
|
}
|
||||||
|
"在线客服" ->{
|
||||||
|
startActivity(Intent(requireContext(), WebViewActivity::class.java))
|
||||||
|
}
|
||||||
|
"签到" ->{
|
||||||
|
viewModel.user_day_sign_log()
|
||||||
|
}
|
||||||
|
"入驻联系运营" ->{
|
||||||
|
startActivity(Intent(requireContext(), WxKeFuAt::class.java))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.xiaoxi
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.view.View
|
||||||
|
import androidx.databinding.ViewDataBinding
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
|
import androidx.fragment.app.FragmentTransaction
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.base.BaseDataBindingFragment
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.lib_base.view.WebViewActivity
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.adapter.MsgAdapter
|
||||||
|
|
||||||
|
import kotlinx.android.synthetic.main.fragment_message.*
|
||||||
|
|
||||||
|
class MessageFragment : BaseDataBindingFragment<BaseViewModel, ViewDataBinding>() {
|
||||||
|
private lateinit var msgAdapter: MsgAdapter
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.messageCount.observe(this) {
|
||||||
|
if (it.system_no_read_count > 0) {
|
||||||
|
system_num.visibility = View.VISIBLE
|
||||||
|
system_num.text = it.system_no_read_count.toString()
|
||||||
|
tv_content.text = it.system_last_message.title
|
||||||
|
} else {
|
||||||
|
system_num.visibility = View.GONE
|
||||||
|
system_num.text = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_message
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
val conversationListFragment = TUIConversationFragment()
|
||||||
|
val manager: FragmentManager = childFragmentManager
|
||||||
|
val transaction: FragmentTransaction = manager.beginTransaction()
|
||||||
|
transaction.replace(R.id.container, conversationListFragment as Fragment)
|
||||||
|
transaction.commit()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
// container.layoutManager = LinearLayoutManager(requireContext())
|
||||||
|
// msgAdapter = MsgAdapter()
|
||||||
|
// container.adapter = msgAdapter
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
// setConversationListener()
|
||||||
|
viewModel.get_user_message_cover_info()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
iv_guanzhu.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.LIB_FOLLOW_FANS).withInt("selectTab", 0)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
iv_fensi.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.LIB_FOLLOW_FANS).withInt("selectTab", 1)
|
||||||
|
.navigation()
|
||||||
|
}
|
||||||
|
iv_black.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.BLACK_LIST).navigation()
|
||||||
|
}
|
||||||
|
gf.setOnClickListener {
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MESSAGE_OFFICE).navigation()
|
||||||
|
}
|
||||||
|
kf.setOnClickListener {
|
||||||
|
startActivity(Intent(requireContext(), WebViewActivity::class.java))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.xiaoxi.black
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide
|
||||||
|
import com.chad.library.adapter.base.BaseQuickAdapter
|
||||||
|
import com.chad.library.adapter.base.BaseViewHolder
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.BlackBean
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
class BlackAdapter :
|
||||||
|
BaseQuickAdapter<BlackBean, BaseViewHolder>(R.layout.item_black, ArrayList()) {
|
||||||
|
override fun convert(helper: BaseViewHolder, item: BlackBean) {
|
||||||
|
Glide.with(mContext).load(item.head_pic).into(helper.getView(R.id.v_img))
|
||||||
|
helper
|
||||||
|
.setText(R.id.tv_title, item.nick_name)
|
||||||
|
.setText(R.id.tv_title2, "" + item.uid)
|
||||||
|
helper.addOnClickListener(R.id.tv_enter)
|
||||||
|
|
||||||
|
if (item.sex == "") {
|
||||||
|
helper.setImageResource(R.id.iv_sex, R.mipmap.login_reg_nan1)
|
||||||
|
} else {
|
||||||
|
helper.setImageResource(R.id.iv_sex, R.mipmap.login_reg_nv1)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.xiaoxi.black
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil.BLACK_LIST
|
||||||
|
import com.yuyin.lib_base.base.BaseActivity
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_home.model.BlackBean
|
||||||
|
import kotlinx.android.synthetic.main.activity_black_list.*
|
||||||
|
|
||||||
|
@Route(path = BLACK_LIST)
|
||||||
|
class BlackListActivity : BaseActivity<BlackListViewModel>() {
|
||||||
|
private lateinit var blackAdapter: BlackAdapter
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.blackData.observe(this) {
|
||||||
|
if (it.room_visitor_list.isEmpty() && it.room_black_list.isEmpty()) {
|
||||||
|
ll_nodata.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
ll_nodata.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
val blackBean = ArrayList<BlackBean>()
|
||||||
|
blackBean.addAll(it.room_black_list)
|
||||||
|
blackBean.addAll(it.room_visitor_list)
|
||||||
|
blackAdapter.setNewData(blackBean)
|
||||||
|
|
||||||
|
}
|
||||||
|
viewModel.removeData.observe(this) {
|
||||||
|
viewModel.get_blacklist()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.activity_black_list
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
blackAdapter = BlackAdapter()
|
||||||
|
recyclerview.layoutManager = LinearLayoutManager(this)
|
||||||
|
recyclerview.adapter = blackAdapter
|
||||||
|
viewModel.get_blacklist()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
blackAdapter.setOnItemChildClickListener { adapter, view, position ->
|
||||||
|
if (view.id == R.id.tv_enter) {
|
||||||
|
viewModel.remove_blacklist(blackAdapter.data[position].uid)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
blackAdapter.setOnItemClickListener { adapter, view, position ->
|
||||||
|
ARouter.getInstance().build(AroutUtil.MAIN_MY_HOME_PAGE).withString("from_id",
|
||||||
|
blackAdapter.data[position].uid).navigation()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.xiaoxi.black
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.mier.module_home.model.BlackList
|
||||||
|
import com.yuyin.mier.repository.CommonRepository
|
||||||
|
|
||||||
|
class BlackListViewModel : BaseViewModel() {
|
||||||
|
var repository = CommonRepository()
|
||||||
|
var blackData = MutableLiveData<BlackList>()
|
||||||
|
var removeData = MutableLiveData<Any>()
|
||||||
|
|
||||||
|
fun get_blacklist() {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.get_blacklist()
|
||||||
|
blackData.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun remove_blacklist(uid: String) {
|
||||||
|
launchUI {
|
||||||
|
val result = repository.remove_blacklist(uid)
|
||||||
|
removeData.value = result.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.xiaoxi.xitong
|
||||||
|
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import com.yuyin.lib_base.base.BaseViewModel
|
||||||
|
import com.yuyin.mier.module_home.model.OffiMessageBean
|
||||||
|
import com.yuyin.mier.repository.CommonRepository
|
||||||
|
|
||||||
|
class MessageGFViewModel : BaseViewModel() {
|
||||||
|
var repository = CommonRepository()
|
||||||
|
var offiMessageData = MutableLiveData<List<OffiMessageBean>>()
|
||||||
|
|
||||||
|
fun loadData(type: String, page: Int) {
|
||||||
|
launchUI {
|
||||||
|
var data = repository.official_message(type, page.toString())
|
||||||
|
offiMessageData.value = data.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.yuyin.mier.module_home.tab.xiaoxi.xitong
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||||
|
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
|
||||||
|
import com.yuyin.lib_base.arouter.AroutUtil.MAIN_MESSAGE_OFFICE
|
||||||
|
import com.yuyin.lib_base.base.BaseActivity
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.adapter.OfficeListAdapter
|
||||||
|
import kotlinx.android.synthetic.main.activity_message_office.*
|
||||||
|
|
||||||
|
@Route(path = MAIN_MESSAGE_OFFICE)
|
||||||
|
class MessageOfficeActivity : BaseActivity<MessageGFViewModel>() {
|
||||||
|
|
||||||
|
private var page = 1
|
||||||
|
|
||||||
|
private var officeListAdapter: OfficeListAdapter? = null
|
||||||
|
override fun startObserve() {
|
||||||
|
viewModel.getFinally().observe(this) {
|
||||||
|
smart.finishRefresh()
|
||||||
|
smart.finishLoadMore()
|
||||||
|
}
|
||||||
|
viewModel.offiMessageData.observe(this) {
|
||||||
|
if (officeListAdapter == null) return@observe
|
||||||
|
if (page == 1 && it.isEmpty()) {
|
||||||
|
ll_nodata.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
ll_nodata.visibility = View.GONE
|
||||||
|
}
|
||||||
|
if (page == 1) {
|
||||||
|
officeListAdapter!!.setNewData(it)
|
||||||
|
} else {
|
||||||
|
officeListAdapter!!.data.addAll(it)
|
||||||
|
officeListAdapter!!.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.activity_message_office
|
||||||
|
|
||||||
|
override fun initView() {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
officeListAdapter = OfficeListAdapter()
|
||||||
|
recyclerview.layoutManager = LinearLayoutManager(this)
|
||||||
|
recyclerview.adapter = officeListAdapter
|
||||||
|
viewModel.loadData("1", page)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun initEvent() {
|
||||||
|
smart.setOnRefreshLoadMoreListener(object : OnRefreshLoadMoreListener {
|
||||||
|
override fun onLoadMore(refreshLayout: RefreshLayout) {
|
||||||
|
page++
|
||||||
|
viewModel.loadData("1", page)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRefresh(refreshLayout: RefreshLayout) {
|
||||||
|
page = 1
|
||||||
|
viewModel.loadData("1", page)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.yuyin.mier.module_login.ui
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentManager
|
||||||
|
import androidx.fragment.app.FragmentTransaction
|
||||||
|
import com.yuyin.mier.R
|
||||||
|
import com.yuyin.mier.module_login.ui.forget.ForgotFragment
|
||||||
|
import com.yuyin.mier.module_login.ui.forget.ForgotFragment2
|
||||||
|
|
||||||
|
class ForgetActivity : AppCompatActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_forget)
|
||||||
|
val conversationListFragment = ForgotFragment.newInstance("1")
|
||||||
|
val manager: FragmentManager = supportFragmentManager
|
||||||
|
val transaction: FragmentTransaction = manager.beginTransaction()
|
||||||
|
transaction.replace(R.id.container, conversationListFragment as Fragment)
|
||||||
|
transaction.commit()
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user