2020/4/7新包
@@ -53,7 +53,41 @@ andResGuard {
|
||||
"R.id.iv_group_like",
|
||||
"R.id.iv_group_dont_like",
|
||||
"R.id.fl_group_content",
|
||||
"R.id.svga_group_voice_like"
|
||||
"R.id.svga_group_voice_like",
|
||||
//for yidun
|
||||
"R.drawable.bg_quick_pass*",
|
||||
"R.drawable.quick_pass_*",
|
||||
//for yidun liantong
|
||||
"R.layout.activity_oauth",
|
||||
"R.id.oauth_back",
|
||||
"R.id.is_agree",
|
||||
"R.id.oauth_title",
|
||||
"R.id.app_name",
|
||||
"R.id.oauth_mobile_et",
|
||||
"R.id.oauth_login",
|
||||
"R.id.service_and_privacy",
|
||||
"R.id.authorize_app",
|
||||
"R.id.brand",
|
||||
"R.id.navigation_bar_line",
|
||||
"R.id.oauth_logo",
|
||||
"R.id.navigation_bar",
|
||||
"R.id.protocol",
|
||||
"R.id.oauth_content",
|
||||
"R.id.other_login",
|
||||
"R.id.login_before_text",
|
||||
|
||||
"R.layout.oauth_loading_dialog",
|
||||
"R.id.oauth_loading_dialog_txt",
|
||||
"R.id.loading_parent",
|
||||
"R.id.oauth_loading_dialog_img",
|
||||
//for yidongka
|
||||
"R.anim.umcsdk_*",
|
||||
"R.drawable.dialog_loading",
|
||||
"R.drawable.umcsdk_*",
|
||||
"R.drawable.loading",
|
||||
"R.string.umcsdk_*",
|
||||
|
||||
|
||||
]
|
||||
compressFilePattern = [
|
||||
"*.png",
|
||||
|
@@ -94,7 +94,8 @@ android {
|
||||
'src/module_treasure_box/java',
|
||||
|
||||
'src/module_community/java',
|
||||
'src/module_album/java'
|
||||
'src/module_album/java',
|
||||
'src/module_quick_pass/java'
|
||||
|
||||
]
|
||||
|
||||
@@ -115,7 +116,8 @@ android {
|
||||
'src/module_treasure_box/res',
|
||||
|
||||
'src/module_community/res',
|
||||
'src/module_album/res'
|
||||
'src/module_album/res',
|
||||
'src/module_quick_pass/res'
|
||||
|
||||
]
|
||||
}
|
||||
@@ -241,6 +243,8 @@ dependencies {
|
||||
api(name: 'push-2.6.0.301', ext: 'aar')
|
||||
// 魅族推送
|
||||
implementation 'com.meizu.flyme.internet:push-internal:3.6.3@aar'
|
||||
// vivo推送
|
||||
implementation files("libs/vivo_pushsdk-v2.9.0.0.aar")
|
||||
|
||||
// api 'com.aliyun.dpa:oss-android-sdk:2.2.0'
|
||||
api files('aliyun-libs/aliyun-oss-sdk-android-2.3.0.1.jar')
|
||||
@@ -271,10 +275,16 @@ dependencies {
|
||||
|
||||
implementation 'it.sephiroth.android.library.imagezoom:library:1.0.4'
|
||||
|
||||
// 易盾一键登录
|
||||
implementation(name: 'quicklogin_libary-external-release', ext: 'aar')
|
||||
implementation(name: 'CMCCSSOSDK-WY', ext: 'aar')
|
||||
implementation(name: 'Ui-factory_oauth_mobile_3.8.3.1', ext: 'aar')
|
||||
implementation(name: 'CTAccount_sdk_api_v3.7.0_all', ext: 'aar')
|
||||
|
||||
}
|
||||
|
||||
repositories {
|
||||
flatDir {
|
||||
dirs 'aliyun-libs', 'hw-push-libs'
|
||||
dirs 'aliyun-libs', 'hw-push-libs', 'quick-pass-libs'
|
||||
}
|
||||
}
|
||||
|
BIN
app/libs/vivo_pushsdk-v2.9.0.0.aar
Normal file
29
app/proguard-rules.pro
vendored
@@ -304,3 +304,32 @@
|
||||
|
||||
#linkedMe
|
||||
-keep class com.microquation.linkedme.android.** { *; }
|
||||
|
||||
# vivo推送
|
||||
-dontwarn com.vivo.push.**
|
||||
-keep class com.vivo.push.**{*; }
|
||||
-keep class com.vivo.vms.**{*; }
|
||||
-keep class com.netease.nimlib.mixpush.vivo.VivoPush* {*;}
|
||||
-keep class com.netease.nimlib.mixpush.vivo.VivoPushReceiver{*;}
|
||||
|
||||
#一键登录
|
||||
-dontwarn com.cmic.sso.sdk.**
|
||||
-keep public class com.cmic.sso.sdk.**{*;}
|
||||
-keep class cn.com.chinatelecom.account.api.**{*;}
|
||||
-keep class com.netease.nis.quicklogin.entity.**{*;}
|
||||
-keep class com.netease.nis.quicklogin.listener.**{*;}
|
||||
-keep class com.netease.nis.quicklogin.QuickLogin{
|
||||
public <methods>;
|
||||
public <fields>;
|
||||
}
|
||||
-keep class com.netease.nis.quicklogin.helper.UnifyUiConfig{*;}
|
||||
-keep class com.netease.nis.quicklogin.helper.UnifyUiConfig$Builder{
|
||||
public <methods>;
|
||||
public <fields>;
|
||||
}
|
||||
-keep class com.netease.nis.quicklogin.utils.LoginUiHelper$CustomViewListener{
|
||||
public <methods>;
|
||||
public <fields>;
|
||||
}
|
||||
-dontwarn com.sdk.**
|
||||
-keep class com.sdk.** { *;}
|
||||
|
BIN
app/quick-pass-libs/CMCCSSOSDK-WY.aar
Normal file
BIN
app/quick-pass-libs/CTAccount_sdk_api_v3.7.0_all.aar
Normal file
BIN
app/quick-pass-libs/Ui-factory_oauth_mobile_3.8.3.1.aar
Normal file
BIN
app/quick-pass-libs/quicklogin_libary-external-release.aar
Normal file
@@ -1,2 +1,5 @@
|
||||
res path mapping:
|
||||
res/drawable -> res/drawable
|
||||
res/layout -> res/layout
|
||||
res/anim -> res/anim
|
||||
res/drawable-xxhdpi-v4 -> res/drawable-xxhdpi-v4
|
||||
|
@@ -74,6 +74,9 @@
|
||||
|
||||
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
|
||||
|
||||
<!--vivo Push需要的权限-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<application
|
||||
android:name=".application.XChatApplication"
|
||||
android:allowBackup="true"
|
||||
@@ -279,6 +282,30 @@
|
||||
<!-- android:value="com.netease.nimlib.service.NimReceiver" /> -->
|
||||
<!-- 云信#####################################################配置 -->
|
||||
<!-- autolayout####################################################配置 -->
|
||||
<!--Vivo Push需要配置的service、activity-->
|
||||
<!--配置的service, activity, receiver-->
|
||||
<service
|
||||
android:name="com.vivo.push.sdk.service.CommandClientService"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name="com.vivo.push.sdk.LinkProxyClientActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
|
||||
<receiver android:name="com.netease.nimlib.mixpush.vivo.VivoPushReceiver">
|
||||
<intent-filter>
|
||||
<!-- 接收 push 消息 -->
|
||||
<action android:name="com.vivo.pushclient.action.RECEIVE"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!--Vivo Push开放平台中应用的appid 和api key-->
|
||||
<meta-data
|
||||
android:name="com.vivo.push.api_key"
|
||||
android:value="1a9cace2-da8a-4b49-a70d-9beefacf6096"/>
|
||||
<meta-data
|
||||
android:name="com.vivo.push.app_id"
|
||||
android:value="16517"/>
|
||||
|
||||
<meta-data
|
||||
android:name="design_width"
|
||||
android:value="768" />
|
||||
@@ -401,7 +428,7 @@
|
||||
<activity
|
||||
android:name=".ui.login.LoginActivity"
|
||||
android:label="登录界面"
|
||||
android:launchMode="singleTask"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".ui.login.QQLoginSelectMemberTypeActivity"
|
||||
@@ -1078,6 +1105,7 @@
|
||||
|
||||
<activity
|
||||
android:name=".home.fragment.CommunityNoticeAct"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<!-- 社区 -->
|
||||
@@ -1129,6 +1157,12 @@
|
||||
android:name=".ui.setting.NoticeSettingActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".quick_pass.QuickPassLoginAct"
|
||||
android:label="一键登录"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@@ -62,6 +62,7 @@ import com.yizhuan.erban.decoration.view.widgets.ShowCarGuideDialog;
|
||||
import com.yizhuan.erban.family.view.activity.FamilyHomeActivity;
|
||||
import com.yizhuan.erban.guide.GuideActivity;
|
||||
import com.yizhuan.erban.home.dialog.RecommendRoomForNewerDialog;
|
||||
import com.yizhuan.erban.home.fragment.CommunityNoticeAct;
|
||||
import com.yizhuan.erban.home.fragment.FindTabFragment;
|
||||
import com.yizhuan.erban.home.fragment.GameHomeFragment;
|
||||
import com.yizhuan.erban.home.fragment.MeFragment;
|
||||
@@ -71,11 +72,13 @@ import com.yizhuan.erban.home.presenter.MainPresenter;
|
||||
import com.yizhuan.erban.home.view.IMainView;
|
||||
import com.yizhuan.erban.luckymoney.viewholder.LuckyMoneyMsgViewHolder;
|
||||
import com.yizhuan.erban.luckymoney.viewholder.LuckyMoneyTipsViewHolder;
|
||||
import com.yizhuan.erban.main.helper.NoticationsUiHelper;
|
||||
import com.yizhuan.erban.miniworld.activity.MiniWorldGuestPageActivity;
|
||||
import com.yizhuan.erban.module.Extras;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
import com.yizhuan.erban.module_hall.secretcode.PwdCodeMgr;
|
||||
import com.yizhuan.erban.public_chat_hall.msg.viewholder.MsgViewHolderAitMe;
|
||||
import com.yizhuan.erban.quick_pass.QuickPassLoginAct;
|
||||
import com.yizhuan.erban.radish.signin.SignDialogTimeManager;
|
||||
import com.yizhuan.erban.service.DaemonService;
|
||||
import com.yizhuan.erban.treasure_box.service.OpenBoxService;
|
||||
@@ -101,6 +104,7 @@ import com.yizhuan.erban.ui.im.chat.MsgViewHolderText;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderTip;
|
||||
import com.yizhuan.erban.ui.im.chat.MsgViewHolderVoiceBottleSayHi;
|
||||
import com.yizhuan.erban.ui.im.chat.SignInNoticeMsgViewHolder;
|
||||
import com.yizhuan.erban.ui.im.chat.SysMsgV2ViewHolder;
|
||||
import com.yizhuan.erban.ui.im.chat.SysMsgViewHolder;
|
||||
import com.yizhuan.erban.ui.im.chat.SysMsgVoiceViewHolder;
|
||||
import com.yizhuan.erban.ui.login.BinderPhoneActivity;
|
||||
@@ -164,6 +168,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.OpenRoomNotiAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.OpenSignInAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RedPacketAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgV2Attachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgVoiceAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.VoiceBottleSayHiAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.VoiceBottleShakeHeartAttachment;
|
||||
@@ -309,6 +314,9 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
NimMiddleActivity.firstEnter = false;
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mCurrentMainPosition = savedInstanceState.getInt(Constants.KEY_MAIN_POSITION);
|
||||
}
|
||||
@@ -417,6 +425,8 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
NimUIKit.registerMsgItemViewHolder(InAppSharingMiniWorldAttachment.class, InAppSharingMsgViewHolder.class);
|
||||
NimUIKit.registerMsgItemViewHolder(InAppSharingTeamAttachment.class, InAppSharingMsgViewHolder.class);
|
||||
NimUIKit.registerMsgItemViewHolder(SysMsgAttachment.class, SysMsgViewHolder.class);
|
||||
//V2系统消息,废弃23 V1
|
||||
NimUIKit.registerMsgItemViewHolder(SysMsgV2Attachment.class, SysMsgV2ViewHolder.class);
|
||||
NimUIKit.registerMsgItemViewHolder(LevelUpAttachment.class, MsgViewHolderLevel.class);
|
||||
NimUIKit.registerMsgItemViewHolder(AitMeAttachment.class, MsgViewHolderAitMe.class);
|
||||
// 声音瓶子
|
||||
@@ -649,14 +659,8 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
*/
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
// if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
// moveTaskToBack(true);
|
||||
// return true;
|
||||
// }
|
||||
// return super.onKeyDown(keyCode, event);
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
|
||||
/**
|
||||
* 防止华为机型未加入白名单时按返回键回到桌面再锁屏后几秒钟进程被杀
|
||||
*/
|
||||
@@ -684,8 +688,6 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// moveTaskToBack(true);
|
||||
// super.onBackPressed();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -788,6 +790,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
}
|
||||
});
|
||||
|
||||
openCommunityNotice();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -814,12 +817,14 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
public void onLogout() {
|
||||
Logger.e(TAG, "onLogout Success ~~~~");
|
||||
getMvpPresenter().exitRoom();
|
||||
LoginActivity.start(MainActivity.this);
|
||||
// LoginActivity.start(MainActivity.this);
|
||||
QuickPassLoginAct.start(MainActivity.this);
|
||||
PmDialogShowMrg.get().onLogout();
|
||||
}
|
||||
|
||||
public void onNeedLogin() {
|
||||
LoginActivity.start(MainActivity.this);
|
||||
NimMiddleActivity.openCommunity = false;
|
||||
QuickPassLoginAct.start(MainActivity.this);
|
||||
}
|
||||
|
||||
|
||||
@@ -1172,6 +1177,7 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
|
||||
//这里稍微晚点访问
|
||||
Single.timer(400, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.flatMap(new Function<Long, SingleSource<ChannelPageInfo>>() {
|
||||
@Override
|
||||
public SingleSource<ChannelPageInfo> apply(Long aLong) throws Exception {
|
||||
@@ -1179,6 +1185,10 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
}
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
//通知栏权限判断
|
||||
NoticationsUiHelper.handle(this, getDialogManager());
|
||||
|
||||
}
|
||||
|
||||
public LimitEnterRoomHelper getLimitEnterRoomHelper() {
|
||||
@@ -1243,6 +1253,8 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
* 云信通知栏跳转的处理
|
||||
*/
|
||||
private void handleNimIntent() {
|
||||
openCommunityNotice();
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent == null) {
|
||||
return;
|
||||
@@ -1253,6 +1265,19 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击互动通知通知栏,重启进程打开互动通知页
|
||||
*/
|
||||
private void openCommunityNotice() {
|
||||
if (NimMiddleActivity.delayOpenCommunity) {
|
||||
return;
|
||||
}
|
||||
if (NimMiddleActivity.openCommunity) {
|
||||
NimMiddleActivity.openCommunity = false;
|
||||
CommunityNoticeAct.start(this);
|
||||
}
|
||||
}
|
||||
|
||||
private Single<ChannelPageInfo> handleChannelPageInfo(boolean isSplashOrLinkedme) {
|
||||
return ChannelPageModel.get().handleSplashOrLinkedmeJump(isSplashOrLinkedme)
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
|
@@ -2,13 +2,18 @@ package com.yizhuan.erban;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.netease.nimlib.sdk.NimIntent;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.home.fragment.CommunityNoticeAct;
|
||||
import com.yizhuan.erban.radish.signin.SignInActivity;
|
||||
import com.yizhuan.erban.utils.PushMessageHandler;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.OpenRoomNotiAttachment;
|
||||
@@ -16,6 +21,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.OpenSignInAttachment;
|
||||
import com.yizhuan.xchat_android_library.utils.UIUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by chenran on 2017/8/5.
|
||||
@@ -23,7 +29,7 @@ import java.util.ArrayList;
|
||||
|
||||
public class NimMiddleActivity extends BaseActivity {
|
||||
|
||||
private static final String TAG = "NimMiddleActivity";
|
||||
private static final String TAG = "mix_push";
|
||||
/**
|
||||
* 通知栏启动Main后,自动跳转到 msg tab
|
||||
*/
|
||||
@@ -32,16 +38,35 @@ public class NimMiddleActivity extends BaseActivity {
|
||||
public static String EXTRA_FROM_NOTIFICATION = "from_notification";
|
||||
public static final String INTENT_ACTION_AVCHAT = "INTENT_ACTION_AVCHAT";
|
||||
|
||||
public static boolean firstEnter = true; // 是否首次进入
|
||||
|
||||
/**
|
||||
* 用于点击动态通知栏跳转到CommunityNoticeAct
|
||||
* openCommunity:打开CommunityNoticeAct
|
||||
*
|
||||
* delayOpenCommunity:控制CommunityNoticeAct打开时机:
|
||||
* 原因:部分机型可以直接打开NimMiddleActivity; 可以直接调用MainActivity.openCommunityNotice启动CommunityNoticeAct;
|
||||
* 部分机型(魅蓝Note5(android7.0,Flyme7.3.0.0A))会先打开Splash,再打开NimMiddleActivity; 会导致Splash启动MainActivity.onNewIntent;
|
||||
* 所以添加delayOpenCommunity字段让CommunityNoticeAct在MainActivity.onNewIntent再启动;
|
||||
*/
|
||||
public static boolean openCommunity = false;
|
||||
public static boolean delayOpenCommunity = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Log.i(TAG, "NimMiddleActivity");
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
|
||||
Map<String, String> payload= (Map<String, String>) intent.getSerializableExtra(PushMessageHandler.PAYLOAD_DATA);
|
||||
|
||||
if (intent.hasExtra(NimIntent.EXTRA_NOTIFY_CONTENT)) {
|
||||
parseNotifyIntent(intent);
|
||||
return;
|
||||
} else if (intent.hasExtra(EXTRA_FROM_NOTIFICATION) || intent.hasExtra(INTENT_ACTION_AVCHAT)) {
|
||||
parseNormalIntent(intent);
|
||||
} else if (payload != null) {
|
||||
parsePayloadData(payload);
|
||||
} else {
|
||||
parseNormalIntent(null);
|
||||
}
|
||||
@@ -79,4 +104,42 @@ public class NimMiddleActivity extends BaseActivity {
|
||||
MainActivity.start(NimMiddleActivity.this, intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void parsePayloadData(Map<String, String> payload) {
|
||||
Log.i(TAG, "rev pushMessage payload true");
|
||||
String data = payload.get("data");
|
||||
|
||||
try {
|
||||
JSONObject object = JSON.parseObject(data);
|
||||
int first = object.getInteger("first");
|
||||
int second = object.getInteger("second");
|
||||
|
||||
if (second == CustomAttachment.CUSTOM_DYNAMTC_UNREADCOUNT && AuthModel.get().getCurrentUid() > 0) {
|
||||
|
||||
if (!firstEnter) {
|
||||
CommunityNoticeAct.start(this);
|
||||
finish();
|
||||
} else {
|
||||
openCommunity = true;
|
||||
parseNormalIntent(null);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (firstEnter) {
|
||||
parseNormalIntent(null);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
if (firstEnter) {
|
||||
parseNormalIntent(null);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ import com.netease.nimlib.sdk.NIMClient;
|
||||
import com.netease.nimlib.sdk.SDKOptions;
|
||||
import com.netease.nimlib.sdk.StatusBarNotificationConfig;
|
||||
import com.netease.nimlib.sdk.mixpush.MixPushConfig;
|
||||
import com.netease.nimlib.sdk.mixpush.NIMPushClient;
|
||||
import com.netease.nimlib.sdk.msg.MessageNotifierCustomization;
|
||||
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
@@ -51,6 +52,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.module_hall.HallDataManager;
|
||||
import com.yizhuan.erban.radish.wallet.RadishWalletManager;
|
||||
import com.yizhuan.erban.reciever.ConnectiveChangedReceiver;
|
||||
import com.yizhuan.erban.utils.PushMessageHandler;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.DemoCache;
|
||||
@@ -140,6 +142,9 @@ public class XChatApplication extends Application {
|
||||
instance = this;
|
||||
String channel = PackerNg.getChannel(this);
|
||||
initEnv(channel);
|
||||
|
||||
// 注册自定义推送消息处理,这个是可选项
|
||||
NIMPushClient.registerMixPushMessageHandler(new PushMessageHandler());
|
||||
//延迟初始化云信
|
||||
NIMClient.init(this, null, options());
|
||||
|
||||
@@ -311,12 +316,23 @@ public class XChatApplication extends Application {
|
||||
|
||||
MixPushConfig mixPushConfig = new MixPushConfig();
|
||||
mixPushConfig.hwCertificateName = "tutuHuaweiAndroid";
|
||||
mixPushConfig.mzAppId = "118040";
|
||||
mixPushConfig.mzAppKey = "8ff2b4ccd52040399af1c3d526db32b2";
|
||||
mixPushConfig.mzCertificateName = "tutuMeizuAndroid";
|
||||
mixPushConfig.xmAppId = "2882303761517873288";
|
||||
mixPushConfig.xmAppKey = "5331787348288";
|
||||
mixPushConfig.xmCertificateName = "tutuXiaomiAndroid";
|
||||
|
||||
mixPushConfig.mzAppId = "125242";
|
||||
mixPushConfig.mzAppKey = "1c478e5eaace4c41ba269d2ca7c9bd69";
|
||||
mixPushConfig.mzCertificateName = "qingxunMeizuAndroid2";
|
||||
|
||||
mixPushConfig.xmAppId = "2882303761518089228";
|
||||
mixPushConfig.xmAppKey = "5781808939228";
|
||||
mixPushConfig.xmCertificateName = "qingxunXiaomiAndroid";
|
||||
|
||||
mixPushConfig.vivoCertificateName = "qingxunVivoAndroid";
|
||||
|
||||
// 下架状态,没有完成接入
|
||||
// mixPushConfig.oppoAppId = "30156338";
|
||||
// mixPushConfig.oppoAppKey = "4659eff1cab747c48fb6f44e2f522e83";
|
||||
// mixPushConfig.oppoAppSercet = "8c6a21854c8045068247c7e1168e29a8";
|
||||
// mixPushConfig.oppoCertificateName = "qingxunOppoAndroid";
|
||||
|
||||
options.mixPushConfig = mixPushConfig;
|
||||
|
||||
return options;
|
||||
@@ -538,7 +554,7 @@ public class XChatApplication extends Application {
|
||||
|
||||
if (isDebug()) {
|
||||
//禁掉沙盒模式
|
||||
//EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX);
|
||||
EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX);
|
||||
}
|
||||
|
||||
RPSDK.initialize(getApplicationContext());
|
||||
|
@@ -281,10 +281,10 @@ public abstract class BaseMicroViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
} else {
|
||||
if (isMale) {
|
||||
tvNick.setCompoundDrawablePadding(4);
|
||||
tvNick.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_male, 0, 0, 0);
|
||||
tvNick.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_male, 0);
|
||||
} else {
|
||||
tvNick.setCompoundDrawablePadding(4);
|
||||
tvNick.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_female, 0, 0, 0);
|
||||
tvNick.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_female, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,11 +29,13 @@ import com.yizhuan.erban.utils.RegexUtil;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomMicInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.bean.GiftValueData;
|
||||
import com.yizhuan.xchat_android_core.room.giftvalue.helper.GiftValueFormat;
|
||||
import com.yizhuan.xchat_android_core.room.pk.bean.PKTeamInfo;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.ActivityUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
@@ -236,6 +238,10 @@ public class MicroViewAdapter extends BaseMicroViewAdapter {
|
||||
TextView tvLabelLeaveMode;
|
||||
CircleImageView ivLeaveMode;
|
||||
|
||||
View inOfficialMask;
|
||||
TextView tvOfficialMask;
|
||||
ImageView ivOfficialMask;
|
||||
|
||||
BossMicroViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
tvRoomType = itemView.findViewById(R.id.tv_room_type);
|
||||
@@ -247,6 +253,12 @@ public class MicroViewAdapter extends BaseMicroViewAdapter {
|
||||
tvRoomDesc.setOnClickListener(this);
|
||||
tvRoomType.setOnClickListener(this);
|
||||
ivRoomCanEdit.setOnClickListener(this);
|
||||
|
||||
inOfficialMask = itemView.findViewById(R.id.in_official_mask);
|
||||
if (inOfficialMask != null) {
|
||||
tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -261,6 +273,8 @@ public class MicroViewAdapter extends BaseMicroViewAdapter {
|
||||
// 新版房主位优先判断麦序是否有人,麦序没人再判断是否是离开模式(防止新版展示离开模式,实际麦位有人)
|
||||
ChatRoomMember chatRoomMember = info.mChatRoomMember;
|
||||
if (chatRoomMember == null) {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
|
||||
if (roomInfo.isLeaveMode()) {
|
||||
tvLabelLeaveMode.setVisibility(View.VISIBLE);
|
||||
ivLeaveMode.setVisibility(View.VISIBLE);
|
||||
@@ -277,13 +291,23 @@ public class MicroViewAdapter extends BaseMicroViewAdapter {
|
||||
} else {
|
||||
ivLeaveMode.setVisibility(View.GONE);
|
||||
tvLabelLeaveMode.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
ivLeaveMode.setVisibility(View.GONE);
|
||||
tvLabelLeaveMode.setVisibility(View.GONE);
|
||||
|
||||
String fixedWord = NobleUtil.getLevel(UserInfo.OAC_NAME, chatRoomMember);
|
||||
String iconPic = NobleUtil.getLevel(UserInfo.OAC_ICON, chatRoomMember);
|
||||
if (!TextUtils.isEmpty(fixedWord) && !TextUtils.isEmpty(iconPic)) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
tvOfficialMask.setText(fixedWord);
|
||||
NobleUtil.loadResource(iconPic, ivOfficialMask);
|
||||
|
||||
} else {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tvNick.setBackgroundColor(context.getResources().getColor(R.color.transparent));
|
||||
@@ -310,8 +334,8 @@ public class MicroViewAdapter extends BaseMicroViewAdapter {
|
||||
if (UserModel.get().getCacheLoginUserInfo() != null &&
|
||||
UserModel.get().getCacheLoginUserInfo().getUserInfoSkillVo() != null) {
|
||||
if (AvRoomDataManager.get().isRoomOwner() && !TextUtils.isEmpty(UserModel.get().getCacheLoginUserInfo().getUserInfoSkillVo().getSkillTag())) {
|
||||
ImageLoadUtils.loadImage(context, UserModel.get().getCacheLoginUserInfo().getUserInfoSkillVo().getSkillTag(), ivTag);
|
||||
ivTag.setVisibility(View.VISIBLE);
|
||||
// ImageLoadUtils.loadImage(context, UserModel.get().getCacheLoginUserInfo().getUserInfoSkillVo().getSkillTag(), ivTag);
|
||||
ivTag.setVisibility(View.GONE);
|
||||
tvNick.setCompoundDrawablePadding(4);
|
||||
tvNick.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
|
||||
} else {
|
||||
|
@@ -6,6 +6,7 @@ import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.AppCompatImageView;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@@ -29,6 +30,7 @@ import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleResourceType;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
import com.yizhuan.xchat_android_core.room.bean.OnlineChatMember;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
|
||||
import java.util.List;
|
||||
@@ -174,6 +176,26 @@ public class OnlineUserAdapter extends BaseMultiItemQuickAdapter<OnlineChatMembe
|
||||
ImageLoadUtils.loadImage(mContext, charmLevelUrl, ivUserCharm);
|
||||
}
|
||||
|
||||
// 官方主播铭牌标识
|
||||
String fixWord = NobleUtil.getLevel(UserInfo.OAC_NAME, onlineChatMember.chatRoomMember);
|
||||
String iconPic = NobleUtil.getLevel(UserInfo.OAC_ICON, onlineChatMember.chatRoomMember);
|
||||
View inOfficialMask = baseViewHolder.getView(R.id.in_official_mask);
|
||||
if (!TextUtils.isEmpty(fixWord) && !TextUtils.isEmpty(iconPic)) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
TextView tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
if (tvOfficialMask != null) {
|
||||
tvOfficialMask.setText(fixWord);
|
||||
}
|
||||
|
||||
ImageView ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
if (ivOfficialMask != null) {
|
||||
NobleUtil.loadResource(iconPic, ivOfficialMask);
|
||||
}
|
||||
|
||||
} else {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
AppCompatImageView ivUserLevel = baseViewHolder.getView(R.id.iv_noble_level);
|
||||
String resource = (String) NobleUtil.getResource(NobleResourceType.KEY_BADGE, onlineChatMember.chatRoomMember);
|
||||
if (TextUtils.isEmpty(resource)) {
|
||||
|
@@ -368,19 +368,6 @@ public class DialogWebFragment extends DialogFragment {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除h5的一些定时器
|
||||
*/
|
||||
private void clearWebActCache() {
|
||||
try {
|
||||
String call = "javascript:clearFun()";
|
||||
if (webView != null) {
|
||||
webView.loadUrl(call);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
|
@@ -216,10 +216,7 @@ import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUS
|
||||
@CreatePresenter(HomePartyPresenter.class)
|
||||
public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomePartyPresenter> implements View.OnClickListener,
|
||||
GiftDialog.OnGiftDialogBtnClickListener, IHomePartyView, OnMicroItemClickListener, PKBoardView.OnActionListener {
|
||||
/**
|
||||
* 显示关注房主的时间
|
||||
*/
|
||||
public static final int SHOW_FOLLOW_TIME = 3 * 60 * 1000;
|
||||
|
||||
public static final int SHOW_JOIN_MINI_WORLD_TIME = 2 * 60 * 1000;
|
||||
private static final int MINI_WORLD_REQUEST_CODE = 101;
|
||||
private long myUid;
|
||||
@@ -3083,7 +3080,7 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
|
||||
|
||||
@Override
|
||||
public void noFollow() {
|
||||
messageView.postDelayed(new Runnable() {
|
||||
messageView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
@@ -3100,7 +3097,7 @@ public class HomePartyRoomFragment extends BaseMvpFragment<IHomePartyView, HomeP
|
||||
messageView.addMessages(ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(roomInfo.getRoomId()), roomFollowOwnerAttachment));
|
||||
|
||||
}
|
||||
}, SHOW_FOLLOW_TIME);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -7,6 +7,7 @@ import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMember;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
@@ -65,9 +66,11 @@ import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
|
||||
import static com.yizhuan.xchat_android_core.manager.RoomEvent.DRAGON_BAR_CANCEL;
|
||||
import static com.yizhuan.xchat_android_core.manager.RoomEvent.DRAGON_BAR_END;
|
||||
@@ -80,6 +83,12 @@ import static com.yizhuan.xchat_android_core.manager.RoomEvent.DRAGON_BAR_END;
|
||||
* @date 2017/12/8
|
||||
*/
|
||||
public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
|
||||
|
||||
/**
|
||||
* 显示关注房主的时间
|
||||
*/
|
||||
public static final int SHOW_FOLLOW_TIME = 3 * 60 * 1000;
|
||||
|
||||
private final HomePartyModel mHomePartyMode;
|
||||
private final AvRoomModel mAvRoomModel;
|
||||
private final SuperAdminModel mSuperAdminModel;
|
||||
@@ -764,13 +773,21 @@ public class HomePartyPresenter extends BaseMvpPresenter<IHomePartyView> {
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void checkFollow(long uid) {
|
||||
PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), uid)
|
||||
Single.just("")
|
||||
.delay(SHOW_FOLLOW_TIME, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap(new Function<String, SingleSource<Boolean>>() {
|
||||
@Override
|
||||
public SingleSource<Boolean> apply(String s) throws Exception {
|
||||
return PraiseModel.get().isPraised(AuthModel.get().getCurrentUid(), uid);
|
||||
}
|
||||
})
|
||||
.compose(bindUntilEvent(PresenterEvent.DESTROY))
|
||||
.compose(RxHelper.handleSchAndExce())
|
||||
.subscribe(new BiConsumer<Boolean, Throwable>() {
|
||||
@Override
|
||||
public void accept(Boolean aBoolean, Throwable throwable) throws Exception {
|
||||
if (getMvpView() == null) {
|
||||
if (throwable != null || getMvpView() == null) {
|
||||
return;
|
||||
}
|
||||
//如果没有关注
|
||||
|
@@ -50,6 +50,9 @@ public class RoomManagerPresenter extends BaseMvpPresenter<IRoomManagerView> {
|
||||
uids.add(member.getAccount());
|
||||
}
|
||||
}
|
||||
if (uids.size() == 0) {
|
||||
return Single.just(new ArrayList<ChatRoomMember>());
|
||||
}
|
||||
return Single.zip(
|
||||
UserModel.get().loadUserInfoByUids(uids),
|
||||
Single.just(chatRoomMembers),
|
||||
|
@@ -23,6 +23,8 @@ import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
|
||||
import com.opensource.svgaplayer.SVGACallback;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
@@ -192,6 +194,12 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
int senderPosition = AvRoomDataManager.get().getMicPosition(magicReceivedInfo.getUid());
|
||||
int receivePosition = AvRoomDataManager.get().getMicPosition(magicReceivedInfo.getTargetUid());
|
||||
|
||||
if (micViewPoint == null) {
|
||||
//空的原因是麦位坐标延迟了500ms初始化
|
||||
LogUtil.print("magic micViewPoint is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
Point senderPoint = micViewPoint.get(senderPosition);
|
||||
Point receivePoint = micViewPoint.get(receivePosition);
|
||||
if (receivePoint == null) { //这种情况就是接收者已经不在麦上
|
||||
@@ -252,6 +260,12 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
if (roomInfo.isLeaveMode() && giftReceiveInfo.getTargetUid() == roomInfo.getUid())
|
||||
receivePosition = -1;
|
||||
|
||||
if (micViewPoint == null) {
|
||||
//产生空的原因是麦位坐标初始化有500ms延迟
|
||||
LogUtil.print("gift micViewPoint is null");
|
||||
continue;
|
||||
}
|
||||
|
||||
Point senderPoint = micViewPoint.get(senderPosition);
|
||||
Point receivePoint = micViewPoint.get(receivePosition);
|
||||
if (receivePoint == null) { //这种情况就是接收者已经不在麦上
|
||||
@@ -399,8 +413,6 @@ public class GiftV2View extends FrameLayout implements GiftEffectView.GiftEffect
|
||||
}
|
||||
|
||||
private String getValidExplodeAnimationUrl(int magicId, String url) {
|
||||
if (XChatApplication.isDebug() && TextUtils.isEmpty(url))
|
||||
return "https://img.erbanyy.com/FpjaLK6_69udWlC_T6P5rmpaWlvT";
|
||||
if (!TextUtils.isEmpty(url)) return url;
|
||||
MagicInfo magicInfo = MagicModel.get().getMagicInfo(magicId);
|
||||
if (magicInfo == null) return "";
|
||||
|
@@ -29,6 +29,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.netease.nim.uikit.business.uinfo.UserInfoHelper;
|
||||
import com.netease.nim.uikit.common.ui.span.RadiusBackgroundSpan;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessageExtension;
|
||||
@@ -46,7 +47,6 @@ import com.yizhuan.erban.avroom.game.PlayGameActivity;
|
||||
import com.yizhuan.erban.common.widget.CustomImageSpan;
|
||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.event.OpenRoomIntroEvent;
|
||||
import com.yizhuan.erban.ui.widget.DividerItemDecoration;
|
||||
import com.yizhuan.erban.ui.widget.MyItemAnimator;
|
||||
import com.yizhuan.erban.ui.widget.UserInfoDialog;
|
||||
@@ -61,6 +61,7 @@ import com.yizhuan.xchat_android_core.decoration.car.bean.CarInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiver;
|
||||
import com.yizhuan.xchat_android_core.helper.ImHelperUtils;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.AuctionAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CarveUpGoldAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
@@ -84,6 +85,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomNoticeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTipAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.WelcomeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameInfo;
|
||||
import com.yizhuan.xchat_android_core.im.game.ImGameMode;
|
||||
import com.yizhuan.xchat_android_core.level.UserLevelResourceType;
|
||||
@@ -101,8 +103,10 @@ import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterProtocol;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleInfo;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleResourceType;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
import com.yizhuan.xchat_android_core.praise.PraiseModel;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomMessageViewNoticeInfo;
|
||||
import com.yizhuan.xchat_android_core.room.bean.WelcomeInfo;
|
||||
import com.yizhuan.xchat_android_core.room.face.DynamicFaceModel;
|
||||
import com.yizhuan.xchat_android_core.room.face.FaceInfo;
|
||||
import com.yizhuan.xchat_android_core.room.face.FaceReceiveInfo;
|
||||
@@ -110,15 +114,21 @@ import com.yizhuan.xchat_android_core.room.game.GameModel;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameRespondEvent;
|
||||
import com.yizhuan.xchat_android_core.room.game.GameResultInfo;
|
||||
import com.yizhuan.xchat_android_core.room.ktv.bean.MusicInfo;
|
||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel;
|
||||
import com.yizhuan.xchat_android_core.room.pk.attachment.RoomPkAttachment;
|
||||
import com.yizhuan.xchat_android_core.room.pk.bean.PKTeamInfo;
|
||||
import com.yizhuan.xchat_android_core.room.pk.bean.RoomPKInvitedUpMicMember;
|
||||
import com.yizhuan.xchat_android_core.room.pk.bean.RoomPkData;
|
||||
import com.yizhuan.xchat_android_core.room.queuing_mic.attachment.QueuingMicAttachment;
|
||||
import com.yizhuan.xchat_android_core.room.queuing_mic.bean.QueuingMicInfo;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.super_admin.util.SuperAdminUtil;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
|
||||
import com.yizhuan.xchat_android_core.utils.ExtensionUtil;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.rxbus.RxBus;
|
||||
import com.yizhuan.xchat_android_library.utils.FormatUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.JavaUtil;
|
||||
@@ -135,8 +145,11 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
@@ -231,7 +244,12 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
|
||||
|
||||
private int imageHeight;
|
||||
private int imageWidth;
|
||||
private void init(Context context) {
|
||||
imageHeight= Utils.dip2px(context, 15);
|
||||
imageWidth= Utils.dip2px(context, 59);
|
||||
|
||||
whiteColor = ContextCompat.getColor(context, R.color.white);
|
||||
greyColor = ContextCompat.getColor(context, R.color.white_transparent_50);
|
||||
roomTipNickColor = ContextCompat.getColor(context, R.color.color_FFEA7F);
|
||||
@@ -481,7 +499,7 @@ public class MessageView extends FrameLayout {
|
||||
// 清除聊天背景
|
||||
clearBackground(tvContent);
|
||||
// 加上勋章
|
||||
setMsgNotification(chatRoomMessage, tvContent);
|
||||
setMsgNotification(chatRoomMessage, tvContent, baseViewHolder.getAdapterPosition());
|
||||
} else if (chatRoomMessage.getMsgType() == MsgTypeEnum.custom) {
|
||||
CustomAttachment attachment = (CustomAttachment) chatRoomMessage.getAttachment();
|
||||
int first = attachment.getFirst();
|
||||
@@ -715,6 +733,11 @@ public class MessageView extends FrameLayout {
|
||||
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
|
||||
break;
|
||||
}
|
||||
} else if (first == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_PUBLIC_SCREEN) {
|
||||
if (second == CustomAttachment.CUSTOM_MSG_SUB_TYPE_PUBLIC_SCREEN_WELCOME) {
|
||||
//麦上用户对你的欢迎语
|
||||
setMicWelcomeContent(chatRoomMessage, tvContent, baseViewHolder.getAdapterPosition());
|
||||
}
|
||||
} else {
|
||||
tvContent.setTextColor(Color.WHITE);
|
||||
tvContent.setText(tvContent.getResources().getText(R.string.not_support_message_tip));
|
||||
@@ -1485,17 +1508,27 @@ public class MessageView extends FrameLayout {
|
||||
String userLevel = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, chatRoomMessage);
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
boolean isOfficial = NobleUtil.getIsOfficial(UserInfo.IS_OFFICIAL, chatRoomMessage);
|
||||
// LogUtil.e("mylog","是否新用户"+newUser);
|
||||
// 内容
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(isOfficial ? ResourcesCompat.getDrawable(getResources(),
|
||||
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent);
|
||||
text.append(isOfficial ? ResourcesCompat.getDrawable(getResources(),
|
||||
R.mipmap.ic_user_official_13dp, null) : null,
|
||||
badgeWidth, badgeHeight)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(NobleUtil.getLocalResourcePath(userBadge), badgeWidth, badgeHeight)
|
||||
.append(userLevel, expLevelWidth, expLevelHeight)
|
||||
.append(NobleUtil.getLocalResourcePath(userBadge), badgeWidth, badgeHeight);
|
||||
|
||||
// 官方主播认证
|
||||
String tvOfficialMask = NobleUtil.getLevel(UserInfo.OAC_NAME, chatRoomMessage);
|
||||
String ivOfficialMask = NobleUtil.getLevel(UserInfo.OAC_ICON, chatRoomMessage);
|
||||
if (!TextUtils.isEmpty(tvOfficialMask) && !TextUtils.isEmpty(ivOfficialMask) && extension != null) { // extension != null 表示自己
|
||||
text.appendBgAndContent(ivOfficialMask, tvOfficialMask, SizeUtils.dp2px(tvContent.getContext(), 59),
|
||||
SizeUtils.dp2px(tvContent.getContext(), 15));
|
||||
}
|
||||
|
||||
text.append(userLevel, expLevelWidth, expLevelHeight)
|
||||
.append(extension == null ? "我" : RegexUtil.getPrintableString(extension.getSenderNick()), new ForegroundColorSpan(greyColor))
|
||||
.append(":" + chatRoomMessage.getContent(), new ForegroundColorSpan(getResources().getColor(R.color.white)));
|
||||
.append(":" + chatRoomMessage.getContent(), new ForegroundColorSpan(getResources().getColor(R.color.white)))
|
||||
;
|
||||
|
||||
tvContent.setText(text.build());
|
||||
}
|
||||
|
||||
@@ -1852,7 +1885,7 @@ public class MessageView extends FrameLayout {
|
||||
* @param chatRoomMessage -
|
||||
* @param tvContent -
|
||||
*/
|
||||
private void setMsgNotification(ChatRoomMessage chatRoomMessage, TextView tvContent) {
|
||||
private void setMsgNotification(ChatRoomMessage chatRoomMessage, TextView tvContent, int position) {
|
||||
ChatRoomNotificationAttachment attachment = (ChatRoomNotificationAttachment) chatRoomMessage.getAttachment();
|
||||
String senderNick = "";
|
||||
List<String> nicks = attachment.getTargetNicks();
|
||||
@@ -1864,6 +1897,7 @@ public class MessageView extends FrameLayout {
|
||||
//String userLevel = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, chatRoomMessage);
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
boolean isOfficial = NobleUtil.getIsOfficial(UserInfo.IS_OFFICIAL, chatRoomMessage);
|
||||
|
||||
// 座驾
|
||||
String carName = NobleUtil.getCarName(CarInfo.CAR_NAME, chatRoomMessage);
|
||||
carName = TextUtils.isEmpty(carName) ? "" : "\"" + carName + "\"";
|
||||
@@ -1875,11 +1909,69 @@ public class MessageView extends FrameLayout {
|
||||
//2018.12.24 @测试 陈陈琳,进房不显示贵族勋章
|
||||
// .append(NobleUtil.getLocalResourcePath(userBadge), badgeWidth, badgeHeight)
|
||||
// .append(userLevel, expLevelWidth, expLevelHeight)
|
||||
.append(senderNick, new ForegroundColorSpan(roomTipColor))
|
||||
.append(senderNick, new ForegroundColorSpan(roomTipColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View view) {
|
||||
if (clickConsumer != null) {
|
||||
Single.just(chatRoomMessage.getFromAccount())
|
||||
.doOnSuccess(clickConsumer).subscribe();
|
||||
}
|
||||
}
|
||||
})
|
||||
.append(TextUtils.isEmpty(carName) ? "" : " 驾着 ", new ForegroundColorSpan(greyColor))
|
||||
.append(carName, new ForegroundColorSpan(roomTipColor))
|
||||
.append(" 进入了房间 ", new ForegroundColorSpan(greyColor));
|
||||
|
||||
//如果自己在麦上,增加一个欢迎ta的按钮,并且这条消息不是自己的
|
||||
if (AvRoomDataManager.get().isOwnerOnMic()
|
||||
&& !UserModel.get().isMyseft(chatRoomMessage.getFromAccount())
|
||||
&& !ExtensionUtil.isWelcomeLocal(chatRoomMessage)) {
|
||||
text.append(
|
||||
ResourcesCompat.getDrawable(getResources(),
|
||||
R.drawable.icon_room_welcome, null),
|
||||
UIUtil.dip2px(mContext, 47),
|
||||
UIUtil.dip2px(mContext, 17),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View view) {
|
||||
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_WELCOME_HIM, "欢迎TA");
|
||||
|
||||
ExtensionUtil.setWelcomeLocal(chatRoomMessage, true);
|
||||
mMessageAdapter.notifyItemChanged(position);
|
||||
|
||||
long targetUid = JavaUtil.str2long(chatRoomMessage.getFromAccount());
|
||||
Single.zip(AvRoomModel.get().getWelcomeConfig(targetUid),
|
||||
UserModel.get().getUserInfo(targetUid), (roomWelcomeConfig, info) -> {
|
||||
WelcomeInfo welcomeInfo = new WelcomeInfo();
|
||||
welcomeInfo.setContent(roomWelcomeConfig.getMsg());
|
||||
welcomeInfo.setTargetUid(targetUid);
|
||||
welcomeInfo.setTargetNick(info.getNick());
|
||||
welcomeInfo.setFans(roomWelcomeConfig.isFans());
|
||||
return welcomeInfo;
|
||||
})
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.flatMap((Function<WelcomeInfo, SingleSource<ChatRoomMessage>>) welcomeInfo -> {
|
||||
WelcomeAttachment attachment = new WelcomeAttachment();
|
||||
attachment.setWelcomeInfo(welcomeInfo);
|
||||
return ImHelperUtils.sendChatRoomMessage(attachment);
|
||||
})
|
||||
//添加到自己的公屏
|
||||
.doOnSuccess(chatRoomMessage ->
|
||||
IMNetEaseManager.get().addMessages(chatRoomMessage))
|
||||
.doOnError(throwable -> {
|
||||
LogUtil.e("send welcome msg failed, error: " + throwable.getMessage());
|
||||
})
|
||||
.subscribe();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
tvContent.setText(text.build());
|
||||
tvContent.setOnClickListener(null);
|
||||
tvContent.setMovementMethod(new LinkMovementMethod());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1986,6 +2078,118 @@ public class MessageView extends FrameLayout {
|
||||
tvContent.setText(text.build());
|
||||
}
|
||||
|
||||
/**
|
||||
* 麦上用户对你的欢迎语
|
||||
*/
|
||||
private void setMicWelcomeContent(ChatRoomMessage chatRoomMessage, TextView tvContent, int position) {
|
||||
clearBackground(tvContent);
|
||||
tvContent.setOnClickListener(null);
|
||||
tvContent.setMovementMethod(new LinkMovementMethod());
|
||||
if (!(chatRoomMessage.getAttachment() instanceof WelcomeAttachment)) {
|
||||
return;
|
||||
}
|
||||
WelcomeAttachment attachment = (WelcomeAttachment) chatRoomMessage.getAttachment();
|
||||
WelcomeInfo welcomeInfo = attachment.getWelcomeInfo();
|
||||
if (welcomeInfo == null) {
|
||||
return;
|
||||
}
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
String userBadge = NobleUtil.getResource(NobleResourceType.KEY_BADGE, chatRoomMessage);
|
||||
String userLevel = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, chatRoomMessage);
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
boolean isOfficial = NobleUtil.getIsOfficial(UserInfo.IS_OFFICIAL, chatRoomMessage);
|
||||
|
||||
// 内容
|
||||
String fromAccount = chatRoomMessage.getFromAccount();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(isOfficial ? ResourcesCompat.getDrawable(getResources(),
|
||||
R.mipmap.ic_user_official_13dp, null) : null,
|
||||
badgeWidth, badgeHeight)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(NobleUtil.getLocalResourcePath(userBadge), badgeWidth, badgeHeight);
|
||||
|
||||
// 官方主播认证
|
||||
String tvOfficialMask = NobleUtil.getLevel(UserInfo.OAC_NAME, chatRoomMessage);
|
||||
String ivOfficialMask = NobleUtil.getLevel(UserInfo.OAC_ICON, chatRoomMessage);
|
||||
if (!TextUtils.isEmpty(tvOfficialMask) && !TextUtils.isEmpty(ivOfficialMask) && extension != null) { // extension != null 表示自己
|
||||
text.appendBgAndContent(ivOfficialMask, tvOfficialMask, SizeUtils.dp2px(tvContent.getContext(), 59),
|
||||
SizeUtils.dp2px(tvContent.getContext(), 15));
|
||||
}
|
||||
|
||||
text.append(userLevel, expLevelWidth, expLevelHeight)
|
||||
.append(extension == null ? "我" : RegexUtil.getPrintableString(extension.getSenderNick()),
|
||||
new ForegroundColorSpan(greyColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
Single.just(String.valueOf(chatRoomMessage.getFromAccount()))
|
||||
.doOnSuccess(clickConsumer).subscribe();
|
||||
}
|
||||
})
|
||||
.append(":" + welcomeInfo.getLastConent(), new ForegroundColorSpan(whiteColor))
|
||||
.append(welcomeInfo.getTargetNick(), new ForegroundColorSpan(roomTipNickColor),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
Single.just(String.valueOf(welcomeInfo.getTargetUid()))
|
||||
.doOnSuccess(clickConsumer).subscribe();
|
||||
}
|
||||
})
|
||||
.append(welcomeInfo.getNextContent(), new ForegroundColorSpan(whiteColor));
|
||||
|
||||
//自己的消息不显示关注按钮
|
||||
//被欢迎人必须是自己
|
||||
if (!UserModel.get().isMyseft(fromAccount) && UserModel.get().isMyseft(welcomeInfo.getTargetUid())) {
|
||||
if (!welcomeInfo.isFans()) {
|
||||
text.append(" ").append(
|
||||
ResourcesCompat.getDrawable(getResources(),
|
||||
R.drawable.icon_room_attent, null),
|
||||
UIUtil.dip2px(mContext, 47),
|
||||
UIUtil.dip2px(mContext, 17),
|
||||
new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View view) {
|
||||
if (welcomeInfo.isConnecting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.Event.EVENT_ROOM_FOLLOW_HIM, "关注TA");
|
||||
|
||||
welcomeInfo.setConnecting(true);
|
||||
//关注
|
||||
PraiseModel.get().praise(JavaUtil.str2long(chatRoomMessage.getFromAccount()), true)
|
||||
.compose(RxHelper.bindContext(mContext))
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String s, String error) {
|
||||
super.accept(s, error);
|
||||
welcomeInfo.setConnecting(false);
|
||||
if (error != null) {
|
||||
SingleToastUtil.showToast(error);
|
||||
return;
|
||||
}
|
||||
welcomeInfo.setFans(true);
|
||||
welcomeInfo.setShowAttentedBtn(true);
|
||||
mMessageAdapter.notifyItemChanged(position);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
} else if (welcomeInfo.isShowAttentedBtn()){
|
||||
text.append(" ").append(
|
||||
ResourcesCompat.getDrawable(getResources(),
|
||||
R.drawable.icon_room_attent_gray, null),
|
||||
UIUtil.dip2px(mContext, 47),
|
||||
UIUtil.dip2px(mContext, 17));
|
||||
}
|
||||
}
|
||||
|
||||
tvContent.setText(text.build());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String account = "";
|
||||
@@ -2116,6 +2320,18 @@ public class MessageView extends FrameLayout {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本和背景分离的情况
|
||||
*/
|
||||
public SpannableBuilder appendBgAndContent(String drawable, String content, int width, int height) {
|
||||
if (TextUtils.isEmpty(drawable)) return this;
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
CustomImageSpan imageSpan = new CustomImageSpan(new ColorDrawable(Color.TRANSPARENT), textView, drawable, content, width, height);
|
||||
builder.setSpan(imageSpan, start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon
|
||||
* @param width 宽
|
||||
@@ -2131,6 +2347,30 @@ public class MessageView extends FrameLayout {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param drawable -icon
|
||||
* @param width 宽
|
||||
* @param height 高
|
||||
* @return -返回一个spannableStringBuilder
|
||||
*/
|
||||
public SpannableBuilder append(Drawable drawable, int width, int height, Object... whats) {
|
||||
if (drawable == null) return this;
|
||||
try {
|
||||
drawable.setBounds(0, 0, width, height);
|
||||
int start = builder.length();
|
||||
builder.append("-");
|
||||
builder.setSpan(new CustomImageSpan(drawable), start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
if (whats != null) {
|
||||
for (int i = 0; i < whats.length; i++) {
|
||||
builder.setSpan(whats[0], start, builder.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text -文字
|
||||
* @param what -span类型
|
||||
|
232
app/src/main/java/com/yizhuan/erban/base/BaseLoginAct.java
Normal file
@@ -0,0 +1,232 @@
|
||||
package com.yizhuan.erban.base;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ishumei.smantifraud.SmAntiFraud;
|
||||
import com.netease.mobsec.rjsb.watchman;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.LoginTipsInfo;
|
||||
import com.yizhuan.xchat_android_core.market_verify.MarketVerifyModel;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
|
||||
public abstract class BaseLoginAct extends BaseActivity {
|
||||
|
||||
protected TextView tvProtocol;
|
||||
protected ImageView wxLogin;
|
||||
protected ImageView qqLogin;
|
||||
protected TextView tvLoginTip;
|
||||
protected TextView tvDesc;
|
||||
|
||||
protected boolean canClick = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
protected void setProtocol() {
|
||||
|
||||
if (tvProtocol == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String privacyAgreementTip = context.getString(R.string.tip_privacy_agreement);
|
||||
String userAgreementTip = context.getString(R.string.tip_user_agreement);
|
||||
String privacyAgreementDescTip = context.getString(R.string.text_login_protocol, privacyAgreementTip, userAgreementTip);
|
||||
SpannableString ss = new SpannableString(privacyAgreementDescTip);
|
||||
int privacyAgreementTipIndex = privacyAgreementDescTip.indexOf(privacyAgreementTip);
|
||||
int userAgreementTipIndex = privacyAgreementDescTip.indexOf(userAgreementTip);
|
||||
|
||||
|
||||
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.design_color)), privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.design_color)) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (!canClick) {
|
||||
return;
|
||||
}
|
||||
if (widget instanceof TextView)
|
||||
((TextView) widget).setHighlightColor(getResources().getColor(android.R.color.transparent));
|
||||
|
||||
CommonWebViewActivity.start(context, UriProvider.getPrivacyAgreement());
|
||||
}
|
||||
}, privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.design_color)), userAgreementTipIndex, userAgreementTipIndex + userAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.design_color)) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (!canClick) {
|
||||
return;
|
||||
}
|
||||
if (widget instanceof TextView)
|
||||
((TextView) widget).setHighlightColor(getResources().getColor(android.R.color.transparent));
|
||||
|
||||
CommonWebViewActivity.start(context, UriProvider.getUserProtocolUrl());
|
||||
}
|
||||
}, userAgreementTipIndex, userAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
tvProtocol.setText(ss);
|
||||
tvProtocol.setHighlightColor(Color.TRANSPARENT);
|
||||
tvProtocol.setMovementMethod(new LinkMovementMethod());
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
protected void showLoginTip() {
|
||||
MarketVerifyModel.get().loadLoginTip()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new BiConsumer<LoginTipsInfo, Throwable>() {
|
||||
@Override
|
||||
public void accept(LoginTipsInfo loginTipsInfo, Throwable throwable) throws Exception {
|
||||
if (throwable == null) {
|
||||
showTvDesc(loginTipsInfo.getTips());
|
||||
|
||||
showTvLoginTip(loginTipsInfo.isShowWechat() || loginTipsInfo.isShowQq());
|
||||
showThirdPartLogin(loginTipsInfo.isShowWechat(), loginTipsInfo.isShowQq());
|
||||
|
||||
} else {
|
||||
showTvLoginTip(false);
|
||||
showThirdPartLogin(false, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void showThirdPartLogin(boolean isShowWechat, boolean isShowQq) {
|
||||
showwxLogin(isShowWechat);
|
||||
showqqLogin(isShowQq);
|
||||
}
|
||||
|
||||
private void showTvLoginTip(boolean visible) {
|
||||
if (tvLoginTip != null) {
|
||||
tvLoginTip.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showwxLogin(boolean visible) {
|
||||
if (wxLogin != null) {
|
||||
wxLogin.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showqqLogin(boolean visible) {
|
||||
if (qqLogin != null) {
|
||||
qqLogin.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showTvDesc(String tips) {
|
||||
if (tvDesc != null && !TextUtils.isEmpty(tips)) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(tips);
|
||||
int start = tips.indexOf("如何登录");
|
||||
|
||||
if (start > -1) {
|
||||
builder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_FE4C62)), start, start + 5, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (!canClick) {
|
||||
return;
|
||||
}
|
||||
CommonWebViewActivity.start(BaseLoginAct.this, UriProvider.JAVA_WEB_URL + XChatConstants.LOGIN_ERBAN_ACCOUNT_URL);
|
||||
}
|
||||
}, start, start + 5, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
tvDesc.setText(builder);
|
||||
tvDesc.setHighlightColor(Color.TRANSPARENT);
|
||||
tvDesc.setMovementMethod(new LinkMovementMethod());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected void wxLogin() {
|
||||
// 易盾保护 token
|
||||
String yiDunToken = watchman.getToken(XChatConstants.YI_DUN_BUSINESS_ID);
|
||||
// 数美天网 deviceId
|
||||
String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
||||
getDialogManager().showProgressDialog(this, "请稍后");
|
||||
AuthModel.get()
|
||||
.wxLogin(yiDunToken, shuMeiDeviceId)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
getDialogManager().dismissDialog();
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
getDialogManager().dismissDialog();
|
||||
dealWithLoginError(e);
|
||||
}
|
||||
});
|
||||
StatisticManager.Instance().onEvent(this,
|
||||
StatisticsProtocol.Event.EVENT_LOGIN_WX_CLICK, "点击微信登录", null);
|
||||
|
||||
}
|
||||
|
||||
protected void qqLogin() {
|
||||
// 易盾保护 token
|
||||
String yiDunToken = watchman.getToken(XChatConstants.YI_DUN_BUSINESS_ID);
|
||||
// 数美天网 deviceId
|
||||
String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
||||
getDialogManager().showProgressDialog(this, "请稍后");
|
||||
AuthModel.get()
|
||||
.qqLogin(yiDunToken, shuMeiDeviceId)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
getDialogManager().dismissDialog();
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
getDialogManager().dismissDialog();
|
||||
dealWithLoginError(e);
|
||||
}
|
||||
});
|
||||
StatisticManager.Instance().onEvent(this,
|
||||
StatisticsProtocol.Event.EVENT_LOGIN_QQ_CLICK, "点击qq登录", null);
|
||||
|
||||
}
|
||||
|
||||
public abstract void dealWithLoginError(Throwable e);
|
||||
}
|
@@ -6,6 +6,7 @@ import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ImageSpan;
|
||||
@@ -19,6 +20,7 @@ import com.bumptech.glide.request.target.Target;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.erban.ui.widget.marqueeview.Utils;
|
||||
import com.yizhuan.xchat_android_library.utils.SizeUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.config.BasicConfig;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -32,6 +34,8 @@ public class CustomImageSpan extends ImageSpan {
|
||||
private int height;
|
||||
private Drawable drawable;
|
||||
|
||||
private String content;
|
||||
|
||||
public CustomImageSpan(Drawable drawable) {
|
||||
super(drawable);
|
||||
this.drawable = drawable;
|
||||
@@ -57,6 +61,26 @@ public class CustomImageSpan extends ImageSpan {
|
||||
loadPicAsync();
|
||||
}
|
||||
|
||||
/**
|
||||
* 官方主播铭牌类似情况:背景图和文本组合展示
|
||||
* @param url
|
||||
* 图标链接
|
||||
* @param content
|
||||
* 文本
|
||||
*/
|
||||
public CustomImageSpan(Drawable defaultDrawable, TextView textView, String url, String content, int width, int height) {
|
||||
super(defaultDrawable);
|
||||
this.content = content;
|
||||
|
||||
this.url = url;
|
||||
this.reference = new WeakReference<>(textView);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.drawable = defaultDrawable;
|
||||
getDrawable().setBounds(0, 0, width, height);
|
||||
loadPicAsync();
|
||||
}
|
||||
|
||||
private void loadPicAsyncNoWidthHeight() {
|
||||
if (!loading && !TextUtils.isEmpty(url) && reference.get() != null) {
|
||||
if (isDestroyedActivity(reference.get().getContext())) {
|
||||
@@ -82,6 +106,8 @@ public class CustomImageSpan extends ImageSpan {
|
||||
loading = false;
|
||||
TextView textView = reference.get();
|
||||
if (textView == null || resource == null) return true;
|
||||
resource = getNewDrawable(textView, resource);
|
||||
|
||||
CustomImageSpan.this.drawable = resource;
|
||||
int i = resource.getMinimumHeight() / 15;
|
||||
CustomImageSpan.this.drawable.setBounds(0, 0,
|
||||
@@ -129,6 +155,8 @@ public class CustomImageSpan extends ImageSpan {
|
||||
loading = false;
|
||||
TextView textView = reference.get();
|
||||
if (textView == null || resource == null) return true;
|
||||
resource = getNewDrawable(textView, resource);
|
||||
|
||||
CustomImageSpan.this.drawable = resource;
|
||||
CustomImageSpan.this.drawable.setBounds(0, 0, width, height);
|
||||
textView.postInvalidate();
|
||||
@@ -143,6 +171,26 @@ public class CustomImageSpan extends ImageSpan {
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable getNewDrawable(TextView textView, Drawable resource) {
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
float extraXOffset = SizeUtils.dp2px(textView.getContext(), 1);
|
||||
|
||||
int width = resource.getIntrinsicWidth();
|
||||
float xLOffset = SizeUtils.dp2px(textView.getContext(), 15);
|
||||
float xROffset = SizeUtils.dp2px(textView.getContext(), 6);
|
||||
float tempWidth = width - xLOffset - xROffset;
|
||||
float x = tempWidth / 2 + xLOffset + extraXOffset;
|
||||
int size = SizeUtils.dp2px(textView.getContext(), 10);
|
||||
|
||||
TextDrawable textDrawable = new TextDrawable(content, x, resource.getIntrinsicHeight(), size);
|
||||
Drawable[] array = new Drawable[] {resource, textDrawable};
|
||||
LayerDrawable id = new LayerDrawable(array);
|
||||
resource = id;
|
||||
}
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getDrawable() {
|
||||
return drawable;
|
||||
|
@@ -0,0 +1,65 @@
|
||||
package com.yizhuan.erban.common.widget;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
public class TextDrawable extends Drawable {
|
||||
|
||||
private String mContent;
|
||||
private Paint mPaint;
|
||||
private float mWidth;
|
||||
private float mHeight;
|
||||
|
||||
public TextDrawable(String content, float width, float height, int size) {
|
||||
mContent = content;
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
|
||||
mPaint = new Paint();
|
||||
mPaint.setColor(Color.WHITE);
|
||||
mPaint.setAntiAlias(true);
|
||||
mPaint.setStrokeWidth(5);
|
||||
mPaint.setStyle(Paint.Style.FILL);
|
||||
mPaint.setTextAlign(Paint.Align.CENTER);
|
||||
mPaint.setTextSize(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(@NonNull Canvas canvas) {
|
||||
if (!TextUtils.isEmpty(mContent)) {
|
||||
Paint.FontMetrics fontMetrics = mPaint.getFontMetrics();
|
||||
float top = fontMetrics.top;//为基线到字体上边框的距离
|
||||
float bottom = fontMetrics.bottom;//为基线到字体下边框的距离
|
||||
Log.i("TextDrawable", "top:" + top);
|
||||
Log.i("TextDrawable", "bottom:" + bottom);
|
||||
|
||||
float y = mHeight / 2 - top / 2 - bottom / 2;
|
||||
|
||||
canvas.drawText(mContent, mWidth, y, mPaint);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(int alpha) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorFilter(@Nullable ColorFilter colorFilter) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return PixelFormat.TRANSLUCENT;
|
||||
}
|
||||
}
|
@@ -67,6 +67,7 @@ import com.yizhuan.xchat_android_core.market_verify.MarketVerifyModel;
|
||||
import com.yizhuan.xchat_android_core.noble.NobleUtil;
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.RecommendationUserInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.StringUtils;
|
||||
|
||||
@@ -211,6 +212,22 @@ public class HomeFragmentAdapter extends BaseMultiItemQuickAdapter<HomeItem, Bas
|
||||
}
|
||||
RecommendationUserInfo item = (RecommendationUserInfo) obj;
|
||||
|
||||
View inOfficialMask = holder.getView(R.id.in_official_mask);
|
||||
UserInfo.NamePlate namePlate = item.getNameplate();
|
||||
if (namePlate != null) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
TextView tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
if (tvOfficialMask != null) {
|
||||
tvOfficialMask.setText(namePlate.getFixedWord());
|
||||
}
|
||||
|
||||
ImageView ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
NobleUtil.loadResource(namePlate.getIconPic(), ivOfficialMask);
|
||||
|
||||
} else {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
//common begin
|
||||
holder.setGone(R.id.iv_noble_level, false);
|
||||
holder.setGone(R.id.iv_user_level, false);
|
||||
@@ -402,6 +419,7 @@ public class HomeFragmentAdapter extends BaseMultiItemQuickAdapter<HomeItem, Bas
|
||||
holder.setGone(R.id.tv_desc, !StringUtils.isBlank(description));
|
||||
//描述
|
||||
holder.setText(R.id.tv_desc, description);
|
||||
|
||||
}
|
||||
|
||||
private boolean isCpRoom(HomeRoom roomInfo) {
|
||||
|
@@ -13,6 +13,7 @@ import android.text.style.ImageSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
@@ -126,6 +127,8 @@ public class HomeHallAdapter extends BaseMultiItemQuickAdapter<HomeHallMsgInfo,
|
||||
ivNobleLevel.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
AppCompatImageView ivUserLevel = (AppCompatImageView) helper.getView(R.id.iv_user_level);
|
||||
ivUserLevel.setVisibility(View.GONE);
|
||||
if (!TextUtils.isEmpty(item.getUserLevelUrl())) {
|
||||
@@ -140,6 +143,25 @@ public class HomeHallAdapter extends BaseMultiItemQuickAdapter<HomeHallMsgInfo,
|
||||
ImageLoadUtils.loadImage(mContext, item.getUserCharmLevelUrl(), ivCharmLevel);
|
||||
}
|
||||
|
||||
// 官方认证标识
|
||||
View inOfficialMask = helper.getView(R.id.in_official_mask);
|
||||
if (!TextUtils.isEmpty(item.getFixedWord()) && !TextUtils.isEmpty(item.getIconPic())) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
|
||||
TextView tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
if (tvOfficialMask != null) {
|
||||
tvOfficialMask.setText(item.getFixedWord());
|
||||
}
|
||||
|
||||
ImageView ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
if (ivOfficialMask != null) {
|
||||
NobleUtil.loadResource(item.getIconPic(), ivOfficialMask);
|
||||
}
|
||||
|
||||
} else {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -477,6 +477,15 @@ public class FindFragment extends BaseMvpFragment<IFindFragmentView, FindFragmen
|
||||
item.setPrettyErbanNo((Boolean) extension.get(UserInfo.HAS_PRETTY
|
||||
));
|
||||
}
|
||||
|
||||
if (extension.get(UserInfo.OAC_NAME) != null) {
|
||||
item.setFixedWord((String) extension.get(UserInfo.OAC_NAME));
|
||||
}
|
||||
|
||||
if (extension.get(UserInfo.OAC_ICON) != null) {
|
||||
item.setIconPic((String) extension.get(UserInfo.OAC_ICON));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,8 +7,10 @@ import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
@@ -87,6 +89,9 @@ public class MeFragment extends BaseFragment implements View.OnClickListener {
|
||||
|
||||
private ObservableScrollView scrollView;
|
||||
|
||||
private ImageView ivOfficialMask;
|
||||
private TextView tvOfficialMask;
|
||||
|
||||
@Override
|
||||
public int getRootLayoutId() {
|
||||
return R.layout.fragment_me;
|
||||
@@ -172,6 +177,25 @@ public class MeFragment extends BaseFragment implements View.OnClickListener {
|
||||
});
|
||||
}
|
||||
|
||||
if (mBinding.inOfficialMask != null) {
|
||||
ivOfficialMask = mBinding.inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
tvOfficialMask = mBinding.inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setOfficialMask(String name, String icon) {
|
||||
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(icon)) {
|
||||
mBinding.inOfficialMask.setVisibility(View.VISIBLE);
|
||||
|
||||
if (tvOfficialMask != null && ivOfficialMask != null) {
|
||||
tvOfficialMask.setText(name);
|
||||
NobleUtil.loadResource(icon, ivOfficialMask);
|
||||
}
|
||||
|
||||
} else {
|
||||
mBinding.inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void onGetRelationShipEvent(RelationShipEvent event) {
|
||||
@@ -198,6 +222,13 @@ public class MeFragment extends BaseFragment implements View.OnClickListener {
|
||||
mBinding.tvUserId.setText(String.format(Locale.getDefault(),
|
||||
getString(R.string.text_user_id), String.valueOf(mUserInfo.getErbanNo())));
|
||||
|
||||
|
||||
if (mUserInfo.getNameplate() != null) {
|
||||
setOfficialMask(mUserInfo.getNameplate().getFixedWord(), mUserInfo.getNameplate().getIconPic());
|
||||
} else {
|
||||
setOfficialMask("", "");
|
||||
}
|
||||
|
||||
int nobleExpire = mUserInfo.getRemainDay();
|
||||
if (nobleExpire > -1) {
|
||||
mBinding.tvNobleRemainTime.setVisibility(View.VISIBLE);
|
||||
@@ -379,6 +410,12 @@ public class MeFragment extends BaseFragment implements View.OnClickListener {
|
||||
CommonWebViewActivity.start(getActivity(), UriProvider.getTutuAprove());
|
||||
break;
|
||||
|
||||
case R.id.ll_anchor_certification:
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_MY_OFFICIAL_ANCHOR, "官方主播");
|
||||
|
||||
CommonWebViewActivity.start(getActivity(), UriProvider.getAnchorCertification());
|
||||
break;
|
||||
|
||||
case R.id.ll_authen:
|
||||
checkPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA)
|
||||
.subscribe(result -> {
|
||||
|
@@ -0,0 +1,103 @@
|
||||
package com.yizhuan.erban.main.helper;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.utils.NotificationsUtils;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.utils.SharedPreferenceUtils;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleEmitter;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Function;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 通知栏ui处理逻辑
|
||||
* Created by lvzebiao on 2020/3/16.
|
||||
*/
|
||||
public class NoticationsUiHelper {
|
||||
|
||||
/**
|
||||
* 用于处理,用户关闭通知栏时,每N天,弹一次
|
||||
*/
|
||||
private static final String KEY_NOTICATIONS_DIALOG_TIME = "notications_dialog_time";
|
||||
|
||||
private static final long CACHE_DISTANCE_TIME = 3 * TimeUtils.MILLIS_OF_A_DAY;
|
||||
|
||||
public static void handle(Activity activity, DialogManager dialogManager) {
|
||||
if (NotificationsUtils.isNotificationEnabled(activity)) {
|
||||
return;
|
||||
}
|
||||
Single.create(new SingleOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
||||
long lastDialogTime = (long) SharedPreferenceUtils
|
||||
.get(KEY_NOTICATIONS_DIALOG_TIME, 0L);
|
||||
long currTime = System.currentTimeMillis();
|
||||
if (lastDialogTime == 0L || currTime - lastDialogTime >= CACHE_DISTANCE_TIME) {
|
||||
//超过三天需要重新弹窗
|
||||
emitter.onSuccess("");
|
||||
return;
|
||||
}
|
||||
emitter.onError(new Throwable("no need to show notications dialog"));
|
||||
}
|
||||
})
|
||||
.flatMap(new Function<String, SingleSource<String>>() {
|
||||
@Override
|
||||
public SingleSource<String> apply(String s) throws Exception {
|
||||
return Single.just(s).delay(60, TimeUnit.SECONDS);
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.compose(RxHelper.bindContext(activity))
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String s, String error) {
|
||||
super.accept(s, error);
|
||||
if (error != null) {
|
||||
return;
|
||||
}
|
||||
if (NotificationsUtils.isNotificationEnabled(activity)) {
|
||||
return;
|
||||
}
|
||||
DialogManager tempDialogManager = dialogManager;
|
||||
if (tempDialogManager == null) {
|
||||
tempDialogManager = new DialogManager(activity);
|
||||
}
|
||||
SharedPreferenceUtils.put(KEY_NOTICATIONS_DIALOG_TIME, System.currentTimeMillis());
|
||||
tempDialogManager.showOkCancelDialog(
|
||||
"开启推送通知",
|
||||
"活动、福利、好友消息,各种精彩瞬间再也不怕错过啦!",
|
||||
"立即开启",
|
||||
"下次再说",
|
||||
new DialogManager.OkCancelDialogListener() {
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_HOME_PUSH_INQUIRE,
|
||||
"通知权限弹窗-区分-下次再说");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk() {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_HOME_PUSH_INQUIRE,
|
||||
"通知权限弹窗-区分-立即开启");
|
||||
NotificationsUtils.openPush(activity);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@@ -5,12 +5,14 @@ import android.content.Intent;
|
||||
import android.databinding.DataBindingUtil;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
import com.netease.nim.uikit.support.glide.GlideApp;
|
||||
import com.yizhuan.erban.MainActivity;
|
||||
import com.yizhuan.erban.NimMiddleActivity;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.databinding.ActivitySplashBinding;
|
||||
@@ -36,6 +38,7 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
NimMiddleActivity.delayOpenCommunity = true;
|
||||
|
||||
//修复 https://blog.csdn.net/u011153817/article/details/77335255
|
||||
// https://blog.csdn.net/zhangcanyan/article/details/52777265 这样的启动异常问题.
|
||||
@@ -95,6 +98,7 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
|
||||
.apply(RequestOptions.bitmapTransform(new SplashBitmapTransformation()))
|
||||
.into(mBinding.ivActivity);
|
||||
} else {
|
||||
NimMiddleActivity.delayOpenCommunity = false;
|
||||
MainActivity.start(SplashActivity.this);
|
||||
finish();
|
||||
}
|
||||
@@ -111,6 +115,8 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
|
||||
if (needJump) {
|
||||
return;
|
||||
}
|
||||
|
||||
NimMiddleActivity.delayOpenCommunity = false;
|
||||
MainActivity.start(SplashActivity.this);
|
||||
finish();
|
||||
}
|
||||
@@ -130,6 +136,8 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("url", link);
|
||||
intent.putExtra("type", type);
|
||||
|
||||
NimMiddleActivity.delayOpenCommunity = false;
|
||||
MainActivity.start(this, intent);
|
||||
break;
|
||||
case R.id.tv_skip:
|
||||
@@ -137,6 +145,8 @@ public class SplashActivity extends BaseActivity implements View.OnClickListener
|
||||
return;
|
||||
}
|
||||
needJump = true;
|
||||
|
||||
NimMiddleActivity.delayOpenCommunity = false;
|
||||
MainActivity.start(this);
|
||||
break;
|
||||
default:
|
||||
|
@@ -28,6 +28,7 @@ import com.yizhuan.erban.ui.login.BinderPhoneActivity;
|
||||
import com.yizhuan.erban.ui.login.ShowBindPhoneActivity;
|
||||
import com.yizhuan.erban.ui.patriarch.help.LimitEnterRoomHelper;
|
||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
||||
import com.yizhuan.erban.ui.setting.FeedbackActivity;
|
||||
import com.yizhuan.erban.ui.setting.ModifyPwdActivity;
|
||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||
import com.yizhuan.erban.ui.wallet.WalletActivity;
|
||||
@@ -282,6 +283,10 @@ public class RouterHandler {
|
||||
EventBus.getDefault().post(new SquareTaskEvent());
|
||||
break;
|
||||
|
||||
case RouterType.FEED_BACK:
|
||||
FeedbackActivity.start(context);
|
||||
break;
|
||||
|
||||
default:
|
||||
SingleToastUtil.showToast("暂不支持哟!");
|
||||
return false;
|
||||
|
@@ -0,0 +1,299 @@
|
||||
package com.yizhuan.erban.ui.im.chat;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.AbsoluteSizeSpan;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.MetricAffectingSpan;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.netease.nim.uikit.business.session.viewholder.MsgViewHolderBase;
|
||||
import com.netease.nim.uikit.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
|
||||
import com.netease.nimlib.sdk.msg.model.IMMessage;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.sys.ErbanSysMsgViewModel;
|
||||
import com.yizhuan.erban.ui.im.RouterHandler;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.SysMsgV2Attachment;
|
||||
import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.msg.sys.ApproveMsgInfo;
|
||||
import com.yizhuan.xchat_android_core.msg.sysv2.ErbanSysMsgV2Component;
|
||||
import com.yizhuan.xchat_android_core.msg.sysv2.ErbanSysMsgV2Info;
|
||||
import com.yizhuan.xchat_android_core.msg.sysv2.ErbanSysMsgV2Layout;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.SizeUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_COMMON_SYSTEM_MSG_V2;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_COMMON_SYSTEM_MSG_V2_APPROVAL;
|
||||
import static com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_COMMON_SYSTEM_MSG_V2_TEXT;
|
||||
|
||||
/**
|
||||
* Created by lvzebiao on 2020/3/28.
|
||||
*/
|
||||
|
||||
public class SysMsgV2ViewHolder extends MsgViewHolderBase implements View.OnClickListener {
|
||||
|
||||
private View container;
|
||||
private TextView title;
|
||||
private TextView timestamp;
|
||||
private TextView content;
|
||||
private TextView approvalState;
|
||||
private TextView tvRejoinMW;
|
||||
private FrameLayout flRejoin;
|
||||
private RelativeLayout resultLayout;
|
||||
private RelativeLayout operationLayout;
|
||||
private ErbanSysMsgV2Info erbanSysMsgV2Info;
|
||||
private ErbanSysMsgViewModel viewModel;
|
||||
|
||||
public SysMsgV2ViewHolder(BaseMultiItemFetchLoadAdapter adapter) {
|
||||
super(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getContentResId() {
|
||||
return R.layout.layout_sys_msg_view_holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void inflateContentView() {
|
||||
container = findViewById(R.id.ll_container);
|
||||
approvalState = findViewById(R.id.tv_result);
|
||||
resultLayout = findViewById(R.id.rl_result_layout);
|
||||
operationLayout = findViewById(R.id.rl_operators);
|
||||
tvRejoinMW = findViewById(R.id.tv_rejoin_mw);
|
||||
flRejoin = findViewById(R.id.fl_rejoin);
|
||||
title = findViewById(R.id.tv_title);
|
||||
timestamp = findViewById(R.id.tv_timestamp);
|
||||
content = findViewById(R.id.tv_content);
|
||||
viewModel = new ErbanSysMsgViewModel();
|
||||
container.setOnClickListener(this);
|
||||
tvRejoinMW.setOnClickListener(this);
|
||||
findViewById(R.id.btn_reject).setOnClickListener(this);
|
||||
findViewById(R.id.btn_agree).setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindContentView() {
|
||||
IMMessage sysMsgInfoMessage = IMNetEaseManager.get().queryMessageByUuid(message.getUuid());
|
||||
SysMsgV2Attachment sysMsgV2Attachment;
|
||||
if (sysMsgInfoMessage == null) {
|
||||
sysMsgV2Attachment = (SysMsgV2Attachment) message.getAttachment();
|
||||
IMNetEaseManager.get().saveMessageToLocal(message);
|
||||
erbanSysMsgV2Info = sysMsgV2Attachment.getErbanSysMsgV2Info();
|
||||
if (erbanSysMsgV2Info == null) {
|
||||
return;
|
||||
}
|
||||
message.setLocalExtension(ErbanSysMsgV2Info.convertToMap(erbanSysMsgV2Info));
|
||||
IMNetEaseManager.get().updateErbanSysMsgV2InfoMessage(message.getUuid(), erbanSysMsgV2Info);
|
||||
} else {
|
||||
sysMsgV2Attachment = (SysMsgV2Attachment) sysMsgInfoMessage.getAttachment();
|
||||
if (sysMsgInfoMessage.getLocalExtension() == null) {
|
||||
erbanSysMsgV2Info = sysMsgV2Attachment.getErbanSysMsgV2Info();
|
||||
} else {
|
||||
erbanSysMsgV2Info = ErbanSysMsgV2Info.convertMapToObject(sysMsgInfoMessage.getLocalExtension());
|
||||
}
|
||||
if (erbanSysMsgV2Info == null) {
|
||||
return;
|
||||
}
|
||||
sysMsgInfoMessage.setLocalExtension(ErbanSysMsgV2Info.convertToMap(erbanSysMsgV2Info));
|
||||
IMNetEaseManager.get().updateErbanSysMsgV2InfoMessage(sysMsgInfoMessage.getUuid(), erbanSysMsgV2Info);
|
||||
}
|
||||
|
||||
String layout = erbanSysMsgV2Info.getLayout();
|
||||
ErbanSysMsgV2Layout ErbanSysMsgV2Layout;
|
||||
try {
|
||||
ErbanSysMsgV2Layout = JSON.parseObject(layout, ErbanSysMsgV2Layout.class);
|
||||
|
||||
} catch (Exception ex) { // json解析出错
|
||||
ex.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
// title
|
||||
setupView(title, ErbanSysMsgV2Layout.getTitle());
|
||||
// timestamp
|
||||
setupView(timestamp, ErbanSysMsgV2Layout.getTime());
|
||||
// content
|
||||
List<ErbanSysMsgV2Component> erbanSysMsgV2LayoutContent = ErbanSysMsgV2Layout.getContents();
|
||||
if (erbanSysMsgV2LayoutContent != null) {
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
|
||||
for (ErbanSysMsgV2Component ErbanSysMsgV2Component : erbanSysMsgV2LayoutContent) {
|
||||
int start = spannableStringBuilder.length();
|
||||
String msgBody = ErbanSysMsgV2Component.getContent();
|
||||
if (Objects.equals(msgBody, "/r/n")) {
|
||||
msgBody = "\r\n";
|
||||
spannableStringBuilder.append(msgBody);
|
||||
continue;
|
||||
}
|
||||
spannableStringBuilder.append(msgBody);
|
||||
if (ErbanSysMsgV2Component.getFontColor() != null) {
|
||||
spannableStringBuilder.setSpan(new ForegroundColorSpan(Color.parseColor(ErbanSysMsgV2Component.getFontColor())),
|
||||
start, spannableStringBuilder.length(),
|
||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
if (ErbanSysMsgV2Component.getFontSize() > 0) {
|
||||
spannableStringBuilder.setSpan(new AbsoluteSizeSpan(SizeUtils.sp2px(content.getContext(), ErbanSysMsgV2Component.getFontSize() + 0.5F)),
|
||||
start, spannableStringBuilder.length(),
|
||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
spannableStringBuilder.setSpan(
|
||||
new MetricAffectingSpan() {
|
||||
@Override
|
||||
public void updateMeasureState(TextPaint p) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(TextPaint tp) {
|
||||
tp.setFakeBoldText(ErbanSysMsgV2Component.isFontBold());
|
||||
}
|
||||
},
|
||||
start, spannableStringBuilder.length(),
|
||||
Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
content.setText(spannableStringBuilder);
|
||||
}
|
||||
|
||||
operationLayout.setVisibility(View.GONE);
|
||||
resultLayout.setVisibility(View.GONE);
|
||||
flRejoin.setVisibility(View.GONE);
|
||||
|
||||
if (sysMsgV2Attachment.getFirst() == CUSTOM_MSG_HEADER_COMMON_SYSTEM_MSG_V2) {
|
||||
switch (sysMsgV2Attachment.getSecond()) {
|
||||
case CUSTOM_MSG_SUB_TYPE_COMMON_SYSTEM_MSG_V2_TEXT:
|
||||
break;
|
||||
|
||||
case CUSTOM_MSG_SUB_TYPE_COMMON_SYSTEM_MSG_V2_APPROVAL:
|
||||
operationLayout.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// bottom layout
|
||||
switch (erbanSysMsgV2Info.getState()) {
|
||||
case ErbanSysMsgV2Info.STATE_UNTREATED:
|
||||
break;
|
||||
|
||||
case ErbanSysMsgV2Info.STATE_AGREE:
|
||||
displayAgreedResult();
|
||||
break;
|
||||
|
||||
case ErbanSysMsgV2Info.STATE_REFUSED:
|
||||
displayRejectedResult();
|
||||
break;
|
||||
|
||||
case ErbanSysMsgV2Info.STATE_OUT_DATE:
|
||||
displayOutDateResult();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setupView(TextView view, ErbanSysMsgV2Component ErbanSysMsgV2Component) {
|
||||
if (ErbanSysMsgV2Component != null) {
|
||||
setupComponent(view, ErbanSysMsgV2Component.getContent(), ErbanSysMsgV2Component.getFontColor(), ErbanSysMsgV2Component.getFontSize(),
|
||||
ErbanSysMsgV2Component.getRouterType(), ErbanSysMsgV2Component.getRouterValue());
|
||||
}
|
||||
}
|
||||
|
||||
public void setupComponent(TextView view, String text, String textColor, float fontSize, int routerType, String routerValue) {
|
||||
view.setText(text);
|
||||
view.setTextColor(Color.parseColor(textColor));
|
||||
view.setTextSize(fontSize);
|
||||
if (routerType > 0) {
|
||||
view.setOnClickListener(v -> RouterHandler.handle(context, routerType, routerValue));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (erbanSysMsgV2Info == null) {
|
||||
return;
|
||||
}
|
||||
switch (v.getId()) {
|
||||
case R.id.ll_container:
|
||||
if (erbanSysMsgV2Info.getRouterType() != 0)
|
||||
RouterHandler.handle(context, erbanSysMsgV2Info.getRouterType(), erbanSysMsgV2Info.getRouterValue());
|
||||
break;
|
||||
|
||||
case R.id.btn_reject:
|
||||
viewModel.requestUrl(erbanSysMsgV2Info.getUrl(), 0, erbanSysMsgV2Info.getParams())
|
||||
.subscribe((approveMsgInfo, throwable) -> {
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
String tips = throwable.getMessage();
|
||||
if (!TextUtils.isEmpty(tips) && !RxHelper.ERROR_TIPS.equals(tips))
|
||||
SingleToastUtil.showToast(context, throwable.getMessage(), Toast.LENGTH_SHORT);
|
||||
} else {
|
||||
if (approveMsgInfo.getStatus() == ErbanSysMsgV2Info.STATE_OUT_DATE) {
|
||||
displayOutDateResult();
|
||||
}else if (approveMsgInfo.getStatus() == ErbanSysMsgV2Info.STATE_REFUSED){
|
||||
displayRejectedResult();
|
||||
}
|
||||
updateMessageToLocal(approveMsgInfo);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case R.id.btn_agree:
|
||||
viewModel.requestUrl(erbanSysMsgV2Info.getUrl(), 1, erbanSysMsgV2Info.getParams())
|
||||
.subscribe((approveMsgInfo, throwable) -> {
|
||||
if (throwable != null) {
|
||||
throwable.printStackTrace();
|
||||
String tips = throwable.getMessage();
|
||||
if (!TextUtils.isEmpty(tips) && !RxHelper.ERROR_TIPS.equals(tips))
|
||||
SingleToastUtil.showToast(context, throwable.getMessage(), Toast.LENGTH_SHORT);
|
||||
} else {
|
||||
if (approveMsgInfo.getStatus() == ErbanSysMsgV2Info.STATE_OUT_DATE) {
|
||||
displayOutDateResult();
|
||||
}else if (approveMsgInfo.getStatus() == ErbanSysMsgV2Info.STATE_AGREE){
|
||||
displayAgreedResult();
|
||||
}
|
||||
updateMessageToLocal(approveMsgInfo);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void updateMessageToLocal(ApproveMsgInfo approveMsgInfo) {
|
||||
erbanSysMsgV2Info.setState(approveMsgInfo.getStatus());
|
||||
IMNetEaseManager.get().updateErbanSysMsgV2InfoMessage(message.getUuid(), erbanSysMsgV2Info);
|
||||
}
|
||||
|
||||
private void displayAgreedResult() {
|
||||
resultLayout.setVisibility(View.VISIBLE);
|
||||
operationLayout.setVisibility(View.GONE);
|
||||
approvalState.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_state_agreed, 0, 0, 0);
|
||||
approvalState.setText(R.string.text_erban_sys_msg_state_agreed);
|
||||
approvalState.setTextColor(ContextCompat.getColor(context, R.color.green_color_light));
|
||||
}
|
||||
|
||||
private void displayRejectedResult() {
|
||||
resultLayout.setVisibility(View.VISIBLE);
|
||||
operationLayout.setVisibility(View.GONE);
|
||||
approvalState.setCompoundDrawablesWithIntrinsicBounds(R.drawable.icon_state_rejected, 0, 0, 0);
|
||||
approvalState.setText(R.string.text_erban_sys_msg_state_rejected);
|
||||
approvalState.setTextColor(ContextCompat.getColor(context, R.color.color_ff6565));
|
||||
}
|
||||
|
||||
private void displayOutDateResult() {
|
||||
resultLayout.setVisibility(View.VISIBLE);
|
||||
operationLayout.setVisibility(View.GONE);
|
||||
approvalState.setText(R.string.text_erban_sys_msg_state_out_date);
|
||||
approvalState.setTextColor(ContextCompat.getColor(context, R.color.color_ff6565));
|
||||
}
|
||||
}
|
@@ -377,7 +377,8 @@ public class RecentListFragment extends BaseFragment {
|
||||
}
|
||||
}
|
||||
} else if (customAttachment.getFirst() == CUSTOM_MSG_HEADER_COMMON_SYSTEM_MSG
|
||||
|| customAttachment.getFirst() == CUSTOM_MSG_SHIFT_OUT) {
|
||||
|| customAttachment.getFirst() == CUSTOM_MSG_SHIFT_OUT
|
||||
|| customAttachment.getFirst() == CustomAttachment.CUSTOM_MSG_HEADER_COMMON_SYSTEM_MSG_V2) {
|
||||
return "[您收到一条系统消息]";
|
||||
} else if (customAttachment.getFirst() == CUSTOM_MSG_PUBLIC_CHAT_HALL) {
|
||||
switch (customAttachment.getSecond()) {
|
||||
|
@@ -130,7 +130,6 @@ public class BinderPhoneActivity extends BaseActivity implements View.OnClickLis
|
||||
etAlipayAccount.getText().toString(),
|
||||
etSmsCode.getText().toString()
|
||||
)
|
||||
.flatMap(s -> UserModel.get().updateCurrentUserInfo())
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new SingleObserver<UserInfo>() {
|
||||
@Override
|
||||
|
@@ -1,55 +1,40 @@
|
||||
package com.yizhuan.erban.ui.login;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.Editable;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ishumei.smantifraud.SmAntiFraud;
|
||||
import com.netease.mobsec.rjsb.watchman;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.tongdaxing.erban.upgrade.AppUpgradeHelper;
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.UIHelper;
|
||||
import com.yizhuan.erban.base.BaseActivity;
|
||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.base.BaseLoginAct;
|
||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||
import com.yizhuan.erban.utils.KeyBoardUtils;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.Env;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
||||
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
|
||||
import com.yizhuan.xchat_android_core.auth.exception.IsSuperAdminException;
|
||||
import com.yizhuan.xchat_android_core.auth.exception.ShowPhoneCodeException;
|
||||
import com.yizhuan.xchat_android_core.bean.LoginTipsInfo;
|
||||
import com.yizhuan.xchat_android_core.code.CodeModel;
|
||||
import com.yizhuan.xchat_android_core.code.CodeType;
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||
import com.yizhuan.xchat_android_core.market_verify.MarketVerifyModel;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_library.utils.DeviceUuidFactory;
|
||||
@@ -66,44 +51,21 @@ import java.util.Locale;
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
|
||||
/**
|
||||
* @author zhouxiangfeng
|
||||
* @date 17/2/26
|
||||
*/
|
||||
public class LoginActivity extends BaseActivity implements View.OnClickListener {
|
||||
public class LoginActivity extends BaseLoginAct implements View.OnClickListener {
|
||||
|
||||
private static final String TAG = "LoginActivity";
|
||||
|
||||
private static final String KICK_OUT = "KICK_OUT";
|
||||
|
||||
/**
|
||||
* 基本权限管理
|
||||
*/
|
||||
private final String[] BASIC_PERMISSIONS = new String[]{
|
||||
Manifest.permission.READ_PHONE_STATE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
// Manifest.permission.CAMERA,
|
||||
// Manifest.permission.RECORD_AUDIO,
|
||||
// Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
// Manifest.permission.ACCESS_FINE_LOCATION
|
||||
};
|
||||
|
||||
private EditText accountEt;
|
||||
private EditText passwordEt;
|
||||
private ImageView wxLogin;
|
||||
private ImageView qqLogin;
|
||||
private Button btnLogin;
|
||||
private TextView tvLoginTip;
|
||||
private EditText codeEditText;
|
||||
private Button getCodeButton;
|
||||
// private volatile boolean isCheckingState = false;
|
||||
|
||||
private TextView tvProtocol;
|
||||
|
||||
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
||||
private AccountValidator accountValidator = new AccountValidator();
|
||||
private SMSCodeValidator smsCodeValidator = new SMSCodeValidator();
|
||||
private CodeDownTimer timer;
|
||||
@@ -113,7 +75,6 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
checkInput();
|
||||
}
|
||||
};
|
||||
private TextView tvDesc;
|
||||
private boolean isSuperAdmin = false;
|
||||
|
||||
public static void start(Context context) {
|
||||
@@ -121,104 +82,46 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void startForResult(Activity context, int requestCode) {
|
||||
Intent intent = new Intent(context, LoginActivity.class);
|
||||
context.startActivityForResult(intent, requestCode); // startActivityForResult会导致singletop,singletask失效
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
initTitleBar("");
|
||||
onFindViews();
|
||||
onSetListener();
|
||||
permission();
|
||||
showLoginTip();
|
||||
// permission();
|
||||
// showLoginTip();
|
||||
EventBus.getDefault().register(this);
|
||||
AuthModel.get().isFromLogin = true;
|
||||
AppUpgradeHelper.checkAppUpgrade(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStatusBar() {
|
||||
// super.setStatusBar();
|
||||
StatusBarLightModes(true);
|
||||
}
|
||||
|
||||
private void permission() {
|
||||
checkPermission(() -> {
|
||||
InitialModel.get().reportBaiduAdv().subscribe();
|
||||
},
|
||||
R.string.ask_again,
|
||||
BASIC_PERMISSIONS);
|
||||
}
|
||||
|
||||
private void onFindViews() {
|
||||
accountEt = findViewById(R.id.et_account);
|
||||
passwordEt = findViewById(R.id.et_password);
|
||||
tvProtocol = (TextView) findViewById(R.id.tv_protocol);
|
||||
wxLogin = (ImageView) findViewById(R.id.img_wx_login);
|
||||
qqLogin = (ImageView) findViewById(R.id.img_qq_login);
|
||||
tvLoginTip = (TextView) findViewById(R.id.tv_login_tip);
|
||||
tvProtocol = findViewById(R.id.tv_protocol);
|
||||
wxLogin = findViewById(R.id.img_wx_login);
|
||||
qqLogin = findViewById(R.id.img_qq_login);
|
||||
tvLoginTip = findViewById(R.id.tv_login_tip);
|
||||
codeEditText = findViewById(R.id.et_code);
|
||||
getCodeButton = findViewById(R.id.btn_get_code);
|
||||
tvDesc = findViewById(R.id.tv_desc);
|
||||
|
||||
String privacyAgreementTip = context.getString(R.string.tip_privacy_agreement);
|
||||
String userAgreementTip = context.getString(R.string.tip_user_agreement);
|
||||
String privacyAgreementDescTip = context.getString(R.string.text_login_protocol, privacyAgreementTip, userAgreementTip);
|
||||
SpannableString ss = new SpannableString(privacyAgreementDescTip);
|
||||
int privacyAgreementTipIndex = privacyAgreementDescTip.indexOf(privacyAgreementTip);
|
||||
int userAgreementTipIndex = privacyAgreementDescTip.indexOf(userAgreementTip);
|
||||
|
||||
|
||||
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.design_color)), privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.design_color)) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (widget instanceof TextView)
|
||||
((TextView) widget).setHighlightColor(getResources().getColor(android.R.color.transparent));
|
||||
|
||||
CommonWebViewActivity.start(context, UriProvider.getPrivacyAgreement());
|
||||
}
|
||||
}, privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.design_color)), userAgreementTipIndex, userAgreementTipIndex + userAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.design_color)) {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
if (widget instanceof TextView)
|
||||
((TextView) widget).setHighlightColor(getResources().getColor(android.R.color.transparent));
|
||||
|
||||
CommonWebViewActivity.start(context, UriProvider.getUserProtocolUrl());
|
||||
}
|
||||
}, userAgreementTipIndex, userAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
tvProtocol.setText(ss);
|
||||
tvProtocol.setHighlightColor(Color.TRANSPARENT);
|
||||
tvProtocol.setMovementMethod(new LinkMovementMethod());
|
||||
|
||||
|
||||
// initOldAccount();
|
||||
setProtocol();
|
||||
|
||||
codeEditText.setVisibility(View.GONE);
|
||||
getCodeButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
// private void initOldAccount() {
|
||||
// String howLogin = context.getString(R.string.tip_login_how_login);
|
||||
// String content = context.getString(R.string.tip_login_old_account, context.getString(R.string.old_app_name), context.getString(R.string.app_name),howLogin);
|
||||
// SpannableString ss = new SpannableString(content);
|
||||
// int howLoginIndex = content.indexOf(howLogin);
|
||||
//
|
||||
//
|
||||
// ss.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.design_color)), howLoginIndex, howLoginIndex + howLogin.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
// ss.setSpan(new OriginalDrawStatusClickSpan() {
|
||||
// @Override
|
||||
// public void onClick(@NonNull View widget) {
|
||||
// CommonWebViewActivity.start(context, UriProvider.getPrivacyAgreement());
|
||||
// }
|
||||
// }, howLoginIndex, howLoginIndex + howLogin.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
//
|
||||
// tvDesc.setText(ss);
|
||||
// tvDesc.setMovementMethod(new LinkMovementMethod());
|
||||
// }
|
||||
|
||||
|
||||
private void onSetListener() {
|
||||
btnLogin = findViewById(R.id.btn_login);
|
||||
btnLogin.setOnClickListener(this);
|
||||
@@ -227,9 +130,6 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
findViewById(R.id.btn_forget).setOnClickListener(this);
|
||||
wxLogin.setOnClickListener(this);
|
||||
qqLogin.setOnClickListener(this);
|
||||
// tvDesc.setOnClickListener(this);
|
||||
// tvLoginTip.setOnClickListener(this);
|
||||
// tvProtocol.setOnClickListener(this);
|
||||
|
||||
accountEt.addTextChangedListener(textWatcher);
|
||||
passwordEt.addTextChangedListener(textWatcher);
|
||||
@@ -256,23 +156,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
moveTaskToBack(true);
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 易盾保护 token
|
||||
String yiDunToken = watchman.getToken(XChatConstants.YI_DUN_BUSINESS_ID);
|
||||
// 易盾保护 token 登录
|
||||
String yiDunLoginToken = watchman.getToken(XChatConstants.YI_DUN_LOGIN_BUSINESS_ID);
|
||||
// 数美天网 deviceId
|
||||
String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
||||
switch (v.getId()) {
|
||||
case R.id.btn_login:
|
||||
if (!accountValidator.isValid(accountEt.getText().toString())) {
|
||||
@@ -293,6 +178,10 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
KeyBoardUtils.hideKeyBoard(this, accountEt);
|
||||
KeyBoardUtils.hideKeyBoard(this, passwordEt);
|
||||
getDialogManager().showProgressDialog(this, "正在登录...");
|
||||
// 易盾保护 token 登录
|
||||
String yiDunLoginToken = watchman.getToken(XChatConstants.YI_DUN_LOGIN_BUSINESS_ID);
|
||||
// 数美天网 deviceId
|
||||
String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
||||
AuthModel.get().login(
|
||||
account,
|
||||
password,
|
||||
@@ -308,6 +197,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
getDialogManager().dismissDialog();
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
|
||||
@@ -331,63 +221,12 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
break;
|
||||
|
||||
case R.id.img_wx_login:
|
||||
getDialogManager().showProgressDialog(this, "请稍后");
|
||||
AuthModel.get()
|
||||
.wxLogin(yiDunToken, shuMeiDeviceId)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
getDialogManager().dismissDialog();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
getDialogManager().dismissDialog();
|
||||
dealWithLoginError(e);
|
||||
}
|
||||
});
|
||||
StatisticManager.Instance().onEvent(this,
|
||||
StatisticsProtocol.Event.EVENT_LOGIN_WX_CLICK, "点击微信登录", null);
|
||||
wxLogin();
|
||||
break;
|
||||
case R.id.img_qq_login:
|
||||
getDialogManager().showProgressDialog(this, "请稍后");
|
||||
AuthModel.get()
|
||||
.qqLogin(yiDunToken, shuMeiDeviceId)
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
getDialogManager().dismissDialog();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
getDialogManager().dismissDialog();
|
||||
dealWithLoginError(e);
|
||||
}
|
||||
});
|
||||
StatisticManager.Instance().onEvent(this,
|
||||
StatisticsProtocol.Event.EVENT_LOGIN_QQ_CLICK, "点击qq登录", null);
|
||||
// } else {
|
||||
// QQLoginSelectMemberTypeActivity.start(this);
|
||||
// }
|
||||
qqLogin();
|
||||
break;
|
||||
|
||||
// case R.id.tv_desc:
|
||||
// case R.id.tv_login_tip:
|
||||
// CommonWebViewActivity.start(this, UriProvider.JAVA_WEB_URL + XChatConstants.LOGIN_ERBAN_ACCOUNT_URL);
|
||||
// break;
|
||||
case R.id.tv_protocol:
|
||||
CommonWebViewActivity.start(this, UriProvider.getUserProtocolUrl());
|
||||
break;
|
||||
@@ -400,7 +239,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
}
|
||||
}
|
||||
|
||||
private void dealWithLoginError(Throwable e) {
|
||||
@Override
|
||||
public void dealWithLoginError(Throwable e) {
|
||||
if (!(e instanceof IsSuperAdminException)) {
|
||||
String msg = e.getMessage();
|
||||
StringBuilder eventLabel = new StringBuilder("登录注册页-登录失败");
|
||||
@@ -415,6 +255,7 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
BanAccountException exception = (BanAccountException) e;
|
||||
String text = "您的账号因" + exception.getMessage() + "被封禁\n解封时间:";
|
||||
int start = text.length();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
||||
text += simpleDateFormat.format(new Date(exception.getDate()));
|
||||
SpannableString spannableString = new SpannableString(text);
|
||||
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginActivity.this, R.color.appColor)),
|
||||
@@ -544,57 +385,10 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLoginEvent(LoginEvent event) {
|
||||
getDialogManager().dismissDialog();
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void showLoginTip() {
|
||||
MarketVerifyModel.get().loadLoginTip()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new BiConsumer<LoginTipsInfo, Throwable>() {
|
||||
@Override
|
||||
public void accept(LoginTipsInfo loginTipsInfo, Throwable throwable) throws Exception {
|
||||
if (throwable == null) {
|
||||
String tips = loginTipsInfo.getTips();
|
||||
|
||||
if (!TextUtils.isEmpty(tips)) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder(tips);
|
||||
int start = tips.indexOf("如何登录");
|
||||
|
||||
if (start > -1) {
|
||||
builder.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.color_FE4C62)), start, start + 5, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
builder.setSpan(new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
CommonWebViewActivity.start(LoginActivity.this, UriProvider.JAVA_WEB_URL + XChatConstants.LOGIN_ERBAN_ACCOUNT_URL);
|
||||
}
|
||||
}, start, start + 5, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
tvDesc.setText(builder);
|
||||
tvDesc.setHighlightColor(Color.TRANSPARENT);
|
||||
tvDesc.setMovementMethod(new LinkMovementMethod());
|
||||
|
||||
} else {
|
||||
// isCheckingState = true;
|
||||
}
|
||||
|
||||
tvLoginTip.setVisibility(loginTipsInfo.isShowWechat() || loginTipsInfo.isShowQq() ? View.VISIBLE : View.GONE);
|
||||
wxLogin.setVisibility(loginTipsInfo.isShowWechat() ? View.VISIBLE : View.GONE);
|
||||
qqLogin.setVisibility(loginTipsInfo.isShowQq() ? View.VISIBLE : View.GONE);
|
||||
|
||||
} else {
|
||||
tvLoginTip.setVisibility(View.GONE);
|
||||
wxLogin.setVisibility(View.GONE);
|
||||
qqLogin.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
View view = getCurrentFocus();
|
||||
|
@@ -10,6 +10,7 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.fourmob.datetimepicker.date.DatePickerDialog;
|
||||
@@ -24,6 +25,7 @@ import com.yizhuan.erban.base.BaseFragment;
|
||||
import com.yizhuan.erban.common.widget.CircleImageView;
|
||||
import com.yizhuan.erban.ui.login.AddUserInfoActivity;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
||||
import com.yizhuan.erban.ui.widget.ButtonItem;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.auth.entity.ThirdUserInfo;
|
||||
@@ -34,6 +36,8 @@ import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserRandomConfig;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_library.utils.StringUtils;
|
||||
import com.yizhuan.xchat_android_library.utils.TimeUtils;
|
||||
|
||||
@@ -47,6 +51,7 @@ import java.util.Map;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
/**
|
||||
* @author jack
|
||||
@@ -67,6 +72,10 @@ public class AddUserInfoFragment extends BaseFragment
|
||||
// private TextView tvGenderMen;
|
||||
// private TextView tvGenderWomen;
|
||||
|
||||
private ImageView ivRandomAvatar;
|
||||
|
||||
private TextView tvRandomNick;
|
||||
|
||||
private DatePickerDialog datePickerDialog;
|
||||
|
||||
private String avatarUrl;
|
||||
@@ -98,6 +107,10 @@ public class AddUserInfoFragment extends BaseFragment
|
||||
okBtn = view.findViewById(R.id.ok_btn);
|
||||
// tvGenderMen = view.findViewById(R.id.tv_gender_men);
|
||||
// tvGenderWomen = view.findViewById(R.id.tv_gender_women);
|
||||
ivRandomAvatar = view.findViewById(R.id.iv_random_avatar);
|
||||
tvRandomNick = view.findViewById(R.id.tv_random_nick);
|
||||
ivRandomAvatar.setVisibility(View.GONE);
|
||||
tvRandomNick.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,6 +122,8 @@ public class AddUserInfoFragment extends BaseFragment
|
||||
okBtn.setOnClickListener(this);
|
||||
// tvGenderMen.setOnClickListener(this);
|
||||
// tvGenderWomen.setOnClickListener(this);
|
||||
ivRandomAvatar.setOnClickListener(this);
|
||||
tvRandomNick.setOnClickListener(this);
|
||||
init();
|
||||
addWXUserInfo();
|
||||
}
|
||||
@@ -145,6 +160,18 @@ public class AddUserInfoFragment extends BaseFragment
|
||||
tvBirthday.setText(String.format(Locale.getDefault(), "%d-01-01", year));
|
||||
// 设置默认昵称
|
||||
tvNick.setText(R.string.text_default_nick);
|
||||
|
||||
UserModel.get().getRandomConfig()
|
||||
.compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
|
||||
.doOnSuccess(userRandomConfig -> {
|
||||
if (userRandomConfig.isAvatar()) {
|
||||
ivRandomAvatar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (userRandomConfig.isNick()) {
|
||||
tvRandomNick.setVisibility(View.VISIBLE);
|
||||
}
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -247,26 +274,54 @@ public class AddUserInfoFragment extends BaseFragment
|
||||
buttonItemList.add(localItem);
|
||||
getDialogManager().showCommonPopupDialog(buttonItemList, "取消", false);
|
||||
break;
|
||||
|
||||
case R.id.iv_random_avatar:
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_INFORMATION_RANDOM_AVATAR,
|
||||
"随机头像");
|
||||
ivRandomAvatar.setEnabled(false);
|
||||
UserModel.get().getRandomAvatar()
|
||||
.compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String avatar, String error) {
|
||||
super.accept(avatar, error);
|
||||
ivRandomAvatar.setEnabled(true);
|
||||
if (error != null) {
|
||||
toast(error);
|
||||
return;
|
||||
}
|
||||
if (!TextUtils.isEmpty(avatar)) {
|
||||
avatarUrl = avatar;
|
||||
ImageLoadUtilsV2.loadAvatar(civAvatar, avatar);
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
case R.id.tv_random_nick:
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_INFORMATION_RANDOM_NAME,
|
||||
"随机昵称");
|
||||
tvRandomNick.setEnabled(false);
|
||||
UserModel.get().getRandomNick()
|
||||
.compose(bindUntilEvent(FragmentEvent.DESTROY_VIEW))
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String nick, String error) {
|
||||
super.accept(nick, error);
|
||||
tvRandomNick.setEnabled(true);
|
||||
if (error != null) {
|
||||
toast(error);
|
||||
return;
|
||||
}
|
||||
if (!TextUtils.isEmpty(nick)) {
|
||||
tvNick.setText(nick);
|
||||
}
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
// case R.id.tv_gender_men:
|
||||
// tvGenderMen.setSelected(!tvGenderMen.isSelected());
|
||||
// if (tvGenderMen.isSelected()) {
|
||||
// gender = UserInfo.GENDER_MALE;
|
||||
// tvGenderWomen.setSelected(false);
|
||||
// } else {
|
||||
// gender = -1;
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case R.id.tv_gender_women:
|
||||
// tvGenderWomen.setSelected(!tvGenderWomen.isSelected());
|
||||
// if (tvGenderWomen.isSelected()) {
|
||||
// gender = UserInfo.GENDER_FEMALE;
|
||||
// tvGenderMen.setSelected(false);
|
||||
// } else {
|
||||
// gender = -1;
|
||||
// }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -301,6 +301,10 @@ public class ChargeActivity extends BaseActivity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
EventBus.getDefault().register(this);
|
||||
if (PayModel.get().isFirstChargeSuccess()) {
|
||||
PayModel.get().setFirstChargeSuccess(false);
|
||||
onRefreshing();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -311,10 +315,20 @@ public class ChargeActivity extends BaseActivity {
|
||||
|
||||
public void onGetChargeList(List<ChargeBean> chargeBeanList) {
|
||||
if (chargeBeanList != null && chargeBeanList.size() > 0) {
|
||||
//先判断存不存在1元档位
|
||||
boolean isExistOneYuan = false;
|
||||
for (int i = 0; i < chargeBeanList.size(); i++) {
|
||||
ChargeBean chargeBean = chargeBeanList.get(i);
|
||||
chargeBean.isSelected = chargeBean.getMoney() == 48;
|
||||
if (48 == chargeBean.getMoney()) {
|
||||
if (chargeBean.getMoney() == 1) {
|
||||
isExistOneYuan = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int selectedMoney = isExistOneYuan ? 1 : 48;
|
||||
for (int i = 0; i < chargeBeanList.size(); i++) {
|
||||
ChargeBean chargeBean = chargeBeanList.get(i);
|
||||
chargeBean.isSelected = chargeBean.getMoney() == selectedMoney;
|
||||
if (selectedMoney == chargeBean.getMoney()) {
|
||||
mSelectChargeBean = chargeBean;
|
||||
}
|
||||
}
|
||||
@@ -444,6 +458,10 @@ public class ChargeActivity extends BaseActivity {
|
||||
disposeCompositeDisposable();
|
||||
if (stringServiceResult != null) {
|
||||
toast(stringServiceResult.getMessage());
|
||||
if (stringServiceResult.getCode() == ServiceResult.SC_SUCCESS) {
|
||||
PayModel.get().setFirstChargeSuccess(false);
|
||||
onRefreshing();
|
||||
}
|
||||
}
|
||||
}, throwable -> {
|
||||
throwable.printStackTrace();
|
||||
|
@@ -42,6 +42,10 @@ public class ChargeAdapter extends BaseQuickAdapter<ChargeBean, BaseViewHolder>
|
||||
tv_money_gold.setTextColor(mContext.getResources().getColor(R.color.color_999999));
|
||||
cb_money.setTextColor(mContext.getResources().getColor(R.color.color_999999));
|
||||
}
|
||||
|
||||
//跟iOS逻辑一致,如果1元则显示首充的icon
|
||||
baseViewHolder.setGone(R.id.iv_first_recharge, chargeBean.getMoney() == 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -236,6 +236,8 @@ public class SearchActivity extends BaseMvpActivity<ISearchView, SearchPresenter
|
||||
if (position >= 0 && position < list.size()) {
|
||||
String record = list.get(position);
|
||||
searchEdit.setText(record);
|
||||
|
||||
toSearch();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package com.yizhuan.erban.ui.setting;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
@@ -20,6 +22,11 @@ public class FeedbackActivity extends BaseActivity {
|
||||
private EditText edtContact;
|
||||
private Button btnCommit;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent intent = new Intent(context, FeedbackActivity.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@@ -7,14 +7,20 @@ import android.text.InputFilter;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.trello.rxlifecycle2.android.ActivityEvent;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.UIHelper;
|
||||
import com.yizhuan.erban.base.BaseBindingActivity;
|
||||
import com.yizhuan.erban.databinding.ActivityModifyPwdBinding;
|
||||
import com.yizhuan.erban.ui.login.CodeDownTimer;
|
||||
import com.yizhuan.erban.ui.login.PasswordValidator;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.code.CodeModel;
|
||||
import com.yizhuan.xchat_android_core.code.CodeType;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.BeanObserver;
|
||||
import com.yizhuan.xchat_android_core.utils.net.DontWarnObserver;
|
||||
import com.yizhuan.xchat_android_library.annatation.ActLayoutRes;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
@@ -31,6 +37,12 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
||||
private int type;
|
||||
|
||||
private PasswordValidator passwordValidator = new PasswordValidator();
|
||||
/**
|
||||
* 是否是首次设置支付密码
|
||||
*/
|
||||
private boolean isFirstSetPayPwd = false;
|
||||
|
||||
private CodeDownTimer timer;
|
||||
|
||||
public static void start(Context context, int type) {
|
||||
Intent intent = new Intent(context, ModifyPwdActivity.class);
|
||||
@@ -40,9 +52,15 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
mBinding.containerCode.setVisibility(View.GONE);
|
||||
mBinding.tvCodeTips.setVisibility(View.GONE);
|
||||
type = getIntent().getIntExtra("type", 1);
|
||||
if (type == PAY_PWD && !UserModel.get().getCacheLoginUserInfo().isBindPaymentPwd()) {
|
||||
type = FOGERT_PAY_PWD;
|
||||
isFirstSetPayPwd = true;
|
||||
mBinding.containerCode.setVisibility(View.VISIBLE);
|
||||
mBinding.tvCodeTips.setVisibility(View.VISIBLE);
|
||||
mBinding.tvCodeTips.setText("");
|
||||
}
|
||||
if (type == LOGIN_PWD) {
|
||||
if (UserModel.get().getCacheLoginUserInfo().isBindPasswd()) {
|
||||
@@ -115,10 +133,12 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
||||
}
|
||||
|
||||
private void setEditStyle() {
|
||||
mBinding.edCurrentPwd.setIntegerType();
|
||||
mBinding.edPwd.setIntegerType();
|
||||
mBinding.edSurePwd.setIntegerType();
|
||||
mBinding.edPwd.getEditText().setFilters(new InputFilter[]{new InputFilter.LengthFilter(6)});
|
||||
mBinding.edSurePwd.getEditText().setFilters(new InputFilter[]{new InputFilter.LengthFilter(6)});
|
||||
mBinding.edCurrentPwd.setPay(true);
|
||||
mBinding.edPwd.setPay(true);
|
||||
mBinding.edSurePwd.setPay(true);
|
||||
}
|
||||
@@ -137,6 +157,41 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
||||
UIHelper.showForgetPswAct(ModifyPwdActivity.this);
|
||||
}
|
||||
break;
|
||||
case R.id.btn_get_code:
|
||||
mBinding.tvCodeTips.setText("");
|
||||
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (userInfo == null || TextUtils.isEmpty(userInfo.getPhone())) {
|
||||
return;
|
||||
}
|
||||
mBinding.btnGetCode.setClickable(false);
|
||||
CodeModel.get().sendCode(userInfo.getPhone(), CodeType.RESET_PAY_PSW)
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String s, String error) {
|
||||
super.accept(s, error);
|
||||
if (error != null) {
|
||||
mBinding.btnGetCode.setClickable(true);
|
||||
return;
|
||||
}
|
||||
mBinding.tvCodeTips.setText(getString(R.string.send_code_success_tips, userInfo.getPhone()));
|
||||
startCountDownTimer();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void startCountDownTimer() {
|
||||
stopCountDownTimer();
|
||||
timer = new CodeDownTimer(mBinding.btnGetCode, 60000, 1000);
|
||||
timer.start();
|
||||
}
|
||||
|
||||
private void stopCountDownTimer() {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +210,10 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
||||
toast("密码长度必须为6位");
|
||||
return;
|
||||
}
|
||||
if (isFirstSetPayPwd && TextUtils.isEmpty(mBinding.etCodePayPwd.getText())) {
|
||||
toast("请先输入验证码");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!passwordValidator.isValid(mBinding.edPwd.getText())) {
|
||||
toast(passwordValidator.getErrorMessage());
|
||||
@@ -212,7 +271,8 @@ public class ModifyPwdActivity extends BaseBindingActivity<ActivityModifyPwdBind
|
||||
});
|
||||
} else if (type == FOGERT_PAY_PWD || type == RESET_PAY_PWD) {
|
||||
getDialogManager().showProgressDialog(ModifyPwdActivity.this, "处理中...");
|
||||
UserModel.get().setPayPwd(mBinding.edPwd.getText())
|
||||
String code = isFirstSetPayPwd ? mBinding.etCodePayPwd.getText().toString() : null;
|
||||
UserModel.get().setPayPwd(mBinding.edPwd.getText(), code)
|
||||
.subscribe(new BeanObserver<String>() {
|
||||
@Override
|
||||
public void onErrorMsg(String error) {
|
||||
|
@@ -40,9 +40,11 @@ public class NoticeSettingActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private View systemNoticeView;
|
||||
|
||||
private TutuSwitchView switchSystemNotice;
|
||||
|
||||
private View communityNoticeView;
|
||||
private TutuSwitchView switchCommunityNotice;
|
||||
|
||||
private UserInfo.Location userExpand;
|
||||
|
||||
@Override
|
||||
@@ -97,6 +99,38 @@ public class NoticeSettingActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
if (communityNoticeView == null) {
|
||||
communityNoticeView = LayoutInflater.from(context).inflate(R.layout.item_system_notice, null);
|
||||
switchCommunityNotice = communityNoticeView.findViewById(R.id.switch_notice);
|
||||
llContainer.addView(communityNoticeView, new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
getResources().getDimensionPixelOffset(R.dimen.dp_setting_sys_notice_item_height))
|
||||
);
|
||||
setName(communityNoticeView, "互动通知");
|
||||
setDesc(communityNoticeView, "关闭后,收到动态互动消息不再提示");
|
||||
}
|
||||
switchCommunityNotice.setOn(userExpand.isInteractiveMsgNotify());
|
||||
|
||||
switchCommunityNotice.setOnSwitchStateChangeListener(new IOSSwitchView.OnSwitchStateChangeListener() {
|
||||
@Override
|
||||
public void onStateSwitched(boolean isOn) {
|
||||
SettingsModel.get().interactiveMsgNotify(isOn)
|
||||
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||
.subscribe(new DontWarnObserver<String>() {
|
||||
@Override
|
||||
public void accept(String s, String error) {
|
||||
super.accept(s, error);
|
||||
if (error == null) {
|
||||
userExpand.setInteractiveMsgNotify(isOn);
|
||||
} else {
|
||||
toast(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setName(View targetView, String name) {
|
||||
|
@@ -143,6 +143,9 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
private TextView sendMsgLayout;
|
||||
private TextView attentionLayout;
|
||||
|
||||
private ImageView ivOfficialMask;
|
||||
private TextView tvOfficialMask;
|
||||
|
||||
UserInfoFragment mUserInfoFragment;
|
||||
UserInfoGiftGroupFrg mUserInfoGiftGroupFrg;
|
||||
UserInfoCarFragment mUserInfoCarFragment;
|
||||
@@ -306,6 +309,11 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
if (mBinding.inOfficialMask != null) {
|
||||
ivOfficialMask = mBinding.inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
tvOfficialMask = mBinding.inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
}
|
||||
}
|
||||
|
||||
private void setEditButton(int identityState, boolean isExpanded) {
|
||||
@@ -469,21 +477,21 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
mBinding.tvConstellation.setText(star);
|
||||
mBinding.tvConstellation.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (userInfo.getUserInfoSkillVo() != null) {
|
||||
mBinding.iv101.setVisibility(userInfo.getUserInfoSkillVo().isLiveTag() ? View.VISIBLE : View.GONE);
|
||||
if (!TextUtils.isEmpty(userInfo.getUserInfoSkillVo().getSkillTag())) {
|
||||
ImageLoadUtils.loadImage(this, userInfo.getUserInfoSkillVo().getSkillTag(), mBinding.ivTag);
|
||||
mBinding.ivTag.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.ivTag.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
mBinding.tvErbanId.setText(getString(R.string.me_user_id, userInfo.getErbanNo()));
|
||||
setUserLevel(userInfo.getUserLevelVo());
|
||||
|
||||
if (userInfo.getNameplate() != null) {
|
||||
setOfficialMask(userInfo.getNameplate().getFixedWord(), userInfo.getNameplate().getIconPic());
|
||||
} else {
|
||||
setOfficialMask("", "");
|
||||
}
|
||||
|
||||
NobleInfo nobleInfo = userInfo.getNobleInfo();
|
||||
HeadWearInfo headWearInfo = userInfo.getUserHeadwear();
|
||||
if (nobleInfo != null) {
|
||||
if (!TextUtils.isEmpty(userInfo.getAttestationBackPic())) {
|
||||
ImageLoadUtils.loadImage(this, userInfo.getAttestationBackPic(), mBinding.avatarBg);
|
||||
|
||||
} else if (nobleInfo != null) {
|
||||
setBgByLevel(true);
|
||||
String zoneBg = nobleInfo.getZoneBg();
|
||||
if (TextUtils.isEmpty(zoneBg)) {
|
||||
@@ -887,6 +895,20 @@ public class UserInfoActivity extends BaseBindingActivity<ActivityUserInfoBindin
|
||||
}
|
||||
}
|
||||
|
||||
private void setOfficialMask(String name, String icon) {
|
||||
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(icon)) {
|
||||
mBinding.inOfficialMask.setVisibility(View.VISIBLE);
|
||||
|
||||
if (tvOfficialMask != null && ivOfficialMask != null) {
|
||||
tvOfficialMask.setText(name);
|
||||
NobleUtil.loadResource(icon, ivOfficialMask);
|
||||
}
|
||||
|
||||
} else {
|
||||
mBinding.inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* static静态代码
|
||||
*/
|
||||
|
@@ -7,7 +7,6 @@ import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -25,7 +24,6 @@ import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.family.view.activity.FamilyHomeActivity;
|
||||
import com.yizhuan.erban.module_hall.team.activity.HallTeamMessageActivity;
|
||||
import com.yizhuan.erban.ui.user.adapter.UserDesAdapter;
|
||||
import com.yizhuan.erban.ui.user.dialog.LiveTagDialog;
|
||||
import com.yizhuan.xchat_android_core.audio.AudioModel;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.UserInfoItem;
|
||||
@@ -41,7 +39,6 @@ import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
import com.yizhuan.xchat_android_core.user.UserModel;
|
||||
import com.yizhuan.xchat_android_core.user.bean.JoinWorldInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.LiveTagInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserGameInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.UserInfo;
|
||||
import com.yizhuan.xchat_android_core.user.event.LoginUserInfoUpdateEvent;
|
||||
@@ -128,10 +125,6 @@ public class UserInfoFragment extends BaseFragment implements View.OnClickListen
|
||||
} else if (userInfoItem.getItemType() == UserInfoItem.TYPE_DES_HALL) {
|
||||
OwnerHallInfo ownerHallInfo = (OwnerHallInfo) userInfoItem.getData();
|
||||
hallOption(view, ownerHallInfo);
|
||||
|
||||
} else if (userInfoItem.getItemType() == UserInfoItem.TYPE_DES_TAG) {
|
||||
tagOption(view);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -178,11 +171,6 @@ public class UserInfoFragment extends BaseFragment implements View.OnClickListen
|
||||
UserInfoItem GameItem = new UserInfoItem(UserInfoItem.TYPE_NONE);
|
||||
GameItem.setTag(UserInfoItem.TYPE_DES_GAME);
|
||||
mList.add(GameItem);
|
||||
|
||||
// 认证标签
|
||||
UserInfoItem tagItem = new UserInfoItem(UserInfoItem.TYPE_NONE);
|
||||
tagItem.setTag(UserInfoItem.TYPE_DES_TAG);
|
||||
mList.add(tagItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,8 +188,10 @@ public class UserInfoFragment extends BaseFragment implements View.OnClickListen
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
unbinder.unbind();
|
||||
super.onDestroyView();
|
||||
if (unbinder != null) {
|
||||
unbinder.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -278,12 +268,6 @@ public class UserInfoFragment extends BaseFragment implements View.OnClickListen
|
||||
|
||||
initJoinWorlds(userInfo.getJoinWorlds());
|
||||
|
||||
// 判断是否隐藏 认证标签 item
|
||||
if (userInfo.getUserInfoSkillVo() != null && !ListUtils.isListEmpty(userInfo.getUserInfoSkillVo().getLiveSkillVoList())) {
|
||||
setUserInfoItem((ArrayList<LiveTagInfo.LiveSkillVoListBean>) userInfo.getUserInfoSkillVo().getLiveSkillVoList(),
|
||||
UserInfoItem.TYPE_DES_TAG, false);
|
||||
}
|
||||
|
||||
mUserDesAdapter.setUserInfo(userInfo);
|
||||
//设置家族
|
||||
if (FamilyInfo.NO_FAMILY_ID.equals(userInfo.getFamilyId()) || TextUtils.isEmpty(userInfo.getFamilyId())
|
||||
@@ -582,16 +566,6 @@ public class UserInfoFragment extends BaseFragment implements View.OnClickListen
|
||||
return mView;
|
||||
}
|
||||
|
||||
private void tagOption(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.tv_edit:
|
||||
LiveTagDialog liveTagDialog = new LiveTagDialog(getActivity(), userInfo.getUserInfoSkillVo().getLiveSkillVoList());
|
||||
liveTagDialog.openDialog();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
@@ -62,7 +62,6 @@ public class UserDesAdapter extends UserTabBaseAdapter implements UserPhotoAdapt
|
||||
addItemType(UserInfoItem.TYPE_DES_HALL, R.layout.include_user_module_hall);
|
||||
addItemType(UserInfoItem.TYPE_DES_GAME, R.layout.layout_desc_game);
|
||||
addItemType(UserInfoItem.TYPE_DES_JOIN_WORLDS, R.layout.layout_user_join_worlds);
|
||||
addItemType(UserInfoItem.TYPE_DES_TAG, R.layout.layout_desc_tag);
|
||||
}
|
||||
|
||||
public void setPlaying(boolean playing) {
|
||||
@@ -101,10 +100,6 @@ public class UserDesAdapter extends UserTabBaseAdapter implements UserPhotoAdapt
|
||||
setGame(helper, item);
|
||||
break;
|
||||
|
||||
case UserInfoItem.TYPE_DES_TAG:
|
||||
setTag(helper, item);
|
||||
break;
|
||||
|
||||
case UserInfoItem.TYPE_DES_JOIN_WORLDS:
|
||||
setJoinWorlds(helper, item);
|
||||
break;
|
||||
@@ -113,36 +108,6 @@ public class UserDesAdapter extends UserTabBaseAdapter implements UserPhotoAdapt
|
||||
|
||||
}
|
||||
|
||||
private LinearLayoutManager tagManager;
|
||||
|
||||
private void setTag(BaseViewHolder helper, UserInfoItem item) {
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
ArrayList<LiveTagInfo.LiveSkillVoListBean> liveSkillVoListBeans = (ArrayList<LiveTagInfo.LiveSkillVoListBean>) item.getData();
|
||||
if (liveSkillVoListBeans == null)
|
||||
return;
|
||||
|
||||
RecyclerView rvTag = helper.itemView.findViewById(R.id.rv_tag);
|
||||
if (rvTag == null)
|
||||
return;
|
||||
|
||||
if (tagManager == null)
|
||||
tagManager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false);
|
||||
rvTag.setLayoutManager(tagManager);
|
||||
|
||||
BaseAdapter<LiveTagInfo.LiveSkillVoListBean> liveTagAdapter = new BaseAdapter(R.layout.item_live_tag, BR.tagInfo);
|
||||
rvTag.setAdapter(liveTagAdapter);
|
||||
|
||||
helper.setGone(R.id.rv_tag, true);
|
||||
helper.setGone(R.id.ll_tag, true);
|
||||
liveTagAdapter.setNewData(liveSkillVoListBeans);
|
||||
|
||||
helper.setGone(R.id.tv_edit, isOwner());
|
||||
helper.addOnClickListener(R.id.tv_edit);
|
||||
|
||||
}
|
||||
|
||||
private LinearLayoutManager gameManager;
|
||||
|
||||
private void setGame(BaseViewHolder helper, UserInfoItem item) {
|
||||
|
@@ -72,6 +72,7 @@ import com.yizhuan.xchat_android_core.manager.IMNetEaseManager;
|
||||
import com.yizhuan.xchat_android_core.manager.RoomEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.PayModel;
|
||||
import com.yizhuan.xchat_android_core.pay.bean.WalletInfo;
|
||||
import com.yizhuan.xchat_android_core.pay.event.FirstRechargeEvent;
|
||||
import com.yizhuan.xchat_android_core.pay.event.UpdateWalletInfoEvent;
|
||||
import com.yizhuan.xchat_android_core.radish.RadishModel;
|
||||
import com.yizhuan.xchat_android_core.radish.RadishWalletInfo;
|
||||
@@ -107,6 +108,7 @@ import io.reactivex.Single;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
/**
|
||||
@@ -138,6 +140,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
private TextView giftNumberText;
|
||||
private ImageView giftNumberOptions;
|
||||
private ImageView ivOpenNoble;
|
||||
private View ivFirstRecharge;
|
||||
private EditText etSendMessage;
|
||||
private Button sendGiftButton;
|
||||
private View layoutEmpty;
|
||||
@@ -387,15 +390,11 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
// 更新所有礼物
|
||||
updateGiftView(giftIndicator.getCurrrentType());
|
||||
goldWalletInfo = PayModel.get().getCurrentWalletInfo();
|
||||
// 如果自己是贵族,则不需要显示开通贵族的入口
|
||||
UserInfo myUserInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (myUserInfo != null) {
|
||||
if (myUserInfo.getNobleInfo() != null && myUserInfo.getNobleInfo().getLevel() > 0) {
|
||||
ivOpenNoble.setVisibility(View.GONE);
|
||||
} else {
|
||||
ivOpenNoble.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
ivFirstRecharge = root.findViewById(R.id.iv_first_recharge);
|
||||
ivFirstRecharge.setOnClickListener(this);
|
||||
//首充逻辑
|
||||
updateFirstRechargeStatus();
|
||||
|
||||
View descLayout = root.findViewById(R.id.desc_layout);
|
||||
|
||||
@@ -470,6 +469,35 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
};
|
||||
RadishWalletManager.get().getLdRadishNumber().observeForever(radishObserver);
|
||||
RadishModel.get().updateRadishWallet().subscribe();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 首充逻辑 有首充则优先显示首充,没有则走贵族的逻辑
|
||||
*/
|
||||
private void updateFirstRechargeStatus() {
|
||||
|
||||
ivFirstRecharge.setVisibility(View.GONE);
|
||||
ivOpenNoble.setVisibility(View.GONE);
|
||||
|
||||
Disposable isFirstChargeDis = PayModel.get().isFirstCharge()
|
||||
.compose(RxHelper.bindContext(context))
|
||||
.subscribe((aBoolean, throwable) -> {
|
||||
if (aBoolean != null && aBoolean) {
|
||||
ivFirstRecharge.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
// 如果自己是贵族,则不需要显示开通贵族的入口
|
||||
UserInfo myUserInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (myUserInfo != null) {
|
||||
if (myUserInfo.getNobleInfo() != null && myUserInfo.getNobleInfo().getLevel() > 0) {
|
||||
ivOpenNoble.setVisibility(View.GONE);
|
||||
} else {
|
||||
ivOpenNoble.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
compositeDisposable.add(isFirstChargeDis);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -1112,6 +1140,12 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
CommonWebViewActivity.start(context, UriProvider.getNobleIntro() + query);
|
||||
break;
|
||||
|
||||
case R.id.iv_first_recharge:
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_ROOM_GIFT_ONEYUAN_ENTRANCE,
|
||||
"礼物面板_一元首充-区分-" + GIFT_DIALOG_FROM);
|
||||
ChargeActivity.start(context);
|
||||
break;
|
||||
|
||||
case R.id.tv_reload:
|
||||
reloadData();
|
||||
break;
|
||||
@@ -1319,6 +1353,11 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onFirstRechargeEvent(FirstRechargeEvent event) {
|
||||
updateFirstRechargeStatus();
|
||||
}
|
||||
|
||||
private void onGiftOutOfDate(String message) {
|
||||
((BaseActivity) getContext()).toast(message);
|
||||
}
|
||||
|
@@ -127,8 +127,8 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
private TextView tvFamilyNameLabel;
|
||||
private TextView tvFamilyName;
|
||||
private FlexboxLayout flexbox;
|
||||
private ImageView iv101;
|
||||
private ImageView ivTag;
|
||||
|
||||
private View inOfficialMask;
|
||||
|
||||
private long myUid;
|
||||
private Disposable subscribe;
|
||||
@@ -184,6 +184,8 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
//ivTopBg = findViewById(R.id.iv_top_bg);
|
||||
flexbox = findViewById(R.id.flexbox);
|
||||
|
||||
inOfficialMask = findViewById(R.id.in_official_mask);
|
||||
|
||||
ivAvatarHeadWear = findViewById(R.id.iv_avatar_head_wear);
|
||||
ivBadge = findViewById(R.id.iv_badge);
|
||||
ivBadge.setVisibility(View.GONE);
|
||||
@@ -196,8 +198,6 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
llFamily = (LinearLayout) findViewById(R.id.ll_family);
|
||||
tvFamilyNameLabel = (TextView) findViewById(R.id.tv_family_name_label);
|
||||
tvFamilyName = (TextView) findViewById(R.id.tv_family_name);
|
||||
iv101 = findViewById(R.id.iv_101);
|
||||
ivTag = findViewById(R.id.iv_tag);
|
||||
|
||||
avatarLayout.setOnClickListener(this);
|
||||
closeImage.setOnClickListener(this);
|
||||
@@ -469,16 +469,16 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
ImageLoadUtils.loadImage(context, userLevelVo.getCharmUrl(), mIvUserCharm);
|
||||
}
|
||||
}
|
||||
if (userInfo.getUserInfoSkillVo() != null) {
|
||||
iv101.setVisibility(userInfo.getUserInfoSkillVo().isLiveTag() ? View.VISIBLE : View.GONE);
|
||||
if (!TextUtils.isEmpty(userInfo.getUserInfoSkillVo().getSkillTag())) {
|
||||
ImageLoadUtils.loadImage(context, userInfo.getUserInfoSkillVo().getSkillTag(), ivTag);
|
||||
ivTag.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
// 改变贵族
|
||||
updateNobleView();
|
||||
|
||||
UserInfo.NamePlate namePlate = userInfo.getNameplate();
|
||||
if (namePlate != null) {
|
||||
setOfficialMask(namePlate.getFixedWord(), namePlate.getIconPic());
|
||||
} else {
|
||||
setOfficialMask(null, null);
|
||||
}
|
||||
|
||||
if (null != findHimView) {
|
||||
//获取用户房间信息
|
||||
AvRoomModel.get().getUserRoom(userInfo.getUid())
|
||||
@@ -527,6 +527,27 @@ public class UserInfoDialog extends AppCompatDialog implements View.OnClickListe
|
||||
}
|
||||
}
|
||||
|
||||
private void setOfficialMask(String name, String icon) {
|
||||
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(icon)) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
TextView tvOfficialMask;
|
||||
tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
if (tvOfficialMask != null) {
|
||||
tvOfficialMask.setText(name);
|
||||
}
|
||||
|
||||
ImageView ivOfficialMask;
|
||||
ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
if (ivOfficialMask != null) {
|
||||
NobleUtil.loadResource(icon, ivOfficialMask);
|
||||
}
|
||||
|
||||
} else {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSimpleFamilyInfo(String familyId) {
|
||||
FamilyModel.Instance().loadFamilySimpleInfo(
|
||||
familyId
|
||||
|
@@ -125,4 +125,30 @@ public class Utils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getScreenPxWidth(Context context) {
|
||||
WindowManager wm = (WindowManager) context
|
||||
.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
wm.getDefaultDisplay().getMetrics(outMetrics);
|
||||
return outMetrics.widthPixels;
|
||||
}
|
||||
|
||||
public static int getScreenDpWidth(Context context) {
|
||||
int pxWidth = getScreenPxWidth(context);
|
||||
return (int) px2dip(context, pxWidth);
|
||||
}
|
||||
|
||||
public static int getScreenPxHeight(Context context) {
|
||||
WindowManager wm = (WindowManager) context
|
||||
.getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics outMetrics = new DisplayMetrics();
|
||||
wm.getDefaultDisplay().getMetrics(outMetrics);
|
||||
return outMetrics.heightPixels;
|
||||
}
|
||||
|
||||
public static int getScreenDpHeight(Context context) {
|
||||
int pxHeight = getScreenPxHeight(context);
|
||||
return (int) px2dip(context, pxHeight);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,125 @@
|
||||
package com.yizhuan.erban.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.support.v4.app.NotificationManagerCompat;
|
||||
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.yizhuan.xchat_android_library.utils.SingleToastUtil;
|
||||
|
||||
/**
|
||||
* 通知栏监测工具
|
||||
* Created by lvzebiao on 2020/3/16.
|
||||
*/
|
||||
public class NotificationsUtils {
|
||||
|
||||
public static boolean isNotificationEnabled(Context context) {
|
||||
return NotificationManagerCompat.from(context.getApplicationContext()).areNotificationsEnabled();
|
||||
}
|
||||
|
||||
private static boolean miuiOpen(Activity activity) {
|
||||
try {
|
||||
if (OSUtils.isMIUI()) {
|
||||
Intent intent = new Intent();
|
||||
ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.Settings$NotificationFilterActivity");
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("appName", activity.getResources().getString(activity.getApplicationInfo().labelRes));
|
||||
bundle.putString("packageName", activity.getPackageName());
|
||||
bundle.putString(":android:show_fragment", "NotificationAccessSettings");
|
||||
intent.putExtras(bundle);
|
||||
intent.setComponent(cn);
|
||||
activity.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void openPush(Activity activity) {
|
||||
try {
|
||||
if (miuiOpen(activity)) {
|
||||
//如果是MIUI系统,能成功跳转,则用MIUI跳转,否则走官方方法
|
||||
return;
|
||||
}
|
||||
|
||||
Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
//这种方案适用于 API 26, 即8.0(含8.0)以上可以用
|
||||
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, activity.getPackageName());
|
||||
intent.putExtra(Settings.EXTRA_CHANNEL_ID, activity.getApplicationInfo().uid);
|
||||
activity.startActivity(intent);
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
|
||||
intent.putExtra("app_package", activity.getPackageName());
|
||||
intent.putExtra("app_uid", activity.getApplicationInfo().uid);
|
||||
activity.startActivity(intent);
|
||||
} else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
intent.setData(Uri.parse("package:" + activity.getPackageName()));
|
||||
activity.startActivity(intent);
|
||||
} else {
|
||||
toPermissionSetting(activity);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
String log = "请去应用设置界面开启";
|
||||
SingleToastUtil.showToast(log);
|
||||
LogUtil.e("跳转通知栏页面失败:" + log);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到权限设置
|
||||
*
|
||||
* @param activity
|
||||
*/
|
||||
public static void toPermissionSetting(Activity activity) {
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
toSystemConfig(activity);
|
||||
} else {
|
||||
try {
|
||||
toApplicationInfo(activity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
toSystemConfig(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用信息界面
|
||||
*
|
||||
* @param activity
|
||||
*/
|
||||
public static void toApplicationInfo(Activity activity) {
|
||||
Intent localIntent = new Intent();
|
||||
localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
localIntent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
localIntent.setData(Uri.fromParts("package", activity.getPackageName(), null));
|
||||
activity.startActivity(localIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统设置界面
|
||||
*
|
||||
* @param activity
|
||||
*/
|
||||
public static void toSystemConfig(Activity activity) {
|
||||
try {
|
||||
Intent intent = new Intent(Settings.ACTION_SETTINGS);
|
||||
activity.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
62
app/src/main/java/com/yizhuan/erban/utils/OSUtils.java
Normal file
@@ -0,0 +1,62 @@
|
||||
package com.yizhuan.erban.utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class OSUtils {
|
||||
//小米
|
||||
private static final String KEY_MIUI_VERSION_NANE = "ro.miui.ui.version.name"; // "V8"
|
||||
private static final String KEY_MIUI_VERSION_CODE = "ro.miui.ui.version.code";
|
||||
//vivo
|
||||
private static final String KEY_FUNTOUCHOS_OS_NAME = "ro.vivo.os.name"; // "Funtouch"
|
||||
private static final String KEY_FUNTOUCHOS_OS_VERSION = "ro.vivo.os.version"; // "3.0"
|
||||
private static final String KEY_FUNTOUCHOS_DISPLAY_ID = "ro.vivo.os.build.display.id"; // "FuntouchOS_3.0"
|
||||
|
||||
public static boolean isMIUI() {
|
||||
return hasBuildPropertie(KEY_MIUI_VERSION_NANE) || hasBuildPropertie(KEY_MIUI_VERSION_CODE);
|
||||
}
|
||||
|
||||
public static boolean isFuntouchOS() {
|
||||
return hasBuildPropertie(KEY_FUNTOUCHOS_OS_NAME) || hasBuildPropertie(KEY_FUNTOUCHOS_OS_VERSION)
|
||||
|| hasBuildPropertie(KEY_FUNTOUCHOS_DISPLAY_ID);
|
||||
}
|
||||
|
||||
public static String getMIUIName() {
|
||||
return getSystemProperty(KEY_MIUI_VERSION_NANE);
|
||||
}
|
||||
|
||||
public static boolean hasBuildPropertie(String propName) {
|
||||
return !TextUtils.isEmpty(getSystemProperty(propName));
|
||||
}
|
||||
|
||||
public static String getSystemProperty(String propName) {
|
||||
String line;
|
||||
BufferedReader input = null;
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec("getprop " + propName);
|
||||
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
|
||||
line = input.readLine();
|
||||
input.close();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
} finally {
|
||||
if (input != null) {
|
||||
try {
|
||||
input.close();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
package com.yizhuan.erban.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.netease.nimlib.sdk.StatusBarNotificationConfig;
|
||||
import com.netease.nimlib.sdk.mixpush.MixPushMessageHandler;
|
||||
import com.yizhuan.xchat_android_core.DemoCache;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
public class PushMessageHandler implements MixPushMessageHandler {
|
||||
private static final String TAG = "mix_push";
|
||||
public static final String PAYLOAD_SESSION_ID = "sessionID";
|
||||
public static final String PAYLOAD_SESSION_TYPE = "sessionType";
|
||||
public static final String PAYLOAD_DATA = "payload_data";
|
||||
|
||||
@Override
|
||||
public boolean onNotificationClicked(Context context, Map<String, String> payload) {
|
||||
Log.i(TAG, "rev pushMessage payload " + payload);
|
||||
|
||||
String sessionId = payload.get(PAYLOAD_SESSION_ID);
|
||||
String type = payload.get(PAYLOAD_SESSION_TYPE);
|
||||
|
||||
String skiptype = payload.get("skiptype");
|
||||
if (!TextUtils.isEmpty(skiptype) && CustomAttachment.CUSTOM_MSG_HEADER_TYPE_WORLD_DYNAMIC == Integer.valueOf(skiptype)) {
|
||||
Log.i(TAG, "second");
|
||||
Intent notifyIntent = new Intent();
|
||||
notifyIntent.setComponent(initLaunchComponent(context));
|
||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
notifyIntent.setAction(Intent.ACTION_VIEW);
|
||||
notifyIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // 必须
|
||||
notifyIntent.putExtra(PAYLOAD_DATA, (Serializable) payload);
|
||||
|
||||
context.startActivity(notifyIntent);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
Log.i(TAG, "rev pushMessage payload false");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private ComponentName initLaunchComponent(Context context) {
|
||||
ComponentName launchComponent;
|
||||
StatusBarNotificationConfig config = DemoCache.getNotificationConfig();
|
||||
Class<? extends Activity> entrance = config.notificationEntrance;
|
||||
if (entrance == null) {
|
||||
launchComponent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()).getComponent();
|
||||
} else {
|
||||
launchComponent = new ComponentName(context, entrance);
|
||||
}
|
||||
return launchComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cleanMixPushNotifications(int pushType) {
|
||||
return false;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 708 B After Width: | Height: | Size: 582 B |
Before Width: | Height: | Size: 614 B After Width: | Height: | Size: 810 B |
BIN
app/src/main/res/drawable-xhdpi/ic_temp_official_mask.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_first_recharge.webp
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_oneyuan_gift.webp
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_room_attent.webp
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/drawable-xhdpi/icon_room_attent_gray.webp
Normal file
After Width: | Height: | Size: 974 B |
BIN
app/src/main/res/drawable-xhdpi/icon_room_welcome.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/switch_random_avatar.webp
Normal file
After Width: | Height: | Size: 1.1 KiB |
@@ -6,6 +6,14 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<com.yizhuan.erban.base.TitleBar
|
||||
android:id="@+id/title_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
<com.yizhuan.erban.ui.widget.SuperEditText
|
||||
android:id="@+id/ed_current_pwd"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hint_color="@color/color_CACACB"
|
||||
@@ -34,7 +33,6 @@
|
||||
android:id="@+id/ed_pwd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
app:hint_color="@color/color_CACACB"
|
||||
app:text_color="@color/color_333333"
|
||||
app:title_hint="新密码"
|
||||
@@ -44,11 +42,67 @@
|
||||
android:id="@+id/ed_sure_pwd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
app:hint_color="@color/color_CACACB"
|
||||
app:text_color="@color/color_333333"
|
||||
app:title_hint="确认密码"
|
||||
app:hint="再次确认新的登录密码"/>
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:id="@+id/container_code"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/et_code_pay_pwd"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start|center_vertical"
|
||||
android:inputType="number"
|
||||
android:paddingBottom="20dp"
|
||||
android:hint="@string/hint_require_code"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textColorHint="@color/color_b3b3b3"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:layout_marginStart="@dimen/dp_25"
|
||||
android:layout_marginEnd="@dimen/dp_25"
|
||||
android:theme="@style/common_edittext_style"
|
||||
android:maxLength="16"
|
||||
tools:ignore="SpUsage" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_get_code"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="29dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_15"
|
||||
android:background="@color/transparent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:onClick="@{click}"
|
||||
android:text="@string/text_request_code"
|
||||
android:textColor="@color/design_color"
|
||||
android:textSize="@dimen/dp_15"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/et_code_pay_pwd"
|
||||
app:layout_constraintEnd_toEndOf="@+id/et_code_pay_pwd"
|
||||
tools:ignore="SpUsage" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_code_tips"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_25"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_25"
|
||||
android:text="@string/send_code_success_tips"
|
||||
android:textColor="@color/color_FE4C62"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_password_tip"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -79,11 +133,12 @@
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/bg_binding_button"
|
||||
android:background="@drawable/bg_login_button"
|
||||
android:clickable="true"
|
||||
android:text="提交"
|
||||
android:textColor="@color/white"
|
||||
android:textColor="@drawable/bg_login_button"
|
||||
android:textSize="18sp"
|
||||
android:enabled="true"
|
||||
android:onClick="@{click}"/>
|
||||
</LinearLayout>
|
||||
</layout>
|
||||
|
@@ -185,21 +185,12 @@
|
||||
android:layout_height="14dp"
|
||||
tools:src="@mipmap/ic_user_level_king" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_101"
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:background="@drawable/tag_101"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone" />
|
||||
android:layout_height="@dimen/dp_15"
|
||||
layout="@layout/layout_official_mask"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/iv_user_level"
|
||||
|
@@ -86,6 +86,17 @@
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/icon_open_noble" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_first_recharge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/icon_oneyuan_gift"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
|
@@ -119,23 +119,14 @@
|
||||
tools:src="@mipmap/ic_user_level_king"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_101"
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/tag_101"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginEnd="5.5dp"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="visible"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/iv_user_level"
|
||||
|
@@ -32,6 +32,17 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_label_add_user_info" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_random_avatar"
|
||||
android:scaleType="fitCenter"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="@id/civ_avatar"
|
||||
app:layout_constraintEnd_toEndOf="@id/civ_avatar"
|
||||
android:src="@drawable/switch_random_avatar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/tv_nick"
|
||||
android:layout_width="match_parent"
|
||||
@@ -39,6 +50,8 @@
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:paddingEnd="@dimen/dp_50"
|
||||
android:paddingStart="0dp"
|
||||
android:gravity="start|center_vertical"
|
||||
android:hint="@string/hint_input_nick"
|
||||
android:paddingBottom="15dp"
|
||||
@@ -54,6 +67,24 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/civ_avatar"
|
||||
tools:ignore="SpUsage" />
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
app:layout_constraintEnd_toEndOf="@id/tv_nick"
|
||||
app:layout_constraintTop_toTopOf="@id/tv_nick"
|
||||
android:text="随机"
|
||||
android:gravity="center"
|
||||
android:paddingStart="@dimen/dp_9"
|
||||
android:paddingEnd="@dimen/dp_9"
|
||||
android:id="@+id/tv_random_nick"
|
||||
android:textColor="@color/color_666666"
|
||||
app:solid="@color/color_E6E6E6"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
tools:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:corner="@dimen/dp_5"
|
||||
android:textSize="@dimen/dp_11"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_20" />
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/tv_gender"
|
||||
android:layout_width="match_parent"
|
||||
|
@@ -156,19 +156,15 @@
|
||||
tools:src="@mipmap/ic_user_level_king"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_101"
|
||||
visible="@{userInfo.userInfoSkillVo.liveTag}"
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/tag_101"
|
||||
android:gravity="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="10sp"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginEnd="5.5dp"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:ignore="SmallSp"
|
||||
tools:visibility="visible" />
|
||||
tools:visibility="visible"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_constellation"
|
||||
@@ -703,6 +699,7 @@
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_approve"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:background="#FAFAFA"
|
||||
@@ -729,6 +726,34 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_anchor_certification"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:background="#FAFAFA"
|
||||
android:onClick="@{click}"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/dp_me_padding_left"
|
||||
android:paddingEnd="@dimen/dp_15"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_me_icon_width"
|
||||
android:layout_height="@dimen/dp_me_icon_height"
|
||||
android:src="@mipmap/icon_anchor_certification"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="55dp"
|
||||
android:layout_marginStart="@dimen/dp_me_text_padding_to_icon"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/anchor_certification"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/me_item_patriarch"
|
||||
android:layout_width="match_parent"
|
||||
|
@@ -104,40 +104,56 @@
|
||||
android:visibility="visible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_nick"
|
||||
android:id="@+id/rl_nick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/micro_layout"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center_vertical">
|
||||
android:layout_below="@+id/micro_layout" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tag"
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginRight="5dp" />
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginEnd="5.5dp"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="visible"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nick"
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_nick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxWidth="120dp"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
tools:text="我是名字"
|
||||
tools:textColor="#000" />
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginRight="5dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxWidth="120dp"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text=""
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
tools:text="我是名字"
|
||||
tools:textColor="#000" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/desc_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/ll_nick"
|
||||
android:layout_below="@+id/rl_nick"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
|
@@ -61,6 +61,13 @@
|
||||
tools:src="@mipmap/ic_user_level_king"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
layout="@layout/layout_official_mask"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/iv_user_level"
|
||||
android:layout_width="38dp"
|
||||
|
@@ -56,6 +56,13 @@
|
||||
tools:src="@mipmap/ic_user_level_king"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
layout="@layout/layout_official_mask"/>
|
||||
|
||||
<android.support.v7.widget.AppCompatImageView
|
||||
android:id="@+id/iv_user_level"
|
||||
android:layout_width="34dp"
|
||||
|
@@ -40,16 +40,33 @@
|
||||
android:layout_marginStart="10dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="15sp"
|
||||
tools:text="我的我的我的我的我的我的" />
|
||||
android:orientation="horizontal">
|
||||
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginEnd="5.5dp"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="2dp"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="15sp"
|
||||
tools:text="我的我的我的我的我的我的" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@@ -1,9 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="76dp"
|
||||
android:paddingLeft="32dp"
|
||||
android:paddingRight="32dp">
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/dp_20"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:paddingLeft="@dimen/dp_25"
|
||||
android:paddingRight="@dimen/dp_25">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -12,35 +15,34 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title_hint"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/subTitleTextAppearance"
|
||||
android:text="原密码"/>
|
||||
|
||||
<EditText
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="start|center_vertical"
|
||||
android:inputType="textPassword"
|
||||
android:paddingBottom="20dp"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textColorHint="@color/color_b3b3b3"
|
||||
android:textSize="@dimen/dp_14"
|
||||
android:theme="@style/common_edittext_style"
|
||||
android:maxLength="16"
|
||||
android:textSize="13sp"
|
||||
android:textColor="@color/color_333333" />
|
||||
tools:ignore="SpUsage" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@color/color_E6E6E6" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_eyes"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:scaleType="center"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_eyes_close" />
|
||||
</FrameLayout>
|
36
app/src/main/res/layout/layout_official_mask.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:id="@+id/container_official_mask"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="59dp"
|
||||
tools:src="@drawable/ic_temp_official_mask"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_official_mask"
|
||||
android:layout_width="38.5dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5.5dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="9.5dp"
|
||||
tools:text="金牌主持"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_official_mask"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
@@ -31,6 +31,17 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_first_recharge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:layout_toStartOf="@+id/cb_money"
|
||||
android:src="@drawable/icon_first_recharge"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cb_money"
|
||||
android:layout_width="wrap_content"
|
||||
|
@@ -19,12 +19,24 @@
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp" />
|
||||
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginEnd="5.5dp"
|
||||
android:layout_gravity="center"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_toEndOf="@id/noble_avatar_view"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nick"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_toEndOf="@id/noble_avatar_view"
|
||||
android:layout_toEndOf="@id/in_official_mask"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:maxWidth="80dp"
|
||||
|
BIN
app/src/main/res/mipmap-xxhdpi/icon_anchor_certification.webp
Normal file
After Width: | Height: | Size: 2.4 KiB |
@@ -514,6 +514,9 @@
|
||||
<color name="color_E0E0E0">#E0E0E0</color>
|
||||
<color name="color_F3F2F5">#F3F2F5</color>
|
||||
<color name="color_FFF044">#FFF044</color>
|
||||
<color name="color_1CE9E7">#1CE9E7</color>
|
||||
<color name="color_45F1E5">#45F1E5</color>
|
||||
<color name="color_ABAAB2">#ABAAB2</color>
|
||||
|
||||
|
||||
</resources>
|
||||
|
@@ -751,6 +751,7 @@
|
||||
<string name="patriarch_mode">青少年模式</string>
|
||||
<string name="real_name_authentication">实名认证</string>
|
||||
<string name="approve">技能认证</string>
|
||||
<string name="anchor_certification">官方主播</string>
|
||||
<string name="module_hall">厅管理</string>
|
||||
<string name="recommend_position">推荐位</string>
|
||||
<string name="find_ta">找到TA</string>
|
||||
@@ -856,5 +857,8 @@
|
||||
<string name="label_search_history">搜索记录</string>
|
||||
<string name="label_room_history">进房记录</string>
|
||||
<string name="label_clear">清空</string>
|
||||
<string name="send_code_success_tips">验证码已发送至您绑定的手机%s</string>
|
||||
|
||||
<string name="quick_pass_slogan">轻松寻觅对的TA</string>
|
||||
|
||||
</resources>
|
||||
|
@@ -123,6 +123,23 @@ public class WorldDynamicAdapter extends BaseQuickAdapter<WorldDynamicBean, Base
|
||||
DynamicNickDetailWidget widget = helper.getView(R.id.widget_nick_detail);
|
||||
widget.setData(item);
|
||||
|
||||
View inOfficialMask = helper.getView(R.id.in_official_mask);
|
||||
if (item.getNameplate() != null) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
TextView tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
if (tvOfficialMask != null) {
|
||||
tvOfficialMask.setText(item.getNameplate().getFixedWord());
|
||||
}
|
||||
|
||||
ImageView ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
if (ivOfficialMask != null) {
|
||||
NobleUtil.loadResource(item.getNameplate().getIconPic(), ivOfficialMask);
|
||||
}
|
||||
|
||||
} else {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
//时间
|
||||
helper.setText(R.id.tv_time, TimeUiUtils.getDynamicUi(item.getPublishTime()));
|
||||
|
||||
|
@@ -327,6 +327,8 @@ public class DynamicDetailActivity extends BaseActivity implements IEmoticonSele
|
||||
|
||||
}
|
||||
|
||||
private View inOfficialMask;
|
||||
|
||||
private void initHeaderView() {
|
||||
mHeaderView = LayoutInflater.from(this).inflate(R.layout.head_dynamic_detail, null);
|
||||
ivAvatar = mHeaderView.findViewById(R.id.iv_avatar);
|
||||
@@ -340,6 +342,28 @@ public class DynamicDetailActivity extends BaseActivity implements IEmoticonSele
|
||||
viewLineDetailHeader = mHeaderView.findViewById(R.id.view_line_detail_header);
|
||||
viewLineDetailHeader.setVisibility(View.VISIBLE);
|
||||
|
||||
inOfficialMask = mHeaderView.findViewById(R.id.in_official_mask);
|
||||
|
||||
}
|
||||
|
||||
private void setOfficialMask(String name, String icon) {
|
||||
if (!TextUtils.isEmpty(name) && !TextUtils.isEmpty(icon)) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
TextView tvOfficialMask;
|
||||
tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
if (tvOfficialMask != null) {
|
||||
tvOfficialMask.setText(name);
|
||||
}
|
||||
|
||||
ImageView ivOfficialMask;
|
||||
ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
if (ivOfficialMask != null) {
|
||||
NobleUtil.loadResource(icon, ivOfficialMask);
|
||||
}
|
||||
|
||||
} else {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void resetTvCommentCountTop(int topDp) {
|
||||
@@ -726,6 +750,13 @@ public class DynamicDetailActivity extends BaseActivity implements IEmoticonSele
|
||||
getDialogManager().showCommonPopupDialog(list, "取消");
|
||||
});
|
||||
|
||||
UserInfo.NamePlate namePlate = info.getNameplate();
|
||||
if (namePlate != null) {
|
||||
setOfficialMask(namePlate.getFixedWord(), namePlate.getIconPic());
|
||||
} else {
|
||||
setOfficialMask(null, null);
|
||||
}
|
||||
|
||||
tvTime.setText(TimeUiUtils.getDynamicUi(bean.getPublishTime()));
|
||||
etvContent.setVisibility(View.GONE);
|
||||
etvContent.setEventType(3);
|
||||
|
@@ -209,6 +209,23 @@ public class SquareDynamicAdapter extends BaseQuickAdapter<WorldDynamicBean, Bas
|
||||
});
|
||||
helper.setGone(R.id.tv_flag_mini_world, !item.isInWorld());
|
||||
|
||||
View inOfficialMask = helper.getView(R.id.in_official_mask);
|
||||
if (item.getNameplate() != null) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
TextView tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
if (tvOfficialMask != null) {
|
||||
tvOfficialMask.setText(item.getNameplate().getFixedWord());
|
||||
}
|
||||
|
||||
ImageView ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
if (ivOfficialMask != null) {
|
||||
NobleUtil.loadResource(item.getNameplate().getIconPic(), ivOfficialMask);
|
||||
}
|
||||
|
||||
} else {
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setLikeCount(BaseViewHolder helper, int likeCount, boolean isLike, boolean isAnim) {
|
||||
|
@@ -36,22 +36,48 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_time"
|
||||
app:layout_constraintBottom_toTopOf="@+id/container_mask_time"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_head_wear"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_head_wear"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
<LinearLayout
|
||||
android:id="@+id/container_mask_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="@dimen/dp_12"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_head_wear"
|
||||
app:layout_constraintStart_toStartOf="@id/widget_nick_detail"
|
||||
app:layout_constraintTop_toBottomOf="@id/widget_nick_detail"
|
||||
tools:text="刚刚" />
|
||||
app:layout_constraintTop_toBottomOf="@id/widget_nick_detail" >
|
||||
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginEnd="6.5dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="@dimen/dp_12"
|
||||
tools:text="刚刚" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!--<TextView-->
|
||||
<!--android:id="@+id/tv_time"-->
|
||||
<!--android:layout_width="wrap_content"-->
|
||||
<!--android:layout_height="wrap_content"-->
|
||||
<!--android:gravity="center"-->
|
||||
<!--android:textColor="@color/color_999999"-->
|
||||
<!--android:textSize="@dimen/dp_12"-->
|
||||
<!--tools:text="刚刚" />-->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_more"
|
||||
|
@@ -55,17 +55,35 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="@dimen/dp_12"
|
||||
app:layout_constraintStart_toStartOf="@id/widget_nick_detail"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintTop_toBottomOf="@id/widget_nick_detail"
|
||||
tools:text="刚刚" />
|
||||
app:layout_constraintStart_toStartOf="@id/widget_nick_detail" >
|
||||
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="6.5dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="@dimen/dp_12"
|
||||
tools:text="刚刚" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
@@ -52,17 +52,35 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="@dimen/dp_12"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="@id/widget_nick_detail"
|
||||
app:layout_constraintTop_toBottomOf="@id/widget_nick_detail"
|
||||
tools:text="刚刚" />
|
||||
>
|
||||
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginEnd="6.5dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/color_999999"
|
||||
android:textSize="@dimen/dp_12"
|
||||
tools:text="刚刚" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
|
@@ -115,7 +115,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginEnd="10dip"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginTop="16dip"
|
||||
android:textColor="@color/color_B3B3B3"
|
||||
tools:text=" 晚上 06:00"
|
||||
@@ -148,7 +148,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_below="@id/tv_nickname"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
@@ -166,7 +166,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_below="@id/tv_nickname"
|
||||
android:src="@drawable/ic_mute_notification"
|
||||
@@ -179,7 +179,7 @@
|
||||
android:layout_height="35dip"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_below="@id/tv_nickname"
|
||||
android:layout_marginEnd="6dip"
|
||||
android:layout_marginEnd="15dp"
|
||||
android:gravity="center"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
@@ -77,6 +77,10 @@ public abstract class ChatRoomMsgViewHolderBase extends RecyclerViewHolder<BaseM
|
||||
public ImageView newUserIconView;
|
||||
public ImageView prettyIconView;
|
||||
|
||||
public View inOfficialMask;
|
||||
public TextView tvOfficialMask;
|
||||
public ImageView ivOfficialMask;
|
||||
|
||||
// contentContainerView的默认长按事件。如果子类需要不同的处理,可覆盖onItemLongClick方法
|
||||
// 但如果某些子控件会拦截触摸消息,导致contentContainer收不到长按事件,子控件也可在inflate时重新设置
|
||||
protected View.OnLongClickListener longClickListener;
|
||||
@@ -206,6 +210,12 @@ public abstract class ChatRoomMsgViewHolderBase extends RecyclerViewHolder<BaseM
|
||||
newUserIconView = findViewById(R.id.message_item_name_icon_new);
|
||||
prettyIconView = findViewById(R.id.message_item_name_icon_pretty);
|
||||
|
||||
inOfficialMask = findViewById(R.id.in_official_mask);
|
||||
if (inOfficialMask != null) {
|
||||
tvOfficialMask = inOfficialMask.findViewById(R.id.tv_official_mask);
|
||||
ivOfficialMask = inOfficialMask.findViewById(R.id.iv_official_mask);
|
||||
}
|
||||
|
||||
// 这里只要inflate出来后加入一次即可
|
||||
if (contentContainer.getChildCount() == 0) {
|
||||
View.inflate(view.getContext(), getContentResId(), contentContainer);
|
||||
@@ -368,6 +378,7 @@ public abstract class ChatRoomMsgViewHolderBase extends RecyclerViewHolder<BaseM
|
||||
prettyIconView.setVisibility(View.GONE);
|
||||
nameTextView.setVisibility(View.VISIBLE);
|
||||
nameTextView.setText(getNameText());
|
||||
inOfficialMask.setVisibility(View.GONE);
|
||||
setStyleOfNameTextView(nameTextView, nameIconView);
|
||||
Map<String, Object> remoteExtension = message.getRemoteExtension();
|
||||
if (remoteExtension != null && remoteExtension.get(message.getFromAccount()) != null) {
|
||||
@@ -409,6 +420,20 @@ public abstract class ChatRoomMsgViewHolderBase extends RecyclerViewHolder<BaseM
|
||||
boolean isOfficial = (boolean) map.get(UserInfo.HAS_PRETTY);
|
||||
prettyIconView.setVisibility(isOfficial ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
String oacName = (String) map.get(UserInfo.OAC_NAME);
|
||||
String oacIcon = (String) map.get(UserInfo.OAC_ICON);
|
||||
if (!TextUtils.isEmpty(oacName) && !TextUtils.isEmpty(oacIcon)) {
|
||||
inOfficialMask.setVisibility(View.VISIBLE);
|
||||
if (tvOfficialMask != null) {
|
||||
tvOfficialMask.setText(oacName);
|
||||
}
|
||||
|
||||
if (ivOfficialMask != null) {
|
||||
NobleUtil.loadResource(oacIcon, ivOfficialMask);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -56,6 +56,15 @@
|
||||
android:layout_marginBottom="3dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
android:id="@+id/in_official_mask"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_15"
|
||||
android:layout_marginEnd="6.5dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
layout="@layout/layout_official_mask" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/message_item_name_icon_official"
|
||||
android:layout_width="@dimen/dp_13"
|
||||
|
@@ -0,0 +1,219 @@
|
||||
package com.yizhuan.erban.quick_pass;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.netease.nis.quicklogin.helper.UnifyUiConfig;
|
||||
import com.netease.nis.quicklogin.utils.LoginUiHelper;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.ui.widget.marqueeview.Utils;
|
||||
import com.yizhuan.xchat_android_core.UriProvider;
|
||||
|
||||
/**
|
||||
* Created by hzhuqi on 2019/12/31
|
||||
*/
|
||||
public class QuickLoginUiConfig {
|
||||
public static UnifyUiConfig getUiConfig(final Context context) {
|
||||
|
||||
int logoToTop = 0;
|
||||
int logoWidth = 90;
|
||||
int logoHeight = 90;
|
||||
int maskNumToTop = logoToTop + logoHeight;
|
||||
int maskNumSize = 20;
|
||||
int sloganToTop = maskNumToTop + maskNumSize + 16;
|
||||
int sloganSize = 14;
|
||||
int loginBtnToTop = sloganToTop + sloganSize + 46;
|
||||
int loginBtnHeight = 48;
|
||||
|
||||
int X_OFFSET = 0;
|
||||
int BOTTOM_OFFSET = 0;
|
||||
UnifyUiConfig uiConfig = new UnifyUiConfig.Builder()
|
||||
// 状态栏
|
||||
.setStatusBarColor(Color.WHITE)
|
||||
.setStatusBarDarkColor(true)
|
||||
// 设置导航栏
|
||||
.setNavigationTitle("一键登录")
|
||||
.setNavigationTitleColor(ContextCompat.getColor(context, R.color.color_333333))
|
||||
.setNavigationBackgroundColor(Color.WHITE)
|
||||
.setNavigationIcon("quick_pass_back")
|
||||
.setNavigationBackIconWidth(25)
|
||||
.setNavigationBackIconHeight(25)
|
||||
.setHideNavigation(false)
|
||||
// 设置logo
|
||||
.setLogoIconName("quick_pass_logo")
|
||||
.setLogoWidth(logoWidth)
|
||||
.setLogoHeight(logoHeight)
|
||||
.setLogoXOffset(X_OFFSET)
|
||||
.setLogoTopYOffset(logoToTop)
|
||||
.setHideLogo(false)
|
||||
//手机掩码
|
||||
.setMaskNumberColor(ContextCompat.getColor(context, R.color.color_common_text_content))
|
||||
.setMaskNumberSize(maskNumSize)
|
||||
.setMaskNumberXOffset(X_OFFSET)
|
||||
.setMaskNumberTopYOffset(maskNumToTop)
|
||||
.setMaskNumberBottomYOffset(BOTTOM_OFFSET)
|
||||
// 认证品牌
|
||||
.setSloganSize(sloganSize)
|
||||
.setSloganColor(ContextCompat.getColor(context, R.color.color_ABAAB2))
|
||||
.setSloganXOffset(X_OFFSET)
|
||||
.setSloganTopYOffset(sloganToTop)
|
||||
.setSloganBottomYOffset(BOTTOM_OFFSET)
|
||||
// 登录按钮
|
||||
.setLoginBtnText("本机号码一键登录")
|
||||
.setLoginBtnTextColor(Color.WHITE)
|
||||
.setLoginBtnBackgroundRes("bg_quick_pass")
|
||||
.setLoginBtnWidth(280)
|
||||
.setLoginBtnHeight(loginBtnHeight)
|
||||
.setLoginBtnTextSize(16)
|
||||
.setLoginBtnXOffset(X_OFFSET)
|
||||
.setLoginBtnTopYOffset(loginBtnToTop)
|
||||
.setLoginBtnBottomYOffset(BOTTOM_OFFSET)
|
||||
// 隐私栏
|
||||
.setPrivacyTextStart("登录即代表同意")
|
||||
.setProtocolText("轻寻隐私政策")
|
||||
.setProtocolLink(UriProvider.getPrivacyAgreement())
|
||||
.setProtocol2Text("轻寻用户协议")
|
||||
.setProtocol2Link(UriProvider.getUserProtocolUrl())
|
||||
.setPrivacyTextEnd("并授权轻寻获取本机号码")
|
||||
.setPrivacyTextColor(ContextCompat.getColor(context, R.color.color_333333))
|
||||
.setPrivacyProtocolColor(ContextCompat.getColor(context, R.color.color_FE4C62))
|
||||
.setHidePrivacyCheckBox(false)
|
||||
|
||||
/**
|
||||
* offset只是设置左侧的间距,无法左右居中,易盾并没有提供左右居中的api;
|
||||
* 通过更改yd_quick_login_privacy.xml实现(文件在quicklogin_libary-external-release.aar)
|
||||
*/
|
||||
// .setPrivacyXOffset(43)
|
||||
|
||||
.setPrivacyState(true)
|
||||
.setPrivacySize(12)
|
||||
// .setPrivacyTopYOffset(510)
|
||||
.setPrivacyBottomYOffset(20)
|
||||
.setCheckedImageName("quick_pass_checked")
|
||||
.setUnCheckedImageName("quick_pass_uncheck")
|
||||
// 协议详情页导航栏
|
||||
.setProtocolPageNavTitle("服务条款")
|
||||
.setProtocolPageNavBackIcon("quick_pass_back")
|
||||
.setProtocolPageNavColor(Color.WHITE)
|
||||
|
||||
// .setBackgroundImage("bg1")
|
||||
// 自定义控件
|
||||
// .addCustomView(otherLoginRel, "relative", UnifyUiConfig.POSITION_IN_BODY, null)
|
||||
.build(context);
|
||||
return uiConfig;
|
||||
}
|
||||
|
||||
public static UnifyUiConfig getDialogUiConfig(final Activity context) {
|
||||
ImageView closeBtn = new ImageView(context);
|
||||
closeBtn.setImageResource(R.drawable.close);
|
||||
closeBtn.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||
closeBtn.setBackgroundColor(Color.TRANSPARENT);
|
||||
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(60, 60);
|
||||
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.CENTER_VERTICAL);
|
||||
layoutParams.topMargin = 30;
|
||||
layoutParams.rightMargin = 50;
|
||||
closeBtn.setLayoutParams(layoutParams);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
RelativeLayout otherLoginRel = (RelativeLayout) inflater.inflate(R.layout.custom_other_login, null);
|
||||
RelativeLayout.LayoutParams layoutParamsOther = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
|
||||
layoutParamsOther.setMargins(0, 0, 0, Utils.dip2px(context, 100));
|
||||
layoutParamsOther.addRule(RelativeLayout.CENTER_HORIZONTAL);
|
||||
layoutParamsOther.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
|
||||
otherLoginRel.setLayoutParams(layoutParamsOther);
|
||||
ImageView wx = otherLoginRel.findViewById(R.id.weixin);
|
||||
ImageView qq = otherLoginRel.findViewById(R.id.qq);
|
||||
wx.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(context, "微信登录", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
qq.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Toast.makeText(context, "qq登录", Toast.LENGTH_SHORT).show();
|
||||
|
||||
}
|
||||
});
|
||||
int X_OFFSET = 0;
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
context.getWindow().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
int dialogWidth = (int) (Utils.getScreenDpWidth(context) * 0.85);
|
||||
int dialogHeight = (int) (Utils.getScreenDpHeight(context) * 0.7);
|
||||
UnifyUiConfig uiConfig = new UnifyUiConfig.Builder()
|
||||
// 设置导航栏
|
||||
.setNavigationTitle("一键登录/注册")
|
||||
.setNavigationTitleColor(Color.RED)
|
||||
.setNavigationBackgroundColor(Color.BLUE)
|
||||
.setNavigationIcon("yd_checkbox_checked")
|
||||
.setHideNavigation(false)
|
||||
// 设置logo
|
||||
.setLogoIconName("ico_logo")
|
||||
.setLogoWidth(50)
|
||||
.setLogoHeight(50)
|
||||
.setLogoXOffset(X_OFFSET)
|
||||
.setLogoTopYOffset(15)
|
||||
// .setLogoBottomYOffset(300)
|
||||
.setHideLogo(false)
|
||||
//手机掩码
|
||||
.setMaskNumberColor(Color.RED)
|
||||
.setMaskNumberSize(15)
|
||||
.setMaskNumberTopYOffset(100)
|
||||
.setMaskNumberXOffset(X_OFFSET)
|
||||
// 认证品牌
|
||||
.setSloganSize(15)
|
||||
.setSloganColor(Color.RED)
|
||||
.setSloganTopYOffset(70)
|
||||
.setSloganXOffset(X_OFFSET)
|
||||
// 登录按钮
|
||||
.setLoginBtnText("易盾一键登录")
|
||||
.setLoginBtnTextColor(Color.WHITE)
|
||||
.setLoginBtnBackgroundRes("btn_shape_login_onepass")
|
||||
.setLoginBtnWidth(200)
|
||||
.setLoginBtnHeight(40)
|
||||
.setLoginBtnTextSize(15)
|
||||
.setLoginBtnXOffset(X_OFFSET)
|
||||
.setLoginBtnTopYOffset(150)
|
||||
// 隐私栏
|
||||
.setPrivacyTextStart("登录即同意")
|
||||
.setProtocolText("服务条款一")
|
||||
.setProtocolLink("https://www.baidu.com")
|
||||
.setProtocol2Text("服务条款二")
|
||||
.setProtocol2Link("https://www.baidu.com")
|
||||
.setPrivacyTextEnd("且授权易盾一键登录SDK使用本机号码")
|
||||
.setPrivacyTextColor(Color.GREEN)
|
||||
.setPrivacyProtocolColor(Color.RED)
|
||||
.setHidePrivacyCheckBox(false)
|
||||
.setPrivacyXOffset(X_OFFSET)
|
||||
.setPrivacyState(true)
|
||||
.setPrivacySize(12)
|
||||
.setPrivacyBottomYOffset(10)
|
||||
.setPrivacyTextGravityCenter(false)
|
||||
.setCheckedImageName("yd_checkbox_checked")
|
||||
.setUnCheckedImageName("yd_checkbox_unchecked")
|
||||
// 协议详情页导航栏
|
||||
.setProtocolPageNavTitle("易盾一键登录SDK服务条款")
|
||||
.setProtocolPageNavBackIcon("yd_checkbox_checked")
|
||||
.setProtocolPageNavColor(Color.BLUE)
|
||||
|
||||
.addCustomView(otherLoginRel, "relative", UnifyUiConfig.POSITION_IN_BODY, null)
|
||||
.addCustomView(closeBtn, "close_btn", UnifyUiConfig.POSITION_IN_TITLE_BAR, new LoginUiHelper.CustomViewListener() {
|
||||
@Override
|
||||
public void onClick(Context context, View view) {
|
||||
Toast.makeText(context.getApplicationContext(), "点击了右上角X按钮", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
})
|
||||
.setDialogMode(true, dialogWidth, dialogHeight, 0, 0, false)
|
||||
.build(context.getApplicationContext());
|
||||
return uiConfig;
|
||||
}
|
||||
}
|
@@ -0,0 +1,315 @@
|
||||
package com.yizhuan.erban.quick_pass;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ishumei.smantifraud.SmAntiFraud;
|
||||
import com.netease.mobsec.rjsb.watchman;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nis.quicklogin.QuickLogin;
|
||||
import com.netease.nis.quicklogin.listener.QuickLoginPreMobileListener;
|
||||
import com.netease.nis.quicklogin.listener.QuickLoginTokenListener;
|
||||
import com.tongdaxing.erban.upgrade.AppUpgradeHelper;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.base.BaseLoginAct;
|
||||
import com.yizhuan.erban.ui.login.LoginActivity;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
|
||||
import com.yizhuan.xchat_android_core.auth.exception.IsSuperAdminException;
|
||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.reactivex.SingleObserver;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListener {
|
||||
|
||||
|
||||
/**
|
||||
* 基本权限管理
|
||||
*/
|
||||
private final String[] BASIC_PERMISSIONS = new String[]{
|
||||
Manifest.permission.READ_PHONE_STATE,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
// Manifest.permission.CAMERA,
|
||||
// Manifest.permission.RECORD_AUDIO,
|
||||
// Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
// Manifest.permission.ACCESS_FINE_LOCATION
|
||||
};
|
||||
|
||||
private void permission() {
|
||||
checkPermission(() -> {
|
||||
InitialModel.get().reportBaiduAdv().subscribe();
|
||||
},
|
||||
R.string.ask_again,
|
||||
BASIC_PERMISSIONS);
|
||||
}
|
||||
|
||||
private static final int quickPassRequestCode = 1000;
|
||||
|
||||
private TextView tvLoginQuickPass;
|
||||
private QuickLogin login;// BUSINESS_ID为从易盾官网申请的业务id
|
||||
|
||||
private LinearLayout containerThirdPart;
|
||||
private View vDivider;
|
||||
|
||||
private TextView tvOtherLogin;
|
||||
|
||||
public static void start(Context context) {
|
||||
Intent intent = new Intent(context, QuickPassLoginAct.class);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.act_quick_pass);
|
||||
|
||||
login = QuickLogin.getInstance(getApplicationContext(), XChatConstants.QUICK_PASS_BUSINESS_ID);// BUSINESS_ID为从易盾官网申请的业务id
|
||||
login.setUnifyUiConfig(QuickLoginUiConfig.getUiConfig(getApplicationContext()));
|
||||
|
||||
onFindViews();
|
||||
onSetListener();
|
||||
permission();
|
||||
showLoginTip();
|
||||
AuthModel.get().isFromLogin = true;
|
||||
AppUpgradeHelper.checkAppUpgrade(this);
|
||||
}
|
||||
|
||||
private void onFindViews() {
|
||||
tvLoginQuickPass = findViewById(R.id.tv_login_quick_pass);
|
||||
tvProtocol = findViewById(R.id.tv_protocol);
|
||||
setProtocol();
|
||||
|
||||
containerThirdPart = findViewById(R.id.container_third_part);
|
||||
vDivider = findViewById(R.id.v_divider_third_part);
|
||||
wxLogin = findViewById(R.id.img_wx_login);
|
||||
qqLogin = findViewById(R.id.img_qq_login);
|
||||
tvLoginTip = findViewById(R.id.tv_login_tip);
|
||||
tvDesc = findViewById(R.id.tv_desc);
|
||||
|
||||
tvOtherLogin = findViewById(R.id.tv_other_login);
|
||||
}
|
||||
|
||||
private void onSetListener() {
|
||||
wxLogin.setOnClickListener(this);
|
||||
qqLogin.setOnClickListener(this);
|
||||
tvLoginQuickPass.setOnClickListener(this);
|
||||
tvOtherLogin.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
switch (v.getId()) {
|
||||
case R.id.img_wx_login:
|
||||
wxLogin();
|
||||
break;
|
||||
|
||||
case R.id.img_qq_login:
|
||||
qqLogin();
|
||||
break;
|
||||
|
||||
case R.id.tv_login_quick_pass:
|
||||
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.Event.EVENT_ONE_CLICK_LOGIN, "一键登录");
|
||||
|
||||
getDialogManager().showProgressDialog(this, "");
|
||||
|
||||
login.prefetchMobileNumber(new QuickLoginPreMobileListener() {
|
||||
@Override
|
||||
public void onGetMobileNumberSuccess(String YDToken, final String mobileNumber) {
|
||||
// 注:对于3网UI统一版本SDK,即2.0.0及以后版本,直接在该回调中调用取号接口onePass即可
|
||||
getDialogManager().dismissDialog();
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.Event.EVENT_ONE_CLICK_LOGIN_SUCCEED, "一键登录成功");
|
||||
onePass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetMobileNumberError(String YDToken, final String msg) {
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.Event.EVENT_ONE_CLICK_LOGIN_FAILED, "一键登录失败");
|
||||
toast("一键登录失败,请使用其他方式登录");
|
||||
LogUtil.e("QuickPassLogin", msg);
|
||||
getDialogManager().dismissDialog();
|
||||
LoginActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case R.id.tv_other_login:
|
||||
tvOtherLogin.setEnabled(false);
|
||||
StatisticManager.Instance().onEvent(
|
||||
StatisticsProtocol.Event.EVENT_ONE_CLICK_LOGIN_CHANGE_ID, "一键登录-切换账号");
|
||||
getDialogManager().showProgressDialog(QuickPassLoginAct.this);
|
||||
LoginActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setStatusBar() {
|
||||
StatusBarLightModes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean needSteepStateBar() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void onePass() {
|
||||
// 易盾保护 token 登录
|
||||
String yiDunLoginToken = watchman.getToken(XChatConstants.YI_DUN_LOGIN_BUSINESS_ID);
|
||||
// 数美天网 deviceId
|
||||
String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
||||
login.onePass(new QuickLoginTokenListener() {
|
||||
@Override
|
||||
public void onGetTokenSuccess(String s, String s1) {
|
||||
getDialogManager().showProgressDialog(QuickPassLoginAct.this);
|
||||
setClickEnable(false);
|
||||
AuthModel.get().quickPassLogin(s, s1, shuMeiDeviceId, yiDunLoginToken)
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(new SingleObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
if (mCompositeDisposable != null) {
|
||||
mCompositeDisposable.add(d);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String s) {
|
||||
setClickEnable(false);
|
||||
getDialogManager().dismissDialog();
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
getDialogManager().dismissDialog();
|
||||
dealWithLoginError(e);
|
||||
setClickEnable(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetTokenError(String s, String s1) {
|
||||
toast("一键登录失败,请使用其他登录方式");
|
||||
LoginActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
|
||||
setClickEnable(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelGetToken() {
|
||||
super.onCancelGetToken();
|
||||
setClickEnable(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dealWithLoginError(Throwable e) {
|
||||
if (!(e instanceof IsSuperAdminException)) {
|
||||
String msg = e.getMessage();
|
||||
StringBuilder eventLabel = new StringBuilder("登录注册页-登录失败");
|
||||
if (!TextUtils.isEmpty(msg)) {
|
||||
eventLabel.append(msg);
|
||||
}
|
||||
// 2004可以完整写入
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.Event.EVENT_LOGIN_FAILED_CLICK, eventLabel.toString());
|
||||
}
|
||||
if (e instanceof BanAccountException) {
|
||||
BanAccountException exception = (BanAccountException) e;
|
||||
String text = "您的账号因" + exception.getMessage() + "被封禁\n解封时间:";
|
||||
int start = text.length();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
||||
text += simpleDateFormat.format(new Date(exception.getDate()));
|
||||
SpannableString spannableString = new SpannableString(text);
|
||||
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(QuickPassLoginAct.this, R.color.appColor)),
|
||||
start, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||
getDialogManager().showOkCancelWithTitleDialog("您被封号了",
|
||||
spannableString, "确定", "取消", null);
|
||||
} else {
|
||||
toast(e.getMessage());
|
||||
LoginActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
moveTaskToBack(true);
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
getDialogManager().dismissDialog();
|
||||
tvOtherLogin.setEnabled(true);
|
||||
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (requestCode == quickPassRequestCode) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showThirdPartLogin(boolean isShowWechat, boolean isShowQq) {
|
||||
if (containerThirdPart != null) {
|
||||
containerThirdPart.setVisibility(isShowWechat || isShowQq ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
|
||||
if (vDivider != null) {
|
||||
vDivider.setVisibility(isShowWechat && isShowQq ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
super.showThirdPartLogin(isShowWechat, isShowQq);
|
||||
}
|
||||
|
||||
private void setClickEnable(boolean enable) {
|
||||
if (tvLoginQuickPass != null) {
|
||||
tvLoginQuickPass.setEnabled(enable);
|
||||
}
|
||||
if (wxLogin != null) {
|
||||
wxLogin.setEnabled(enable);
|
||||
}
|
||||
if (qqLogin != null) {
|
||||
qqLogin.setEnabled(enable);
|
||||
}
|
||||
if (tvOtherLogin != null) {
|
||||
tvOtherLogin.setEnabled(enable);
|
||||
}
|
||||
canClick = enable;
|
||||
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 204 B |
After Width: | Height: | Size: 3.0 KiB |
9
app/src/module_quick_pass/res/drawable/bg_quick_pass.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="24dp"/>
|
||||
|
||||
<gradient android:startColor="@color/color_1CE9E7"
|
||||
android:endColor="@color/color_45F1E5"/>
|
||||
|
||||
</shape>
|
BIN
app/src/module_quick_pass/res/drawable/quick_pass_back.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
app/src/module_quick_pass/res/drawable/quick_pass_checked.png
Normal file
After Width: | Height: | Size: 393 B |
BIN
app/src/module_quick_pass/res/drawable/quick_pass_logo.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
app/src/module_quick_pass/res/drawable/quick_pass_uncheck.png
Normal file
After Width: | Height: | Size: 360 B |
126
app/src/module_quick_pass/res/layout/act_quick_pass.xml
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@color/white">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_logo_quick_pass"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="108dp"
|
||||
android:src="@drawable/ic_quick_pass_logo"
|
||||
android:layout_marginTop="60dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_slogan_quick_pass"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="9.5dp"
|
||||
android:text="@string/quick_pass_slogan"
|
||||
android:textSize="@dimen/dp_16"
|
||||
android:textColor="@color/color_B3B3B3"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_logo_quick_pass"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_login_quick_pass"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="48dp"
|
||||
android:gravity="center"
|
||||
android:text="本机号码一键登录"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_16"
|
||||
android:layout_marginTop="40dp"
|
||||
android:background="@drawable/bg_quick_pass"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_slogan_quick_pass"
|
||||
tools:ignore="SpUsage"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_other_login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:drawablePadding="6dp"
|
||||
android:drawableEnd="@drawable/ic_full_arraw_right"
|
||||
android:textSize="@dimen/dp_15"
|
||||
android:textColor="@color/color_666666"
|
||||
android:text="其他账号登录"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_login_quick_pass"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_protocol"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:text="@string/text_login_protocol"
|
||||
android:textColor="@color/color_666666"
|
||||
android:textSize="@dimen/dp_12"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/container_third_part"
|
||||
tools:ignore="SpUsage" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/container_third_part"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="29dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/tv_desc">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_wx_login"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="33dp"
|
||||
android:src="@drawable/wx_login"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_divider_third_part"
|
||||
android:layout_width="63.5dp"
|
||||
android:layout_height="1dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_qq_login"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="33dp"
|
||||
android:src="@drawable/qq_login"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_desc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="#ff333333"
|
||||
android:textSize="13sp"
|
||||
android:layout_marginBottom="49dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:text="遇到问题点击这里" />
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
67
app/src/module_quick_pass/res/layout/custom_other_login.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relative"
|
||||
android:layout_width="225dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_centerHorizontal="true">
|
||||
|
||||
<View
|
||||
android:id="@+id/view"
|
||||
android:layout_width="51dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="#D8D8D8">
|
||||
|
||||
</View>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="其他方式登录"
|
||||
android:textColor="#797894" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view1"
|
||||
android:layout_width="51dp"
|
||||
android:layout_height="1dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:background="#D8D8D8">
|
||||
|
||||
</View>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/relative"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/weixin"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:background="@drawable/wx_login"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/qq"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:background="@drawable/qq_login" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
@@ -0,0 +1,19 @@
|
||||
<?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="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_other_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="其他账号登录"
|
||||
android:drawableEnd="@drawable/ic_full_arraw_right"
|
||||
android:textSize="@dimen/dp_15"
|
||||
android:textColor="@color/color_666666"
|
||||
android:drawablePadding="6.5dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|