Commit a6494f52 authored by jyx's avatar jyx

代码优化

parent c2c2bd50
...@@ -26,7 +26,6 @@ public class TUIC2CChatActivity extends TUIBaseChatActivity { ...@@ -26,7 +26,6 @@ public class TUIC2CChatActivity extends TUIBaseChatActivity {
chatFragment = new TUIC2CChatFragment(); chatFragment = new TUIC2CChatFragment();
chatFragment.setChatInfo((C2CChatInfo) chatInfo); chatFragment.setChatInfo((C2CChatInfo) chatInfo);
getSupportFragmentManager().beginTransaction().replace(R.id.empty_view, chatFragment).commitAllowingStateLoss(); getSupportFragmentManager().beginTransaction().replace(R.id.empty_view, chatFragment).commitAllowingStateLoss();
} }
......
...@@ -8,7 +8,9 @@ import android.text.TextUtils; ...@@ -8,7 +8,9 @@ import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import android.webkit.MimeTypeMap; import android.webkit.MimeTypeMap;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.tencent.imsdk.BaseConstants; import com.tencent.imsdk.BaseConstants;
import com.tencent.imsdk.v2.V2TIMMessage; import com.tencent.imsdk.v2.V2TIMMessage;
...@@ -58,6 +60,7 @@ import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageParser; ...@@ -58,6 +60,7 @@ import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageParser;
import com.tencent.qcloud.tuikit.tuichat.util.OfflinePushInfoUtils; import com.tencent.qcloud.tuikit.tuichat.util.OfflinePushInfoUtils;
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog; import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog;
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatUtils; import com.tencent.qcloud.tuikit.tuichat.util.TUIChatUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
...@@ -140,7 +143,10 @@ public abstract class ChatPresenter { ...@@ -140,7 +143,10 @@ public abstract class ChatPresenter {
baseMessageSender = new IBaseMessageSender() { baseMessageSender = new IBaseMessageSender() {
@Override @Override
public String sendMessage(TUIMessageBean message, String receiver, boolean isGroup, boolean onlineUserOnly) { public String sendMessage(TUIMessageBean message, String receiver, boolean isGroup, boolean onlineUserOnly) {
return ChatPresenter.this.sendMessage(message, receiver, isGroup, onlineUserOnly); ToastUtil.show(message.getV2TIMMessage().getMsgID(), true, 0);
return "";
// return ChatPresenter.this.sendMessage(message, receiver, isGroup, onlineUserOnly);
} }
}; };
TUIChatService.getInstance().setMessageSender(baseMessageSender); TUIChatService.getInstance().setMessageSender(baseMessageSender);
...@@ -158,7 +164,8 @@ public abstract class ChatPresenter { ...@@ -158,7 +164,8 @@ public abstract class ChatPresenter {
loadMessage(type, locateMessage, null); loadMessage(type, locateMessage, null);
} }
public void loadMessage(int type, TUIMessageBean locateMessage, IUIKitCallback<List<TUIMessageBean>> callback) {} public void loadMessage(int type, TUIMessageBean locateMessage, IUIKitCallback<List<TUIMessageBean>> callback) {
}
public void locateLastMessage(String chatID, boolean isGroup, IUIKitCallback<Void> callback) { public void locateLastMessage(String chatID, boolean isGroup, IUIKitCallback<Void> callback) {
provider.loadLastMessage(chatID, isGroup, true, new IUIKitCallback<TUIMessageBean>() { provider.loadLastMessage(chatID, isGroup, true, new IUIKitCallback<TUIMessageBean>() {
...@@ -217,7 +224,8 @@ public abstract class ChatPresenter { ...@@ -217,7 +224,8 @@ public abstract class ChatPresenter {
locateMessage(messageBean.getId(), new IUIKitCallback<Void>() { locateMessage(messageBean.getId(), new IUIKitCallback<Void>() {
@Override @Override
public void onSuccess(Void data) {} public void onSuccess(Void data) {
}
@Override @Override
public void onError(String module, int errCode, String errMsg) { public void onError(String module, int errCode, String errMsg) {
...@@ -250,7 +258,8 @@ public abstract class ChatPresenter { ...@@ -250,7 +258,8 @@ public abstract class ChatPresenter {
} }
locateMessage(originMsgId, new IUIKitCallback<Void>() { locateMessage(originMsgId, new IUIKitCallback<Void>() {
@Override @Override
public void onSuccess(Void data) {} public void onSuccess(Void data) {
}
@Override @Override
public void onError(String module, int errCode, String errMsg) { public void onError(String module, int errCode, String errMsg) {
...@@ -279,7 +288,8 @@ public abstract class ChatPresenter { ...@@ -279,7 +288,8 @@ public abstract class ChatPresenter {
updateAdapter(IMessageRecyclerView.DATA_CHANGE_TYPE_UPDATE, 0); updateAdapter(IMessageRecyclerView.DATA_CHANGE_TYPE_UPDATE, 0);
loadMessage(TUIChatConstants.GET_MESSAGE_LOCATE, data, new IUIKitCallback<List<TUIMessageBean>>() { loadMessage(TUIChatConstants.GET_MESSAGE_LOCATE, data, new IUIKitCallback<List<TUIMessageBean>>() {
@Override @Override
public void onSuccess(List<TUIMessageBean> data) {} public void onSuccess(List<TUIMessageBean> data) {
}
@Override @Override
public void onError(String module, int errCode, String errMsg) { public void onError(String module, int errCode, String errMsg) {
...@@ -437,7 +447,8 @@ public abstract class ChatPresenter { ...@@ -437,7 +447,8 @@ public abstract class ChatPresenter {
}); });
} }
protected void onMessageLoadCompleted(List<TUIMessageBean> data, int getType) {} protected void onMessageLoadCompleted(List<TUIMessageBean> data, int getType) {
}
protected void processLoadedMessage(List<TUIMessageBean> data, int type) { protected void processLoadedMessage(List<TUIMessageBean> data, int type) {
for (TUIMessageBean messageBean : data) { for (TUIMessageBean messageBean : data) {
...@@ -1051,7 +1062,8 @@ public abstract class ChatPresenter { ...@@ -1051,7 +1062,8 @@ public abstract class ChatPresenter {
TUIConstants.TUIConversation.EVENT_SUB_KEY_MESSAGE_SEND_FOR_CONVERSATION, param); TUIConstants.TUIConversation.EVENT_SUB_KEY_MESSAGE_SEND_FOR_CONVERSATION, param);
} }
public void sendTypingStatusMessage(TUIMessageBean message, String receiver, IUIKitCallback<TUIMessageBean> callBack) {} public void sendTypingStatusMessage(TUIMessageBean message, String receiver, IUIKitCallback<TUIMessageBean> callBack) {
}
public boolean isSupportTyping(long time) { public boolean isSupportTyping(long time) {
return false; return false;
...@@ -1062,11 +1074,12 @@ public abstract class ChatPresenter { ...@@ -1062,11 +1074,12 @@ public abstract class ChatPresenter {
if (loadedMessageInfoList.get(i) == null) { if (loadedMessageInfoList.get(i) == null) {
continue; continue;
} }
if (loadedMessageInfoList.get(i).getId().equals(messageInfo.getId())) {
loadedMessageInfoList.set(i, messageInfo); // if (loadedMessageInfoList.get(i).getId().equals(messageInfo.getId())) {
updateAdapter(dataChangeType, messageInfo); // loadedMessageInfoList.set(i, messageInfo);
return; // updateAdapter(dataChangeType, messageInfo);
} // return;
// }
} }
} }
...@@ -1273,7 +1286,8 @@ public abstract class ChatPresenter { ...@@ -1273,7 +1286,8 @@ public abstract class ChatPresenter {
} }
@Override @Override
public void onError(String module, int errCode, String errMsg) {} public void onError(String module, int errCode, String errMsg) {
}
}); });
} }
...@@ -1294,7 +1308,8 @@ public abstract class ChatPresenter { ...@@ -1294,7 +1308,8 @@ public abstract class ChatPresenter {
} }
@Override @Override
public void onError(String module, int errCode, String errMsg) {} public void onError(String module, int errCode, String errMsg) {
}
}); });
} }
...@@ -1475,7 +1490,8 @@ public abstract class ChatPresenter { ...@@ -1475,7 +1490,8 @@ public abstract class ChatPresenter {
} }
} }
protected void assembleGroupMessage(TUIMessageBean message) {} protected void assembleGroupMessage(TUIMessageBean message) {
}
public void forwardMessageMerge( public void forwardMessageMerge(
List<TUIMessageBean> msgInfos, boolean isGroup, String id, String offlineTitle, boolean selfConversation, final IUIKitCallback callBack) { List<TUIMessageBean> msgInfos, boolean isGroup, String id, String offlineTitle, boolean selfConversation, final IUIKitCallback callBack) {
...@@ -1862,9 +1878,11 @@ public abstract class ChatPresenter { ...@@ -1862,9 +1878,11 @@ public abstract class ChatPresenter {
ChatModifyMessageHelper.enqueueTask(task); ChatModifyMessageHelper.enqueueTask(task);
} }
public void getChatName(String chatID, IUIKitCallback<String> callback) {} public void getChatName(String chatID, IUIKitCallback<String> callback) {
}
public void getChatFaceUrl(String chatID, IUIKitCallback<List<Object>> callback) {} public void getChatFaceUrl(String chatID, IUIKitCallback<List<Object>> callback) {
}
public void getUserBean(Set<String> userIds, IUIKitCallback<Map<String, UserBean>> callback) { public void getUserBean(Set<String> userIds, IUIKitCallback<Map<String, UserBean>> callback) {
Map<String, UserBean> userBeanHashMap = new HashMap<>(); Map<String, UserBean> userBeanHashMap = new HashMap<>();
...@@ -1940,17 +1958,23 @@ public abstract class ChatPresenter { ...@@ -1940,17 +1958,23 @@ public abstract class ChatPresenter {
} }
public interface ChatNotifyHandler { public interface ChatNotifyHandler {
default void onGroupForceExit() {} default void onGroupForceExit() {
}
default void onGroupNameChanged(String newName) {} default void onGroupNameChanged(String newName) {
}
default void onFriendNameChanged(String newName) {} default void onFriendNameChanged(String newName) {
}
default void onApplied(int size) {} default void onApplied(int size) {
}
default void onFriendFaceUrlChanged(String faceUrl) {} default void onFriendFaceUrlChanged(String faceUrl) {
}
default void onGroupFaceUrlChanged(String faceUrl) {} default void onGroupFaceUrlChanged(String faceUrl) {
}
void onExitChat(String chatId); void onExitChat(String chatId);
} }
......
...@@ -7,12 +7,15 @@ import android.database.Cursor; ...@@ -7,12 +7,15 @@ import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import com.tencent.qcloud.tuicore.annotations.TUIInitializerDependency; import com.tencent.qcloud.tuicore.annotations.TUIInitializerDependency;
import com.tencent.qcloud.tuicore.annotations.TUIInitializerID; import com.tencent.qcloud.tuicore.annotations.TUIInitializerID;
import com.tencent.qcloud.tuicore.annotations.TUIInitializerPriority; import com.tencent.qcloud.tuicore.annotations.TUIInitializerPriority;
import com.tencent.qcloud.tuicore.interfaces.TUIInitializer; import com.tencent.qcloud.tuicore.interfaces.TUIInitializer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
...@@ -35,7 +38,8 @@ public class ServiceInitializer extends ContentProvider { ...@@ -35,7 +38,8 @@ public class ServiceInitializer extends ContentProvider {
/** /**
* @param context applicationContext * @param context applicationContext
*/ */
public void init(Context context) {} public void init(Context context) {
}
/** /**
* LightTheme id * LightTheme id
......
{
"agcgw":{
"backurl":"connect-drcn.dbankcloud.cn",
"url":"connect-drcn.hispace.hicloud.com"
},
"client":{
"cp_id":"*********",
"product_id":"********",
"client_id":"********",
"client_secret":"************",
"app_id":"********",
"package_name":"com.duben.roseplaylet",
"api_key":"**********"
},
"service":{
"analytics":{
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
"resource_id":"p1",
"channel_id":""
},
"cloudstorage":{
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn"
},
"ml":{
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
}
},
"region":"CN",
"configuration_version":"1.0"
}
\ No newline at end of file
...@@ -5,6 +5,10 @@ apply plugin: 'kotlin-kapt' ...@@ -5,6 +5,10 @@ apply plugin: 'kotlin-kapt'
//sharesdk //sharesdk
apply plugin: 'com.mob.sdk' apply plugin: 'com.mob.sdk'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'
apply plugin: 'com.hihonor.mcs.asplugin'
android { android {
compileSdkVersion rootProject.ext.androidCompileSdkVersion compileSdkVersion rootProject.ext.androidCompileSdkVersion
buildToolsVersion rootProject.ext.androidBuildToolsVersion buildToolsVersion rootProject.ext.androidBuildToolsVersion
...@@ -33,7 +37,12 @@ android { ...@@ -33,7 +37,12 @@ android {
SHARE_SECRET : RELEASE_SHARESDK_SECRET, SHARE_SECRET : RELEASE_SHARESDK_SECRET,
MAP_KEY : RELEASE_MAP_KEY, MAP_KEY : RELEASE_MAP_KEY,
XG_ACCESS_ID : TX_XG_ACCESS_ID, XG_ACCESS_ID : TX_XG_ACCESS_ID,
XG_ACCESS_KEY : TX_XG_ACCESS_KEY] XG_ACCESS_KEY : TX_XG_ACCESS_KEY,
"VIVO_APPKEY": " ",
"VIVO_APPID" : " ",
"HONOR_APPID": " "
]
} }
compileOptions { compileOptions {
...@@ -285,6 +294,17 @@ dependencies { ...@@ -285,6 +294,17 @@ dependencies {
api "com.tencent.imsdk:tuiconversationgroup-plugin:8.3.6498" api "com.tencent.imsdk:tuiconversationgroup-plugin:8.3.6498"
// 集成会话标记插件,从 7.3 版本开始支持 // 集成会话标记插件,从 7.3 版本开始支持
api "com.tencent.imsdk:tuiconversationmark-plugin:8.3.6498" api "com.tencent.imsdk:tuiconversationmark-plugin:8.3.6498"
// 集成消息推送插件,从 7.6 版本开始支持
api 'com.tencent.timpush:timpush:8.3.6498'
// 按需集成对应厂商推送包
api 'com.tencent.timpush:fcm:8.3.6498'
api 'com.tencent.timpush:xiaomi:8.3.6498'
api 'com.tencent.timpush:meizu:8.3.6498'
api 'com.tencent.timpush:oppo:8.3.6498'
api 'com.tencent.timpush:vivo:8.3.6498'
api 'com.tencent.timpush:huawei:8.3.6498'
api 'com.tencent.timpush:honor:8.3.6498'
annotationProcessor 'com.google.auto.service:auto-service-annotations:1.1.1'
// 选择器 // 选择器
implementation 'com.contrarywind:Android-PickerView:4.1.9' implementation 'com.contrarywind:Android-PickerView:4.1.9'
......
{
"project_info": {
"project_number": "******",
"firebase_url": "******",
"project_id": "******",
"storage_bucket": "******.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "******",
"android_client_info": {
"package_name": "com.duben.roseplaylet"
}
},
"oauth_client": [
{
"client_id": "******.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "******"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "******.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
{
"developer_id":"********",
"app_id":"********",
"package_name":"com.duben.roseplaylet",
"version":"1.0"
}
\ No newline at end of file
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
android:name="android.permission.READ_CALENDAR" android:name="android.permission.READ_CALENDAR"
tools:node="remove" /> tools:node="remove" />
<!-- 业务使用权限 --> <!-- 业务使用权限 -->
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
...@@ -251,6 +250,11 @@ ...@@ -251,6 +250,11 @@
android:exported="false" android:exported="false"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.CustomChatActivity"
android:exported="false"
android:screenOrientation="portrait" />
<service <service
android:name=".ui.service.UpdateService" android:name=".ui.service.UpdateService"
......
...@@ -10,6 +10,7 @@ import androidx.multidex.MultiDexApplication; ...@@ -10,6 +10,7 @@ import androidx.multidex.MultiDexApplication;
import com.downloader.PRDownloader; import com.downloader.PRDownloader;
import com.downloader.PRDownloaderConfig; import com.downloader.PRDownloaderConfig;
import com.duben.roseplaylet.ad.TTAdManagerHolder; import com.duben.roseplaylet.ad.TTAdManagerHolder;
import com.duben.roseplaylet.common.AppConfig;
import com.duben.roseplaylet.common.Constant; import com.duben.roseplaylet.common.Constant;
import com.duben.roseplaylet.manager.CsjAppLogManager; import com.duben.roseplaylet.manager.CsjAppLogManager;
import com.duben.roseplaylet.manager.CsjDJXSdkManager; import com.duben.roseplaylet.manager.CsjDJXSdkManager;
...@@ -188,11 +189,5 @@ public class MintsApplication extends MultiDexApplication { ...@@ -188,11 +189,5 @@ public class MintsApplication extends MultiDexApplication {
private void initIMAppInfo() { private void initIMAppInfo() {
TUIConfig.setTUIHostType(TUIConfig.TUI_HOST_TYPE_IMAPP); TUIConfig.setTUIHostType(TUIConfig.TUI_HOST_TYPE_IMAPP);
// try {
// Field field = BuildConfig.class.getField("FLAVOR");
// AppConfig.FLAVOR_VERSION = (String) field.get(null);
// } catch (NoSuchFieldException | IllegalAccessException | ClassCastException e) {
// ignore
// }
} }
} }
package com.duben.roseplaylet.common; package com.duben.roseplaylet.common;
import com.duben.roseplaylet.im.GenerateTestUserSig;
/** /**
* 描述:配置app设置开关 * 描述:配置app设置开关
* 作者:孟崔广 * 作者:孟崔广
...@@ -33,10 +35,9 @@ public class AppConfig { ...@@ -33,10 +35,9 @@ public class AppConfig {
public static double firstVipPrice = 0.0; public static double firstVipPrice = 0.0;
public static String IM_FLAVOR_VERSION = Constant.FLAVOR_LOCAL; public static String IM_FLAVOR_VERSION = Constant.FLAVOR_LOCAL;
public static final int IM_UI_STYLE_CLASSIC = 0; public static final int IM_UI_STYLE_CLASSIC = 0;
public static int IM_UI_STYLE = IM_UI_STYLE_CLASSIC; public static int IM_UI_STYLE = IM_UI_STYLE_CLASSIC;
public static int IM_SDK_APPID = 0; public static int IM_SDK_APPID = GenerateTestUserSig.SDKAPPID;
} }
...@@ -77,4 +77,7 @@ object Constant { ...@@ -77,4 +77,7 @@ object Constant {
const val USERINFO = "userInfo" const val USERINFO = "userInfo"
const val FLAVOR_INTERNATIONAL = "international" const val FLAVOR_INTERNATIONAL = "international"
const val DEMO_LANGUAGE_CHANGED_ACTION = "demoLanguageChangedAction"
const val DEMO_THEME_CHANGED_ACTION = "demoThemeChangedAction"
} }
\ No newline at end of file
...@@ -31,6 +31,14 @@ enum class UserProfile(val str: String, val arr: Array<String>) { ...@@ -31,6 +31,14 @@ enum class UserProfile(val str: String, val arr: Array<String>) {
"个性标签", "个性标签",
arrayOf("") arrayOf("")
), ),
PROFILE_NL(
"年龄",
arrayOf("")
),
PROFILE_JYJM(
"交友节目",
arrayOf("")
),
UNKNOWN( UNKNOWN(
"未知", "未知",
arrayOf("") arrayOf("")
......
...@@ -4,6 +4,7 @@ import android.content.Context; ...@@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import com.duben.roseplaylet.common.AppConfig; import com.duben.roseplaylet.common.AppConfig;
import com.duben.roseplaylet.manager.UserManager;
import com.duben.roseplaylet.utils.LogUtil; import com.duben.roseplaylet.utils.LogUtil;
import com.tencent.imsdk.BaseConstants; import com.tencent.imsdk.BaseConstants;
import com.tencent.imsdk.v2.V2TIMConversationListener; import com.tencent.imsdk.v2.V2TIMConversationListener;
...@@ -105,13 +106,10 @@ public class LoginWrapper { ...@@ -105,13 +106,10 @@ public class LoginWrapper {
return; return;
} }
ThreadUtils.runOnUiThread(new Runnable() { ThreadUtils.runOnUiThread(() -> {
@Override
public void run() {
if (!appLoginObservers.contains(observer)) { if (!appLoginObservers.contains(observer)) {
appLoginObservers.add(observer); appLoginObservers.add(observer);
} }
}
}); });
} }
...@@ -127,7 +125,7 @@ public class LoginWrapper { ...@@ -127,7 +125,7 @@ public class LoginWrapper {
TUILogin.login(context, sdkAppID, userID, userSig, config, new TUICallback() { TUILogin.login(context, sdkAppID, userID, userSig, config, new TUICallback() {
@Override @Override
public void onError(final int code, final String desc) { public void onError(final int code, final String desc) {
UserInfo.getInstance().setLastLoginCode(code); UserManager.getInstance().setLastImLoginCode(code);
if (tuiCallback != null) { if (tuiCallback != null) {
tuiCallback.onError(code, desc); tuiCallback.onError(code, desc);
} }
...@@ -136,7 +134,7 @@ public class LoginWrapper { ...@@ -136,7 +134,7 @@ public class LoginWrapper {
@Override @Override
public void onSuccess() { public void onSuccess() {
if (config == null || false == config.isInitLocalStorageOnly()) { if (config == null || false == config.isInitLocalStorageOnly()) {
UserInfo.getInstance().setLastLoginCode(BaseConstants.ERR_SUCC); UserManager.getInstance().setLastImLoginCode(BaseConstants.ERR_SUCC);
} }
if (tuiCallback != null) { if (tuiCallback != null) {
...@@ -148,12 +146,15 @@ public class LoginWrapper { ...@@ -148,12 +146,15 @@ public class LoginWrapper {
private void tryToAutoLogin() { private void tryToAutoLogin() {
int loginStatus = V2TIMManager.getInstance().getLoginStatus(); int loginStatus = V2TIMManager.getInstance().getLoginStatus();
int lastLoginCode = UserInfo.getInstance().getLastLoginCode(); UserManager userInfo = UserManager.getInstance();
UserInfo userInfo = UserInfo.getInstance(); int lastLoginCode = userInfo.getLastImLoginCode();
if (loginStatus == V2TIMManager.V2TIM_STATUS_LOGOUT && !TextUtils.isEmpty(userInfo.getUserId()) && userInfo.isAutoLogin()) {
// if (loginStatus == V2TIMManager.V2TIM_STATUS_LOGOUT && !TextUtils.isEmpty(userInfo.getUserID()) && userInfo.isAutoLogin()) {
if (loginStatus == V2TIMManager.V2TIM_STATUS_LOGOUT && !TextUtils.isEmpty(userInfo.getUserID())) {
if (lastLoginCode >= BaseConstants.ERR_SDK_NET_ENCODE_FAILED && lastLoginCode <= BaseConstants.ERR_SDK_NET_SEND_REMAINING_TIMEOUT_NO_NETWORK) { if (lastLoginCode >= BaseConstants.ERR_SDK_NET_ENCODE_FAILED && lastLoginCode <= BaseConstants.ERR_SDK_NET_SEND_REMAINING_TIMEOUT_NO_NETWORK) {
LogUtil.i(TAG, "onConnectSuccess, login IMSDK"); LogUtil.i(TAG, "onConnectSuccess, login IMSDK");
loginIMSDK(TIMAppService.getAppContext(), AppConfig.IM_SDK_APPID, userInfo.getUserId(), userInfo.getUserSig(), TUIUtils.getLoginConfig(), loginIMSDK(TIMAppService.getAppContext(), AppConfig.IM_SDK_APPID, userInfo.getUserID(),
GenerateTestUserSig.genTestUserSig(userInfo.getUserID()), TUIUtils.getLoginConfig(),
new TUICallback() { new TUICallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
...@@ -162,17 +163,11 @@ public class LoginWrapper { ...@@ -162,17 +163,11 @@ public class LoginWrapper {
@Override @Override
public void onError(int errorCode, String errorMessage) { public void onError(int errorCode, String errorMessage) {
UserInfo.getInstance().setLastLoginCode(errorCode); UserManager.getInstance().setLastImLoginCode(errorCode);
LogUtil.e(TAG, "tryToAutoLogin error:" + errorCode); LogUtil.e(TAG, "tryToAutoLogin error:" + errorCode);
if (errorCode < BaseConstants.ERR_SDK_NET_ENCODE_FAILED if (errorCode < BaseConstants.ERR_SDK_NET_ENCODE_FAILED
|| errorCode > BaseConstants.ERR_SDK_NET_SEND_REMAINING_TIMEOUT_NO_NETWORK) { || errorCode > BaseConstants.ERR_SDK_NET_SEND_REMAINING_TIMEOUT_NO_NETWORK) {
if (AppConfig.IM_UI_STYLE == AppConfig.IM_UI_STYLE_CLASSIC) {
// MainActivity.finishMainActivity();
} else {
// MainMinimalistActivity.finishMainActivity();
}
TIMAppService.getInstance().startLoginActivity();
} }
} }
}); });
......
...@@ -7,8 +7,7 @@ import android.content.IntentFilter; ...@@ -7,8 +7,7 @@ import android.content.IntentFilter;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.duben.roseplaylet.R; import com.duben.roseplaylet.common.Constant;
import com.duben.roseplaylet.common.AppConfig;
import com.duben.roseplaylet.utils.LogUtil; import com.duben.roseplaylet.utils.LogUtil;
import com.google.auto.service.AutoService; import com.google.auto.service.AutoService;
import com.tencent.qcloud.tuicore.ServiceInitializer; import com.tencent.qcloud.tuicore.ServiceInitializer;
...@@ -19,7 +18,6 @@ import com.tencent.qcloud.tuicore.interfaces.ITUIService; ...@@ -19,7 +18,6 @@ import com.tencent.qcloud.tuicore.interfaces.ITUIService;
import com.tencent.qcloud.tuicore.interfaces.TUICallback; import com.tencent.qcloud.tuicore.interfaces.TUICallback;
import com.tencent.qcloud.tuicore.interfaces.TUIInitializer; import com.tencent.qcloud.tuicore.interfaces.TUIInitializer;
import com.tencent.qcloud.tuicore.interfaces.TUILoginListener; import com.tencent.qcloud.tuicore.interfaces.TUILoginListener;
import com.tencent.qcloud.tuicore.util.ToastUtil;
@AutoService(TUIInitializer.class) @AutoService(TUIInitializer.class)
@TUIInitializerDependency("TIMCommon") @TUIInitializerDependency("TIMCommon")
...@@ -80,18 +78,7 @@ public class TIMAppService implements TUIInitializer, ITUIService { ...@@ -80,18 +78,7 @@ public class TIMAppService implements TUIInitializer, ITUIService {
public void logout() { public void logout() {
LogUtil.i(TAG, "logout"); LogUtil.i(TAG, "logout");
UserInfo.getInstance().cleanUserInfo(); // UserInfo.getInstance().cleanUserInfo();
// Intent intent = new Intent(getAppContext(), LoginForDevActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.putExtra("LOGOUT", true);
// getAppContext().startActivity(intent);
if (AppConfig.IM_SDK_APPID == AppConfig.IM_UI_STYLE_CLASSIC) {
// MainActivity.finishMainActivity();
} else {
// MainMinimalistActivity.finishMainActivity();
}
} }
private void initThemeAndLanguageChangedReceiver() { private void initThemeAndLanguageChangedReceiver() {
...@@ -108,13 +95,13 @@ public class TIMAppService implements TUIInitializer, ITUIService { ...@@ -108,13 +95,13 @@ public class TIMAppService implements TUIInitializer, ITUIService {
CustomConfigHelper.initConversationDefaultAvatar(); CustomConfigHelper.initConversationDefaultAvatar();
} }
}; };
// IntentFilter languageFilter = new IntentFilter(); IntentFilter languageFilter = new IntentFilter();
// languageFilter.addAction(Constant.DEMO_LANGUAGE_CHANGED_ACTION); languageFilter.addAction(Constant.DEMO_LANGUAGE_CHANGED_ACTION);
// LocalBroadcastManager.getInstance(mContext).registerReceiver(languageChangedReceiver, languageFilter); LocalBroadcastManager.getInstance(mContext).registerReceiver(languageChangedReceiver, languageFilter);
//
// IntentFilter themeFilter = new IntentFilter(); IntentFilter themeFilter = new IntentFilter();
// themeFilter.addAction(Constant.DEMO_THEME_CHANGED_ACTION); themeFilter.addAction(Constant.DEMO_THEME_CHANGED_ACTION);
// LocalBroadcastManager.getInstance(mContext).registerReceiver(themeChangedReceiver, themeFilter); LocalBroadcastManager.getInstance(mContext).registerReceiver(themeChangedReceiver, themeFilter);
} }
public void registerPushManually() { public void registerPushManually() {
...@@ -133,12 +120,6 @@ public class TIMAppService implements TUIInitializer, ITUIService { ...@@ -133,12 +120,6 @@ public class TIMAppService implements TUIInitializer, ITUIService {
initSetting.initBeforeLogin(sdkappid); initSetting.initBeforeLogin(sdkappid);
} }
public void startLoginActivity() {
// Intent intent = new Intent(mContext, LoginForDevActivity.class);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// mContext.startActivity(intent);
}
public static Context getAppContext() { public static Context getAppContext() {
return ServiceInitializer.getAppContext(); return ServiceInitializer.getAppContext();
} }
......
package com.duben.roseplaylet.im;
import android.content.SharedPreferences;
import com.duben.roseplaylet.common.Constant;
import com.google.gson.Gson;
import com.tencent.imsdk.BaseConstants;
import java.io.Serializable;
public class UserInfo implements Serializable {
private final static String PER_USER_MODEL = "per_user_model";
private static UserInfo sUserInfo;
private int sdkAppId;
private String zone;
private String phone;
private String token;
private String userId;
private String userSig;
private String name;
private String avatar;
private boolean autoLogin;
private boolean debugLogin = false;
private int lastLoginCode = BaseConstants.ERR_SUCC;
public synchronized static UserInfo getInstance() {
if (sUserInfo == null) {
SharedPreferences shareInfo = TIMAppService.getAppContext().getSharedPreferences(Constant.USERINFO, 0);
String json = shareInfo.getString(PER_USER_MODEL, "");
sUserInfo = new Gson().fromJson(json, UserInfo.class);
if (sUserInfo == null) {
sUserInfo = new UserInfo();
}
}
return sUserInfo;
}
private UserInfo() {}
public void setUserInfo(UserInfo info) {
SharedPreferences shareInfo = TIMAppService.getAppContext().getSharedPreferences(Constant.USERINFO, 0);
SharedPreferences.Editor editor = shareInfo.edit();
editor.putString(PER_USER_MODEL, new Gson().toJson(info));
editor.commit();
}
public int getSdkAppId() {
return sdkAppId;
}
public void setSdkAppId(int sdkAppId) {
this.sdkAppId = sdkAppId;
}
public String getUserSig() {
return this.userSig;
}
public void setUserSig(String userSig) {
this.userSig = userSig;
setUserInfo(this);
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
setUserInfo(this);
}
public String getUserId() {
return this.userId;
}
public void setUserId(String userId) {
this.userId = userId;
setUserInfo(this);
}
public String getToken() {
return this.token;
}
public void setToken(String token) {
this.token = token;
setUserInfo(this);
}
public String getZone() {
return this.zone;
}
public void setZone(String zone) {
this.zone = zone;
setUserInfo(this);
}
public String getPhone() {
return this.phone;
}
public void setPhone(String userPhone) {
this.phone = userPhone;
setUserInfo(this);
}
public Boolean isAutoLogin() {
return this.autoLogin;
}
public void setAutoLogin(boolean autoLogin) {
this.autoLogin = autoLogin;
setUserInfo(this);
}
public String getAvatar() {
return this.avatar;
}
public void setAvatar(String url) {
this.avatar = url;
setUserInfo(this);
}
public void setDebugLogin(boolean debugLogin) {
this.debugLogin = debugLogin;
setUserInfo(this);
}
public boolean isDebugLogin() {
return debugLogin;
}
public int getLastLoginCode() {
return lastLoginCode;
}
public void setLastLoginCode(int lastLoginCode) {
this.lastLoginCode = lastLoginCode;
setUserInfo(this);
}
public void cleanUserInfo() {
sdkAppId = 0;
zone = "";
token = "";
userId = "";
userSig = "";
name = "";
avatar = "";
autoLogin = false;
lastLoginCode = BaseConstants.ERR_SUCC;
setUserInfo(this);
}
}
package com.duben.roseplaylet.im.activities;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.tencent.qcloud.tuicore.TUIThemeManager;
import com.tencent.qcloud.tuikit.timcommon.R;
public class BaseLightActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
getWindow().setStatusBarColor(
getResources().getColor(TUIThemeManager.getAttrResId(this, com.tencent.qcloud.tuicore.R.attr.core_header_start_color)));
getWindow().setNavigationBarColor(getResources().getColor(R.color.navigation_bar_color));
int vis = getWindow().getDecorView().getSystemUiVisibility();
vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
vis |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
getWindow().getDecorView().setSystemUiVisibility(vis);
}
}
@Override
public void finish() {
hideSoftInput();
super.finish();
}
public void hideSoftInput() {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
Window window = getWindow();
if (window != null) {
imm.hideSoftInputFromWindow(window.getDecorView().getWindowToken(), 0);
}
}
}
package com.duben.roseplaylet.im.activities;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.tencent.imsdk.v2.V2TIMGroupAtInfo;
import com.tencent.imsdk.v2.V2TIMMessage;
import com.tencent.qcloud.tuicore.TUIConstants;
import com.tencent.qcloud.tuicore.util.ToastUtil;
import com.tencent.qcloud.tuikit.timcommon.bean.TUIMessageBean;
import com.tencent.qcloud.tuikit.timcommon.component.activities.BaseLightActivity;
import com.tencent.qcloud.tuikit.tuichat.R;
import com.tencent.qcloud.tuikit.tuichat.bean.C2CChatInfo;
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
import com.tencent.qcloud.tuikit.tuichat.bean.DraftInfo;
import com.tencent.qcloud.tuikit.tuichat.bean.GroupChatInfo;
import com.tencent.qcloud.tuikit.tuichat.util.ChatMessageBuilder;
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog;
import java.util.List;
public abstract class TUIBaseChatActivity extends BaseLightActivity {
private static final String TAG = TUIBaseChatActivity.class.getSimpleName();
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
TUIChatLog.i(TAG, "onCreate " + this);
super.onCreate(savedInstanceState);
setContentView(R.layout.chat_activity);
initChat(getIntent());
}
@Override
protected void onNewIntent(Intent intent) {
TUIChatLog.i(TAG, "onNewIntent");
super.onNewIntent(intent);
initChat(intent);
}
@Override
protected void onResume() {
TUIChatLog.i(TAG, "onResume");
super.onResume();
}
private void initChat(Intent intent) {
Bundle bundle = intent.getExtras();
TUIChatLog.i(TAG, "bundle: " + bundle + " intent: " + intent);
ChatInfo chatInfo = getChatInfo(intent);
TUIChatLog.i(TAG, "start chatActivity chatInfo: " + chatInfo);
if (chatInfo != null) {
initChat(chatInfo);
} else {
ToastUtil.toastShortMessage("init chat failed , chatInfo is empty.");
TUIChatLog.e(TAG, "init chat failed , chatInfo is empty.");
finish();
}
}
public abstract void initChat(ChatInfo chatInfo);
private ChatInfo getChatInfo(Intent intent) {
int chatType = intent.getIntExtra(TUIConstants.TUIChat.CHAT_TYPE, ChatInfo.TYPE_INVALID);
ChatInfo chatInfo;
if (chatType == ChatInfo.TYPE_C2C) {
chatInfo = new C2CChatInfo();
} else if (chatType == ChatInfo.TYPE_GROUP) {
chatInfo = new GroupChatInfo();
} else {
return null;
}
chatInfo.setType(chatType);
chatInfo.setId(intent.getStringExtra(TUIConstants.TUIChat.CHAT_ID));
chatInfo.setChatName(intent.getStringExtra(TUIConstants.TUIChat.CHAT_NAME));
DraftInfo draftInfo = new DraftInfo();
draftInfo.setDraftText(intent.getStringExtra(TUIConstants.TUIChat.DRAFT_TEXT));
draftInfo.setDraftTime(intent.getLongExtra(TUIConstants.TUIChat.DRAFT_TIME, 0));
chatInfo.setDraft(draftInfo);
chatInfo.setTopChat(intent.getBooleanExtra(TUIConstants.TUIChat.IS_TOP_CHAT, false));
V2TIMMessage v2TIMMessage = (V2TIMMessage) intent.getSerializableExtra(TUIConstants.TUIChat.LOCATE_MESSAGE);
TUIMessageBean messageInfo = ChatMessageBuilder.buildMessage(v2TIMMessage);
chatInfo.setLocateMessage(messageInfo);
chatInfo.setAtInfoList((List<V2TIMGroupAtInfo>) intent.getSerializableExtra(TUIConstants.TUIChat.AT_INFO_LIST));
chatInfo.setFaceUrl(intent.getStringExtra(TUIConstants.TUIChat.FACE_URL));
chatInfo.setEnableAudioCall(intent.getBooleanExtra(TUIConstants.TUIChat.ENABLE_AUDIO_CALL, true));
chatInfo.setEnableVideoCall(intent.getBooleanExtra(TUIConstants.TUIChat.ENABLE_VIDEO_CALL, true));
chatInfo.setEnableRoom(intent.getBooleanExtra(TUIConstants.TUIChat.ENABLE_ROOM, true));
if (chatType == ChatInfo.TYPE_GROUP) {
GroupChatInfo groupChatInfo = (GroupChatInfo) chatInfo;
groupChatInfo.setGroupName(intent.getStringExtra(TUIConstants.TUIChat.GROUP_NAME));
groupChatInfo.setGroupType(intent.getStringExtra(TUIConstants.TUIChat.GROUP_TYPE));
groupChatInfo.setNotice(intent.getStringExtra(TUIConstants.TUIChat.NOTICE));
}
if (TextUtils.isEmpty(chatInfo.getId())) {
return null;
}
return chatInfo;
}
}
package com.duben.roseplaylet.im.activities;
import com.tencent.qcloud.tuicore.util.ToastUtil;
import com.tencent.qcloud.tuikit.tuichat.R;
import com.tencent.qcloud.tuikit.tuichat.bean.C2CChatInfo;
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIBaseChatActivity;
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatFragment;
import com.tencent.qcloud.tuikit.tuichat.presenter.C2CChatPresenter;
import com.tencent.qcloud.tuikit.tuichat.util.TUIChatLog;
public class TUIC2CChatActivity extends TUIBaseChatActivity {
private static final String TAG = TUIC2CChatActivity.class.getSimpleName();
private TUIC2CChatFragment chatFragment;
@Override
public void initChat(ChatInfo chatInfo) {
TUIChatLog.i(TAG, "inti chat " + chatInfo);
if (!(chatInfo instanceof C2CChatInfo)) {
TUIChatLog.e(TAG, "init C2C chat failed , chatInfo = " + chatInfo);
ToastUtil.toastShortMessage("init c2c chat failed.");
return;
}
chatFragment = new TUIC2CChatFragment();
chatFragment.setChatInfo((C2CChatInfo) chatInfo);
getSupportFragmentManager().beginTransaction().replace(R.id.empty_view, chatFragment).commitAllowingStateLoss();
}
@Override
protected void onDestroy() {
C2CChatPresenter chatPresenter = null;
if (chatFragment != null) {
chatPresenter = chatFragment.getPresenter();
}
if (chatPresenter != null) {
chatPresenter.removeC2CChatEventListener();
}
super.onDestroy();
}
}
...@@ -4,6 +4,7 @@ import android.text.TextUtils; ...@@ -4,6 +4,7 @@ import android.text.TextUtils;
import com.duben.roseplaylet.MintsApplication; import com.duben.roseplaylet.MintsApplication;
import com.duben.roseplaylet.mvp.model.UserBean; import com.duben.roseplaylet.mvp.model.UserBean;
import com.tencent.imsdk.BaseConstants;
import net.grandcentrix.tray.AppPreferences; import net.grandcentrix.tray.AppPreferences;
...@@ -54,6 +55,12 @@ public class UserManager { ...@@ -54,6 +55,12 @@ public class UserManager {
* vip是否永久 * vip是否永久
*/ */
private static final String VIP_FOREVER = "VIP_FOREVER"; private static final String VIP_FOREVER = "VIP_FOREVER";
/**
* 上次IM登录CODE
*/
private static final String LAST_IM_LOGIN_CODE = "LAST_IM_LOGIN_CODE";
private static final String VIP_DATE = "VIP_DATE"; private static final String VIP_DATE = "VIP_DATE";
private static final String CODE_ID = "codeId"; private static final String CODE_ID = "codeId";
private static final String SHARE_CODE = "share_code"; private static final String SHARE_CODE = "share_code";
...@@ -61,12 +68,10 @@ public class UserManager { ...@@ -61,12 +68,10 @@ public class UserManager {
private static final String NEW_FLAG = "new_flag"; private static final String NEW_FLAG = "new_flag";
public static UserManager getInstance() { public static UserManager getInstance() {
if (_inst != null) { if (_inst == null) {
return _inst;
} else {
_inst = new UserManager(); _inst = new UserManager();
return _inst;
} }
return _inst;
} }
private UserManager() { private UserManager() {
...@@ -226,7 +231,6 @@ public class UserManager { ...@@ -226,7 +231,6 @@ public class UserManager {
ps.put(VIP_FLAG, vipFlag); ps.put(VIP_FLAG, vipFlag);
} }
public String getShareCode() { public String getShareCode() {
if (ps == null) { if (ps == null) {
return null; return null;
...@@ -234,6 +238,20 @@ public class UserManager { ...@@ -234,6 +238,20 @@ public class UserManager {
return ps.getString(SHARE_CODE, ""); return ps.getString(SHARE_CODE, "");
} }
public void setLastImLoginCode(int lastImLoginCode) {
if (ps == null) {
return;
}
ps.put(LAST_IM_LOGIN_CODE, lastImLoginCode);
}
public int getLastImLoginCode() {
if (ps == null) {
return BaseConstants.ERR_SUCC;
}
return ps.getInt(LAST_IM_LOGIN_CODE, BaseConstants.ERR_SUCC);
}
public void userLogout() { public void userLogout() {
if (ps != null) { if (ps != null) {
ps.remove(USER_ID); ps.remove(USER_ID);
......
...@@ -128,142 +128,4 @@ class MyPresenter : BasePresenter<MyView>() { ...@@ -128,142 +128,4 @@ class MyPresenter : BasePresenter<MyView>() {
} }
}) })
} }
fun showTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.showTurn(),
object : BaseSubscriber<BaseResponse<NineShowBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<NineShowBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.showTurnSuc(baseResponse.data)
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
fun getTurnIphoneMsg() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.getTurnConfig(),
object : BaseSubscriber<BaseResponse<NineListBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<NineListBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.getTurnIphoneMsgSuc(baseResponse.data)
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
fun toTurn() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.toTurn(),
object : BaseSubscriber<BaseResponse<NineListBean.NineBean>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<NineListBean.NineBean>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.toTurnSuc(baseResponse.data)
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
fun unlock(vo: java.util.HashMap<String, Any>) {
AppHttpManager.getInstance(loanApplication)
.call(
loanService.unlock(vo),
object : BaseSubscriber<BaseResponse<IndexList>>() {
override fun onCompleted() {
if (isLinkView) return
view.hideLoading()
}
override fun onNext(baseResponse: BaseResponse<IndexList>) {
if (isLinkView) return
view.hideLoading()
val code = baseResponse.status
val message = baseResponse.message
when (code) {
200 -> view.unlockSuc()
else -> {
view.showToast(message)
}
}
}
override fun onError(e: Throwable?) {
if (isLinkView) return
view.hideLoading()
view.showToast(e?.message)
}
})
}
} }
\ No newline at end of file
...@@ -8,6 +8,7 @@ import com.duben.library.net.neterror.Throwable; ...@@ -8,6 +8,7 @@ import com.duben.library.net.neterror.Throwable;
import com.duben.roseplaylet.MintsApplication; import com.duben.roseplaylet.MintsApplication;
import com.duben.roseplaylet.common.AppConfig; import com.duben.roseplaylet.common.AppConfig;
import com.duben.roseplaylet.common.DeviceInfo; import com.duben.roseplaylet.common.DeviceInfo;
import com.duben.roseplaylet.im.GenerateTestUserSig;
import com.duben.roseplaylet.im.LoginWrapper; import com.duben.roseplaylet.im.LoginWrapper;
import com.duben.roseplaylet.im.TIMAppService; import com.duben.roseplaylet.im.TIMAppService;
import com.duben.roseplaylet.im.TUIUtils; import com.duben.roseplaylet.im.TUIUtils;
...@@ -28,9 +29,7 @@ public class TrackPresenter extends BaseTrackPresenter { ...@@ -28,9 +29,7 @@ public class TrackPresenter extends BaseTrackPresenter {
public void visitorlogin() { public void visitorlogin() {
HashMap<String, Object> vo = new HashMap<>(); HashMap<String, Object> vo = new HashMap<>();
vo.put("device", new DeviceUuidFactory().getDeviceUuid()); vo.put("device", new DeviceUuidFactory().getDeviceUuid());
saveV6Terminal(vo); saveV6Terminal(vo);
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo), .call(loanService.visitorlogin(vo),
new BaseSubscriber<BaseResponse<UserBean>>() { new BaseSubscriber<BaseResponse<UserBean>>() {
...@@ -47,11 +46,8 @@ public class TrackPresenter extends BaseTrackPresenter { ...@@ -47,11 +46,8 @@ public class TrackPresenter extends BaseTrackPresenter {
switch (baseResponse.getStatus()) { switch (baseResponse.getStatus()) {
case 200: { case 200: {
UserManager.getInstance().saveUserInfo(baseResponse.getData()); UserManager.getInstance().saveUserInfo(baseResponse.getData());
// firstShowVedio(); // firstShowVedio();
saveTerminalInfo(); saveTerminalInfo();
initUserLocalData(); initUserLocalData();
} }
} }
...@@ -63,20 +59,21 @@ public class TrackPresenter extends BaseTrackPresenter { ...@@ -63,20 +59,21 @@ public class TrackPresenter extends BaseTrackPresenter {
UserManager instance = UserManager.getInstance(); UserManager instance = UserManager.getInstance();
TUILoginConfig tuiLoginConfig = TUIUtils.getLoginConfig(); TUILoginConfig tuiLoginConfig = TUIUtils.getLoginConfig();
tuiLoginConfig.setInitLocalStorageOnly(true); tuiLoginConfig.setInitLocalStorageOnly(true);
LoginWrapper.getInstance().loginIMSDK(MintsApplication.getContext(), AppConfig.IM_SDK_APPID, instance.getUserID(), instance.getUserID(), tuiLoginConfig, new TUICallback() { LoginWrapper.getInstance().loginIMSDK(MintsApplication.getContext(), AppConfig.IM_SDK_APPID, instance.getUserID(),
GenerateTestUserSig.genTestUserSig(instance.getUserID()), tuiLoginConfig, new TUICallback() {
@Override @Override
public void onSuccess() { public void onSuccess() {
LogUtil.d("AAAAAAAAAAA onSuccess");
TIMAppService.getInstance().registerPushManually(); TIMAppService.getInstance().registerPushManually();
} }
@Override @Override
public void onError(final int errorCode, final String errorMessage) { public void onError(final int errorCode, final String errorMessage) {
LogUtil.i("LoginWrapper ", "imLogin errorCode = " + errorCode + ", errorInfo = " + errorMessage); LogUtil.e("LoginWrapper ", "imLogin errorCode = " + errorCode + ", errorInfo = " + errorMessage);
} }
}); });
} }
public void getMyInfo() { public void getMyInfo() {
HashMap<String, Object> vo = new HashMap<>(); HashMap<String, Object> vo = new HashMap<>();
vo.put("os", "android"); vo.put("os", "android");
......
package com.duben.roseplaylet.mvp.views package com.duben.roseplaylet.mvp.views
import com.duben.roseplaylet.mvp.model.NineListBean
import com.duben.roseplaylet.mvp.model.NineShowBean
import com.duben.roseplaylet.mvp.model.UserBean import com.duben.roseplaylet.mvp.model.UserBean
interface MyView : BaseView { interface MyView : BaseView {
fun getUserSuc(data:UserBean) fun getUserSuc(data: UserBean)
fun showTurnSuc(data: NineShowBean)
fun getTurnIphoneMsgSuc(data: NineListBean)
fun toTurnSuc(data: NineListBean.NineBean)
fun unlockSuc()
} }
...@@ -351,7 +351,7 @@ public interface LoanService { ...@@ -351,7 +351,7 @@ public interface LoanService {
Observable<BaseResponse<JsonObject>> signAfterSeconds(); Observable<BaseResponse<JsonObject>> signAfterSeconds();
/** /**
<<<<<<< Updated upstream * <<<<<<< Updated upstream
* 支付宝获取授权 * 支付宝获取授权
*/ */
@POST("api/user/getAlipayAuthUrl") @POST("api/user/getAlipayAuthUrl")
...@@ -363,7 +363,7 @@ public interface LoanService { ...@@ -363,7 +363,7 @@ public interface LoanService {
@POST("api/user/reportAlipayMsg") @POST("api/user/reportAlipayMsg")
Observable<BaseResponse<Object>> reportAlipayMsg(@Body Map<String, Object> vo); Observable<BaseResponse<Object>> reportAlipayMsg(@Body Map<String, Object> vo);
======= /*
* 获得活体sdk初始化参数 * 获得活体sdk初始化参数
*/ */
@POST("roseApi/face/getFaceParam") @POST("roseApi/face/getFaceParam")
...@@ -434,7 +434,6 @@ public interface LoanService { ...@@ -434,7 +434,6 @@ public interface LoanService {
*/ */
@POST("roseApi/user/seeMeList") @POST("roseApi/user/seeMeList")
Observable<BaseResponse<JsonObject>> getSeeMeList(@Body Map<String, Object> vo); Observable<BaseResponse<JsonObject>> getSeeMeList(@Body Map<String, Object> vo);
>>>>>>> Stashed changes
/** /**
* 默认http工厂 * 默认http工厂
......
package com.duben.roseplaylet.ui.activitys
import android.os.Bundle
import android.view.View
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.roseplaylet.R
import com.duben.roseplaylet.ui.activitys.base.BaseActivity
import com.tencent.qcloud.tuikit.tuichat.bean.C2CChatInfo
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatFragment
class CustomChatActivity : BaseActivity(), View.OnClickListener {
companion object {
const val CHAT_ID = "chat-id"
}
private var chatID: String = ""
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
chatID = it.getString(CHAT_ID, "")
}
}
override fun getContentViewLayoutID() = R.layout.activity_custom_chat
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
initListener()
initChatFragment()
}
private fun initChatFragment() {
val c2cChatInfo = C2CChatInfo()
c2cChatInfo.id = chatID
val tuic2CChatFragment = TUIC2CChatFragment()
tuic2CChatFragment.chatInfo = c2cChatInfo
supportFragmentManager.beginTransaction()
.add(R.id.chat_fragment_container, tuic2CChatFragment).commitAllowingStateLoss();
}
override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return
when (v?.id) {
R.id.iv_left_icon -> finish()
}
}
private fun initListener() {
}
}
package com.duben.roseplaylet.ui.activitys
import android.Manifest
import android.app.Activity
import android.content.Intent
import android.content.pm.ActivityInfo
import android.graphics.Color
import android.text.TextUtils
import android.view.View
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import com.duben.library.utils.GlideUtils
import com.duben.roseplaylet.R
import com.duben.roseplaylet.ui.activitys.base.BaseActivity
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.roseplaylet.common.OssType
import com.duben.roseplaylet.common.UserProfile
import com.duben.roseplaylet.manager.OssManager
import com.duben.roseplaylet.manager.UserManager
import com.duben.roseplaylet.mvp.model.PickBean
import com.duben.roseplaylet.ui.widgets.pick.SinglePickDialog
import com.duben.roseplaylet.utils.GlideEngine
import com.duben.roseplaylet.utils.UcropUtils
import com.luck.picture.lib.PictureSelector
import com.luck.picture.lib.compress.Luban
import com.luck.picture.lib.config.PictureConfig
import com.luck.picture.lib.config.PictureMimeType
import com.luck.picture.lib.entity.LocalMedia
import com.luck.picture.lib.style.PictureWindowAnimationStyle
import com.luck.picture.lib.thread.PictureThreadUtils
import com.luck.picture.lib.tools.DateUtils
import com.luck.picture.lib.tools.SdkVersionUtils
import com.tbruyelle.rxpermissions.RxPermissions
import com.yalantis.ucrop.UCrop
import kotlinx.android.synthetic.main.activity_edit_profile.*
import kotlinx.android.synthetic.main.activity_edit_profile.layout_gxbq
import kotlinx.android.synthetic.main.activity_edit_profile.layout_jyfw
import kotlinx.android.synthetic.main.activity_edit_profile.layout_sg
import kotlinx.android.synthetic.main.activity_edit_profile.layout_sx
import kotlinx.android.synthetic.main.activity_edit_profile.layout_tz
import kotlinx.android.synthetic.main.activity_edit_profile.layout_zy
import kotlinx.android.synthetic.main.activity_real_auth.*
import kotlinx.android.synthetic.main.header_layout.*
import java.io.File
class EditProfileActivity : BaseActivity(), View.OnClickListener {
private lateinit var ivAvatar: ImageView
private var avatarUrl = ""
private val userManager by lazy { UserManager.getInstance() }
override fun getContentViewLayoutID() = R.layout.activity_edit_profile
override fun isApplyKitKatTranslucency() = false
private var mSinglePickDialog: SinglePickDialog? = null
override fun initViewsAndEvents() {
tv_title.text = "编辑资料"
tv_title.setTextColor(Color.WHITE)
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_white)
initView()
initListener()
}
private fun initView() {
// 昵称
ivAvatar = layout_avatar.findViewById<ImageView>(R.id.iv_avatar)
layout_avatar.findViewById<TextView>(R.id.label_tv).text = "点击修改头像"
layout_avatar.setOnClickListener(this)
// 昵称
layout_nickname.findViewById<TextView>(R.id.label_start).text = "昵称"
val nicknameEt = layout_nickname.findViewById<EditText>(R.id.label_et)
if (!TextUtils.isEmpty("")) {
nicknameEt.setText("")
} else {
nicknameEt.hint = "填写昵称"
nicknameEt.setText("")
}
// 微信
layout_wechat.findViewById<TextView>(R.id.label_start).text = "微信"
val wechatEt = layout_wechat.findViewById<EditText>(R.id.label_et)
if (!TextUtils.isEmpty("")) {
wechatEt.setText("")
} else {
wechatEt.hint = "填写微信号"
wechatEt.setText("")
}
// 个性签名
layout_gxqm.findViewById<TextView>(R.id.label_start).text = "个性签名"
val gxqmEt = layout_wechat.findViewById<EditText>(R.id.label_et)
if (!TextUtils.isEmpty("")) {
gxqmEt.setText("")
} else {
gxqmEt.hint = "您还没有设置签名哦"
gxqmEt.setText("")
}
// 年龄
layout_nl.findViewById<TextView>(R.id.label_start).text = UserProfile.PROFILE_NL.str
val nlTv = layout_nl.findViewById<TextView>(R.id.label_tv)
if (!TextUtils.isEmpty("")) {
nlTv.text = ""
} else {
nlTv.text = "不详"
}
layout_nl.setOnClickListener(this)
// 职业
layout_zy.findViewById<TextView>(R.id.label_start).text = UserProfile.PROFILE_ZY.str
val zyTv = layout_zy.findViewById<TextView>(R.id.label_tv)
if (!TextUtils.isEmpty("")) {
zyTv.text = ""
} else {
zyTv.text = "不详"
}
layout_zy.setOnClickListener(this)
// 身高
layout_sg.findViewById<TextView>(R.id.label_start).text = UserProfile.PROFILE_SG.str
val sgTv = layout_sg.findViewById<TextView>(R.id.label_tv)
if (!TextUtils.isEmpty("")) {
sgTv.text = ""
} else {
sgTv.text = "不详"
}
layout_sg.setOnClickListener(this)
// 体重
layout_tz.findViewById<TextView>(R.id.label_start).text = UserProfile.PROFILE_TZ.str
val tzTv = layout_tz.findViewById<TextView>(R.id.label_tv)
if (!TextUtils.isEmpty("")) {
tzTv.text = ""
} else {
tzTv.text = "不详"
}
layout_tz.setOnClickListener(this)
// 身形
layout_sx.findViewById<TextView>(R.id.label_start).text = UserProfile.PROFILE_SX.str
val sxTv = layout_sx.findViewById<TextView>(R.id.label_tv)
if (!TextUtils.isEmpty("")) {
sxTv.text = ""
} else {
sxTv.text = "不详"
}
layout_sx.setOnClickListener(this)
// 交友范围
layout_jyfw.findViewById<TextView>(R.id.label_start).text = UserProfile.PROFILE_JYFW.str
val jyfwTv = layout_jyfw.findViewById<TextView>(R.id.label_tv)
if (!TextUtils.isEmpty("")) {
jyfwTv.text = ""
} else {
jyfwTv.text = "不详"
}
// 交友节目
layout_jyjm.findViewById<TextView>(R.id.label_start).text = UserProfile.PROFILE_JYFW.str
val jyjmTv = layout_jyjm.findViewById<TextView>(R.id.label_tv)
if (!TextUtils.isEmpty("")) {
jyjmTv.text = ""
} else {
jyjmTv.text = "不详"
}
layout_jyjm.setOnClickListener(this)
// 个性标签
layout_gxbq.findViewById<TextView>(R.id.label_start).text = UserProfile.PROFILE_GXBQ.str
val gxbqTv = layout_gxbq.findViewById<TextView>(R.id.label_tv)
if (!TextUtils.isEmpty("")) {
gxbqTv.text = ""
} else {
gxbqTv.text = "不详"
}
layout_gxbq.setOnClickListener(this)
}
private fun getPickerData(pickerType: String): MutableList<PickBean> {
val data = mutableListOf<PickBean>()
val stringData = when (pickerType) {
UserProfile.PROFILE_SG.str -> {
UserProfile.PROFILE_SG.arr
}
UserProfile.PROFILE_TZ.str -> {
UserProfile.PROFILE_TZ.arr
}
UserProfile.PROFILE_SX.str -> {
UserProfile.PROFILE_SX.arr
}
UserProfile.PROFILE_JYFW.str -> {
UserProfile.PROFILE_JYFW.arr
}
UserProfile.PROFILE_ZY.str -> {
UserProfile.PROFILE_ZY.arr
}
UserProfile.PROFILE_JYJM.str -> {
UserProfile.PROFILE_JYJM.arr
}
else -> {
UserProfile.UNKNOWN.arr
}
}
for (stringDatum in stringData) {
data.add(PickBean(stringDatum, false))
}
return data
}
private fun showPickDialog(pickerType: String, defaultValue: String) {
when (pickerType) {
UserProfile.PROFILE_SG.str -> {
mSinglePickDialog = SinglePickDialog(
this,
UserProfile.PROFILE_SG.str,
getPickerData(UserProfile.PROFILE_SG.str),
defaultValue
)
mSinglePickDialog?.setPickResultListener(object :
SinglePickDialog.OnPickResultListener {
override fun onPickResult(result: String) {
}
})
mSinglePickDialog?.show()
}
UserProfile.PROFILE_TZ.str -> {
mSinglePickDialog = SinglePickDialog(
this,
UserProfile.PROFILE_TZ.str,
getPickerData(UserProfile.PROFILE_TZ.str),
defaultValue
)
mSinglePickDialog?.setPickResultListener(object :
SinglePickDialog.OnPickResultListener {
override fun onPickResult(result: String) {
}
})
mSinglePickDialog?.show()
}
UserProfile.PROFILE_SX.str -> {
mSinglePickDialog = SinglePickDialog(
this,
UserProfile.PROFILE_SX.str,
getPickerData(UserProfile.PROFILE_SX.str),
defaultValue
)
mSinglePickDialog?.setPickResultListener(object :
SinglePickDialog.OnPickResultListener {
override fun onPickResult(result: String) {
}
})
mSinglePickDialog?.show()
}
UserProfile.PROFILE_JYJM.str -> {
mSinglePickDialog = SinglePickDialog(
this,
UserProfile.PROFILE_JYJM.str,
getPickerData(UserProfile.PROFILE_JYJM.str),
defaultValue
)
mSinglePickDialog?.setPickResultListener(object :
SinglePickDialog.OnPickResultListener {
override fun onPickResult(result: String) {
}
})
mSinglePickDialog?.show()
}
UserProfile.PROFILE_ZY.str -> {
mSinglePickDialog = SinglePickDialog(
this,
UserProfile.PROFILE_ZY.str,
getPickerData(UserProfile.PROFILE_ZY.str),
defaultValue
)
mSinglePickDialog?.setPickResultListener(object :
SinglePickDialog.OnPickResultListener {
override fun onPickResult(result: String) {
}
})
mSinglePickDialog?.show()
}
else -> {}
}
}
override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return
when (v?.id) {
R.id.iv_left_icon -> finish()
R.id.layout_avatar -> {
}
R.id.layout_nl -> {
showPickDialog(UserProfile.PROFILE_NL.str, "")
}
R.id.layout_zy -> {
showPickDialog(UserProfile.PROFILE_ZY.str, "")
}
R.id.layout_sg -> {
showPickDialog(UserProfile.PROFILE_SG.str, "")
}
R.id.layout_tz -> {
showPickDialog(UserProfile.PROFILE_TZ.str, "")
}
R.id.layout_sx -> {
showPickDialog(UserProfile.PROFILE_SX.str, "")
}
R.id.layout_jyfw -> {
}
R.id.layout_jyjm -> {
showPickDialog(UserProfile.PROFILE_JYJM.str, "")
}
R.id.layout_gxbq -> {
readyGoForResult(
UserLabelActivity::class.java,
RealAuthActivity.USER_LABEL_REQUEST_CODE
)
}
}
}
private fun initListener() {
iv_left_icon.setOnClickListener(this)
}
private fun showAlbum() {
val windowAnimationStyle = PictureWindowAnimationStyle()
windowAnimationStyle.ofAllAnimation(
com.luck.picture.lib.R.anim.picture_anim_up_in,
com.luck.picture.lib.R.anim.picture_anim_down_out
)
RxPermissions(this)
.request(Manifest.permission.READ_EXTERNAL_STORAGE)
.subscribe { granted: Boolean ->
if (granted) {
val isEnableCrop = false
PictureSelector.create(this)
.openGallery(PictureMimeType.ofImage())
.theme(R.style.picture_WeChat_style) // 微信主题色
.isWeChatStyle(true) // 微信样式
.isCamera(false) //列表是否显示拍照按钮
.isZoomAnim(isEnableCrop)//图片选择缩放效果
.isEnableCrop(isEnableCrop)//是否开启裁剪
.setPictureWindowAnimationStyle(windowAnimationStyle)
.withAspectRatio(2, 4)
.isCompress(true)//是否压缩
.compressFocusAlpha(false)//压缩后是否保持图片的透明通道
.minimumCompressSize(200)// 小于多少kb的图片不压缩
.compressQuality(60)//图片压缩后输出质量
.synOrAsy(true)//开启同步or异步压缩
.maxSelectNum(10)
.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)//屏幕旋转方向
.selectionMode(PictureConfig.MULTIPLE)//单选or多选
.imageEngine(GlideEngine.createGlideEngine())// 图片加载引擎
.forResult(PictureConfig.CHOOSE_REQUEST)
} else {
showMissingPermissionDialog("存储")
}
}
}
/**
* 鲁班压缩
*/
private fun luban(cutPath: String) {
val media = LocalMedia(cutPath, 0, false, 1, 0, PictureMimeType.ofImage())
media.cutPath = cutPath
if (SdkVersionUtils.checkedAndroid_Q()) {
media.androidQToPath = cutPath
}
runOnUiThread {
showLoading("加载中...")
}
val newFileName = DateUtils.getCreateFileName("IMG_CMP_") + ".jpeg"
PictureThreadUtils.executeByIo(object : PictureThreadUtils.SimpleTask<List<File>>() {
@Throws(Exception::class)
override fun doInBackground(): List<File> {
return Luban.with(mContext)
.loadMediaData<LocalMedia>(arrayListOf(media))
.ignoreBy(200)
.isCamera(false)
.setCompressQuality(80)
.setTargetDir(null)
.setFocusAlpha(false)
.setNewCompressFileName(newFileName).get()
}
override fun onSuccess(files: List<File>) {
uploadOss(files[0].path, OssType.PHOTO.type)
}
override fun onFail(t: Throwable?) {
super.onFail(t)
hideLoading()
}
})
}
/**
* 上传到oss服务器
*/
private fun uploadOss(localFile: String, type: String) {
OssManager.instance?.run {
uploadImg(type, localFile)
setOssUploadImgListener(object : OssManager.OssUploadImgListener {
override fun uploadImgFailForSubthread(errorInfo: String) {
runOnUiThread {
showToast(errorInfo)
}
}
override fun uploadImgSuccessForSubthread(imgPath: String?) {
runOnUiThread {
if (TextUtils.isEmpty(imgPath)) {
showToast("图片异常,请重新添加")
return@runOnUiThread
}
avatarUrl = imgPath!!
GlideUtils.loadImageView(
this@EditProfileActivity,
avatarUrl, ivAvatar
)
}
}
})
}
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (resultCode) {
Activity.RESULT_OK -> {
when (requestCode) {
// 相册获取图片
PictureConfig.CHOOSE_REQUEST -> {
val selectList: List<LocalMedia> =
PictureSelector.obtainMultipleResult(data)
val img = selectList[0]
uploadOss(img.compressPath, OssType.PHOTO.type)
}
// 裁剪获取图片
UcropUtils.UCROP_REQUEST_CODE -> {
data?.let {
val uri = UCrop.getOutput(it)
luban(uri?.path!!)
}
}
}
}
UCrop.RESULT_ERROR -> {
showToast("裁剪失败,请再试一下")
}
RealAuthActivity.USER_LABEL_REQUEST_CODE -> {
// val arrayExtra = data?.getStringArrayExtra(RealAuthActivity.USER_LABEL_DATA)
}
}
}
}
...@@ -304,9 +304,6 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -304,9 +304,6 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
} }
}) })
mSinglePickDialog?.show() mSinglePickDialog?.show()
}
UserProfile.PROFILE_GXBQ.str -> {
} }
else -> {} else -> {}
} }
...@@ -331,9 +328,6 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView { ...@@ -331,9 +328,6 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
UserProfile.PROFILE_ZY.str -> { UserProfile.PROFILE_ZY.str -> {
UserProfile.PROFILE_ZY.arr UserProfile.PROFILE_ZY.arr
} }
UserProfile.PROFILE_GXBQ.str -> {
UserProfile.PROFILE_GXBQ.arr
}
else -> { else -> {
UserProfile.UNKNOWN.arr UserProfile.UNKNOWN.arr
} }
......
package com.duben.roseplaylet.ui.adapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
class MsgPageAdapter(
private val data: List<String>,
val fragments: List<Fragment>,
activity: FragmentActivity
) :
FragmentStateAdapter(activity) {
override fun getItemId(position: Int): Long {
return position.toLong()
}
override fun getItemCount() = data.size
override fun createFragment(position: Int): Fragment {
return fragments[position]
}
override fun containsItem(itemId: Long): Boolean {
for (i in data.indices) {
if (i.toLong() == itemId) {
return true
}
}
return false
}
}
\ No newline at end of file
package com.duben.roseplaylet.ui.fragment package com.duben.roseplaylet.ui.fragment
import android.os.Bundle import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import com.duben.library.utils.nodoubleclick.AntiShake import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.roseplaylet.R import com.duben.roseplaylet.R
import com.duben.roseplaylet.common.AppConfig import com.duben.roseplaylet.common.AppConfig
import com.duben.roseplaylet.common.Constant import com.duben.roseplaylet.common.Constant
import com.duben.roseplaylet.manager.UserManager import com.duben.roseplaylet.manager.UserManager
import com.duben.roseplaylet.ui.activitys.CommonTabActivity import com.duben.roseplaylet.ui.adapter.MsgPageAdapter
import com.duben.roseplaylet.ui.fragment.base.LazyLoadBaseFragment import com.duben.roseplaylet.ui.fragment.base.LazyLoadBaseFragment
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment
import kotlinx.android.synthetic.main.fragment_main_message.* import kotlinx.android.synthetic.main.fragment_main_message.*
/**
* 描述:消息
* 作者:孟崔广
* 时间:2023/12/27 11:30
*/
class MessageFragment : LazyLoadBaseFragment(), View.OnClickListener { class MessageFragment : LazyLoadBaseFragment(), View.OnClickListener {
private val tabsData = arrayListOf<String>()
private val fragmentsData = mutableListOf<Fragment>()
private var vpAdapter: MsgPageAdapter? = null
private var mSelectTabIndex = 0
private val userManager by lazy { UserManager.getInstance() } private val userManager by lazy { UserManager.getInstance() }
override fun getContentViewLayoutID() = R.layout.fragment_main_message override fun getContentViewLayoutID() = R.layout.fragment_main_message
...@@ -29,139 +33,67 @@ class MessageFragment : LazyLoadBaseFragment(), View.OnClickListener { ...@@ -29,139 +33,67 @@ class MessageFragment : LazyLoadBaseFragment(), View.OnClickListener {
} }
private fun initView() { private fun initView() {
// 站内信 tabsData.add(String.format("聊天"))
ll_znx.findViewById<TextView>(R.id.tv_title).text = "站内信" tabsData.add(String.format("系统消息"))
ll_znx.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 打招呼
ll_dzh.findViewById<TextView>(R.id.tv_title).text = "打招呼"
ll_dzh.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 谁看过我
ll_skgw.findViewById<TextView>(R.id.tv_title).text = "谁看过我"
ll_skgw.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 谁联系我
ll_slxw.findViewById<TextView>(R.id.tv_title).text = "谁联系我"
ll_slxw.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 系统通知
ll_xttz.findViewById<TextView>(R.id.tv_title).text = "系统通知"
ll_xttz.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 评论通知
ll_pltz.findViewById<TextView>(R.id.tv_title).text = "评论通知"
ll_pltz.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 相亲通知
ll_xqtz.findViewById<TextView>(R.id.tv_title).text = "相亲通知"
ll_xqtz.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
ll_znx.setOnClickListener(this)
ll_dzh.setOnClickListener(this)
ll_skgw.setOnClickListener(this)
ll_slxw.setOnClickListener(this)
ll_xttz.setOnClickListener(this)
ll_pltz.setOnClickListener(this)
ll_xqtz.setOnClickListener(this)
}
override fun onFragmentResume() { fragmentsData.add(TUIConversationFragment())
super.onFragmentResume() fragmentsData.add(SystemMsgFragment())
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FOUR) { vpAdapter = MsgPageAdapter(tabsData, fragmentsData, requireActivity())
vp2.adapter = vpAdapter
TabLayoutMediator(tab_msg, vp2) { tab, position ->
// 初始化Tab
tab.id = position
if (tabsData.size > 0) {
tab.customView = getTabView(tabsData[position])
} }
}.attach()
tab_msg.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) {
updateTab(tab, true)
mSelectTabIndex = tab!!.id
} }
override fun onClick(v: View?) { override fun onTabUnselected(tab: TabLayout.Tab?) {
if (AntiShake.check(v?.id)) return updateTab(tab, false)
}
when (v?.id) { override fun onTabReselected(tab: TabLayout.Tab?) {
R.id.ll_znx -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_ZNX
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
} }
R.id.ll_dzh -> { })
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_DZH
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
} }
R.id.ll_skgw -> {
val bundle = Bundle() private fun getTabView(text: String): View {
bundle.putString( val view = LayoutInflater.from(requireContext()).inflate(R.layout.item_video_tab, null)
CommonTabActivity.ACTIVITY_COMMON_TYPE, view.findViewById<TextView>(R.id.item_tv).text = text
CommonTabActivity.ACTIVITY_TYPE_LLJL return view
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
} }
R.id.ll_slxw -> {
val bundle = Bundle() private fun updateTab(tab: TabLayout.Tab?, isSelected: Boolean) {
bundle.putString( tab?.customView?.let {
CommonTabActivity.ACTIVITY_COMMON_TYPE, val text = it.findViewById<TextView>(R.id.item_tv)
CommonTabActivity.ACTIVITY_TYPE_LXJL if (isSelected) {
) text.setTextColor(ContextCompat.getColor(requireContext(), R.color.red))
bundle.putInt( } else {
CommonTabActivity.ACTIVITY_COMMON_POSITION, text.setTextColor(ContextCompat.getColor(requireContext(), R.color.color_8D8F90))
0
)
readyGo(CommonTabActivity::class.java, bundle)
} }
R.id.ll_xttz -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_TZ
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
} }
R.id.ll_pltz -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_TZ
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
1
)
readyGo(CommonTabActivity::class.java, bundle)
} }
R.id.ll_xqtz -> {
val bundle = Bundle()
bundle.putString( override fun onFragmentResume() {
CommonTabActivity.ACTIVITY_COMMON_TYPE, super.onFragmentResume()
CommonTabActivity.ACTIVITY_TYPE_TZ if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FOUR) {
)
bundle.putInt( }
CommonTabActivity.ACTIVITY_COMMON_POSITION,
2
)
readyGo(CommonTabActivity::class.java, bundle)
} }
override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return
when (v?.id) {
} }
} }
} }
\ No newline at end of file
package com.duben.roseplaylet.ui.fragment package com.duben.roseplaylet.ui.fragment
import android.app.Dialog import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
import android.widget.FrameLayout import android.widget.FrameLayout
import com.daimajia.androidanimations.library.Techniques import com.duben.library.utils.nodoubleclick.AntiShake
import com.daimajia.androidanimations.library.YoYo import com.duben.roseplaylet.MintsApplication
import com.duben.roseplaylet.R import com.duben.roseplaylet.R
import com.duben.roseplaylet.ad.AdManager
import com.duben.roseplaylet.ad.AdStatusListener
import com.duben.roseplaylet.ad.NoPreAdManager
import com.duben.roseplaylet.ad.express.ExpressAdCallback import com.duben.roseplaylet.ad.express.ExpressAdCallback
import com.duben.roseplaylet.ad.express.MyExpressManager import com.duben.roseplaylet.ad.express.MyExpressManager
import com.duben.roseplaylet.common.AppConfig import com.duben.roseplaylet.common.AppConfig
import com.duben.roseplaylet.common.Constant import com.duben.roseplaylet.common.Constant
import com.duben.roseplaylet.im.GenerateTestUserSig
import com.duben.roseplaylet.im.LoginWrapper
import com.duben.roseplaylet.im.TIMAppService
import com.duben.roseplaylet.im.TUIUtils
import com.duben.roseplaylet.manager.UserManager import com.duben.roseplaylet.manager.UserManager
import com.duben.roseplaylet.mvp.model.NineListBean
import com.duben.roseplaylet.mvp.model.NineShowBean
import com.duben.roseplaylet.mvp.model.UserBean import com.duben.roseplaylet.mvp.model.UserBean
import com.duben.roseplaylet.mvp.presenters.MyPresenter import com.duben.roseplaylet.mvp.presenters.MyPresenter
import com.duben.roseplaylet.mvp.views.MyView import com.duben.roseplaylet.mvp.views.MyView
import com.duben.roseplaylet.ui.activitys.* import com.duben.roseplaylet.ui.activitys.*
import com.duben.roseplaylet.ui.fragment.base.LazyLoadBaseFragment import com.duben.roseplaylet.ui.fragment.base.LazyLoadBaseFragment
import com.duben.roseplaylet.ui.widgets.DialogListener import com.duben.roseplaylet.utils.LogUtil
import com.duben.roseplaylet.ui.widgets.NineContinueDialog
import com.duben.roseplaylet.utils.AppPreferencesManager
import com.duben.roseplaylet.utils.SpanUtils import com.duben.roseplaylet.utils.SpanUtils
import com.duben.roseplaylet.utils.TimeRender import com.duben.roseplaylet.utils.TimeRender
import com.duben.roseplaylet.utils.UIUtils import com.duben.roseplaylet.utils.UIUtils
import com.duben.roseplaylet.utils.rxutil.CommonRxTask import com.tencent.imsdk.v2.V2TIMConversation
import com.duben.roseplaylet.utils.rxutil.RxjavaUtil import com.tencent.qcloud.tuicore.TUIConstants
import com.duben.library.utils.nodoubleclick.AntiShake import com.tencent.qcloud.tuicore.interfaces.TUICallback
import com.tencent.qcloud.tuikit.tuichat.classicui.ClassicUIService
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity
import kotlinx.android.synthetic.main.fragment_main_my.* import kotlinx.android.synthetic.main.fragment_main_my.*
/** /**
...@@ -46,13 +42,6 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -46,13 +42,6 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
private val myPresenter by lazy { MyPresenter() } private val myPresenter by lazy { MyPresenter() }
private val userManager by lazy { UserManager.getInstance() } private val userManager by lazy { UserManager.getInstance() }
val luckyIndexMap: MutableMap<Int, String> = HashMap()
private var yoyo: YoYo.YoYoString? = null
private var isInitLuckyData = false
private var isTurnLuckyPage = false
private var nineShowBean: NineShowBean? = null
var carrierType = Constant.CARRIERTYPE_NINE
override fun getContentViewLayoutID() = R.layout.fragment_main_my override fun getContentViewLayoutID() = R.layout.fragment_main_my
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
...@@ -72,14 +61,10 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -72,14 +61,10 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
override fun onFragmentFirstVisible() { override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible() super.onFragmentFirstVisible()
} }
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
yoyo?.stop()
yoyo = null
myPresenter.detachView() myPresenter.detachView()
} }
...@@ -94,13 +79,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -94,13 +79,7 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
showAd() showAd()
} }
if (isTurnLuckyPage) {
isTurnLuckyPage = false
clickTurn()
}
if (!TextUtils.isEmpty(userManager?.userID)) { if (!TextUtils.isEmpty(userManager?.userID)) {
// myPresenter.showTurn()
myPresenter.getMyInfo() myPresenter.getMyInfo()
} else { } else {
myPresenter.userLogin() myPresenter.userLogin()
...@@ -108,14 +87,46 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -108,14 +87,46 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
} }
} }
private fun startChatActivity() {
val intent = Intent(ClassicUIService.getAppContext(), TUIC2CChatActivity::class.java)
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C)
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, userManager.userID)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
}
private fun initUserLocalData() {
val instance = UserManager.getInstance()
val tuiLoginConfig = TUIUtils.getLoginConfig()
tuiLoginConfig.isInitLocalStorageOnly = true
val userID = instance.userID
val userSig = GenerateTestUserSig.genTestUserSig(instance.userID)
LoginWrapper.getInstance().loginIMSDK(MintsApplication.getContext(),
AppConfig.IM_SDK_APPID, userID, userSig, tuiLoginConfig, object : TUICallback() {
override fun onSuccess() {
LogUtil.i("LoginWrapper ", "imLogin onSuccess")
TIMAppService.getInstance().registerPushManually()
}
override fun onError(errorCode: Int, errorMessage: String) {
LogUtil.i(
"LoginWrapper ",
"imLogin errorCode = $errorCode, errorInfo = $errorMessage"
)
}
})
}
override fun onClick(v: View?) { override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return if (AntiShake.check(v?.id)) return
when (v?.id) { when (v?.id) {
R.id.tv_my_btn -> { R.id.tv_my_btn -> {
if (!userManager.vipFlag) { // if (!userManager.vipFlag) {
readyGo(VipActivity::class.java) // readyGo(VipActivity::class.java)
} // }
initUserLocalData()
} }
R.id.ll_my_setting -> { R.id.ll_my_setting -> {
// readyGo(SettingsActivity::class.java) // readyGo(SettingsActivity::class.java)
...@@ -135,14 +146,12 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -135,14 +146,12 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
readyGo(UserLabelActivity::class.java) readyGo(UserLabelActivity::class.java)
} }
R.id.ll_contactus -> { R.id.ll_contactus -> {
(requireActivity() as MainActivity).backPhoneDialog() // (requireActivity() as MainActivity).backPhoneDialog()
startChatActivity()
} }
R.id.ll_my_payrecord -> { R.id.ll_my_payrecord -> {
readyGo(OrderRecordActivity::class.java) readyGo(OrderRecordActivity::class.java)
} }
R.id.btn_action, R.id.rl_lucky -> {
clickTurn()
}
} }
} }
...@@ -208,201 +217,8 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -208,201 +217,8 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
ll_my_payrecord.setOnClickListener(this) ll_my_payrecord.setOnClickListener(this)
ll_my_setting.setOnClickListener(this) ll_my_setting.setOnClickListener(this)
ll_contactus.setOnClickListener(this) ll_contactus.setOnClickListener(this)
btn_action.setOnClickListener(this)
rl_lucky.setOnClickListener(this)
}
//----9宫格逻辑--开始--//
override fun unlockSuc() {
// myPresenter.showTurn()
if (nineShowBean != null) {
if (nineShowBean!!.need - nineShowBean!!.complete - 1 > 0) {
showContinueDialog()
}
}
}
override fun getTurnIphoneMsgSuc(data: NineListBean) {
lucky_panel.setImgArray(data.list)
initLuckyIndexForPid(data.list)
}
private fun initLuckyIndexForPid(list: List<NineListBean.NineBean>) {
if (list != null && list.size > 0) {
for (i in 0 until list.size) {
luckyIndexMap.put(i, list.get(i).pid ?: i.toString())
}
}
}
override fun toTurnSuc(data: NineListBean.NineBean) {
Handler(Looper.getMainLooper()).postDelayed({
startNine(data)
}, 500)
}
override fun showTurnSuc(data: NineShowBean) {
AppPreferencesManager.get()
.put(Constant.LUCKY_FLAG, data.isShow)
nineShowBean = data
if (data.isShow) {
// 加载一次转盘数据
if (!isInitLuckyData) {
myPresenter.getTurnIphoneMsg()
btn_action?.postDelayed({
yoyo = YoYo.with(Techniques.Pulse).duration(1000).repeat(-1).playOn(btn_action)
}, 200)
isInitLuckyData = true
}
rl_lucky.visibility = View.VISIBLE
if (TextUtils.equals(
carrierType,
Constant.CARRIERTYPE_NINE3
) && data.complete >= data.need
) {
carrierType = Constant.CARRIERTYPE_NINE
myPresenter.toTurn()
}
tv_nine_count.text = "${data.complete}/${data.need}次"
} else {
rl_lucky.visibility = View.GONE
}
}
private fun luckyAward() {
if (nineShowBean != null) {
if (nineShowBean!!.complete >= nineShowBean!!.need) {
carrierType = Constant.CARRIERTYPE_NINE3
}
}
AdManager.instance.showAd(requireActivity(), carrierType,
object : AdStatusListener {
var canFail = false
override fun adSuccess() {
canFail = true
} }
override fun adFail() {
if (canFail) return
NoPreAdManager.loadVideoAd(
requireActivity(),
carrierType, object : AdStatusListener {
override fun adFail() {
carrierType = Constant.CARRIERTYPE_NINE
showToast("广告太火爆了,请稍候再试")
}
override fun adSuccess() {
}
override fun adClose(vo: HashMap<String, Any>?) {
vo?.let {
myPresenter.unlock(vo)
}
}
})
}
override fun adClose(vo: HashMap<String, Any>?) {
vo?.let {
myPresenter.unlock(vo)
}
}
})
}
private fun startNine(data: NineListBean.NineBean) {
if (data.pid == null) {
showToast("抽奖产品未配置")
return
}
if (!lucky_panel.isGameRunning) {
lucky_panel.startGame()
RxjavaUtil.executeRxTask(object : CommonRxTask<String>("") {
override fun doInIOThread() {
Thread.sleep(3000)
}
override fun doInUIThread() {
val index = getLuckyIndex(data.pid)
lucky_panel.tryToStop(index)
Handler(Looper.getMainLooper()).postDelayed({
val bundle = Bundle()
bundle.putString(NinePayActivity.PID, data.pid)
bundle.putString(NinePayActivity.TITLE, data.title)
bundle.putString(NinePayActivity.TYPE, data.type)
readyGo(NinePayActivity::class.java, bundle)
}, 1500)
}
})
}
}
private fun getLuckyIndex(pid: String): Int {
if (luckyIndexMap.size > 0) {
for ((key, value) in luckyIndexMap) {
if (TextUtils.equals(pid, value)) {
return key
}
}
}
return 1
}
// 点击九宫格按钮
private fun clickTurn() {
if (luckyIndexMap.size == 0) {
showToast("界面初始异常,请重新进入")
return
}
if (nineShowBean != null) {
if (nineShowBean!!.complete != nineShowBean!!.need) {
val luckyFirst =
AppPreferencesManager.get().getBoolean(Constant.LUCKY_MY_FIRST, false)
if (!luckyFirst) {
isTurnLuckyPage = true
AppPreferencesManager.get().put(Constant.LUCKY_MY_FIRST, true)
val bundle = Bundle()
bundle.putInt(NineKnowActivity.COMPLETE, nineShowBean!!.complete)
bundle.putInt(NineKnowActivity.NEED, nineShowBean!!.need)
readyGo(NineKnowActivity::class.java, bundle)
return
}
}
}
luckyAward()
}
// 继续观看逻辑
private fun showContinueDialog() {
nineShowBean?.let {
NineContinueDialog(
requireActivity(),
it.need - it.complete - 1,
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
dialog?.dismiss()
clickTurn()
}
}).show()
}
}
//----9宫格逻辑--结束--//
private fun showAd() { private fun showAd() {
MyExpressManager.instance.getAdView(object : ExpressAdCallback { MyExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) { override fun loadSuccess(adView: FrameLayout?) {
...@@ -430,4 +246,5 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener { ...@@ -430,4 +246,5 @@ class MyFragment : LazyLoadBaseFragment(), MyView, View.OnClickListener {
} }
}) })
} }
} }
\ No newline at end of file
package com.duben.roseplaylet.ui.fragment
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.duben.library.utils.nodoubleclick.AntiShake
import com.duben.roseplaylet.R
import com.duben.roseplaylet.common.AppConfig
import com.duben.roseplaylet.common.Constant
import com.duben.roseplaylet.manager.UserManager
import com.duben.roseplaylet.ui.activitys.CommonTabActivity
import com.duben.roseplaylet.ui.fragment.base.LazyLoadBaseFragment
import kotlinx.android.synthetic.main.fragment_system_msg.*
class SystemMsgFragment : LazyLoadBaseFragment(), View.OnClickListener {
private val userManager by lazy { UserManager.getInstance() }
override fun getContentViewLayoutID() = R.layout.fragment_system_msg
override fun initViewsAndEvents() {
initView()
}
private fun initView() {
// 站内信
ll_znx.findViewById<TextView>(R.id.tv_title).text = "站内信"
ll_znx.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 打招呼
ll_dzh.findViewById<TextView>(R.id.tv_title).text = "打招呼"
ll_dzh.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 谁看过我
ll_skgw.findViewById<TextView>(R.id.tv_title).text = "谁看过我"
ll_skgw.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 谁联系我
ll_slxw.findViewById<TextView>(R.id.tv_title).text = "谁联系我"
ll_slxw.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 系统通知
ll_xttz.findViewById<TextView>(R.id.tv_title).text = "系统通知"
ll_xttz.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 评论通知
ll_pltz.findViewById<TextView>(R.id.tv_title).text = "评论通知"
ll_pltz.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
// 相亲通知
ll_xqtz.findViewById<TextView>(R.id.tv_title).text = "相亲通知"
ll_xqtz.findViewById<ImageView>(R.id.iv_icon).setImageResource(R.mipmap.ic_launcher_main)
ll_znx.setOnClickListener(this)
ll_dzh.setOnClickListener(this)
ll_skgw.setOnClickListener(this)
ll_slxw.setOnClickListener(this)
ll_xttz.setOnClickListener(this)
ll_pltz.setOnClickListener(this)
ll_xqtz.setOnClickListener(this)
}
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FOUR) {
}
}
override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return
when (v?.id) {
R.id.ll_znx -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_ZNX
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
}
R.id.ll_dzh -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_DZH
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
}
R.id.ll_skgw -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_LLJL
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
}
R.id.ll_slxw -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_LXJL
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
}
R.id.ll_xttz -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_TZ
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
0
)
readyGo(CommonTabActivity::class.java, bundle)
}
R.id.ll_pltz -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_TZ
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
1
)
readyGo(CommonTabActivity::class.java, bundle)
}
R.id.ll_xqtz -> {
val bundle = Bundle()
bundle.putString(
CommonTabActivity.ACTIVITY_COMMON_TYPE,
CommonTabActivity.ACTIVITY_TYPE_TZ
)
bundle.putInt(
CommonTabActivity.ACTIVITY_COMMON_POSITION,
2
)
readyGo(CommonTabActivity::class.java, bundle)
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<FrameLayout
android:id="@+id/chat_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<com.duben.roseplaylet.ui.widgets.ElasticScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/layout_avatar"
layout="@layout/layout_basic_header"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginBottom="10dp" />
<include
android:id="@+id/layout_nickname"
layout="@layout/layout_basic_edit" />
<include
android:id="@+id/layout_wechat"
layout="@layout/layout_basic_edit" />
<include
android:id="@+id/layout_gxqm"
layout="@layout/layout_basic_edit" />
<include
android:id="@+id/layout_nl"
layout="@layout/layout_basic_text" />
<include
android:id="@+id/layout_zy"
layout="@layout/layout_basic_text" />
<include
android:id="@+id/layout_sg"
layout="@layout/layout_basic_text" />
<include
android:id="@+id/layout_tz"
layout="@layout/layout_basic_text" />
<include
android:id="@+id/layout_sx"
layout="@layout/layout_basic_text" />
<include
android:id="@+id/layout_jyfw"
layout="@layout/layout_basic_text" />
<include
android:id="@+id/layout_jyjm"
layout="@layout/layout_basic_text" />
<include
android:id="@+id/layout_gxbq"
layout="@layout/layout_basic_text" />
</LinearLayout>
</com.duben.roseplaylet.ui.widgets.ElasticScrollView>
</LinearLayout>
...@@ -250,6 +250,7 @@ ...@@ -250,6 +250,7 @@
android:maxLength="13" android:maxLength="13"
android:maxLines="1" android:maxLines="1"
android:paddingStart="20dp" android:paddingStart="20dp"
android:paddingEnd="20dp"
android:textColor="#172B54" android:textColor="#172B54"
android:textColorHint="#BEC2CC" android:textColorHint="#BEC2CC"
android:textSize="14sp" android:textSize="14sp"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_F1F2F8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:layout_marginTop="30dp"
android:gravity="center_vertical">
<include
android:id="@+id/ll_znx" <com.google.android.material.tabs.TabLayout
layout="@layout/layout_label" /> android:id="@+id/tab_msg"
android:layout_width="0dp"
<View style="@style/view_line_E6E6E6" /> android:layout_height="48dp"
android:layout_marginStart="10dp"
<include android:layout_weight="1"
android:id="@+id/ll_dzh" app:tabIndicatorColor="@color/red"
layout="@layout/layout_label" /> app:tabIndicatorHeight="2dp"
app:tabMode="fixed"
<include app:tabRippleColor="@null" />
android:id="@+id/ll_skgw"
layout="@layout/layout_label" <TextView
android:layout_width="match_parent" android:id="@+id/tv_clear_noread"
android:layout_height="60dp" android:layout_width="wrap_content"
android:layout_marginTop="10dp" /> android:layout_height="wrap_content"
android:text="清除未读" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_slxw"
layout="@layout/layout_label" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_xttz"
layout="@layout/layout_label"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_pltz"
layout="@layout/layout_label" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_xqtz"
layout="@layout/layout_label" />
<View style="@style/view_line_E6E6E6" />
</LinearLayout> <TextView
android:id="@+id/tv_clear_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:text="清除列表" />
</LinearLayout> </LinearLayout>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vp2"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</androidx.core.widget.NestedScrollView> </LinearLayout>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <com.duben.roseplaylet.ui.widgets.ElasticScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:overScrollMode="never">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout <FrameLayout
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
...@@ -51,9 +51,9 @@ ...@@ -51,9 +51,9 @@
android:textSize="16sp" /> android:textSize="16sp" />
<LinearLayout <LinearLayout
android:layout_marginTop="6dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
...@@ -72,8 +72,8 @@ ...@@ -72,8 +72,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp" android:layout_marginStart="10dp"
android:src="@mipmap/ic_my_bind"></ImageView> android:src="@mipmap/ic_my_bind" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
...@@ -128,40 +128,6 @@ ...@@ -128,40 +128,6 @@
</LinearLayout> </LinearLayout>
<RelativeLayout
android:id="@+id/rl_lucky"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:visibility="gone">
<com.duben.roseplaylet.ui.widgets.luckymonkeypanel.LuckyMonkeyPanelView
android:id="@+id/lucky_panel"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<RelativeLayout
android:id="@+id/btn_action"
android:layout_width="82dp"
android:layout_height="82dp"
android:layout_centerInParent="true"
android:background="@mipmap/ic_luckly_btn">
<TextView
android:id="@+id/tv_nine_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:text="-/-"
android:textColor="@color/white"
android:textSize="10dp"></TextView>
</RelativeLayout>
</RelativeLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -333,7 +299,7 @@ ...@@ -333,7 +299,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/shape_bg_write" /> android:background="@drawable/shape_bg_write" />
</LinearLayout> </LinearLayout>
</ScrollView> </com.duben.roseplaylet.ui.widgets.ElasticScrollView>
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_F1F2F8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="@+id/ll_znx"
layout="@layout/layout_label" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_dzh"
layout="@layout/layout_label" />
<include
android:id="@+id/ll_skgw"
layout="@layout/layout_label"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_slxw"
layout="@layout/layout_label" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_xttz"
layout="@layout/layout_label"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_pltz"
layout="@layout/layout_label" />
<View style="@style/view_line_E6E6E6" />
<include
android:id="@+id/ll_xqtz"
layout="@layout/layout_label" />
<View style="@style/view_line_E6E6E6" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:paddingStart="15dp"
android:paddingEnd="15dp">
<TextView
android:id="@+id/label_start"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="QQ"
android:textColor="@color/gray"
android:textSize="18sp" />
<TextView
android:id="@+id/label_start2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_below="@id/label_start"
android:text="QQ"
android:textColor="@color/gray"
android:textSize="10sp"
android:visibility="gone" />
<EditText
android:id="@+id/label_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/label_start"
android:gravity="end"
android:hint="点击输入QQ"
android:textColor="@color/black"
android:textSize="18sp"
android:visibility="visible" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="@color/my_color_gray" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:paddingStart="15dp"
android:paddingEnd="15dp">
<ImageView
android:id="@+id/iv_avatar"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerVertical="true"
android:src="@mipmap/ic_my_avat" />
<TextView
android:id="@+id/label_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/iv_avatar"
android:drawableEnd="@mipmap/ic_label_right"
android:gravity="end"
android:textColor="@color/black"
android:textSize="18sp" />
<View
style="@style/view_line_E6E6E6"
android:layout_alignParentBottom="true" />
</RelativeLayout>
\ No newline at end of file
...@@ -26,6 +26,12 @@ ...@@ -26,6 +26,12 @@
<item name="android:layout_gravity">center</item> <item name="android:layout_gravity">center</item>
</style> </style>
<style name="view_line_F1F2F8">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">10dp</item>
<item name="android:background">#F1F2F8</item>
</style>
<!-- activity 切换 anim --> <!-- activity 切换 anim -->
<style name="line_1"> <style name="line_1">
......
...@@ -15,12 +15,17 @@ buildscript { ...@@ -15,12 +15,17 @@ buildscript {
maven { url "https://artifact.bytedance.com/repository/pangle" } maven { url "https://artifact.bytedance.com/repository/pangle" }
//sharesdk //sharesdk
maven { url "https://mvn.mob.com/android" } maven { url "https://mvn.mob.com/android" }
maven {url 'https://developer.huawei.com/repo/'}
maven {url 'https://developer.hihonor.com/repo'}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.1.1' classpath 'com.android.tools.build:gradle:7.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// sharesdk // sharesdk
classpath "com.mob.sdk:MobSDK:+" classpath "com.mob.sdk:MobSDK:+"
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
classpath 'com.hihonor.mcs:asplugin:2.0.1.300'
classpath 'com.google.gms:google-services:4.3.15'
} }
} }
...@@ -39,6 +44,8 @@ allprojects { ...@@ -39,6 +44,8 @@ allprojects {
maven { url "https://artifact.bytedance.com/repository/pangle" } maven { url "https://artifact.bytedance.com/repository/pangle" }
//sharesdk //sharesdk
maven { url "https://mvn.mob.com/android" } maven { url "https://mvn.mob.com/android" }
maven {url 'https://developer.huawei.com/repo/'}
maven {url 'https://developer.hihonor.com/repo'}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment