登录注册UI修改
@@ -10,7 +10,7 @@ android {
|
|||||||
compileSdkVersion 32
|
compileSdkVersion 32
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.mango.yinyou"
|
applicationId "com.vele.peko"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 32
|
targetSdkVersion 32
|
||||||
versionCode Integer.valueOf(version_code)
|
versionCode Integer.valueOf(version_code)
|
||||||
@@ -55,26 +55,22 @@ android {
|
|||||||
enabled = true
|
enabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
packagingOptions {
|
|
||||||
exclude 'lib/armeabi-v7a/libagora-crypto.so'
|
|
||||||
}
|
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
|
|
||||||
v2 {
|
v2 {
|
||||||
storeFile file('../yinyou.jks')
|
storeFile file('../peko.jks')
|
||||||
storePassword "yinyou2021"
|
storePassword "peko2022"
|
||||||
keyAlias "yinyou"
|
keyAlias "peko"
|
||||||
keyPassword "yinyou2021"
|
keyPassword "peko2022"
|
||||||
v2SigningEnabled true
|
v2SigningEnabled true
|
||||||
v1SigningEnabled true
|
v1SigningEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
v1 {
|
v1 {
|
||||||
storeFile file('../yinyou.jks')
|
storeFile file('../peko.jks')
|
||||||
storePassword "yinyou2021"
|
storePassword "peko2022"
|
||||||
keyAlias "yinyou"
|
keyAlias "peko"
|
||||||
keyPassword "yinyou2021"
|
keyPassword "peko2022"
|
||||||
v2SigningEnabled false
|
v2SigningEnabled false
|
||||||
v1SigningEnabled true
|
v1SigningEnabled true
|
||||||
}
|
}
|
||||||
@@ -98,10 +94,8 @@ android {
|
|||||||
'src/module_bank_card/java',
|
'src/module_bank_card/java',
|
||||||
'src/module_super_admin/java',
|
'src/module_super_admin/java',
|
||||||
'src/module_treasure_box/java',
|
'src/module_treasure_box/java',
|
||||||
|
|
||||||
'src/module_community/java',
|
'src/module_community/java',
|
||||||
'src/module_album/java',
|
'src/module_album/java',
|
||||||
'src/module_quick_pass/java'
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -120,10 +114,8 @@ android {
|
|||||||
'src/module_bank_card/res',
|
'src/module_bank_card/res',
|
||||||
'src/module_super_admin/res',
|
'src/module_super_admin/res',
|
||||||
'src/module_treasure_box/res',
|
'src/module_treasure_box/res',
|
||||||
|
|
||||||
'src/module_community/res',
|
'src/module_community/res',
|
||||||
'src/module_album/res',
|
'src/module_album/res',
|
||||||
'src/module_quick_pass/res'
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -198,7 +190,6 @@ dependencies {
|
|||||||
api "com.ms-square:expandableTextView:0.1.4"
|
api "com.ms-square:expandableTextView:0.1.4"
|
||||||
api "com.jakewharton:butterknife:10.2.3"
|
api "com.jakewharton:butterknife:10.2.3"
|
||||||
annotationProcessor "com.jakewharton:butterknife-compiler:10.2.3"
|
annotationProcessor "com.jakewharton:butterknife-compiler:10.2.3"
|
||||||
implementation "com.llew.huawei:verifier:1.0.3"
|
|
||||||
annotationProcessor 'androidx.annotation:annotation:1.4.0'
|
annotationProcessor 'androidx.annotation:annotation:1.4.0'
|
||||||
|
|
||||||
implementation 'io.github.h07000223:flycoTabLayout:3.0.0'
|
implementation 'io.github.h07000223:flycoTabLayout:3.0.0'
|
||||||
@@ -239,13 +230,6 @@ dependencies {
|
|||||||
implementation 'com.github.mmin18:realtimeblurview:1.2.1'
|
implementation 'com.github.mmin18:realtimeblurview:1.2.1'
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
flatDir {
|
|
||||||
dirs 'aliyun-libs','com.huawei.agconnect'
|
|
||||||
}
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
channel {
|
channel {
|
||||||
//多渠道包的输出目录,默认为new File(project.buildDir,"channel")
|
//多渠道包的输出目录,默认为new File(project.buildDir,"channel")
|
||||||
outputDir = new File(project.buildDir, "channelapk")
|
outputDir = new File(project.buildDir, "channelapk")
|
||||||
|
@@ -197,26 +197,7 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
android:resource="@xml/provider_paths" />
|
android:resource="@xml/provider_paths" />
|
||||||
</provider> <!-- 支付宝支付需要注册 -->
|
</provider>
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name="com.yizhuan.xchat_android_core.pay.PaymentActivity"
|
|
||||||
android:launchMode="singleTask"
|
|
||||||
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
|
|
||||||
<!-- tinker配置 end ########################################################## -->
|
|
||||||
<!-- 支付相关配置 -->
|
|
||||||
<!-- 微信支付需要注册 -->
|
|
||||||
<activity-alias
|
|
||||||
android:name="${applicationId}.wxapi.WXPayEntryActivity"
|
|
||||||
android:targetActivity="com.yizhuan.xchat_android_core.pay.PaymentActivity" />
|
|
||||||
<!-- 支付相关配置 -->
|
|
||||||
|
|
||||||
<!-- 为了兼容小程序返回的问题,声明WXEntryActivity,并把之前的 WechatHandlerActivity注释 -->
|
|
||||||
<activity
|
|
||||||
android:name="com.mango.yinyou.wxapi.WXEntryActivity"
|
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
|
||||||
|
|
||||||
<!-- shareSDK配置 end ####################################################### -->
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="com.darsh.multipleimageselect.activities.AlbumSelectActivity"
|
android:name="com.darsh.multipleimageselect.activities.AlbumSelectActivity"
|
||||||
@@ -237,6 +218,28 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.mob.tools.MobUIShell"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||||
|
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||||
|
<activity
|
||||||
|
android:name="com.vele.peko.lineapi.LineAuthenticationCallbackActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:noHistory="true">
|
||||||
|
|
||||||
|
<!-- 集成line客户端登录授权,需要添如下格式的过滤器 -->
|
||||||
|
<intent-filter>
|
||||||
|
<data android:scheme="lineauth" />
|
||||||
|
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".service.DaemonService"
|
android:name=".service.DaemonService"
|
||||||
android:enabled="true" />
|
android:enabled="true" />
|
||||||
@@ -261,31 +264,14 @@
|
|||||||
|
|
||||||
<!-- 此处scheme值需要替换为后台设置中的scheme值 -->
|
<!-- 此处scheme值需要替换为后台设置中的scheme值 -->
|
||||||
<data
|
<data
|
||||||
android:host="linkedme"
|
android:host="main"
|
||||||
android:scheme="yinyouapp" />
|
android:scheme="pekoapp" />
|
||||||
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<!-- APP Links方式,Android 23版本及以后支持 -->
|
|
||||||
<intent-filter android:autoVerify="true">
|
|
||||||
<action android:name="android.intent.action.VIEW" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
|
||||||
<!-- 以下pathPrefix值需要替换为后台设置中 App ID 的值 -->
|
|
||||||
<data
|
|
||||||
android:host="lkme.cc"
|
|
||||||
android:pathPrefix="/brG"
|
|
||||||
android:scheme="https" />
|
|
||||||
<data
|
|
||||||
android:host="lkme.cc"
|
|
||||||
android:pathPrefix="/brG"
|
|
||||||
android:scheme="http" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@@ -395,11 +381,6 @@
|
|||||||
android:label="充值"
|
android:label="充值"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".ui.pay.ChargeDialog"
|
|
||||||
android:label="充值"
|
|
||||||
android:theme="@style/dialogactivity" />
|
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".home.activity.CollectionRoomActivity"
|
android:name=".home.activity.CollectionRoomActivity"
|
||||||
android:label="收藏房间"
|
android:label="收藏房间"
|
||||||
@@ -937,7 +918,7 @@
|
|||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".quick_pass.QuickPassLoginAct"
|
android:name=".ui.login.LoginActivity"
|
||||||
android:label="一键登录"
|
android:label="一键登录"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
package com.vele.peko.lineapi;
|
||||||
|
|
||||||
|
import cn.sharesdk.line.LineHandlerActivity;
|
||||||
|
|
||||||
|
public class LineAuthenticationCallbackActivity extends LineHandlerActivity {
|
||||||
|
}
|
@@ -1,26 +0,0 @@
|
|||||||
package com.xuanyi.accompany.wxapi;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
|
|
||||||
import cn.sharesdk.wechat.utils.WXMediaMessage;
|
|
||||||
import cn.sharesdk.wechat.utils.WechatHandlerActivity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* create by lvzebiao @2019/11/8
|
|
||||||
*/
|
|
||||||
public class WXEntryActivity extends WechatHandlerActivity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onShowMessageFromWXReq(WXMediaMessage msg) {
|
|
||||||
super.onShowMessageFromWXReq(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGetMessageFromWXReq(WXMediaMessage msg) {
|
|
||||||
super.onGetMessageFromWXReq(msg);
|
|
||||||
//从小程序返回APP
|
|
||||||
Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName());
|
|
||||||
startActivity(iLaunchMyself);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -20,7 +20,6 @@ import android.view.animation.LinearInterpolator;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
@@ -65,7 +64,7 @@ import com.yizhuan.erban.main.helper.NoticationsUiHelper;
|
|||||||
import com.yizhuan.erban.miniworld.activity.MiniWorldGuestPageActivity;
|
import com.yizhuan.erban.miniworld.activity.MiniWorldGuestPageActivity;
|
||||||
import com.yizhuan.erban.module.Extras;
|
import com.yizhuan.erban.module.Extras;
|
||||||
import com.yizhuan.erban.module_hall.secretcode.PwdCodeMgr;
|
import com.yizhuan.erban.module_hall.secretcode.PwdCodeMgr;
|
||||||
import com.yizhuan.erban.quick_pass.QuickPassLoginAct;
|
import com.yizhuan.erban.ui.login.LoginActivity;
|
||||||
import com.yizhuan.erban.service.DaemonService;
|
import com.yizhuan.erban.service.DaemonService;
|
||||||
import com.yizhuan.erban.ui.im.ImInitHelper;
|
import com.yizhuan.erban.ui.im.ImInitHelper;
|
||||||
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
import com.yizhuan.erban.ui.im.avtivity.NimP2PMessageActivity;
|
||||||
@@ -98,7 +97,6 @@ import com.yizhuan.xchat_android_core.home.model.HomeModel;
|
|||||||
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||||
import com.yizhuan.xchat_android_core.linked.LinkedModel;
|
import com.yizhuan.xchat_android_core.linked.LinkedModel;
|
||||||
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
|
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
|
||||||
import com.yizhuan.xchat_android_core.manager.AudioEngineManager;
|
|
||||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||||
import com.yizhuan.xchat_android_core.manager.IMBroadcastManager;
|
import com.yizhuan.xchat_android_core.manager.IMBroadcastManager;
|
||||||
import com.yizhuan.xchat_android_core.manager.IMMessageManager;
|
import com.yizhuan.xchat_android_core.manager.IMMessageManager;
|
||||||
@@ -501,13 +499,13 @@ public class MainActivity extends BaseMvpActivity<IMainView, MainPresenter>
|
|||||||
public void onLogout() {
|
public void onLogout() {
|
||||||
Logger.e(TAG, "onLogout Success ~~~~");
|
Logger.e(TAG, "onLogout Success ~~~~");
|
||||||
getMvpPresenter().exitRoom();
|
getMvpPresenter().exitRoom();
|
||||||
QuickPassLoginAct.start(MainActivity.this);
|
LoginActivity.start(MainActivity.this);
|
||||||
PmDialogShowMrg.get().onLogout();
|
PmDialogShowMrg.get().onLogout();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onNeedLogin() {
|
public void onNeedLogin() {
|
||||||
NimMiddleActivity.openCommunity = false;
|
NimMiddleActivity.openCommunity = false;
|
||||||
QuickPassLoginAct.start(MainActivity.this);
|
LoginActivity.start(MainActivity.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -6,12 +6,16 @@ import android.annotation.SuppressLint;
|
|||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.Signature;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.net.http.HttpResponseCache;
|
import android.net.http.HttpResponseCache;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.multidex.MultiDex;
|
import androidx.multidex.MultiDex;
|
||||||
@@ -19,7 +23,6 @@ import androidx.multidex.MultiDex;
|
|||||||
import com.bumptech.glide.request.target.ViewTarget;
|
import com.bumptech.glide.request.target.ViewTarget;
|
||||||
import com.coorchice.library.utils.LogUtils;
|
import com.coorchice.library.utils.LogUtils;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import com.llew.huawei.verifier.LoadedApkHuaWei;
|
|
||||||
import com.mob.MobSDK;
|
import com.mob.MobSDK;
|
||||||
import com.netease.nim.uikit.api.NimUIKit;
|
import com.netease.nim.uikit.api.NimUIKit;
|
||||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||||
@@ -95,6 +98,8 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@@ -253,7 +258,6 @@ public class XChatApplication extends Application {
|
|||||||
lifeManager = new ActivityLifeManager();
|
lifeManager = new ActivityLifeManager();
|
||||||
}
|
}
|
||||||
registerActivityLifecycleCallback(lifeManager);
|
registerActivityLifecycleCallback(lifeManager);
|
||||||
dealHuaWeiCrash();
|
|
||||||
initLinkedMe();
|
initLinkedMe();
|
||||||
MobSDK.init(context);
|
MobSDK.init(context);
|
||||||
MobSDK.submitPolicyGrantResult(true);
|
MobSDK.submitPolicyGrantResult(true);
|
||||||
@@ -296,17 +300,6 @@ public class XChatApplication extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void dealHuaWeiCrash() {
|
|
||||||
String brand = Build.BRAND;
|
|
||||||
String manufacturer = Build.MANUFACTURER;
|
|
||||||
if (!TextUtils.isEmpty(brand) && (
|
|
||||||
"HUAWEI".toLowerCase().equals(brand.toLowerCase())
|
|
||||||
|| "HONOR".toLowerCase().equals(brand.toLowerCase())
|
|
||||||
|| "HUAWEI".equals(manufacturer))) {
|
|
||||||
LoadedApkHuaWei.hookHuaWeiVerifier((Application) BasicConfig.INSTANCE.getAppContext().getApplicationContext());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||||
public static void registerActivityLifecycleCallback(Application.ActivityLifecycleCallbacks callbacks) {
|
public static void registerActivityLifecycleCallback(Application.ActivityLifecycleCallbacks callbacks) {
|
||||||
((Application) BasicConfig.INSTANCE.getAppContext().getApplicationContext()).registerActivityLifecycleCallbacks(callbacks);
|
((Application) BasicConfig.INSTANCE.getAppContext().getApplicationContext()).registerActivityLifecycleCallbacks(callbacks);
|
||||||
@@ -515,6 +508,22 @@ public class XChatApplication extends Application {
|
|||||||
if (!isShowPrivacyAgreement) {
|
if (!isShowPrivacyAgreement) {
|
||||||
initOtherSDK();
|
initOtherSDK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
facebookHashKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Facebook秘钥散列获取
|
||||||
|
private void facebookHashKey() {
|
||||||
|
try {
|
||||||
|
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
|
||||||
|
for (Signature signature : info.signatures) {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("SHA");
|
||||||
|
md.update(signature.toByteArray());
|
||||||
|
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
|
||||||
|
}
|
||||||
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -1,254 +0,0 @@
|
|||||||
package com.yizhuan.erban.base;
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Bundle;
|
|
||||||
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.CheckBox;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import com.netease.nim.uikit.StatusBarUtil;
|
|
||||||
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 CheckBox tvProtocol;
|
|
||||||
protected TextView wxLogin;
|
|
||||||
protected TextView qqLogin;
|
|
||||||
protected TextView tvLoginQuickPass;
|
|
||||||
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.color_2D93FF)), privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_2D93FF)) {
|
|
||||||
@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.color_2D93FF)), userAgreementTipIndex, userAgreementTipIndex + userAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_2D93FF)) {
|
|
||||||
@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(), loginTipsInfo.isShowOneClick());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
showTvLoginTip(false);
|
|
||||||
showThirdPartLogin(false, false, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void showThirdPartLogin(boolean isShowWechat, boolean isShowQq, boolean isShowOneClick) {
|
|
||||||
showwxLogin(isShowWechat);
|
|
||||||
showqqLogin(isShowQq);
|
|
||||||
showOneClickLogin(isShowOneClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 showOneClickLogin(boolean visible) {
|
|
||||||
if (tvLoginQuickPass != null) {
|
|
||||||
tvLoginQuickPass.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("", "")
|
|
||||||
.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_LOGIN_WX_CLICK, "点击微信登录", null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void qqLogin() {
|
|
||||||
// 易盾保护 token
|
|
||||||
// String yiDunToken = watchman.getToken(XChatConstants.YI_DUN_BUSINESS_ID);
|
|
||||||
// 数美天网 deviceId
|
|
||||||
// String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
|
||||||
String yiDunToken = "";
|
|
||||||
String shuMeiDeviceId = "";
|
|
||||||
|
|
||||||
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_LOGIN_QQ_CLICK, "点击qq登录", null);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void dealWithLoginError(Throwable e);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean needSteepStateBar() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setStatusBar() {
|
|
||||||
StatusBarUtil.transparencyBar(this);
|
|
||||||
StatusBarUtil.StatusBarLightMode(this);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -20,7 +20,7 @@ import androidx.core.content.ContextCompat;
|
|||||||
import com.coorchice.library.utils.LogUtils;
|
import com.coorchice.library.utils.LogUtils;
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.base.BaseLoginAct;
|
import com.yizhuan.erban.base.BaseActivity;
|
||||||
import com.yizhuan.erban.ui.login.ui.CodeEditText;
|
import com.yizhuan.erban.ui.login.ui.CodeEditText;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
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.BanAccountException;
|
||||||
@@ -48,7 +48,7 @@ import io.reactivex.disposables.Disposable;
|
|||||||
* @author zhouxiangfeng
|
* @author zhouxiangfeng
|
||||||
* @date 17/2/26
|
* @date 17/2/26
|
||||||
*/
|
*/
|
||||||
public class BindCodeActivity extends BaseLoginAct {
|
public class BindCodeActivity extends BaseActivity {
|
||||||
|
|
||||||
private static final String TYPE_SMS = "1";
|
private static final String TYPE_SMS = "1";
|
||||||
private CodeEditText codeEt;
|
private CodeEditText codeEt;
|
||||||
@@ -171,44 +171,12 @@ public class BindCodeActivity extends BaseLoginAct {
|
|||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
toast(e.getMessage());
|
toast(e.getMessage());
|
||||||
// finish();
|
|
||||||
LogUtils.e("获取短信失败!");
|
LogUtils.e("获取短信失败!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@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_LOGIN_FAILED_CLICK, eventLabel.toString());
|
|
||||||
}
|
|
||||||
if (e instanceof BanAccountException) {
|
|
||||||
isSuperAdmin = false;
|
|
||||||
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(BindCodeActivity.this, R.color.appColor)),
|
|
||||||
start, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkCancelWithTitleDialog("您被封号了",
|
|
||||||
spannableString, "确定", "取消", null);
|
|
||||||
} else if (e instanceof IOException) {
|
|
||||||
toast("网络异常,请检查您的网络再试~");
|
|
||||||
} else {
|
|
||||||
isSuperAdmin = false;
|
|
||||||
toast(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startCountDownTimer() {
|
private void startCountDownTimer() {
|
||||||
stopCountDownTimer();
|
stopCountDownTimer();
|
||||||
timer = new CodeDownDescTimer(tvSecond, tvGetCode, 60000, 1000);
|
timer = new CodeDownDescTimer(tvSecond, tvGetCode, 60000, 1000);
|
||||||
|
247
app/src/main/java/com/yizhuan/erban/ui/login/LoginActivity.java
Normal file
@@ -0,0 +1,247 @@
|
|||||||
|
package com.yizhuan.erban.ui.login;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.Spanned;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.netease.nim.uikit.StatusBarUtil;
|
||||||
|
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||||
|
import com.yizhuan.erban.R;
|
||||||
|
import com.yizhuan.erban.base.BaseActivity;
|
||||||
|
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||||
|
import com.yizhuan.erban.ui.login.helper.LogoutHelper;
|
||||||
|
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
||||||
|
import com.yizhuan.xchat_android_core.DemoCache;
|
||||||
|
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 org.greenrobot.eventbus.EventBus;
|
||||||
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
|
import io.reactivex.SingleObserver;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
|
public class LoginActivity extends BaseActivity implements View.OnClickListener {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String NEED_CHECKED_PROTOCOL = "need_checked_protocol";
|
||||||
|
protected CheckBox tvProtocol;
|
||||||
|
private TextView tvProtocolHint;
|
||||||
|
|
||||||
|
public static void start(Context context) {
|
||||||
|
Intent intent = new Intent(context, LoginActivity.class);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_login);
|
||||||
|
EventBus.getDefault().register(this);
|
||||||
|
onFindViews();
|
||||||
|
onSetListener();
|
||||||
|
setProtocol();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onFindViews() {
|
||||||
|
tvProtocol = findViewById(R.id.tv_protocol);
|
||||||
|
tvProtocolHint = findViewById(R.id.tv_protocol_hint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onSetListener() {
|
||||||
|
findViewById(R.id.tv_facebook).setOnClickListener(this);
|
||||||
|
findViewById(R.id.tv_line).setOnClickListener(this);
|
||||||
|
findViewById(R.id.tv_google).setOnClickListener(this);
|
||||||
|
findViewById(R.id.tv_others).setOnClickListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setProtocol() {
|
||||||
|
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.color_2D93FF)), privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_2D93FF)) {
|
||||||
|
@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.color_2D93FF)), userAgreementTipIndex, userAgreementTipIndex + userAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.color_2D93FF)) {
|
||||||
|
@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());
|
||||||
|
|
||||||
|
if (DemoCache.readBoolean(NEED_CHECKED_PROTOCOL, false)) {
|
||||||
|
tvProtocol.setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
tvProtocol.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
if (isChecked) {
|
||||||
|
tvProtocolHint.setVisibility(View.GONE);
|
||||||
|
DemoCache.saveBoolean(NEED_CHECKED_PROTOCOL, true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (!tvProtocol.isChecked()) {
|
||||||
|
tvProtocolHint.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (v.getId()) {
|
||||||
|
case R.id.tv_facebook:
|
||||||
|
getDialogManager().showProgressDialog(this);
|
||||||
|
AuthModel.get().facebookLogin()
|
||||||
|
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||||
|
.subscribe(new SingleObserver<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String s) {
|
||||||
|
getDialogManager().dismissDialog();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
getDialogManager().dismissDialog();
|
||||||
|
dealWithLoginError(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case R.id.tv_line:
|
||||||
|
getDialogManager().showProgressDialog(this);
|
||||||
|
AuthModel.get().lineLogin()
|
||||||
|
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||||
|
.subscribe(new SingleObserver<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String s) {
|
||||||
|
getDialogManager().dismissDialog();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
getDialogManager().dismissDialog();
|
||||||
|
dealWithLoginError(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
|
case R.id.tv_google:
|
||||||
|
getDialogManager().showProgressDialog(this);
|
||||||
|
AuthModel.get().googleLogin()
|
||||||
|
.compose(bindUntilEvent(ActivityEvent.DESTROY))
|
||||||
|
.subscribe(new SingleObserver<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String s) {
|
||||||
|
getDialogManager().dismissDialog();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
getDialogManager().dismissDialog();
|
||||||
|
dealWithLoginError(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
case R.id.tv_others:
|
||||||
|
LoginPasswordActivity.start(LoginActivity.this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setStatusBar() {
|
||||||
|
super.setStatusBar();
|
||||||
|
StatusBarUtil.transparencyBar(this);
|
||||||
|
StatusBarUtil.StatusBarLightMode(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean needSteepStateBar() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dealWithLoginError(Throwable e) {
|
||||||
|
LogoutHelper.dealWithLoginError(this, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
EventBus.getDefault().unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册成功后发送过来的事件
|
||||||
|
*/
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onLoginEvent(LoginEvent event) {
|
||||||
|
getDialogManager().dismissDialog();
|
||||||
|
setResult(RESULT_OK);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -21,7 +21,8 @@ import com.coorchice.library.utils.LogUtils;
|
|||||||
import com.netease.nim.uikit.StatusBarUtil;
|
import com.netease.nim.uikit.StatusBarUtil;
|
||||||
import com.trello.rxlifecycle3.android.ActivityEvent;
|
import com.trello.rxlifecycle3.android.ActivityEvent;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.base.BaseLoginAct;
|
import com.yizhuan.erban.base.BaseActivity;
|
||||||
|
import com.yizhuan.erban.ui.login.helper.LogoutHelper;
|
||||||
import com.yizhuan.erban.ui.login.ui.CodeEditText;
|
import com.yizhuan.erban.ui.login.ui.CodeEditText;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
||||||
@@ -49,10 +50,8 @@ import io.reactivex.disposables.Disposable;
|
|||||||
* @author zhouxiangfeng
|
* @author zhouxiangfeng
|
||||||
* @date 17/2/26
|
* @date 17/2/26
|
||||||
*/
|
*/
|
||||||
public class LoginCodeActivity extends BaseLoginAct {
|
public class LoginCodeActivity extends BaseActivity {
|
||||||
|
|
||||||
private static final String TAG = "LoginVertificationActivity";
|
|
||||||
private static final String TYPE_SMS = "1";
|
|
||||||
private CodeEditText codeEt;
|
private CodeEditText codeEt;
|
||||||
private TextView tvGetCode, tvDesc, tvSecond;
|
private TextView tvGetCode, tvDesc, tvSecond;
|
||||||
private String mPhone;
|
private String mPhone;
|
||||||
@@ -182,16 +181,12 @@ public class LoginCodeActivity extends BaseLoginAct {
|
|||||||
private void login() {
|
private void login() {
|
||||||
String smsCode = codeEt.getText().toString();
|
String smsCode = codeEt.getText().toString();
|
||||||
getDialogManager().showProgressDialog(this, "正在登录...");
|
getDialogManager().showProgressDialog(this, "正在登录...");
|
||||||
// 易盾保护 token 登录
|
|
||||||
// String yiDunLoginToken = watchman.getToken(XChatConstants.YI_DUN_LOGIN_BUSINESS_ID);
|
|
||||||
// 数美天网 deviceId
|
|
||||||
// String shuMeiDeviceId = SmAntiFraud.getDeviceId();
|
|
||||||
AuthModel.get().login(
|
AuthModel.get().login(
|
||||||
mPhone,
|
mPhone,
|
||||||
"",
|
"",
|
||||||
smsCode,
|
smsCode,
|
||||||
"",
|
"",
|
||||||
"")
|
"")
|
||||||
.subscribe(new SingleObserver<String>() {
|
.subscribe(new SingleObserver<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
@@ -217,47 +212,8 @@ public class LoginCodeActivity extends BaseLoginAct {
|
|||||||
StatisticsProtocol.EVENT_LOGIN_PHONE_CLICK, "点击手机号登录", null);
|
StatisticsProtocol.EVENT_LOGIN_PHONE_CLICK, "点击手机号登录", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dealWithLoginError(Throwable e) {
|
public void dealWithLoginError(Throwable e) {
|
||||||
if (!(e instanceof IsSuperAdminException)) {
|
LogoutHelper.dealWithLoginError(this, e);
|
||||||
String msg = e.getMessage();
|
|
||||||
StringBuilder eventLabel = new StringBuilder("登录注册页-登录失败");
|
|
||||||
if (!TextUtils.isEmpty(msg)) {
|
|
||||||
eventLabel.append(msg);
|
|
||||||
}
|
|
||||||
// 2004可以完整写入
|
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_LOGIN_FAILED_CLICK, eventLabel.toString());
|
|
||||||
}
|
|
||||||
if (e instanceof BanAccountException) {
|
|
||||||
isSuperAdmin = false;
|
|
||||||
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(LoginCodeActivity.this, R.color.appColor)),
|
|
||||||
start, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkCancelWithTitleDialog("您被封号了",
|
|
||||||
spannableString, "确定", "取消", null);
|
|
||||||
} else if (e instanceof AccountCancelException) {
|
|
||||||
AccountCancelException exception = (AccountCancelException) e;
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
|
||||||
|
|
||||||
String text = "注销时间:" + simpleDateFormat.format(new Date(exception.getCancelDate()));
|
|
||||||
int end = text.length();
|
|
||||||
text += "\n\n请联系客服(微信:yinyoukefu01)处理哦~";
|
|
||||||
SpannableString spannableString = new SpannableString(text);
|
|
||||||
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginCodeActivity.this, R.color.appColor)),
|
|
||||||
0, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkWithTitleDialog("该账号已注销",
|
|
||||||
spannableString, "我知道了", true, null);
|
|
||||||
} else if (e instanceof IOException) {
|
|
||||||
toast("网络异常,请检查您的网络再试~");
|
|
||||||
} else {
|
|
||||||
isSuperAdmin = false;
|
|
||||||
toast(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startCountDownTimer() {
|
private void startCountDownTimer() {
|
||||||
|
@@ -15,9 +15,8 @@ import android.widget.EditText;
|
|||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.base.BaseLoginAct;
|
import com.yizhuan.erban.base.BaseActivity;
|
||||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
import com.yizhuan.erban.ui.login.helper.LogoutHelper;
|
||||||
import com.yizhuan.erban.quick_pass.QuickPassLoginAct;
|
|
||||||
import com.yizhuan.erban.ui.setting.ResetPasswordActivity;
|
import com.yizhuan.erban.ui.setting.ResetPasswordActivity;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
|
||||||
@@ -41,7 +40,7 @@ import io.reactivex.SingleObserver;
|
|||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
|
|
||||||
public class LoginPasswordActivity extends BaseLoginAct {
|
public class LoginPasswordActivity extends BaseActivity {
|
||||||
|
|
||||||
|
|
||||||
private View btnNext;
|
private View btnNext;
|
||||||
@@ -73,7 +72,6 @@ public class LoginPasswordActivity extends BaseLoginAct {
|
|||||||
btnNext.setEnabled(enabled);
|
btnNext.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initView() {
|
private void initView() {
|
||||||
btnNext = findViewById(R.id.btn_next);
|
btnNext = findViewById(R.id.btn_next);
|
||||||
edtPhone = findViewById(R.id.et_account);
|
edtPhone = findViewById(R.id.et_account);
|
||||||
@@ -82,7 +80,6 @@ public class LoginPasswordActivity extends BaseLoginAct {
|
|||||||
edtPassword.addTextChangedListener(textWatcher);
|
edtPassword.addTextChangedListener(textWatcher);
|
||||||
btnNext.setOnClickListener(v -> login());
|
btnNext.setOnClickListener(v -> login());
|
||||||
findViewById(R.id.iv_back).setOnClickListener(v -> finish());
|
findViewById(R.id.iv_back).setOnClickListener(v -> finish());
|
||||||
findViewById(R.id.tv_code_login).setOnClickListener(v -> finish());
|
|
||||||
findViewById(R.id.tv_forget_password).setOnClickListener(v -> ResetPasswordActivity.start(context, ResetPasswordActivity.FROM_NOT_LOGIN));
|
findViewById(R.id.tv_forget_password).setOnClickListener(v -> ResetPasswordActivity.start(context, ResetPasswordActivity.FROM_NOT_LOGIN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,11 +92,11 @@ public class LoginPasswordActivity extends BaseLoginAct {
|
|||||||
private void login() {
|
private void login() {
|
||||||
getDialogManager().showProgressDialog(this, "正在登录...");
|
getDialogManager().showProgressDialog(this, "正在登录...");
|
||||||
AuthModel.get().login(
|
AuthModel.get().login(
|
||||||
edtPhone.getText().toString().trim(),
|
edtPhone.getText().toString().trim(),
|
||||||
edtPassword.getText().toString().trim(),
|
edtPassword.getText().toString().trim(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"")
|
"")
|
||||||
.subscribe(new SingleObserver<String>() {
|
.subscribe(new SingleObserver<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSubscribe(Disposable d) {
|
public void onSubscribe(Disposable d) {
|
||||||
@@ -119,50 +116,10 @@ public class LoginPasswordActivity extends BaseLoginAct {
|
|||||||
dealWithLoginError(e);
|
dealWithLoginError(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
StatisticManager.Instance().onEvent(this,
|
|
||||||
StatisticsProtocol.EVENT_LOGIN_PHONE_CLICK, "点击手机号登录", null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dealWithLoginError(Throwable e) {
|
public void dealWithLoginError(Throwable e) {
|
||||||
if (!(e instanceof IsSuperAdminException)) {
|
LogoutHelper.dealWithLoginError(this, e);
|
||||||
String msg = e.getMessage();
|
|
||||||
StringBuilder eventLabel = new StringBuilder("登录注册页-登录失败");
|
|
||||||
if (!TextUtils.isEmpty(msg)) {
|
|
||||||
eventLabel.append(msg);
|
|
||||||
}
|
|
||||||
// 2004可以完整写入
|
|
||||||
StatisticManager.Instance().onEvent(StatisticsProtocol.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(LoginPasswordActivity.this, R.color.appColor)),
|
|
||||||
start, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkCancelWithTitleDialog("您被封号了",
|
|
||||||
spannableString, "确定", "取消", null);
|
|
||||||
} else if (e instanceof AccountCancelException) {
|
|
||||||
AccountCancelException exception = (AccountCancelException) e;
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
|
||||||
|
|
||||||
String text = "注销时间:" + simpleDateFormat.format(new Date(exception.getCancelDate()));
|
|
||||||
int end = text.length();
|
|
||||||
text += "\n\n请联系客服(微信:yinyoukefu01)处理哦~";
|
|
||||||
SpannableString spannableString = new SpannableString(text);
|
|
||||||
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(LoginPasswordActivity.this, R.color.appColor)),
|
|
||||||
0, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkWithTitleDialog("该账号已注销",
|
|
||||||
spannableString, "我知道了", true, null);
|
|
||||||
} else if (e instanceof IOException) {
|
|
||||||
toast("网络异常,请检查您的网络再试~");
|
|
||||||
} else {
|
|
||||||
toast(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,7 +1,27 @@
|
|||||||
package com.yizhuan.erban.ui.login.helper;
|
package com.yizhuan.erban.ui.login.helper;
|
||||||
|
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
|
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
import com.yizhuan.erban.R;
|
||||||
|
import com.yizhuan.erban.base.BaseActivity;
|
||||||
|
import com.yizhuan.erban.ui.login.LoginActivity;
|
||||||
import com.yizhuan.xchat_android_core.PreferencesUtils;
|
import com.yizhuan.xchat_android_core.PreferencesUtils;
|
||||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||||
|
import com.yizhuan.xchat_android_core.auth.exception.AccountCancelException;
|
||||||
|
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
|
||||||
|
import com.yizhuan.xchat_android_core.auth.exception.IsSuperAdminException;
|
||||||
|
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
||||||
|
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create by lvzebiao @2019/12/9
|
* create by lvzebiao @2019/12/9
|
||||||
@@ -13,4 +33,44 @@ public class LogoutHelper {
|
|||||||
PreferencesUtils.setFristQQ(true);
|
PreferencesUtils.setFristQQ(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void dealWithLoginError(BaseActivity activity,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_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(activity, R.color.appColor)),
|
||||||
|
start, text.length(), Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
activity.getDialogManager().showOkCancelWithTitleDialog("您被封号了",
|
||||||
|
spannableString, "确定", "取消", null);
|
||||||
|
} else if (e instanceof AccountCancelException) {
|
||||||
|
AccountCancelException exception = (AccountCancelException) e;
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
||||||
|
|
||||||
|
String text = "注销时间:" + simpleDateFormat.format(new Date(exception.getCancelDate()));
|
||||||
|
int end = text.length();
|
||||||
|
text += "\n\n请联系客服(微信:yinyoukefu01)处理哦~";
|
||||||
|
SpannableString spannableString = new SpannableString(text);
|
||||||
|
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(activity, R.color.appColor)),
|
||||||
|
0, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
||||||
|
activity.getDialogManager().showOkWithTitleDialog("该账号已注销",
|
||||||
|
spannableString, "我知道了", true, null);
|
||||||
|
} else if (e instanceof IOException) {
|
||||||
|
activity.toast("网络异常,请检查您的网络再试~");
|
||||||
|
} else {
|
||||||
|
activity.toast(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
BIN
app/src/main/res/drawable-xhdpi/bg_login.png
Normal file
After Width: | Height: | Size: 332 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 32 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_login_arrow_right.png
Normal file
After Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_login_facebook.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_login_google.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_login_line.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_login_next.png
Normal file
After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 972 B After Width: | Height: | Size: 1.5 KiB |
@@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
<gradient
|
<gradient
|
||||||
android:angle="180"
|
android:angle="180"
|
||||||
android:endColor="@color/color_218eff"
|
android:endColor="#19EBFF"
|
||||||
android:startColor="@color/color_7727e4"
|
android:startColor="#ED66FF"
|
||||||
android:type="linear"
|
android:type="linear"
|
||||||
android:useLevel="true" />
|
android:useLevel="true" />
|
||||||
<corners android:radius="100dp" />
|
<corners android:radius="10dp" />
|
||||||
|
|
||||||
</shape>
|
</shape>
|
@@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
<gradient
|
<gradient
|
||||||
android:angle="180"
|
android:angle="180"
|
||||||
android:endColor="#ED992A"
|
android:endColor="#19EBFF"
|
||||||
android:startColor="#F9C237"
|
android:startColor="#ED66FF"
|
||||||
android:type="linear"
|
android:type="linear"
|
||||||
android:useLevel="true" />
|
android:useLevel="true" />
|
||||||
<corners android:radius="100dp" />
|
<corners android:radius="10dp" />
|
||||||
|
|
||||||
|
|
||||||
</shape>
|
</shape>
|
10
app/src/main/res/drawable/shape_login_btn_bg.xml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#F0F5F6" />
|
||||||
|
<corners
|
||||||
|
android:bottomLeftRadius="10dp"
|
||||||
|
android:bottomRightRadius="10dp"
|
||||||
|
android:topLeftRadius="10dp"
|
||||||
|
android:topRightRadius="10dp" />
|
||||||
|
</shape>
|
@@ -1,5 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="@color/bg_normal_1c1b22" />
|
<solid android:color="@color/white"/>
|
||||||
|
<corners android:topLeftRadius="@dimen/dp_25"
|
||||||
|
android:topRightRadius="@dimen/dp_25"/>
|
||||||
</shape>
|
</shape>
|
141
app/src/main/res/layout/activity_login.xml
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg_top"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/bg_login"
|
||||||
|
app:layout_constraintDimensionRatio="750:666"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_slogan"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginTop="100dp"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
|
android:text="Welcome to"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="30sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_app_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
|
android:text="Peko!"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="64sp"
|
||||||
|
app:layout_constraintStart_toStartOf="@id/tv_slogan"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tv_slogan" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/view_bg_bottom"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/shape_white_top_25dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_facebook"
|
||||||
|
android:layout_width="308dp"
|
||||||
|
android:layout_height="63dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:background="@drawable/shape_login_btn_bg"
|
||||||
|
android:drawableStart="@drawable/ic_login_facebook"
|
||||||
|
android:drawablePadding="35dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="25dp"
|
||||||
|
android:text="Facebook登录"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_line"
|
||||||
|
android:layout_width="308dp"
|
||||||
|
android:layout_height="63dp"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
|
android:background="@drawable/shape_login_btn_bg"
|
||||||
|
android:drawableStart="@drawable/ic_login_line"
|
||||||
|
android:drawablePadding="35dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="25dp"
|
||||||
|
android:text="Line登录"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_google"
|
||||||
|
android:layout_width="308dp"
|
||||||
|
android:layout_height="63dp"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
|
android:background="@drawable/shape_login_btn_bg"
|
||||||
|
android:drawableStart="@drawable/ic_login_google"
|
||||||
|
android:drawablePadding="35dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="25dp"
|
||||||
|
android:text="Gmail登录"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_others"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:drawableEnd="@drawable/ic_login_arrow_right"
|
||||||
|
android:gravity="center"
|
||||||
|
android:includeFontPadding="false"
|
||||||
|
android:text="选择其他方式登录"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:layout_marginBottom="50dp"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_protocol_hint"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
|
android:background="@drawable/bg_login_protocol_hint"
|
||||||
|
android:gravity="center_horizontal|bottom"
|
||||||
|
android:paddingBottom="6dp"
|
||||||
|
android:text="同意隐私政策和用户协议后,才可以注册登录哦~"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="10dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/tv_protocol"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginBottom="25dp"
|
||||||
|
android:button="@null"
|
||||||
|
android:drawableStart="@drawable/selector_login_radio_btn"
|
||||||
|
android:drawablePadding="@dimen/dp_5"
|
||||||
|
android:text="@string/text_login_protocol"
|
||||||
|
android:textColor="#FFBBB1FF"
|
||||||
|
android:textSize="@dimen/dp_11"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:ignore="SpUsage" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -6,139 +6,148 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/bg_normal_1c1b22">
|
android:background="@color/bg_normal_1c1b22">
|
||||||
|
|
||||||
<ImageView
|
<View
|
||||||
android:id="@+id/iv_back"
|
android:id="@+id/view_bg_top"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="@dimen/dp_30"
|
android:background="@drawable/bg_login"
|
||||||
android:padding="@dimen/dp_17"
|
app:layout_constraintDimensionRatio="750:666"
|
||||||
android:src="@drawable/arrow_left"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_code_login"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="75dp"
|
|
||||||
android:layout_marginEnd="@dimen/dp_15"
|
|
||||||
android:text="验证码登录"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/sp_15"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="140dp"
|
|
||||||
android:text="你的手机号是多少"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/text_size_18"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_slogan"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
|
android:layout_marginTop="100dp"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
|
android:text="登录"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="30sp"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_top"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginBottom="30dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/view_bg_top"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/ll_account"
|
android:id="@+id/view_bg_bottom"
|
||||||
android:layout_width="270dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="0dp"
|
||||||
android:layout_marginTop="70dp"
|
android:background="@drawable/shape_white_top_25dp"
|
||||||
android:background="@drawable/bg_common_edit"
|
android:gravity="center_horizontal"
|
||||||
android:baselineAligned="true"
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_title">
|
app:layout_constraintTop_toBottomOf="@id/view_top">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_account"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="63dp"
|
||||||
|
android:layout_marginStart="33dp"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:layout_marginEnd="33dp"
|
||||||
|
android:background="@drawable/shape_login_btn_bg"
|
||||||
|
android:baselineAligned="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="@dimen/dp_15"
|
||||||
|
android:paddingEnd="@dimen/dp_15"
|
||||||
|
android:text="ID号"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="@dimen/sp_15" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/et_account"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="33dp"
|
||||||
|
android:background="@null"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLength="11"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="@dimen/dp_15"
|
||||||
|
tools:ignore="SpUsage"
|
||||||
|
tools:text="123456" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_password"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="63dp"
|
||||||
|
android:layout_marginStart="33dp"
|
||||||
|
android:layout_marginTop="25dp"
|
||||||
|
android:layout_marginEnd="33dp"
|
||||||
|
android:background="@drawable/shape_login_btn_bg"
|
||||||
|
android:baselineAligned="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/ll_account">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:paddingStart="@dimen/dp_15"
|
||||||
|
android:paddingEnd="@dimen/dp_15"
|
||||||
|
android:text="密码"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="@dimen/sp_15" />
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/et_password"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="33dp"
|
||||||
|
android:background="@null"
|
||||||
|
android:focusable="true"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:inputType="textPassword"
|
||||||
|
android:maxLength="16"
|
||||||
|
android:textColor="@color/text_title_white"
|
||||||
|
android:textSize="@dimen/dp_15"
|
||||||
|
tools:ignore="SpUsage" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/tv_forget_password"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center_vertical"
|
android:layout_gravity="end"
|
||||||
android:paddingStart="@dimen/dp_15"
|
android:layout_marginTop="@dimen/dp_15"
|
||||||
android:paddingEnd="@dimen/dp_15"
|
android:layout_marginEnd="33dp"
|
||||||
android:text="+86"
|
android:text="忘记密码"
|
||||||
android:textColor="@color/text_title_white"
|
android:textColor="#B3B3C3"
|
||||||
android:textSize="@dimen/sp_15" />
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_next"
|
||||||
|
android:layout_width="165dp"
|
||||||
|
android:layout_height="63dp"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="30dp"
|
||||||
|
android:background="@drawable/ic_login_next"
|
||||||
|
android:enabled="false"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/tv_forget_password" />
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/et_account"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="33dp"
|
|
||||||
android:background="@null"
|
|
||||||
android:focusable="true"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:inputType="number"
|
|
||||||
android:maxLength="11"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
tools:ignore="SpUsage"
|
|
||||||
tools:text="123456" />
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/ll_password"
|
|
||||||
android:layout_width="270dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:background="@drawable/bg_common_edit"
|
|
||||||
android:baselineAligned="true"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/ll_account">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingStart="@dimen/dp_15"
|
|
||||||
android:paddingEnd="@dimen/dp_15"
|
|
||||||
android:text="密码"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/sp_15" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/et_password"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="33dp"
|
|
||||||
android:background="@null"
|
|
||||||
android:focusable="true"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:inputType="textPassword"
|
|
||||||
android:maxLength="16"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_forget_password"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_15"
|
|
||||||
android:layout_marginEnd="75dp"
|
|
||||||
android:text="忘记密码"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/sp_14"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/ll_password" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btn_next"
|
|
||||||
android:layout_width="270dp"
|
|
||||||
android:layout_height="@dimen/dp_45"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:background="@drawable/bg_common_confirm"
|
|
||||||
android:enabled="false"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="下一步"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_forget_password" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
@@ -8,46 +8,117 @@
|
|||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg_top"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/bg_login"
|
||||||
|
app:layout_constraintDimensionRatio="750:666"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bg_bottom"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@drawable/shape_white_top_25dp"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/view_bottom_top" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/view_bottom_top"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/rg_gender"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_title"
|
android:id="@+id/tv_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="30dp"
|
||||||
android:layout_marginTop="@dimen/dp_100"
|
android:layout_marginTop="@dimen/dp_100"
|
||||||
android:text="@string/add_info"
|
android:fontFamily="sans-serif-medium"
|
||||||
|
android:text="注册"
|
||||||
android:textColor="@color/text_title_white"
|
android:textColor="@color/text_title_white"
|
||||||
android:textSize="@dimen/dp_18"
|
android:textSize="40sp"
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<me.shihao.library.XRadioGroup
|
||||||
|
android:id="@+id/rg_gender"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="35dp"
|
||||||
|
android:layout_marginEnd="35dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/tv_detail"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:ignore="SpUsage">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_male"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/selector_radiobutton_gender_male"
|
||||||
|
android:button="@null" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/rb_female"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:background="@drawable/selector_radiobutton_gender_female"
|
||||||
|
android:button="@null" />
|
||||||
|
|
||||||
|
</me.shihao.library.XRadioGroup>
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_detail"
|
android:id="@+id/tv_detail"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
android:layout_marginBottom="23dp"
|
||||||
android:text="@string/gender_cannot_modify"
|
android:text="@string/gender_cannot_modify"
|
||||||
android:textColor="@color/text_normal_c6c6e9"
|
android:textColor="#B3B3C3"
|
||||||
android:textSize="@dimen/dp_13"
|
android:textSize="@dimen/dp_13"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/view_nick_bg"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/view_nick_bg"
|
android:id="@+id/view_nick_bg"
|
||||||
android:layout_width="270dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="63dp"
|
||||||
android:layout_marginTop="50dp"
|
android:layout_marginStart="33dp"
|
||||||
android:background="@drawable/bg_common_edit"
|
android:layout_marginEnd="33dp"
|
||||||
|
android:layout_marginBottom="25dp"
|
||||||
|
android:background="@drawable/shape_login_btn_bg"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/view_code_bg"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_detail" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_nick_title"
|
android:id="@+id/tv_nick_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="23dp"
|
android:layout_marginStart="23dp"
|
||||||
|
android:fontFamily="sans-serif-medium"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:text="昵称"
|
android:text="昵称"
|
||||||
android:textColor="@color/text_normal_c6c6e9"
|
android:textColor="@color/text_normal_c6c6e9"
|
||||||
@@ -87,67 +158,26 @@
|
|||||||
app:layout_constraintEnd_toEndOf="@id/view_nick_bg"
|
app:layout_constraintEnd_toEndOf="@id/view_nick_bg"
|
||||||
app:layout_constraintTop_toTopOf="@id/view_nick_bg" />
|
app:layout_constraintTop_toTopOf="@id/view_nick_bg" />
|
||||||
|
|
||||||
<me.shihao.library.XRadioGroup
|
|
||||||
android:id="@+id/rg_gender"
|
|
||||||
android:layout_width="270dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/view_nick_bg"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/view_nick_bg"
|
|
||||||
tools:ignore="SpUsage">
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_male"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/selector_radiobutton_gender_male"
|
|
||||||
android:button="@null" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_height="1dp"/>
|
|
||||||
|
|
||||||
<RadioButton
|
|
||||||
android:id="@+id/rb_female"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:background="@drawable/selector_radiobutton_gender_female"
|
|
||||||
android:button="@null" />
|
|
||||||
|
|
||||||
</me.shihao.library.XRadioGroup>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_code_title_top"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:text="邀请码"
|
|
||||||
android:textColor="@color/text_normal_c6c6e9"
|
|
||||||
android:textSize="@dimen/dp_18"
|
|
||||||
app:layout_constraintStart_toStartOf="@id/view_code_bg"
|
|
||||||
app:layout_constraintEnd_toEndOf="@id/view_code_bg"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/rg_gender" />
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:id="@+id/view_code_bg"
|
android:id="@+id/view_code_bg"
|
||||||
android:layout_width="270dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="63dp"
|
||||||
|
android:layout_marginStart="33dp"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="20dp"
|
||||||
android:background="@drawable/bg_common_edit"
|
android:layout_marginEnd="33dp"
|
||||||
|
android:layout_marginBottom="30dp"
|
||||||
|
android:background="@drawable/shape_login_btn_bg"
|
||||||
|
app:layout_constraintBottom_toTopOf="@id/ok_btn"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_code_title_top" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_code_title"
|
android:id="@+id/tv_code_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="23dp"
|
android:layout_marginStart="23dp"
|
||||||
android:text="请输入邀请码"
|
android:fontFamily="sans-serif-medium"
|
||||||
|
android:text="邀请码"
|
||||||
android:textColor="@color/text_normal_c6c6e9"
|
android:textColor="@color/text_normal_c6c6e9"
|
||||||
android:textSize="@dimen/dp_15"
|
android:textSize="@dimen/dp_15"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/view_code_bg"
|
app:layout_constraintBottom_toBottomOf="@id/view_code_bg"
|
||||||
@@ -168,7 +198,7 @@
|
|||||||
android:paddingEnd="23dp"
|
android:paddingEnd="23dp"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textColor="@color/text_title_white"
|
android:textColor="@color/text_title_white"
|
||||||
android:textColorHint="@color/text_hint_555574"
|
android:textColorHint="#B3B3C3"
|
||||||
android:textSize="@dimen/dp_14"
|
android:textSize="@dimen/dp_14"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/view_code_bg"
|
app:layout_constraintBottom_toBottomOf="@id/view_code_bg"
|
||||||
app:layout_constraintEnd_toEndOf="@id/view_code_bg"
|
app:layout_constraintEnd_toEndOf="@id/view_code_bg"
|
||||||
@@ -176,31 +206,18 @@
|
|||||||
app:layout_constraintTop_toTopOf="@id/view_code_bg"
|
app:layout_constraintTop_toTopOf="@id/view_code_bg"
|
||||||
tools:ignore="SpUsage" />
|
tools:ignore="SpUsage" />
|
||||||
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/ok_btn"
|
android:id="@+id/ok_btn"
|
||||||
android:layout_width="270dp"
|
android:layout_width="165dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="63dp"
|
||||||
android:layout_marginTop="80dp"
|
android:layout_marginBottom="@dimen/dp_50"
|
||||||
android:layout_marginBottom="@dimen/dp_16"
|
|
||||||
android:background="@drawable/bg_common_confirm"
|
android:background="@drawable/bg_common_confirm"
|
||||||
android:text="下一步"
|
android:text="完成"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_15"
|
android:textSize="@dimen/sp_15"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/view_code_bg"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="15dp"
|
|
||||||
android:text="@string/add_user_info_desc"
|
|
||||||
android:textColor="@color/text_secondary_4f516a"
|
|
||||||
android:textSize="@dimen/dp_11"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
tools:ignore="SpUsage" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
@@ -568,7 +568,7 @@
|
|||||||
<!-- 输入框背景颜色 -->
|
<!-- 输入框背景颜色 -->
|
||||||
<color name="bg_edit_e8e8f6">#E8E8F6</color>
|
<color name="bg_edit_e8e8f6">#E8E8F6</color>
|
||||||
<!-- 标题文字颜色 -->
|
<!-- 标题文字颜色 -->
|
||||||
<color name="text_title_white">#FF333333</color>
|
<color name="text_title_white">#1F1A4E</color>
|
||||||
<!-- 常用文字颜色 -->
|
<!-- 常用文字颜色 -->
|
||||||
<color name="text_normal_c6c6e9">#FF333333</color>
|
<color name="text_normal_c6c6e9">#FF333333</color>
|
||||||
<!-- 日期等次级文案 -->
|
<!-- 日期等次级文案 -->
|
||||||
|
@@ -1,88 +0,0 @@
|
|||||||
package com.yizhuan.erban.quick_pass;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.Spanned;
|
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.base.BaseDialog;
|
|
||||||
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
|
||||||
import com.yizhuan.erban.databinding.DialogProtocolBinding;
|
|
||||||
import com.yizhuan.erban.ui.webview.CommonWebViewActivity;
|
|
||||||
import com.yizhuan.xchat_android_core.UriProvider;
|
|
||||||
|
|
||||||
public class ProtocolDialog extends BaseDialog<DialogProtocolBinding> {
|
|
||||||
|
|
||||||
public static ProtocolDialog newInstance() {
|
|
||||||
return new ProtocolDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private View.OnClickListener onClickListener;
|
|
||||||
|
|
||||||
public void setOnClickListener(View.OnClickListener onClickListener) {
|
|
||||||
this.onClickListener = onClickListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
setProtocol();
|
|
||||||
getBinding().btnCancel.setOnClickListener(v -> {
|
|
||||||
if (onClickListener != null){
|
|
||||||
onClickListener.onClick(v);
|
|
||||||
}
|
|
||||||
dismissAllowingStateLoss();
|
|
||||||
});
|
|
||||||
getBinding().btnOk.setOnClickListener(v -> {
|
|
||||||
if (onClickListener != null){
|
|
||||||
onClickListener.onClick(v);
|
|
||||||
}
|
|
||||||
dismissAllowingStateLoss();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setProtocol() {
|
|
||||||
Context context = requireContext();
|
|
||||||
|
|
||||||
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_3, 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.appColor)), privacyAgreementTipIndex, privacyAgreementTipIndex + privacyAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.appColor)) {
|
|
||||||
@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.appColor)), userAgreementTipIndex, userAgreementTipIndex + userAgreementTip.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
ss.setSpan(new OriginalDrawStatusClickSpan(ContextCompat.getColor(context, R.color.appColor)) {
|
|
||||||
@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);
|
|
||||||
|
|
||||||
getBinding().tvProtocol.setText(ss);
|
|
||||||
getBinding().tvProtocol.setHighlightColor(Color.TRANSPARENT);
|
|
||||||
getBinding().tvProtocol.setMovementMethod(new LinkMovementMethod());
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,259 +0,0 @@
|
|||||||
package com.yizhuan.erban.quick_pass;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
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.TextView;
|
|
||||||
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
import com.netease.nim.uikit.StatusBarUtil;
|
|
||||||
import com.yizhuan.erban.R;
|
|
||||||
import com.yizhuan.erban.base.BaseLoginAct;
|
|
||||||
import com.yizhuan.erban.ui.login.LoginPhoneActivity;
|
|
||||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
|
||||||
import com.yizhuan.xchat_android_core.DemoCache;
|
|
||||||
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.AccountCancelException;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.exception.BanAccountException;
|
|
||||||
import com.yizhuan.xchat_android_core.auth.exception.IsSuperAdminException;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.StatisticManager;
|
|
||||||
import com.yizhuan.xchat_android_core.statistic.protocol.StatisticsProtocol;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
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 static final String NEED_CHECKED_PROTOCOL = "need_checked_protocol";
|
|
||||||
|
|
||||||
private static final int quickPassRequestCode = 1000;
|
|
||||||
|
|
||||||
private TextView tvLoginQuickPass;
|
|
||||||
|
|
||||||
private TextView phoneLogin;
|
|
||||||
|
|
||||||
private TextView tvProtocolHint;
|
|
||||||
|
|
||||||
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);
|
|
||||||
EventBus.getDefault().register(this);
|
|
||||||
onFindViews();
|
|
||||||
onSetListener();
|
|
||||||
showLoginTip();
|
|
||||||
AuthModel.get().isFromLogin = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onFindViews() {
|
|
||||||
tvProtocol = findViewById(R.id.tv_protocol);
|
|
||||||
tvProtocolHint = findViewById(R.id.tv_protocol_hint);
|
|
||||||
wxLogin = findViewById(R.id.img_wx_login);
|
|
||||||
tvLoginQuickPass = findViewById(R.id.tv_login_quick_pass);
|
|
||||||
qqLogin = findViewById(R.id.img_qq_login);
|
|
||||||
tvDesc = findViewById(R.id.tv_desc);
|
|
||||||
phoneLogin = findViewById(R.id.img_phone_login);
|
|
||||||
setProtocol();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onSetListener() {
|
|
||||||
wxLogin.setOnClickListener(this);
|
|
||||||
qqLogin.setOnClickListener(this);
|
|
||||||
tvLoginQuickPass.setOnClickListener(this);
|
|
||||||
phoneLogin.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setProtocol() {
|
|
||||||
super.setProtocol();
|
|
||||||
if (DemoCache.readBoolean(NEED_CHECKED_PROTOCOL, false)) {
|
|
||||||
tvProtocol.setChecked(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
tvProtocol.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
|
||||||
if (isChecked) {
|
|
||||||
tvProtocolHint.setVisibility(View.GONE);
|
|
||||||
DemoCache.saveBoolean(NEED_CHECKED_PROTOCOL, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (!tvProtocol.isChecked()) {
|
|
||||||
tvProtocolHint.setVisibility(View.VISIBLE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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_ONE_CLICK_LOGIN, "一键登录");
|
|
||||||
break;
|
|
||||||
case R.id.img_phone_login:
|
|
||||||
StatisticManager.Instance().onEvent(
|
|
||||||
StatisticsProtocol.EVENT_ONE_CLICK_LOGIN_CHANGE_ID, "一键登录-切换账号");
|
|
||||||
LoginPhoneActivity.start(QuickPassLoginAct.this);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void setStatusBar() {
|
|
||||||
super.setStatusBar();
|
|
||||||
StatusBarUtil.transparencyBar(this);
|
|
||||||
StatusBarUtil.StatusBarLightMode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean needSteepStateBar() {
|
|
||||||
return 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_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 if (e instanceof AccountCancelException) {
|
|
||||||
AccountCancelException exception = (AccountCancelException) e;
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日", Locale.getDefault());
|
|
||||||
|
|
||||||
String text = "注销时间:" + simpleDateFormat.format(new Date(exception.getCancelDate()));
|
|
||||||
int end = text.length();
|
|
||||||
text += "\n\n请联系客服(微信:yinyoukefu01)处理哦~";
|
|
||||||
SpannableString spannableString = new SpannableString(text);
|
|
||||||
spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(QuickPassLoginAct.this, R.color.appColor)),
|
|
||||||
0, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
|
|
||||||
getDialogManager().showOkWithTitleDialog("该账号已注销",
|
|
||||||
spannableString, "我知道了", true, null);
|
|
||||||
} else if (e instanceof IOException) {
|
|
||||||
toast("网络异常,请检查您的网络再试~");
|
|
||||||
LoginPhoneActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
|
|
||||||
} else {
|
|
||||||
toast(e.getMessage());
|
|
||||||
LoginPhoneActivity.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();
|
|
||||||
// phoneLogin.setEnabled(true);
|
|
||||||
|
|
||||||
if (resultCode == RESULT_OK) {
|
|
||||||
if (requestCode == quickPassRequestCode) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showThirdPartLogin(boolean isShowWechat, boolean isShowQq, boolean isOneClick) {
|
|
||||||
wxLogin.setVisibility(isShowWechat ? View.VISIBLE : View.INVISIBLE);
|
|
||||||
qqLogin.setVisibility(isShowQq ? View.VISIBLE : View.INVISIBLE);
|
|
||||||
tvLoginQuickPass.setVisibility(isOneClick ? View.VISIBLE : View.INVISIBLE);
|
|
||||||
super.showThirdPartLogin(isShowWechat, isShowQq, isOneClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setClickEnable(boolean enable) {
|
|
||||||
if (tvLoginQuickPass != null) {
|
|
||||||
tvLoginQuickPass.setEnabled(enable);
|
|
||||||
}
|
|
||||||
if (wxLogin != null) {
|
|
||||||
wxLogin.setEnabled(enable);
|
|
||||||
}
|
|
||||||
if (qqLogin != null) {
|
|
||||||
qqLogin.setEnabled(enable);
|
|
||||||
}
|
|
||||||
// if (phoneLogin != null) {
|
|
||||||
// phoneLogin.setEnabled(enable);
|
|
||||||
// }
|
|
||||||
canClick = enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册成功后发送过来的事件
|
|
||||||
*/
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
||||||
public void onLoginEvent(LoginEvent event) {
|
|
||||||
getDialogManager().dismissDialog();
|
|
||||||
setResult(RESULT_OK);
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private boolean checkProtocol() {
|
|
||||||
|
|
||||||
if (!tvProtocol.isChecked()) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Before Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 360 B |
@@ -1,164 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="@color/bg_normal_1c1b22">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_logo"
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="100dp"
|
|
||||||
android:layout_marginTop="105dp"
|
|
||||||
android:src="@drawable/about_logo"
|
|
||||||
app:layout_constraintEnd_toStartOf="@id/tv_slogan"
|
|
||||||
app:layout_constraintHorizontal_chainStyle="packed"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_app_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:text="@string/app_name"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/dp_21"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/tv_slogan"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/iv_logo"
|
|
||||||
app:layout_constraintTop_toTopOf="@id/iv_logo"
|
|
||||||
app:layout_constraintVertical_chainStyle="packed" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_slogan"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="8dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:text="来大鹅,快乐不止游戏"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="13sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@id/iv_logo"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toEndOf="@id/iv_logo"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_app_name" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_login_quick_pass"
|
|
||||||
android:layout_width="270dp"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
android:layout_marginBottom="130dp"
|
|
||||||
android:background="@drawable/bg_common_confirm"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="本机号码一键登录"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/dp_15"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/iv_logo"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/tv_protocol"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:button="@null"
|
|
||||||
android:drawableStart="@drawable/selector_login_radio_btn"
|
|
||||||
android:drawablePadding="@dimen/dp_5"
|
|
||||||
android:text="@string/text_login_protocol"
|
|
||||||
android:textColor="#FFBBB1FF"
|
|
||||||
android:textSize="@dimen/dp_11"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_login_quick_pass"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_protocol_hint"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:background="@drawable/bg_login_protocol_hint"
|
|
||||||
android:gravity="center_horizontal|bottom"
|
|
||||||
android:paddingBottom="6dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:text="同意隐私政策和用户协议后,才可以注册登录哦~"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="10dp"
|
|
||||||
tools:visibility="visible"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_protocol" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/container_third_part"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="@dimen/dp_35"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/img_qq_login"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:drawableTop="@drawable/ic_login_qq"
|
|
||||||
android:drawablePadding="@dimen/dp_15"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="QQ"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/dp_11"
|
|
||||||
android:visibility="gone"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/img_phone_login"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="@dimen/dp_45"
|
|
||||||
android:layout_marginEnd="@dimen/dp_45"
|
|
||||||
android:drawableTop="@drawable/ic_login_phone"
|
|
||||||
android:drawablePadding="@dimen/dp_15"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="手机"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/dp_11" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/img_wx_login"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:drawableTop="@drawable/ic_login_wx"
|
|
||||||
android:drawablePadding="@dimen/dp_15"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="微信"
|
|
||||||
android:textColor="@color/text_title_white"
|
|
||||||
android:textSize="@dimen/dp_11"
|
|
||||||
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_marginStart="26dp"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginEnd="26dp"
|
|
||||||
android:layout_marginBottom="49dp"
|
|
||||||
android:textColor="@color/text_secondary_4f516a"
|
|
||||||
android:textSize="13sp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
tools:text="遇到问题点击这里" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -1,67 +0,0 @@
|
|||||||
<?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/ic_login_wx"
|
|
||||||
android:scaleType="centerCrop" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/qq"
|
|
||||||
android:layout_width="35dp"
|
|
||||||
android:layout_height="35dp"
|
|
||||||
android:layout_marginRight="30dp"
|
|
||||||
android:background="@drawable/ic_login_qq" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
@@ -1,70 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
|
|
||||||
<data>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="295dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:background="@drawable/shape_white_corner_8dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
tools:background="@color/black_transparent_10">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginStart="39dp"
|
|
||||||
android:layout_marginTop="20dp"
|
|
||||||
android:layout_marginEnd="39dp"
|
|
||||||
android:layout_marginBottom="@dimen/dp_14"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:text="提示"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="@dimen/sp_16"
|
|
||||||
android:textStyle="bold"
|
|
||||||
tools:visibility="visible" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_protocol"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_marginStart="39dp"
|
|
||||||
android:layout_marginEnd="39dp"
|
|
||||||
android:layout_marginBottom="@dimen/dp_20"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:text="阅读并同意《隐私政策》与《用户协议》方可登录"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="13sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/btn_ok"
|
|
||||||
android:layout_width="150dp"
|
|
||||||
android:layout_height="38dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:background="@drawable/bg_common_confirm"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="同意"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/btn_cancel"
|
|
||||||
android:layout_width="105dp"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_marginBottom="20dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="暂不使用"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="15sp" />
|
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</layout>
|
|
@@ -1,213 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_label_add_user_info"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/text_complete_user_info"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:layout_marginTop="26dp"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:textSize="25dp"/>
|
|
||||||
|
|
||||||
<com.yizhuan.erban.common.widget.CircleImageView
|
|
||||||
android:id="@+id/civ_avatar"
|
|
||||||
android:layout_width="87dp"
|
|
||||||
android:layout_height="87dp"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
android:src="@drawable/tutu_default_avatar_purple"
|
|
||||||
app:cborder_color="@color/transparent"
|
|
||||||
app:cborder_width="0dp"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
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" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/tv_nick"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
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"
|
|
||||||
android:textColor="@color/color_1A1A1A"
|
|
||||||
android:textColorHint="@color/color_C7C7C7"
|
|
||||||
android:textSize="@dimen/dp_14"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
android:lines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:text="@string/text_default_nick"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
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" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/tv_gender"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:layout_marginEnd="26dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_1A1A1A"
|
|
||||||
android:textColorHint="@color/color_C7C7C7"
|
|
||||||
android:textSize="@dimen/dp_14"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
android:lines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:hint="请选择性别(选择后不可更改)"
|
|
||||||
android:focusable="false"
|
|
||||||
android:focusableInTouchMode="false"
|
|
||||||
android:drawableEnd="@drawable/arrow_right"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_nick"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/tv_birthday"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="@dimen/dp_20"
|
|
||||||
android:layout_marginEnd="26dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:inputType="number"
|
|
||||||
android:paddingBottom="15dp"
|
|
||||||
android:textColor="@color/color_1A1A1A"
|
|
||||||
android:textColorHint="@color/color_C7C7C7"
|
|
||||||
android:textSize="@dimen/dp_14"
|
|
||||||
android:theme="@style/common_edittext_style"
|
|
||||||
android:lines="1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:hint="@string/hint_input_your_birthday"
|
|
||||||
android:focusable="false"
|
|
||||||
android:focusableInTouchMode="false"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_gender"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_warning"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/tips_can_not_register_below_18"
|
|
||||||
android:textColor="@color/text_tertiary"
|
|
||||||
android:layout_marginStart="26dp"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tv_birthday"
|
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/ok_btn"
|
|
||||||
android:layout_width="260dp"
|
|
||||||
android:layout_height="43dp"
|
|
||||||
android:layout_marginTop="@dimen/common_item_view_height"
|
|
||||||
android:layout_marginBottom="@dimen/dp_16"
|
|
||||||
android:background="@drawable/shape_semi_round_gray_solid"
|
|
||||||
android:text="@string/save"
|
|
||||||
android:textColor="@color/color_333333"
|
|
||||||
android:textSize="15dp"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_warning"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
tools:ignore="SpUsage" />
|
|
||||||
|
|
||||||
<!--<TextView-->
|
|
||||||
<!--android:id="@+id/tv_gender_men"-->
|
|
||||||
<!--android:layout_width="125dp"-->
|
|
||||||
<!--android:layout_height="43dp"-->
|
|
||||||
<!--android:layout_marginTop="@dimen/dp_20"-->
|
|
||||||
<!--android:layout_marginEnd="@dimen/dp_15"-->
|
|
||||||
<!--android:background="@drawable/selector_gender_select_men"-->
|
|
||||||
<!--android:drawableStart="@drawable/selector_gender_select_men_padding_drawable"-->
|
|
||||||
<!--android:drawablePadding="@dimen/dp_3"-->
|
|
||||||
<!--android:gravity="center"-->
|
|
||||||
<!--android:paddingStart="@dimen/dp_40"-->
|
|
||||||
<!--android:paddingEnd="@dimen/dp_40"-->
|
|
||||||
<!--android:text="@string/text_gender_men"-->
|
|
||||||
<!--android:textColor="@color/gender_select_text_color"-->
|
|
||||||
<!--android:textSize="@dimen/dp_14"-->
|
|
||||||
<!--app:layout_constraintStart_toStartOf="@+id/tv_birthday"-->
|
|
||||||
<!--app:layout_constraintTop_toBottomOf="@+id/tv_birthday"-->
|
|
||||||
<!--tools:ignore="SpUsage" />-->
|
|
||||||
|
|
||||||
<!--<TextView-->
|
|
||||||
<!--android:id="@+id/tv_gender_women"-->
|
|
||||||
<!--android:layout_width="125dp"-->
|
|
||||||
<!--android:layout_height="43dp"-->
|
|
||||||
<!--android:layout_marginStart="@dimen/dp_15"-->
|
|
||||||
<!--android:layout_marginTop="@dimen/dp_20"-->
|
|
||||||
<!--android:background="@drawable/selector_gender_select_women"-->
|
|
||||||
<!--android:drawableStart="@drawable/selector_gender_select_women_padding_drawable"-->
|
|
||||||
<!--android:drawablePadding="@dimen/dp_3"-->
|
|
||||||
<!--android:gravity="center"-->
|
|
||||||
<!--android:paddingStart="@dimen/dp_40"-->
|
|
||||||
<!--android:paddingEnd="@dimen/dp_40"-->
|
|
||||||
<!--android:text="@string/text_gender_women"-->
|
|
||||||
<!--android:textColor="@color/gender_select_text_color"-->
|
|
||||||
<!--android:textSize="@dimen/dp_14"-->
|
|
||||||
<!--app:layout_constraintEnd_toEndOf="@+id/tv_birthday"-->
|
|
||||||
<!--app:layout_constraintTop_toBottomOf="@+id/tv_birthday"-->
|
|
||||||
<!--tools:ignore="SpUsage" />-->
|
|
||||||
|
|
||||||
<!--<TextView-->
|
|
||||||
<!--android:id="@+id/tv_tips"-->
|
|
||||||
<!--android:layout_width="wrap_content"-->
|
|
||||||
<!--android:layout_height="wrap_content"-->
|
|
||||||
<!--android:layout_marginTop="@dimen/dp_13"-->
|
|
||||||
<!--android:text="性别选择后不可更改"-->
|
|
||||||
<!--android:textColor="@color/color_999999"-->
|
|
||||||
<!--android:textSize="@dimen/dp_12"-->
|
|
||||||
<!--android:visibility="gone"-->
|
|
||||||
<!--app:layout_constraintEnd_toEndOf="@+id/tv_gender_women"-->
|
|
||||||
<!--app:layout_constraintStart_toStartOf="@+id/tv_gender_men"-->
|
|
||||||
<!--app:layout_constraintTop_toBottomOf="@+id/tv_gender_men"-->
|
|
||||||
<!--tools:ignore="SpUsage" />-->
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
@@ -1,19 +0,0 @@
|
|||||||
<?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>
|
|
@@ -3,7 +3,6 @@ package com.yizhuan.xchat_android_core.auth;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.netease.nim.uikit.api.NimUIKit;
|
import com.netease.nim.uikit.api.NimUIKit;
|
||||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||||
@@ -43,6 +42,7 @@ import com.yizhuan.xchat_android_core.linked.LinkedModel;
|
|||||||
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
|
import com.yizhuan.xchat_android_core.linked.bean.LinkedInfo;
|
||||||
import com.yizhuan.xchat_android_core.utils.APIEncryptUtil;
|
import com.yizhuan.xchat_android_core.utils.APIEncryptUtil;
|
||||||
import com.yizhuan.xchat_android_core.utils.CheckUtils;
|
import com.yizhuan.xchat_android_core.utils.CheckUtils;
|
||||||
|
import com.yizhuan.xchat_android_core.utils.LogUtils;
|
||||||
import com.yizhuan.xchat_android_core.utils.OldHttpErrorHandleUtil;
|
import com.yizhuan.xchat_android_core.utils.OldHttpErrorHandleUtil;
|
||||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||||
@@ -56,15 +56,15 @@ import com.yizhuan.xchat_android_library.utils.json.JsonUtils;
|
|||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import cn.sharesdk.facebook.Facebook;
|
||||||
import cn.sharesdk.framework.Platform;
|
import cn.sharesdk.framework.Platform;
|
||||||
import cn.sharesdk.framework.PlatformActionListener;
|
import cn.sharesdk.framework.PlatformActionListener;
|
||||||
import cn.sharesdk.framework.ShareSDK;
|
import cn.sharesdk.framework.ShareSDK;
|
||||||
import cn.sharesdk.tencent.qq.QQ;
|
import cn.sharesdk.google.GooglePlus;
|
||||||
import cn.sharesdk.wechat.friends.Wechat;
|
import cn.sharesdk.line.Line;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import io.reactivex.SingleEmitter;
|
import io.reactivex.SingleEmitter;
|
||||||
import io.reactivex.SingleOnSubscribe;
|
import io.reactivex.SingleOnSubscribe;
|
||||||
@@ -75,8 +75,6 @@ import io.reactivex.functions.Function;
|
|||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
import retrofit2.HttpException;
|
|
||||||
import retrofit2.Response;
|
|
||||||
import retrofit2.http.Field;
|
import retrofit2.http.Field;
|
||||||
import retrofit2.http.FormUrlEncoded;
|
import retrofit2.http.FormUrlEncoded;
|
||||||
import retrofit2.http.GET;
|
import retrofit2.http.GET;
|
||||||
@@ -115,6 +113,9 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
*/
|
*/
|
||||||
private static final int TYPE_LOGIN_NORMAL = 1;
|
private static final int TYPE_LOGIN_NORMAL = 1;
|
||||||
private static final int TYPE_LOGIN_BIND_QQ = 2;
|
private static final int TYPE_LOGIN_BIND_QQ = 2;
|
||||||
|
public static final int TYPE_GOOGLE_LOGIN = 5;
|
||||||
|
public static final int TYPE_LINE_LOGIN = 6;
|
||||||
|
public static final int TYPE_FACEBOOK_LOGIN = 7;
|
||||||
/**
|
/**
|
||||||
* 校验验证码
|
* 校验验证码
|
||||||
*/
|
*/
|
||||||
@@ -126,18 +127,16 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
private static final int TYPE_WECHAT_LOGIN = 1;//微信登录类型
|
private static final int TYPE_WECHAT_LOGIN = 1;//微信登录类型
|
||||||
private static final int TYPE_QQ_LOGIN = 2;//QQ登录类型
|
private static final int TYPE_QQ_LOGIN = 2;//QQ登录类型
|
||||||
private volatile static AuthModel instance = null;
|
private volatile static AuthModel instance = null;
|
||||||
/**
|
|
||||||
* 是否来源于登录
|
|
||||||
*/
|
|
||||||
public boolean isFromLogin = false;
|
|
||||||
boolean isInit = false;
|
boolean isInit = false;
|
||||||
private Api api;
|
private Api api;
|
||||||
@Getter
|
@Getter
|
||||||
private AccountInfo currentAccountInfo;
|
private AccountInfo currentAccountInfo;
|
||||||
private TicketInfo ticketInfo;
|
private TicketInfo ticketInfo;
|
||||||
private ThirdUserInfo thirdUserInfo;
|
private ThirdUserInfo thirdUserInfo;
|
||||||
private Platform wechat;
|
private Platform facebook;
|
||||||
private Platform qq;
|
private Platform line;
|
||||||
|
private Platform google;
|
||||||
/****************************************************** IM *************************************************************/
|
/****************************************************** IM *************************************************************/
|
||||||
|
|
||||||
private StatusCode statusCode;
|
private StatusCode statusCode;
|
||||||
@@ -328,80 +327,71 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信登录
|
* 微信登录
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Single<String> wxLogin(String yiDunToken, String shuMeiDeviceId) {
|
public Single<String> facebookLogin() {
|
||||||
return Single.create(new SingleOnSubscribe<Platform>() {
|
return Single.create((SingleOnSubscribe<Platform>) e -> {
|
||||||
@Override
|
facebook = ShareSDK.getPlatform(Facebook.NAME);
|
||||||
public void subscribe(SingleEmitter<Platform> e) throws Exception {
|
if (facebook == null || !facebook.isClientValid()) {
|
||||||
wechat = ShareSDK.getPlatform(Wechat.NAME);
|
e.onError(new Throwable("未安装facebook"));
|
||||||
if (wechat == null || !wechat.isClientValid()) {
|
return;
|
||||||
e.onError(new Throwable("未安装微信"));
|
}
|
||||||
return;
|
if (facebook.isAuthValid()) {
|
||||||
|
facebook.removeAccount(true);
|
||||||
|
}
|
||||||
|
facebook.setPlatformActionListener(new PlatformActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(final Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||||
|
if (i == Platform.ACTION_USER_INFOR) {
|
||||||
|
String openid = platform.getDb().getUserId();
|
||||||
|
String unionid = platform.getDb().get("unionid");
|
||||||
|
Logger.i(platform.getDb().getUserGender() + "----openid" + openid + "unionid" + unionid + platform.getDb().getUserIcon());
|
||||||
|
thirdUserInfo = new ThirdUserInfo();
|
||||||
|
thirdUserInfo.setPlatform("Facebook");
|
||||||
|
thirdUserInfo.setUserName(platform.getDb().getUserName());
|
||||||
|
thirdUserInfo.setUserGender(platform.getDb().getUserGender());
|
||||||
|
thirdUserInfo.setUserIcon(platform.getDb().getUserIcon());
|
||||||
|
e.onSuccess(platform);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (wechat.isAuthValid()) {
|
|
||||||
wechat.removeAccount(true);
|
@Override
|
||||||
|
public void onError(Platform platform, int i, Throwable throwable) {
|
||||||
|
e.onError(new Throwable("登录出错"+ i));
|
||||||
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
wechat.setPlatformActionListener(new PlatformActionListener() {
|
|
||||||
@Override
|
|
||||||
public void onComplete(final Platform platform, int i, HashMap<String, Object> hashMap) {
|
|
||||||
if (i == Platform.ACTION_USER_INFOR) {
|
|
||||||
String openid = platform.getDb().getUserId();
|
|
||||||
String unionid = platform.getDb().get("unionid");
|
|
||||||
Logger.i("openid" + openid + "unionid" + unionid + platform.getDb().getUserIcon());
|
|
||||||
thirdUserInfo = new ThirdUserInfo();
|
|
||||||
thirdUserInfo.setPlatform("微信");
|
|
||||||
thirdUserInfo.setType(ThirdUserInfo.TYPE_WX);
|
|
||||||
thirdUserInfo.setUserName(platform.getDb().getUserName());
|
|
||||||
thirdUserInfo.setUserGender(platform.getDb().getUserGender());
|
|
||||||
thirdUserInfo.setUserIcon(platform.getDb().getUserIcon());
|
|
||||||
e.onSuccess(platform);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Platform platform, int i, Throwable throwable) {
|
public void onCancel(Platform platform, int i) {
|
||||||
e.onError(new Throwable("获取微信信息失败"));
|
e.onError(new Throwable("登录取消"));
|
||||||
}
|
}
|
||||||
|
});
|
||||||
@Override
|
facebook.SSOSetting(false);
|
||||||
public void onCancel(Platform platform, int i) {
|
facebook.showUser(null);
|
||||||
e.onError(new Throwable("微信登录取消"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
wechat.SSOSetting(false);
|
|
||||||
wechat.showUser(null);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.flatMap(new Function<Platform, SingleSource<String>>() {
|
.flatMap(platform -> {
|
||||||
@Override
|
String openid = platform.getDb().getUserId();
|
||||||
public SingleSource<String> apply(Platform platform) throws Exception {
|
String unionid = platform.getDb().get("unionid");
|
||||||
String openid = platform.getDb().getUserId();
|
String avatar = thirdUserInfo.getUserIcon();
|
||||||
String unionid = platform.getDb().get("unionid");
|
if (avatar != null && avatar.equals("null")) {
|
||||||
return thirdLogin(openid, unionid, TYPE_WECHAT_LOGIN, yiDunToken, shuMeiDeviceId);
|
avatar = null;
|
||||||
}
|
}
|
||||||
})
|
thirdUserInfo.setUserIcon(avatar);
|
||||||
.flatMap(new Function<String, SingleSource<String>>() {
|
String gender = thirdUserInfo.getUserGender();
|
||||||
@Override
|
if (gender != null && !gender.trim().isEmpty()) {
|
||||||
public SingleSource<String> apply(String s) throws Exception {
|
gender = gender.replace("m", "1").replace("f", "2");
|
||||||
return imLogin(currentAccountInfo);
|
|
||||||
}
|
}
|
||||||
|
thirdUserInfo.setUserGender(gender);
|
||||||
|
return thirdLogin(openid, unionid, TYPE_FACEBOOK_LOGIN, "", "");
|
||||||
})
|
})
|
||||||
|
.flatMap(s -> imLogin(currentAccountInfo))
|
||||||
.subscribeOn(AndroidSchedulers.mainThread())
|
.subscribeOn(AndroidSchedulers.mainThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.doOnSuccess(new Consumer<String>() {
|
.doOnSuccess(s -> EventBus.getDefault().post(new LoginEvent()));
|
||||||
@Override
|
|
||||||
public void accept(String s) throws Exception {
|
|
||||||
//登录成功
|
|
||||||
EventBus.getDefault().post(new LoginEvent());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -410,19 +400,19 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Single<String> qqLogin(String yiDunToken, String shuMeiDeviceId) {
|
public Single<String> lineLogin() {
|
||||||
return Single.create(new SingleOnSubscribe<Platform>() {
|
return Single.create(new SingleOnSubscribe<Platform>() {
|
||||||
@Override
|
@Override
|
||||||
public void subscribe(SingleEmitter<Platform> e) throws Exception {
|
public void subscribe(SingleEmitter<Platform> e) throws Exception {
|
||||||
qq = ShareSDK.getPlatform(QQ.NAME);
|
line = ShareSDK.getPlatform(Line.NAME);
|
||||||
if (qq == null || !qq.isClientValid()) {
|
if (line == null || !line.isClientValid()) {
|
||||||
e.onError(new Throwable("未安装腾讯QQ或TIM"));
|
e.onError(new Throwable("未安装Line"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (qq.isAuthValid()) {
|
if (line.isAuthValid()) {
|
||||||
qq.removeAccount(true);
|
line.removeAccount(true);
|
||||||
}
|
}
|
||||||
qq.setPlatformActionListener(new PlatformActionListener() {
|
line.setPlatformActionListener(new PlatformActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||||
if (i == Platform.ACTION_USER_INFOR) {
|
if (i == Platform.ACTION_USER_INFOR) {
|
||||||
@@ -431,7 +421,7 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
Logger.i("openid:" + openid + " unionid:" + unionid + platform.getDb().getUserIcon());
|
Logger.i("openid:" + openid + " unionid:" + unionid + platform.getDb().getUserIcon());
|
||||||
|
|
||||||
thirdUserInfo = new ThirdUserInfo();
|
thirdUserInfo = new ThirdUserInfo();
|
||||||
thirdUserInfo.setType(ThirdUserInfo.TYPE_QQ);
|
thirdUserInfo.setPlatform("LINE");
|
||||||
thirdUserInfo.setUserName(platform.getDb().getUserName());
|
thirdUserInfo.setUserName(platform.getDb().getUserName());
|
||||||
thirdUserInfo.setUserGender(platform.getDb().getUserGender());
|
thirdUserInfo.setUserGender(platform.getDb().getUserGender());
|
||||||
thirdUserInfo.setUserIcon(platform.getDb().getUserIcon());
|
thirdUserInfo.setUserIcon(platform.getDb().getUserIcon());
|
||||||
@@ -441,44 +431,112 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Platform platform, int i, Throwable throwable) {
|
public void onError(Platform platform, int i, Throwable throwable) {
|
||||||
e.onError(new Throwable("获取QQ登录信息错误"));
|
e.onError(new Throwable("登录出错" + i));
|
||||||
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancel(Platform platform, int i) {
|
public void onCancel(Platform platform, int i) {
|
||||||
e.onError(new Throwable("QQ登录取消"));
|
e.onError(new Throwable("取消登录"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
qq.SSOSetting(false);
|
line.SSOSetting(false);
|
||||||
qq.showUser(null);
|
line.showUser(null);
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.flatMap(new Function<Platform, SingleSource<String>>() {
|
.flatMap(platform -> {
|
||||||
@Override
|
String openid = platform.getDb().getUserId();
|
||||||
public SingleSource<String> apply(Platform platform) throws Exception {
|
String unionid = platform.getDb().get("unionid");
|
||||||
String openid = platform.getDb().getUserId();
|
String avatar = thirdUserInfo.getUserIcon();
|
||||||
String unionid = platform.getDb().get("unionid");
|
if (avatar != null && avatar.equals("null")) {
|
||||||
return thirdLogin(openid, unionid, TYPE_QQ_LOGIN, yiDunToken, shuMeiDeviceId);
|
avatar = null;
|
||||||
}
|
}
|
||||||
})
|
thirdUserInfo.setUserIcon(avatar);
|
||||||
.flatMap(new Function<String, SingleSource<String>>() {
|
String gender = thirdUserInfo.getUserGender();
|
||||||
@Override
|
if (gender != null && !gender.trim().isEmpty()) {
|
||||||
public SingleSource<String> apply(String s) throws Exception {
|
gender = gender.replace("m", "1").replace("f", "2");
|
||||||
return imLogin(currentAccountInfo);
|
|
||||||
}
|
}
|
||||||
|
thirdUserInfo.setUserGender(gender);
|
||||||
|
return thirdLogin(openid, unionid, TYPE_LINE_LOGIN, "", "");
|
||||||
})
|
})
|
||||||
|
.flatMap(s -> imLogin(currentAccountInfo))
|
||||||
.subscribeOn(AndroidSchedulers.mainThread())
|
.subscribeOn(AndroidSchedulers.mainThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.doOnSuccess(new Consumer<String>() {
|
.compose(RxHelper.handleException())
|
||||||
@Override
|
.doOnSuccess(s -> EventBus.getDefault().post(new LoginEvent()));
|
||||||
public void accept(String s) throws Exception {
|
|
||||||
//登录成功
|
|
||||||
EventBus.getDefault().post(new LoginEvent());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Single<String> googleLogin() {
|
||||||
|
return Single.create(new SingleOnSubscribe<Platform>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(SingleEmitter<Platform> e) throws Exception {
|
||||||
|
google = ShareSDK.getPlatform(GooglePlus.NAME);
|
||||||
|
//是否安装客户端
|
||||||
|
if (google == null || !google.isClientValid()) {
|
||||||
|
e.onError(new Throwable("未安装gmail"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//判断指定平台是否已经完成授权
|
||||||
|
if (google.isAuthValid()) {
|
||||||
|
google.removeAccount(true);
|
||||||
|
}
|
||||||
|
google.setPlatformActionListener(new PlatformActionListener() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
|
||||||
|
if (i == Platform.ACTION_USER_INFOR) {
|
||||||
|
String openid = platform.getDb().getUserId();
|
||||||
|
String unionid = platform.getDb().get("unionid");
|
||||||
|
Logger.i("openid:" + openid + " unionid:" + unionid + platform.getDb().getUserIcon());
|
||||||
|
|
||||||
|
thirdUserInfo = new ThirdUserInfo();
|
||||||
|
thirdUserInfo.setPlatform("Google");
|
||||||
|
thirdUserInfo.setUserName(platform.getDb().getUserName());
|
||||||
|
thirdUserInfo.setUserGender(platform.getDb().getUserGender());
|
||||||
|
thirdUserInfo.setUserIcon(platform.getDb().getUserIcon());
|
||||||
|
e.onSuccess(platform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Platform platform, int i, Throwable throwable) {
|
||||||
|
throwable.printStackTrace();
|
||||||
|
LogUtils.d("googleLogin" + i);
|
||||||
|
e.onError(new Throwable("登录出错" + i));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCancel(Platform platform, int i) {
|
||||||
|
e.onError(new Throwable("取消登录"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
google.SSOSetting(false);
|
||||||
|
google.showUser(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.flatMap(platform -> {
|
||||||
|
String openid = platform.getDb().getUserId();
|
||||||
|
String unionid = platform.getDb().get("unionid");
|
||||||
|
String avatar = thirdUserInfo.getUserIcon();
|
||||||
|
if (avatar != null && avatar.equals("null")) {
|
||||||
|
avatar = null;
|
||||||
|
}
|
||||||
|
thirdUserInfo.setUserIcon(avatar);
|
||||||
|
String gender = thirdUserInfo.getUserGender();
|
||||||
|
if (gender != null && !gender.trim().isEmpty()) {
|
||||||
|
gender = gender.replace("m", "1").replace("f", "2");
|
||||||
|
}
|
||||||
|
thirdUserInfo.setUserGender(gender);
|
||||||
|
return thirdLogin(openid, unionid, TYPE_GOOGLE_LOGIN, "", "");
|
||||||
|
})
|
||||||
|
.flatMap(s -> imLogin(currentAccountInfo))
|
||||||
|
.subscribeOn(AndroidSchedulers.mainThread())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.compose(RxHelper.handleException())
|
||||||
|
.doOnSuccess(s -> EventBus.getDefault().post(new LoginEvent()));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 第三方信息登录
|
* 第三方信息登录
|
||||||
*
|
*
|
||||||
@@ -546,75 +604,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Single<String> quickPassLogin(String token, String accessToken, String shuMeiDeviceId, String yiDunToken) {
|
|
||||||
return Single.create(new SingleOnSubscribe<String>() {
|
|
||||||
@Override
|
|
||||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
|
||||||
//获取登录信息
|
|
||||||
try {
|
|
||||||
LoginResult loginResult = api.quickPassLogin(token, accessToken, yiDunToken, shuMeiDeviceId).blockingGet();
|
|
||||||
if (!loginResult.isSuccess()) {
|
|
||||||
if (loginResult.getCode() == CODE_BAN_ACCOUNT || loginResult.getCode() == CODE_BAN_DEVICE) {
|
|
||||||
emitter.onError(new BanAccountException(loginResult.getReason(), loginResult.getDate()));
|
|
||||||
} else if (loginResult.getCode() == CODE_ACCOUNT_CANCEL) {
|
|
||||||
emitter.onError(new AccountCancelException(loginResult.getMessage(), loginResult.getErbanNo(), loginResult.getCancelDate()));
|
|
||||||
} else if (loginResult.getCode() == SUPER_CODE_SHOW_CODE) {
|
|
||||||
//是否是超管
|
|
||||||
if (loginResult.getSuperCodeVerify() == 1) {
|
|
||||||
emitter.onError(new IsSuperAdminException(loginResult.getMessage()));
|
|
||||||
} else {
|
|
||||||
emitter.onError(new Throwable(loginResult.getMessage()));
|
|
||||||
}
|
|
||||||
} else if (loginResult.getCode() == CODE_BIG_HEAD_NUM) {
|
|
||||||
emitter.onError(new BigHeadPhoneException(loginResult.getMessage()));
|
|
||||||
} else {
|
|
||||||
emitter.onError(new Throwable(loginResult.getMessage()));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
currentAccountInfo = loginResult.getData();
|
|
||||||
DemoCache.saveCurrentAccountInfo(currentAccountInfo);
|
|
||||||
//成功获取到uid后,就通知首页刷新审核中状态的数据
|
|
||||||
EventBus.getDefault().post(new GetCurrentUidEvent(true));
|
|
||||||
} catch (Exception e) {
|
|
||||||
emitter.onError(new Throwable(OldHttpErrorHandleUtil.handle(e)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
//获取tick
|
|
||||||
try {
|
|
||||||
TicketResult ticketResult = requestTicket().blockingGet();
|
|
||||||
if (!ticketResult.isSuccess()) {
|
|
||||||
emitter.onError(new Throwable(ticketResult.getMessage()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ticketInfo = ticketResult.getData();
|
|
||||||
DemoCache.saveTicketInfo(ticketInfo);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
emitter.onError(new Throwable(OldHttpErrorHandleUtil.handle(e)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emitter.onSuccess("登录成功!");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.flatMap(new Function<String, SingleSource<String>>() {
|
|
||||||
@Override
|
|
||||||
public SingleSource<String> apply(String s) throws Exception {
|
|
||||||
return imLogin(currentAccountInfo);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.doOnSuccess(new Consumer<String>() {
|
|
||||||
@Override
|
|
||||||
public void accept(String s) throws Exception {
|
|
||||||
//登录成功后发出登录事件
|
|
||||||
EventBus.getDefault().post(new LoginEvent());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取tick
|
* 获取tick
|
||||||
*
|
*
|
||||||
@@ -627,10 +616,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Single<ServiceResult<String>> isExistsQQAccount(String qqOpenid) {
|
|
||||||
return api.isExistsQqAccount(qqOpenid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置
|
* 重置
|
||||||
*/
|
*/
|
||||||
@@ -653,36 +638,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
return pwd;
|
return pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取短信验证码
|
|
||||||
*
|
|
||||||
* @param phone
|
|
||||||
* @param type
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Single<String> requestSMSCode(String phone, int type) {
|
|
||||||
return Single.create(new SingleOnSubscribe<String>() {
|
|
||||||
@Override
|
|
||||||
public void subscribe(SingleEmitter<String> emitter) throws Exception {
|
|
||||||
try {
|
|
||||||
ServiceResult serviceResult = api.requestSMSCode(
|
|
||||||
DESUtils.DESAndBase64(phone),
|
|
||||||
String.valueOf(type)
|
|
||||||
).blockingGet();
|
|
||||||
if (!serviceResult.isSuccess()) {
|
|
||||||
emitter.onError(new Throwable(serviceResult.getMessage()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emitter.onSuccess("获取短信验证码成功");
|
|
||||||
} catch (Exception e) {
|
|
||||||
emitter.onError(new Throwable(OldHttpErrorHandleUtil.handle(e)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置密码
|
* 重置密码
|
||||||
*
|
*
|
||||||
@@ -773,42 +728,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
.compose(RxHelper.handleSchedulers());
|
.compose(RxHelper.handleSchedulers());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取手机验证码
|
|
||||||
*
|
|
||||||
* @param phone
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Single<String> getSMSCode(String phone) {
|
|
||||||
|
|
||||||
Map<String, String> paramsEncrypt = new HashMap<>();
|
|
||||||
paramsEncrypt.put("phone", phone);
|
|
||||||
String paramsStr = "";
|
|
||||||
String signStr = "";
|
|
||||||
try {
|
|
||||||
paramsStr = APIEncryptUtil.encryptParams(paramsEncrypt);
|
|
||||||
signStr = APIEncryptUtil.paramsToSign(paramsEncrypt);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return api.getSMSCode(
|
|
||||||
paramsStr,
|
|
||||||
signStr
|
|
||||||
)
|
|
||||||
.flatMap(new Function<ServiceResult, SingleSource<String>>() {
|
|
||||||
@Override
|
|
||||||
public SingleSource<String> apply(ServiceResult serviceResult) throws Exception {
|
|
||||||
if (!serviceResult.isSuccess()) {
|
|
||||||
return Single.error(new Throwable(serviceResult.getMessage()));
|
|
||||||
}
|
|
||||||
return Single.just("获取手机验证码成功");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.subscribeOn(Schedulers.io())
|
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册
|
* 注册
|
||||||
@@ -855,21 +774,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册-获取验证码
|
|
||||||
*
|
|
||||||
* @param phone
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Single<ResponseBody> getVerificationCode(String phone) {
|
|
||||||
long timestamp = System.currentTimeMillis() + InitialModel.get().getTimeDiff();
|
|
||||||
String nonce = RandomStringUtil.getRandomString(6);
|
|
||||||
String sign = MD5Utils.getMD5String(phone + nonce + timestamp);
|
|
||||||
return api.getVerificationCode(phone, timestamp, nonce, sign)
|
|
||||||
.compose(RxHelper.handleSchedulers());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出登录
|
* 退出登录
|
||||||
*
|
*
|
||||||
@@ -972,12 +876,6 @@ public class AuthModel extends BaseModel implements IAuthModel {
|
|||||||
.compose(new Transformer<>());
|
.compose(new Transformer<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Single<ServiceResult<String>> recoverAccount(String erbanNo) {
|
|
||||||
return api.recoverAccount(erbanNo)
|
|
||||||
.compose(RxHelper.handleSchedulers());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断IM 登录状态
|
* 判断IM 登录状态
|
||||||
*
|
*
|
||||||
|
@@ -50,25 +50,17 @@ public interface IAuthModel extends IModel{
|
|||||||
*/
|
*/
|
||||||
Single<String> login(String account, String password, String code, String yiDunToken, String shuMeiDeviceId);
|
Single<String> login(String account, String password, String code, String yiDunToken, String shuMeiDeviceId);
|
||||||
|
|
||||||
Single<String> wxLogin(String yiDunToken, String shuMeiDeviceId);
|
Single<String> facebookLogin();
|
||||||
|
|
||||||
Single<String> qqLogin(String yiDunToken, String shuMeiDeviceId);
|
Single<String> lineLogin();
|
||||||
|
|
||||||
Single<ServiceResult<String>> isExistsQQAccount(String qqOpenid);
|
Single<String> googleLogin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置用户信息
|
* 重置用户信息
|
||||||
*/
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取短信验证码
|
|
||||||
* @param phone
|
|
||||||
* @param type
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Single<String> requestSMSCode(String phone, int type);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置密码
|
* 重置密码
|
||||||
* @param phone
|
* @param phone
|
||||||
@@ -92,13 +84,6 @@ public interface IAuthModel extends IModel{
|
|||||||
*/
|
*/
|
||||||
Single<String> bindPhone(String phone, String code);
|
Single<String> bindPhone(String phone, String code);
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取手机验证码
|
|
||||||
* @param phone
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Single<String> getSMSCode(String phone);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册
|
* 注册
|
||||||
* @param phone
|
* @param phone
|
||||||
@@ -111,13 +96,6 @@ public interface IAuthModel extends IModel{
|
|||||||
Single<String> register(String phone, String sms_code, String verifyCode, String password,
|
Single<String> register(String phone, String sms_code, String verifyCode, String password,
|
||||||
String yiDunToken, String shuMeiDeviceId);
|
String yiDunToken, String shuMeiDeviceId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 注册-获取验证码
|
|
||||||
* @param phone
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Single<ResponseBody> getVerificationCode(String phone);
|
|
||||||
|
|
||||||
Single<String> logout();
|
Single<String> logout();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,10 +124,4 @@ public interface IAuthModel extends IModel{
|
|||||||
*/
|
*/
|
||||||
boolean isImLogin();
|
boolean isImLogin();
|
||||||
|
|
||||||
/**
|
|
||||||
* 一键登录
|
|
||||||
*/
|
|
||||||
Single<String> quickPassLogin(String token, String accessToken, String shuMeiDeviceId, String yiDunToken);
|
|
||||||
|
|
||||||
Single<ServiceResult<String>> recoverAccount(String erbanNo);
|
|
||||||
}
|
}
|
||||||
|
33
mob.gradle
@@ -8,25 +8,26 @@ MobSDK {
|
|||||||
//平台配置信息
|
//平台配置信息
|
||||||
gui false
|
gui false
|
||||||
devInfo {
|
devInfo {
|
||||||
Wechat {
|
Facebook {
|
||||||
appId "wx3f0462eb7eccd64f"
|
appKey "1266232494209868"
|
||||||
appSecret "1c07949e3f53433f1c6038bfcdd54c40"
|
appSecret "c9b170b383f8be9cdf118823b8632821"
|
||||||
}
|
callbackUri "https://mob.com"
|
||||||
WechatMoments {
|
|
||||||
appId "wx3f0462eb7eccd64f"
|
|
||||||
appSecret "1c07949e3f53433f1c6038bfcdd54c40"
|
|
||||||
}
|
|
||||||
QQ {
|
|
||||||
appId "101937205"
|
|
||||||
appKey "458ed9d671ba4b177799189db5fbc434"
|
|
||||||
shareByAppClient true
|
|
||||||
}
|
|
||||||
QZone {
|
|
||||||
appId "101937205"
|
|
||||||
appKey "458ed9d671ba4b177799189db5fbc434"
|
|
||||||
shareByAppClient true
|
shareByAppClient true
|
||||||
|
enable true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GooglePlus {
|
||||||
|
appId "766987211654-2b4de5kbhe7tpgtfto4bjll3dj7ih26u.apps.googleusercontent.com"
|
||||||
|
callbackUri "http://localhost"
|
||||||
|
officialVersion "default"
|
||||||
|
enable true
|
||||||
|
}
|
||||||
|
|
||||||
|
Line {
|
||||||
|
appId "1657475529"
|
||||||
|
appSecret "903d014c269d65b827cd32997836e60b"
|
||||||
|
enable true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -3,22 +3,22 @@
|
|||||||
<SinaWeibo Enable="false" />
|
<SinaWeibo Enable="false" />
|
||||||
<TencentWeibo Enable="false" />
|
<TencentWeibo Enable="false" />
|
||||||
<Douban Enable="false" />
|
<Douban Enable="false" />
|
||||||
<QZone AppId="101937205" AppKey="458ed9d671ba4b177799189db5fbc434" ShareByAppClient="true" />
|
<QZone Enable="false" />
|
||||||
<Renren Enable="false" />
|
<Renren Enable="false" />
|
||||||
<KaiXin Enable="false" />
|
<KaiXin Enable="false" />
|
||||||
<Facebook Enable="false" />
|
<Facebook ShareByAppClient="true" Enable="true" ConsumerKey="1266232494209868" ConsumerSecret="c9b170b383f8be9cdf118823b8632821" RedirectUrl="https://mob.com" />
|
||||||
<Twitter Enable="false" />
|
<Twitter Enable="false" />
|
||||||
<Evernote Enable="false" />
|
<Evernote Enable="false" />
|
||||||
<FourSquare Enable="false" />
|
<FourSquare Enable="false" />
|
||||||
<GooglePlus Enable="false" />
|
<GooglePlus OfficialVersion="default" Enable="true" ClientID="766987211654-2b4de5kbhe7tpgtfto4bjll3dj7ih26u.apps.googleusercontent.com" RedirectUrl="http://localhost" />
|
||||||
<Instagram Enable="false" />
|
<Instagram Enable="false" />
|
||||||
<LinkedIn Enable="false" />
|
<LinkedIn Enable="false" />
|
||||||
<Tumblr Enable="false" />
|
<Tumblr Enable="false" />
|
||||||
<Email Enable="false" />
|
<Email Enable="false" />
|
||||||
<ShortMessage Enable="false" />
|
<ShortMessage Enable="false" />
|
||||||
<Wechat AppId="wx3f0462eb7eccd64f" AppSecret="1c07949e3f53433f1c6038bfcdd54c40" />
|
<Wechat Enable="false" />
|
||||||
<WechatMoments AppId="wx3f0462eb7eccd64f" AppSecret="1c07949e3f53433f1c6038bfcdd54c40" />
|
<WechatMoments Enable="false" />
|
||||||
<QQ AppId="101937205" AppKey="458ed9d671ba4b177799189db5fbc434" ShareByAppClient="true" />
|
<QQ Enable="false" />
|
||||||
<Instapaper Enable="false" />
|
<Instapaper Enable="false" />
|
||||||
<Pocket Enable="false" />
|
<Pocket Enable="false" />
|
||||||
<YouDao Enable="false" />
|
<YouDao Enable="false" />
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
<Yixin Enable="false" />
|
<Yixin Enable="false" />
|
||||||
<YixinMoments Enable="false" />
|
<YixinMoments Enable="false" />
|
||||||
<Mingdao Enable="false" />
|
<Mingdao Enable="false" />
|
||||||
<Line Enable="false" />
|
<Line Enable="true" ChannelID="1657475529" ChannelSecret="903d014c269d65b827cd32997836e60b" />
|
||||||
<WhatsApp Enable="false" />
|
<WhatsApp Enable="false" />
|
||||||
<KakaoTalk Enable="false" />
|
<KakaoTalk Enable="false" />
|
||||||
<KakaoStory Enable="false" />
|
<KakaoStory Enable="false" />
|
||||||
|