Commit a6494f52 authored by jyx's avatar jyx

代码优化

parent c2c2bd50
......@@ -26,7 +26,6 @@ public class TUIC2CChatActivity extends TUIBaseChatActivity {
chatFragment = new TUIC2CChatFragment();
chatFragment.setChatInfo((C2CChatInfo) chatInfo);
getSupportFragmentManager().beginTransaction().replace(R.id.empty_view, chatFragment).commitAllowingStateLoss();
}
......
......@@ -7,12 +7,15 @@ import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tencent.qcloud.tuicore.annotations.TUIInitializerDependency;
import com.tencent.qcloud.tuicore.annotations.TUIInitializerID;
import com.tencent.qcloud.tuicore.annotations.TUIInitializerPriority;
import com.tencent.qcloud.tuicore.interfaces.TUIInitializer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
......@@ -35,7 +38,8 @@ public class ServiceInitializer extends ContentProvider {
/**
* @param context applicationContext
*/
public void init(Context context) {}
public void init(Context context) {
}
/**
* LightTheme id
......@@ -150,7 +154,7 @@ public class ServiceInitializer extends ContentProvider {
}
// sort by dependency count and priority
List<DependencyNode> dependencyNodeList = new ArrayList<>(dependencyNodeMap.values());
Comparator<DependencyNode> comparator = (o1, o2) -> {
Comparator<DependencyNode> comparator = (o1, o2) -> {
if (o1.dependencyCount() == o2.dependencyCount()) {
return o2.priority - o1.priority;
}
......@@ -208,7 +212,7 @@ public class ServiceInitializer extends ContentProvider {
private static class DependencyNode {
TUIInitializer initializer;
int priority;
Set<DependencyNode> dependencySet = new HashSet<>();
Set<DependencyNode> beDependencySet = new HashSet<>();
......@@ -262,7 +266,7 @@ public class ServiceInitializer extends ContentProvider {
@Nullable
@Override
public Cursor query(
@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
return null;
}
......
{
"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'
//sharesdk
apply plugin: 'com.mob.sdk'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'
apply plugin: 'com.hihonor.mcs.asplugin'
android {
compileSdkVersion rootProject.ext.androidCompileSdkVersion
buildToolsVersion rootProject.ext.androidBuildToolsVersion
......@@ -33,7 +37,12 @@ android {
SHARE_SECRET : RELEASE_SHARESDK_SECRET,
MAP_KEY : RELEASE_MAP_KEY,
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 {
......@@ -285,6 +294,17 @@ dependencies {
api "com.tencent.imsdk:tuiconversationgroup-plugin:8.3.6498"
// 集成会话标记插件,从 7.3 版本开始支持
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'
......
{
"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 @@
android:name="android.permission.READ_CALENDAR"
tools:node="remove" />
<!-- 业务使用权限 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
......@@ -251,6 +250,11 @@
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.CustomChatActivity"
android:exported="false"
android:screenOrientation="portrait" />
<service
android:name=".ui.service.UpdateService"
......
......@@ -10,6 +10,7 @@ import androidx.multidex.MultiDexApplication;
import com.downloader.PRDownloader;
import com.downloader.PRDownloaderConfig;
import com.duben.roseplaylet.ad.TTAdManagerHolder;
import com.duben.roseplaylet.common.AppConfig;
import com.duben.roseplaylet.common.Constant;
import com.duben.roseplaylet.manager.CsjAppLogManager;
import com.duben.roseplaylet.manager.CsjDJXSdkManager;
......@@ -188,11 +189,5 @@ public class MintsApplication extends MultiDexApplication {
private void initIMAppInfo() {
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;
import com.duben.roseplaylet.im.GenerateTestUserSig;
/**
* 描述:配置app设置开关
* 作者:孟崔广
......@@ -33,10 +35,9 @@ public class AppConfig {
public static double firstVipPrice = 0.0;
public static String IM_FLAVOR_VERSION = Constant.FLAVOR_LOCAL;
public static final int IM_UI_STYLE_CLASSIC = 0;
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 {
const val USERINFO = "userInfo"
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>) {
"个性标签",
arrayOf("")
),
PROFILE_NL(
"年龄",
arrayOf("")
),
PROFILE_JYJM(
"交友节目",
arrayOf("")
),
UNKNOWN(
"未知",
arrayOf("")
......
......@@ -4,6 +4,7 @@ import android.content.Context;
import android.text.TextUtils;
import com.duben.roseplaylet.common.AppConfig;
import com.duben.roseplaylet.manager.UserManager;
import com.duben.roseplaylet.utils.LogUtil;
import com.tencent.imsdk.BaseConstants;
import com.tencent.imsdk.v2.V2TIMConversationListener;
......@@ -105,12 +106,9 @@ public class LoginWrapper {
return;
}
ThreadUtils.runOnUiThread(new Runnable() {
@Override
public void run() {
if (!appLoginObservers.contains(observer)) {
appLoginObservers.add(observer);
}
ThreadUtils.runOnUiThread(() -> {
if (!appLoginObservers.contains(observer)) {
appLoginObservers.add(observer);
}
});
}
......@@ -127,7 +125,7 @@ public class LoginWrapper {
TUILogin.login(context, sdkAppID, userID, userSig, config, new TUICallback() {
@Override
public void onError(final int code, final String desc) {
UserInfo.getInstance().setLastLoginCode(code);
UserManager.getInstance().setLastImLoginCode(code);
if (tuiCallback != null) {
tuiCallback.onError(code, desc);
}
......@@ -136,7 +134,7 @@ public class LoginWrapper {
@Override
public void onSuccess() {
if (config == null || false == config.isInitLocalStorageOnly()) {
UserInfo.getInstance().setLastLoginCode(BaseConstants.ERR_SUCC);
UserManager.getInstance().setLastImLoginCode(BaseConstants.ERR_SUCC);
}
if (tuiCallback != null) {
......@@ -148,12 +146,15 @@ public class LoginWrapper {
private void tryToAutoLogin() {
int loginStatus = V2TIMManager.getInstance().getLoginStatus();
int lastLoginCode = UserInfo.getInstance().getLastLoginCode();
UserInfo userInfo = UserInfo.getInstance();
if (loginStatus == V2TIMManager.V2TIM_STATUS_LOGOUT && !TextUtils.isEmpty(userInfo.getUserId()) && userInfo.isAutoLogin()) {
UserManager userInfo = UserManager.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())) {
if (lastLoginCode >= BaseConstants.ERR_SDK_NET_ENCODE_FAILED && lastLoginCode <= BaseConstants.ERR_SDK_NET_SEND_REMAINING_TIMEOUT_NO_NETWORK) {
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() {
@Override
public void onSuccess() {
......@@ -162,17 +163,11 @@ public class LoginWrapper {
@Override
public void onError(int errorCode, String errorMessage) {
UserInfo.getInstance().setLastLoginCode(errorCode);
UserManager.getInstance().setLastImLoginCode(errorCode);
LogUtil.e(TAG, "tryToAutoLogin error:" + errorCode);
if (errorCode < BaseConstants.ERR_SDK_NET_ENCODE_FAILED
|| 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;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.duben.roseplaylet.R;
import com.duben.roseplaylet.common.AppConfig;
import com.duben.roseplaylet.common.Constant;
import com.duben.roseplaylet.utils.LogUtil;
import com.google.auto.service.AutoService;
import com.tencent.qcloud.tuicore.ServiceInitializer;
......@@ -19,7 +18,6 @@ import com.tencent.qcloud.tuicore.interfaces.ITUIService;
import com.tencent.qcloud.tuicore.interfaces.TUICallback;
import com.tencent.qcloud.tuicore.interfaces.TUIInitializer;
import com.tencent.qcloud.tuicore.interfaces.TUILoginListener;
import com.tencent.qcloud.tuicore.util.ToastUtil;
@AutoService(TUIInitializer.class)
@TUIInitializerDependency("TIMCommon")
......@@ -80,18 +78,7 @@ public class TIMAppService implements TUIInitializer, ITUIService {
public void logout() {
LogUtil.i(TAG, "logout");
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();
}
// UserInfo.getInstance().cleanUserInfo();
}
private void initThemeAndLanguageChangedReceiver() {
......@@ -108,13 +95,13 @@ public class TIMAppService implements TUIInitializer, ITUIService {
CustomConfigHelper.initConversationDefaultAvatar();
}
};
// IntentFilter languageFilter = new IntentFilter();
// languageFilter.addAction(Constant.DEMO_LANGUAGE_CHANGED_ACTION);
// LocalBroadcastManager.getInstance(mContext).registerReceiver(languageChangedReceiver, languageFilter);
//
// IntentFilter themeFilter = new IntentFilter();
// themeFilter.addAction(Constant.DEMO_THEME_CHANGED_ACTION);
// LocalBroadcastManager.getInstance(mContext).registerReceiver(themeChangedReceiver, themeFilter);
IntentFilter languageFilter = new IntentFilter();
languageFilter.addAction(Constant.DEMO_LANGUAGE_CHANGED_ACTION);
LocalBroadcastManager.getInstance(mContext).registerReceiver(languageChangedReceiver, languageFilter);
IntentFilter themeFilter = new IntentFilter();
themeFilter.addAction(Constant.DEMO_THEME_CHANGED_ACTION);
LocalBroadcastManager.getInstance(mContext).registerReceiver(themeChangedReceiver, themeFilter);
}
public void registerPushManually() {
......@@ -133,12 +120,6 @@ public class TIMAppService implements TUIInitializer, ITUIService {
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() {
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;
import com.duben.roseplaylet.MintsApplication;
import com.duben.roseplaylet.mvp.model.UserBean;
import com.tencent.imsdk.BaseConstants;
import net.grandcentrix.tray.AppPreferences;
......@@ -54,6 +55,12 @@ public class UserManager {
* vip是否永久
*/
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 CODE_ID = "codeId";
private static final String SHARE_CODE = "share_code";
......@@ -61,12 +68,10 @@ public class UserManager {
private static final String NEW_FLAG = "new_flag";
public static UserManager getInstance() {
if (_inst != null) {
return _inst;
} else {
if (_inst == null) {
_inst = new UserManager();
return _inst;
}
return _inst;
}
private UserManager() {
......@@ -226,7 +231,6 @@ public class UserManager {
ps.put(VIP_FLAG, vipFlag);
}
public String getShareCode() {
if (ps == null) {
return null;
......@@ -234,6 +238,20 @@ public class UserManager {
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() {
if (ps != null) {
ps.remove(USER_ID);
......
......@@ -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;
import com.duben.roseplaylet.MintsApplication;
import com.duben.roseplaylet.common.AppConfig;
import com.duben.roseplaylet.common.DeviceInfo;
import com.duben.roseplaylet.im.GenerateTestUserSig;
import com.duben.roseplaylet.im.LoginWrapper;
import com.duben.roseplaylet.im.TIMAppService;
import com.duben.roseplaylet.im.TUIUtils;
......@@ -28,9 +29,7 @@ public class TrackPresenter extends BaseTrackPresenter {
public void visitorlogin() {
HashMap<String, Object> vo = new HashMap<>();
vo.put("device", new DeviceUuidFactory().getDeviceUuid());
saveV6Terminal(vo);
AppHttpManager.getInstance(loanApplication)
.call(loanService.visitorlogin(vo),
new BaseSubscriber<BaseResponse<UserBean>>() {
......@@ -47,11 +46,8 @@ public class TrackPresenter extends BaseTrackPresenter {
switch (baseResponse.getStatus()) {
case 200: {
UserManager.getInstance().saveUserInfo(baseResponse.getData());
// firstShowVedio();
saveTerminalInfo();
initUserLocalData();
}
}
......@@ -63,19 +59,20 @@ public class TrackPresenter extends BaseTrackPresenter {
UserManager instance = UserManager.getInstance();
TUILoginConfig tuiLoginConfig = TUIUtils.getLoginConfig();
tuiLoginConfig.setInitLocalStorageOnly(true);
LoginWrapper.getInstance().loginIMSDK(MintsApplication.getContext(), AppConfig.IM_SDK_APPID, instance.getUserID(), instance.getUserID(), tuiLoginConfig, new TUICallback() {
@Override
public void onSuccess() {
TIMAppService.getInstance().registerPushManually();
}
@Override
public void onError(final int errorCode, final String errorMessage) {
LogUtil.i("LoginWrapper ", "imLogin errorCode = " + errorCode + ", errorInfo = " + errorMessage);
}
});
}
LoginWrapper.getInstance().loginIMSDK(MintsApplication.getContext(), AppConfig.IM_SDK_APPID, instance.getUserID(),
GenerateTestUserSig.genTestUserSig(instance.getUserID()), tuiLoginConfig, new TUICallback() {
@Override
public void onSuccess() {
LogUtil.d("AAAAAAAAAAA onSuccess");
TIMAppService.getInstance().registerPushManually();
}
@Override
public void onError(final int errorCode, final String errorMessage) {
LogUtil.e("LoginWrapper ", "imLogin errorCode = " + errorCode + ", errorInfo = " + errorMessage);
}
});
}
public void getMyInfo() {
HashMap<String, Object> vo = new HashMap<>();
......
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
interface MyView : BaseView {
fun getUserSuc(data:UserBean)
fun showTurnSuc(data: NineShowBean)
fun getTurnIphoneMsgSuc(data: NineListBean)
fun toTurnSuc(data: NineListBean.NineBean)
fun unlockSuc()
fun getUserSuc(data: UserBean)
}
......@@ -351,7 +351,7 @@ public interface LoanService {
Observable<BaseResponse<JsonObject>> signAfterSeconds();
/**
<<<<<<< Updated upstream
* <<<<<<< Updated upstream
* 支付宝获取授权
*/
@POST("api/user/getAlipayAuthUrl")
......@@ -363,7 +363,7 @@ public interface LoanService {
@POST("api/user/reportAlipayMsg")
Observable<BaseResponse<Object>> reportAlipayMsg(@Body Map<String, Object> vo);
=======
/*
* 获得活体sdk初始化参数
*/
@POST("roseApi/face/getFaceParam")
......@@ -434,7 +434,6 @@ public interface LoanService {
*/
@POST("roseApi/user/seeMeList")
Observable<BaseResponse<JsonObject>> getSeeMeList(@Body Map<String, Object> vo);
>>>>>>> Stashed changes
/**
* 默认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() {
}
}
......@@ -304,9 +304,6 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
}
})
mSinglePickDialog?.show()
}
UserProfile.PROFILE_GXBQ.str -> {
}
else -> {}
}
......@@ -331,9 +328,6 @@ class RealAuthActivity : BaseActivity(), View.OnClickListener, RealAuthView {
UserProfile.PROFILE_ZY.str -> {
UserProfile.PROFILE_ZY.arr
}
UserProfile.PROFILE_GXBQ.str -> {
UserProfile.PROFILE_GXBQ.arr
}
else -> {
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
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
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.adapter.MsgPageAdapter
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.*
/**
* 描述:消息
* 作者:孟崔广
* 时间:2023/12/27 11:30
*/
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() }
override fun getContentViewLayoutID() = R.layout.fragment_main_message
......@@ -29,48 +33,59 @@ class MessageFragment : LazyLoadBaseFragment(), View.OnClickListener {
}
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)
tabsData.add(String.format("聊天"))
tabsData.add(String.format("系统消息"))
fragmentsData.add(TUIConversationFragment())
fragmentsData.add(SystemMsgFragment())
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 onTabUnselected(tab: TabLayout.Tab?) {
updateTab(tab, false)
}
override fun onTabReselected(tab: TabLayout.Tab?) {
}
})
}
private fun getTabView(text: String): View {
val view = LayoutInflater.from(requireContext()).inflate(R.layout.item_video_tab, null)
view.findViewById<TextView>(R.id.item_tv).text = text
return view
}
private fun updateTab(tab: TabLayout.Tab?, isSelected: Boolean) {
tab?.customView?.let {
val text = it.findViewById<TextView>(R.id.item_tv)
if (isSelected) {
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.red))
} else {
text.setTextColor(ContextCompat.getColor(requireContext(), R.color.color_8D8F90))
}
}
}
override fun onFragmentResume() {
super.onFragmentResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_FOUR) {
}
}
......@@ -78,90 +93,7 @@ class MessageFragment : LazyLoadBaseFragment(), View.OnClickListener {
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
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 @@
android:maxLength="13"
android:maxLines="1"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:textColor="#172B54"
android:textColorHint="#BEC2CC"
android:textSize="14sp"
......
<?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_height="match_parent"
android:background="@color/color_F1F2F8">
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_marginTop="30dp"
android:gravity="center_vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_msg"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_marginStart="10dp"
android:layout_weight="1"
app:tabIndicatorColor="@color/red"
app:tabIndicatorHeight="2dp"
app:tabMode="fixed"
app:tabRippleColor="@null" />
<TextView
android:id="@+id/tv_clear_noread"
android:layout_width="wrap_content"
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" />
android:text="清除未读" />
<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>
<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>
\ No newline at end of file
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<com.duben.roseplaylet.ui.widgets.ElasticScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
......@@ -36,8 +36,8 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
......@@ -51,9 +51,9 @@
android:textSize="16sp" />
<LinearLayout
android:layout_marginTop="6dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:orientation="horizontal">
<TextView
......@@ -72,8 +72,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:src="@mipmap/ic_my_bind"></ImageView>
android:layout_marginStart="10dp"
android:src="@mipmap/ic_my_bind" />
</LinearLayout>
</LinearLayout>
......@@ -128,40 +128,6 @@
</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
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -333,7 +299,7 @@
android:layout_height="wrap_content"
android:background="@drawable/shape_bg_write" />
</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 @@
<item name="android:layout_gravity">center</item>
</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 -->
<style name="line_1">
......
......@@ -15,12 +15,17 @@ buildscript {
maven { url "https://artifact.bytedance.com/repository/pangle" }
//sharesdk
maven { url "https://mvn.mob.com/android" }
maven {url 'https://developer.huawei.com/repo/'}
maven {url 'https://developer.hihonor.com/repo'}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// sharesdk
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 {
maven { url "https://artifact.bytedance.com/repository/pangle" }
//sharesdk
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