启动页 登录注册 个人页面
@ -78,6 +78,7 @@ dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation rootProject.ext.dependencies["recyclerview-androidx"]
|
||||
implementation project(path: ':lib_country_code')
|
||||
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
//common
|
||||
|
@ -103,6 +103,11 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activity.login.EntryActivity"
|
||||
android:exported="true"/>
|
||||
|
||||
<activity
|
||||
android:name=".activity.MainActivity"
|
||||
android:exported="false" />
|
||||
@ -114,6 +119,16 @@
|
||||
android:name=".activity.message.ChatActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
||||
|
||||
<activity
|
||||
android:name=".activity.login.LoginActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
||||
<activity
|
||||
android:name=".activity.login.FindPwdActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
||||
|
||||
<activity
|
||||
android:name=".activity.login.RegisterActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize"/>
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.shayu.onetoone.fileprovider"
|
||||
|
@ -2,9 +2,29 @@ package com.shayu.onetoone.activity;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
||||
import static com.yunbao.common.CommonAppContext.sInstance;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.core.app.ActivityOptionsCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@ -12,23 +32,46 @@ import com.blankj.utilcode.util.DeviceUtils;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.login.EntryActivity;
|
||||
import com.shayu.onetoone.manager.RouteManager;
|
||||
import com.shayu.onetoone.utils.MainHttpConsts;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.tencent.rtmp.ITXLivePlayListener;
|
||||
import com.tencent.rtmp.TXLiveBase;
|
||||
import com.tencent.rtmp.TXLiveConstants;
|
||||
import com.tencent.rtmp.TXLivePlayer;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.tencent.ugc.TXUGCBase;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.AdBean;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.custom.CircleProgress;
|
||||
import com.yunbao.common.event.DataUserInfoEvent;
|
||||
import com.yunbao.common.event.UpdateTablePointMe;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.JsonBean;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.DownloadUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.LogUtil;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import com.linecorp.linesdk.Scope;
|
||||
import com.linecorp.linesdk.auth.LineAuthenticationParams;
|
||||
@ -53,12 +96,48 @@ import com.facebook.ProfileTracker;
|
||||
import com.facebook.login.LoginManager;
|
||||
import com.facebook.login.LoginResult;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 启动Activity
|
||||
*/
|
||||
public class LauncherActivity extends AbsOTOActivity {
|
||||
public class LauncherActivity extends AbsOTOActivity implements View.OnClickListener {
|
||||
|
||||
private static final String TAG = "LauncherActivity";
|
||||
private static final int WHAT_GET_CONFIG = 0;
|
||||
private static final int WHAT_COUNT_DOWN = 1;
|
||||
protected Context mContext;
|
||||
private Handler mHandler;
|
||||
private ViewGroup mRoot;
|
||||
private ImageView mCover;
|
||||
private ViewGroup mContainer;
|
||||
private CircleProgress mCircleProgress;
|
||||
private List<AdBean> mAdList;
|
||||
private List<ImageView> mImageViewList;
|
||||
private int mMaxProgressVal;
|
||||
private int mCurProgressVal;
|
||||
private int mAdIndex;
|
||||
private int mInterval = 2000;
|
||||
private View mBtnSkipImage;
|
||||
private View mBtnSkipVideo;
|
||||
private TXCloudVideoView mTXCloudVideoView;
|
||||
private TXLivePlayer mPlayer;
|
||||
private boolean mPaused;
|
||||
private int mVideoLastProgress;
|
||||
private boolean mForward;
|
||||
|
||||
@Override
|
||||
public Resources getResources() {
|
||||
Resources res = super.getResources();
|
||||
Configuration config = new Configuration();
|
||||
config.setToDefaults();
|
||||
config.locale = IMLoginManager.get(this).getLocaleLanguage();
|
||||
res.updateConfiguration(config, res.getDisplayMetrics());
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -67,78 +146,461 @@ public class LauncherActivity extends AbsOTOActivity {
|
||||
|
||||
@Override
|
||||
protected void main(Bundle savedInstanceState) {
|
||||
// getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
|
||||
// EventBus.getDefault().register(this);
|
||||
setStatusBar();
|
||||
setContentView(R.layout.activity_launcher);
|
||||
mContext = this;
|
||||
mRoot = findViewById(R.id.root);
|
||||
mCover = findViewById(R.id.cover);
|
||||
mCircleProgress = findViewById(R.id.progress);
|
||||
mContainer = findViewById(R.id.container);
|
||||
mBtnSkipImage = findViewById(R.id.btn_skip_img);
|
||||
mBtnSkipVideo = findViewById(R.id.btn_skip_video);
|
||||
mBtnSkipImage.setOnClickListener(this);
|
||||
mBtnSkipVideo.setOnClickListener(this);
|
||||
ImgLoader.display(mContext, R.mipmap.screen, mCover);
|
||||
mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
switch (msg.what) {
|
||||
case WHAT_GET_CONFIG:
|
||||
getConfig();
|
||||
break;
|
||||
case WHAT_COUNT_DOWN:
|
||||
updateCountDown();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
mHandler.sendEmptyMessageDelayed(WHAT_GET_CONFIG, 1000);
|
||||
LogUtil.uploadErrorLog(sInstance);
|
||||
SpUtil.getInstance().setBooleanValue("NOTIFICATION", NotificationManagerCompat.from(this).areNotificationsEnabled());
|
||||
}
|
||||
|
||||
findViewById(R.id.login).setOnClickListener(view -> {
|
||||
//账号密码登录 临时用的登录代码,将就下
|
||||
String account = ((EditText) findViewById(R.id.edit_user)).getText().toString();
|
||||
String password= ((EditText) findViewById(R.id.edit_password)).getText().toString();
|
||||
MainHttpUtil.login(account, password, DeviceUtils.getUniqueDeviceId(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String uid = obj.getString("id");
|
||||
String token = obj.getString("token");
|
||||
// mFirstLogin = obj.getIntValue("first_login") == 1;
|
||||
// mShowInvite = obj.getIntValue("isagent") == 1;
|
||||
CommonAppConfig.getInstance().setLoginInfo(uid, token, true);
|
||||
//设置登录信息
|
||||
IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class);
|
||||
IMLoginManager.get(mContext).setupLoginUser(model);
|
||||
connectRongCloud();
|
||||
/**
|
||||
* 图片倒计时
|
||||
*/
|
||||
private void updateCountDown() {
|
||||
mCurProgressVal += 100;
|
||||
if (mCurProgressVal > mMaxProgressVal) {
|
||||
return;
|
||||
}
|
||||
if (mCircleProgress != null) {
|
||||
mCircleProgress.setCurProgress(mCurProgressVal);
|
||||
}
|
||||
int index = mCurProgressVal / mInterval;
|
||||
if (index < mAdList.size() && mAdIndex != index) {
|
||||
View v = mImageViewList.get(mAdIndex);
|
||||
if (v != null && v.getVisibility() == View.VISIBLE) {
|
||||
v.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
mAdIndex = mCurProgressVal / mInterval;
|
||||
}
|
||||
if (mCurProgressVal < mMaxProgressVal) {
|
||||
if (mHandler != null) {
|
||||
mHandler.sendEmptyMessageDelayed(WHAT_COUNT_DOWN, 100);
|
||||
}
|
||||
} else if (mCurProgressVal == mMaxProgressVal) {
|
||||
checkUidAndToken();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取Config信息
|
||||
*/
|
||||
private void getConfig() {
|
||||
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
|
||||
@Override
|
||||
public void callback(ConfigBean bean) {
|
||||
if (bean != null) {
|
||||
L.e(TAG, "----------> getPaster360Url:" + bean.getBeautyKey() + " " + bean.getPaster360Url());
|
||||
CommonAppConfig.getInstance().setBeautySdkType(bean.getSproutType());
|
||||
//转盘开关
|
||||
CommonAppConfig.getInstance().setTurnTableEnable(bean.getTurntableEnable());
|
||||
CommonAppConfig.getInstance().setBeauty360TieZhiUrl(bean.getPaster360Url());
|
||||
CommonAppConfig.getInstance().setAnchorPkTime(bean.getPkTime());
|
||||
if (!TextUtils.isEmpty(bean.getTxVideoUgcLicenceUrl()) && !TextUtils.isEmpty(bean.getTxVideoUgcKey()))
|
||||
Log.i("tvv", bean.getTxVideoUgcLicenceUrl() + "是" + bean.getTxVideoUgcKey());
|
||||
TXLiveBase.getInstance().setLicence(LauncherActivity.this, bean.getTxVideoUgcLicenceUrl(), bean.getTxVideoUgcKey());
|
||||
TXUGCBase.getInstance().setLicence(LauncherActivity.this, bean.getTxPlayUgcLicenceUrl(), bean.getTxVideoUgcKey());
|
||||
|
||||
String adInfo = bean.getAdInfo();
|
||||
if (!TextUtils.isEmpty(adInfo)) {
|
||||
JSONObject obj = JSON.parseObject(adInfo);
|
||||
Log.i(TAG, "callback: " + adInfo);
|
||||
if (obj.getIntValue("switch") == 1) {
|
||||
List<AdBean> list = JSON.parseArray(obj.getString("list"), AdBean.class);
|
||||
if (list != null && list.size() > 0) {
|
||||
mAdList = list;
|
||||
mInterval = obj.getIntValue("time") * 1000;
|
||||
if (mContainer != null) {
|
||||
mContainer.setOnClickListener(LauncherActivity.this);
|
||||
}
|
||||
String[] uidAndToken = SpUtil.getInstance().getMultiStringValue(
|
||||
new String[]{SpUtil.UID, SpUtil.TOKEN});
|
||||
final String uid = uidAndToken[0];
|
||||
final String token = uidAndToken[1];
|
||||
if (!TextUtils.isEmpty(uid) && !TextUtils.isEmpty(token)) {
|
||||
playAD(obj.getIntValue("type") == 0);
|
||||
} else {
|
||||
releaseVideo();
|
||||
LauncherActivity.this.startActivity(new Intent(LauncherActivity.this, EntryActivity.class));
|
||||
LauncherActivity.this.finish();
|
||||
}
|
||||
} else {
|
||||
checkUidAndToken();
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
checkUidAndToken();
|
||||
}
|
||||
} else {
|
||||
checkUidAndToken();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void connectRongCloud() {
|
||||
HttpClient.getInstance().get("User.getBaseInfos", "getBaseInfo")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
IMLoginManager.get(CommonAppContext.sInstance.getApplicationContext()).upDataUserInfo(info[0]);
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
UserBean bean = JSON.toJavaObject(obj, UserBean.class);
|
||||
bean.setMedalName(obj.getString("medal_name"));
|
||||
bean.setMedalLevel(obj.getIntValue("medal_level"));
|
||||
CommonAppConfig.getInstance().setUserBean(bean);
|
||||
CommonAppConfig.getInstance().setUserItemList(obj.getString("list"));
|
||||
bean.seUserInfoComplete(obj.getIntValue("user_info_complete"));
|
||||
SpUtil.getInstance().setStringValue(SpUtil.USER_INFO, info[0]);
|
||||
/**
|
||||
* 检查uid和token是否存在
|
||||
*/
|
||||
private void checkUidAndToken() {
|
||||
if (mForward) {
|
||||
return;
|
||||
}
|
||||
mForward = true;
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
mHandler = null;
|
||||
}
|
||||
IMLoginModel model = IMLoginManager.get(this).getUserInfo();
|
||||
if (model != null) {
|
||||
IMLoginManager.get(this).upDataUserInfo();
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(this);
|
||||
forwardMainActivity();
|
||||
} else {
|
||||
//兼容老版本
|
||||
if (IMLoginManager.get(this).checkOLd()) {
|
||||
IMLoginManager.get(this).upDataUserInfo();
|
||||
} else {
|
||||
releaseVideo();
|
||||
this.startActivity(new Intent(this, EntryActivity.class));
|
||||
this.finish();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(mContext);
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
System.out.println("code = " + code + ", msg = " + msg + ", info = " + Arrays.toString(info));
|
||||
RouteManager.forwardMainActivity();
|
||||
finish();
|
||||
/**
|
||||
* 跳转到首页
|
||||
*/
|
||||
private void forwardMainActivity() {
|
||||
releaseVideo();
|
||||
Intent intent = new Intent(
|
||||
LauncherActivity.this, MainActivity.class);
|
||||
intent.putExtra(Constants.SHOW_INVITE, false);
|
||||
|
||||
}
|
||||
if (getIntent().getStringExtra("liveid") != null) {
|
||||
intent.putExtra("liveid", getIntent().getStringExtra("liveid"));
|
||||
}
|
||||
if (getIntent().getStringExtra("type") != null) {
|
||||
intent.putExtra("type", getIntent().getStringExtra("type"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<JsonBean> response) {
|
||||
super.onError(response);
|
||||
String message = response.message();
|
||||
System.out.println(">>>>>" + message);
|
||||
}
|
||||
});
|
||||
if (getIntent().getStringExtra("activityUrl") != null) {
|
||||
intent.putExtra("activityUrl", getIntent().getStringExtra("activityUrl"));
|
||||
}
|
||||
if (mImageViewList != null && mImageViewList.size() > 0) {
|
||||
Log.i(TAG, "forwardMainActivity: " + mImageViewList.size());
|
||||
AdBean bean = mAdList.get(0);
|
||||
if (bean != null && bean.getAnimation() == 1) {
|
||||
intent.putExtra("ad_url", mAdList.get(0).getUrl());
|
||||
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(LauncherActivity.this, mImageViewList.get(0), "ad_img_0").toBundle();
|
||||
LauncherActivity.this.startActivity(intent, bundle);
|
||||
} else {
|
||||
LauncherActivity.this.startActivity(intent);
|
||||
}
|
||||
} else {
|
||||
LauncherActivity.this.startActivity(intent);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
mHandler = null;
|
||||
}
|
||||
MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO);
|
||||
CommonHttpUtil.cancel(CommonHttpConsts.GET_CONFIG);
|
||||
releaseVideo();
|
||||
// if (mLauncherAdViewHolder != null) {
|
||||
// mLauncherAdViewHolder.release();
|
||||
// }
|
||||
// mLauncherAdViewHolder = null;
|
||||
super.onDestroy();
|
||||
L.e(TAG, "----------> onDestroy");
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置透明状态栏
|
||||
*/
|
||||
private void setStatusBar() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = getWindow();
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_skip_img || i == R.id.btn_skip_video) {
|
||||
if (mBtnSkipImage != null) {
|
||||
mBtnSkipImage.setClickable(false);
|
||||
}
|
||||
if (mBtnSkipVideo != null) {
|
||||
mBtnSkipVideo.setClickable(false);
|
||||
}
|
||||
checkUidAndToken();
|
||||
} else if (i == R.id.container) {
|
||||
clickAD();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 点击广告
|
||||
*/
|
||||
private void clickAD() {
|
||||
if (mAdList != null && mAdList.size() > mAdIndex) {
|
||||
AdBean adBean = mAdList.get(mAdIndex);
|
||||
if (adBean != null) {
|
||||
String link = adBean.getLink();
|
||||
if (!TextUtils.isEmpty(link)) {
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
if (mContainer != null) {
|
||||
mContainer.setClickable(false);
|
||||
}
|
||||
releaseVideo();
|
||||
// if (mLauncherAdViewHolder == null) {
|
||||
// mLauncherAdViewHolder = new LauncherAdViewHolder(mContext, mRoot, link + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken());
|
||||
// mLauncherAdViewHolder.addToParent();
|
||||
// mLauncherAdViewHolder.loadData();
|
||||
// mLauncherAdViewHolder.show();
|
||||
// mLauncherAdViewHolder.setActionListener(new LauncherAdViewHolder.ActionListener() {
|
||||
// @Override
|
||||
// public void onHideClick() {
|
||||
// checkUidAndToken();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void releaseVideo() {
|
||||
if (mPlayer != null) {
|
||||
mPlayer.stopPlay(false);
|
||||
mPlayer.setPlayListener(null);
|
||||
}
|
||||
mPlayer = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 播放广告
|
||||
*/
|
||||
private void playAD(boolean isImage) {
|
||||
if (mContainer == null) {
|
||||
return;
|
||||
}
|
||||
if (isImage) {
|
||||
int imgSize = mAdList.size();
|
||||
if (imgSize > 0) {
|
||||
mImageViewList = new ArrayList<>();
|
||||
for (int i = 0; i < imgSize; i++) {
|
||||
ImageView imageView = new ImageView(mContext);
|
||||
imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
imageView.setBackgroundColor(0xffffffff);
|
||||
imageView.setTransitionName("ad_img_" + i);
|
||||
mImageViewList.add(imageView);
|
||||
ImgLoader.display(mContext, mAdList.get(i).getUrl(), imageView);
|
||||
}
|
||||
for (int i = imgSize - 1; i >= 0; i--) {
|
||||
mContainer.addView(mImageViewList.get(i));
|
||||
}
|
||||
if (mBtnSkipImage != null && mBtnSkipImage.getVisibility() != View.VISIBLE) {
|
||||
mBtnSkipImage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mMaxProgressVal = imgSize * mInterval;
|
||||
if (mCircleProgress != null) {
|
||||
mCircleProgress.setMaxProgress(mMaxProgressVal);
|
||||
}
|
||||
if (mHandler != null) {
|
||||
mHandler.sendEmptyMessageDelayed(WHAT_COUNT_DOWN, 100);
|
||||
}
|
||||
if (mCover != null && mCover.getVisibility() == View.VISIBLE) {
|
||||
mCover.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
} else {
|
||||
checkUidAndToken();
|
||||
}
|
||||
} else {
|
||||
if (mAdList == null || mAdList.size() == 0) {
|
||||
checkUidAndToken();
|
||||
return;
|
||||
}
|
||||
String videoUrl = mAdList.get(0).getUrl();
|
||||
if (TextUtils.isEmpty(videoUrl)) {
|
||||
checkUidAndToken();
|
||||
return;
|
||||
}
|
||||
String videoFileName = MD5Util.getMD5(videoUrl);
|
||||
if (TextUtils.isEmpty(videoFileName)) {
|
||||
checkUidAndToken();
|
||||
return;
|
||||
}
|
||||
File file = new File(getCacheDir(), videoFileName);
|
||||
if (file.exists()) {
|
||||
playAdVideo(file);
|
||||
} else {
|
||||
downloadAdFile(videoUrl, videoFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
mPaused = true;
|
||||
if (mPlayer != null && mPlayer.isPlaying()) {
|
||||
mPlayer.setMute(true);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (mPaused) {
|
||||
if (mPlayer != null && mPlayer.isPlaying()) {
|
||||
mPlayer.setMute(false);
|
||||
}
|
||||
}
|
||||
mPaused = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载视频
|
||||
*/
|
||||
private void downloadAdFile(String url, String fileName) {
|
||||
DownloadUtil downloadUtil = new DownloadUtil();
|
||||
downloadUtil.download("ad_video", getCacheDir(), fileName, url, new DownloadUtil.Callback() {
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
playAdVideo(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
checkUidAndToken();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 播放视频
|
||||
*/
|
||||
private void playAdVideo(File videoFile) {
|
||||
if (mBtnSkipVideo != null && mBtnSkipVideo.getVisibility() != View.VISIBLE) {
|
||||
mBtnSkipVideo.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mTXCloudVideoView = new TXCloudVideoView(mContext);
|
||||
mTXCloudVideoView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
mTXCloudVideoView.setRenderMode(TXLiveConstants.RENDER_MODE_FULL_FILL_SCREEN);
|
||||
mContainer.addView(mTXCloudVideoView);
|
||||
mPlayer = new TXLivePlayer(mContext);
|
||||
mPlayer.setPlayerView(mTXCloudVideoView);
|
||||
mPlayer.setAutoPlay(true);
|
||||
mPlayer.setPlayListener(new ITXLivePlayListener() {
|
||||
@Override
|
||||
public void onPlayEvent(int e, Bundle bundle) {
|
||||
if (e == TXLiveConstants.PLAY_EVT_PLAY_END) {//获取到视频播放完毕的回调
|
||||
checkUidAndToken();
|
||||
L.e(TAG, "视频播放结束------>");
|
||||
} else if (e == TXLiveConstants.PLAY_EVT_CHANGE_RESOLUTION) {////获取到视频宽高回调
|
||||
float videoWidth = bundle.getInt("EVT_PARAM1", 0);
|
||||
float videoHeight = bundle.getInt("EVT_PARAM2", 0);
|
||||
if (mTXCloudVideoView != null && videoWidth > 0 && videoHeight > 0) {
|
||||
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mTXCloudVideoView.getLayoutParams();
|
||||
int targetH = 0;
|
||||
if (videoWidth >= videoHeight) {//横屏
|
||||
params.gravity = Gravity.CENTER_VERTICAL;
|
||||
targetH = (int) (mTXCloudVideoView.getWidth() / videoWidth * videoHeight);
|
||||
} else {
|
||||
targetH = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
}
|
||||
if (targetH != params.height) {
|
||||
params.height = targetH;
|
||||
mTXCloudVideoView.requestLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
} else if (e == TXLiveConstants.PLAY_EVT_RCV_FIRST_I_FRAME) {
|
||||
if (mCover != null && mCover.getVisibility() == View.VISIBLE) {
|
||||
mCover.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
} else if (e == TXLiveConstants.PLAY_ERR_NET_DISCONNECT ||
|
||||
e == TXLiveConstants.PLAY_ERR_FILE_NOT_FOUND) {
|
||||
ToastUtil.show(mContext.getString(R.string.live_play_error));
|
||||
checkUidAndToken();
|
||||
} else if (e == TXLiveConstants.PLAY_EVT_PLAY_PROGRESS) {
|
||||
int progress = bundle.getInt("EVT_PLAY_PROGRESS_MS");
|
||||
if (mVideoLastProgress == progress) {
|
||||
L.e(TAG, "视频播放结束------>");
|
||||
checkUidAndToken();
|
||||
} else {
|
||||
mVideoLastProgress = progress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNetStatus(Bundle bundle) {
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
mPlayer.startPlay(videoFile.getAbsolutePath(), TXLivePlayer.PLAY_TYPE_LOCAL_VIDEO);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onDataUserInfoEvent(DataUserInfoEvent event) {
|
||||
if (event.isUpDataSuccess()) {
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(getApplication());
|
||||
forwardMainActivity();
|
||||
} else {
|
||||
releaseVideo();
|
||||
this.startActivity(new Intent(this, EntryActivity.class));
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,633 @@
|
||||
package com.shayu.onetoone.activity.fragments;
|
||||
|
||||
|
||||
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Outline;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewOutlineProvider;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ms.banner.Banner;
|
||||
import com.ms.banner.BannerConfig;
|
||||
import com.ms.banner.listener.OnBannerClickListener;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.utils.MainHttpConsts;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.GoogleBean;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.bean.UserItemBean;
|
||||
import com.yunbao.common.event.CompleteInformationEvent;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.manager.APKManager;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.SVGAViewUtils;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
//import com.yunbao.live.activity.LiveRecordActivity;
|
||||
//import com.yunbao.live.activity.RoomManageActivity;
|
||||
//import com.yunbao.live.activity.WebViewActivityMedal;
|
||||
//import com.yunbao.live.bean.SlideBean;
|
||||
//import com.yunbao.live.views.CustomMyViewHolder;
|
||||
//import com.yunbao.main.activity.EditProfileActivity;
|
||||
//import com.yunbao.main.activity.FansActivity;
|
||||
//import com.yunbao.main.activity.FollowActivity;
|
||||
//import com.yunbao.main.activity.MyProfitActivity;
|
||||
//import com.yunbao.main.activity.MyVideoActivity;
|
||||
//import com.yunbao.main.activity.MyWalletActivity;
|
||||
//import com.yunbao.main.activity.RewardActivity;
|
||||
//import com.yunbao.main.activity.SettingActivity;
|
||||
//import com.yunbao.main.activity.ThreeDistributActivity;
|
||||
//import com.yunbao.main.activity.ZhuangBanActivity;
|
||||
//import com.yunbao.main.adapter.MainMeAdapter;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 我的主页面
|
||||
*/
|
||||
public class MyFragment extends BaseFragment {
|
||||
public class MyFragment extends BaseFragment implements OnItemClickListener<UserItemBean>, View.OnClickListener {
|
||||
|
||||
private ImageView mAvatar;
|
||||
private TextView mName, tv_level;
|
||||
private ImageView mSex;
|
||||
private ImageView mLevelAnchor;
|
||||
private ImageView mLevel, img_setting;
|
||||
private TextView mID;
|
||||
private TextView mFollow;
|
||||
private TextView mFans;
|
||||
private boolean mPaused;
|
||||
private RecyclerView mRecyclerView;
|
||||
// private MainMeAdapter mAdapter;
|
||||
private TextView signature;
|
||||
private TextView coin, gold, star_coin;//金豆,钻石,星币
|
||||
private TextView btnCopy;
|
||||
private SVGAImageView gift_svga;
|
||||
private View v_noble;
|
||||
private LinearLayout lt_noble;
|
||||
// private LinearLayout btnUserNoble;
|
||||
private ImageView user_noble_ico, good_nub_ico, img_lv_pic;
|
||||
private TextView user_noble_text, user_noble_time, tv_setting;
|
||||
private UserItemBean beanStetting = null, beanKefu = null;
|
||||
private boolean firstInto = true;
|
||||
private Banner banner_me;
|
||||
private LinearLayout lt_advertisement;
|
||||
private View redPoint;
|
||||
|
||||
|
||||
@Override
|
||||
public View createView(LayoutInflater inflater, ViewGroup container, Bundle
|
||||
savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_my, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(View itemView) {
|
||||
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
redPoint = itemView.findViewById(R.id.red_point);
|
||||
ViewClicksAntiShake.clicksAntiShake(mAvatar, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
gift_svga = (SVGAImageView) itemView.findViewById(R.id.gift_svga);
|
||||
ViewClicksAntiShake.clicksAntiShake(gift_svga, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
RouteUtil.forwardUserHome(mContext, CommonAppConfig.getInstance().getUid(), 2);
|
||||
}
|
||||
});
|
||||
user_noble_ico = (ImageView) itemView.findViewById(R.id.user_noble_ico);
|
||||
mLevelAnchor = (ImageView) itemView.findViewById(R.id.level_anchor);
|
||||
mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
tv_level = (TextView) itemView.findViewById(R.id.tv_level);
|
||||
good_nub_ico = (ImageView) itemView.findViewById(R.id.good_nub_ico);
|
||||
mID = (TextView) itemView.findViewById(R.id.id_val);
|
||||
signature = (TextView) itemView.findViewById(R.id.signature);
|
||||
coin = (TextView) itemView.findViewById(R.id.coin);
|
||||
star_coin = (TextView) itemView.findViewById(R.id.star_coin);
|
||||
gold = (TextView) itemView.findViewById(R.id.gold);
|
||||
btnCopy = (TextView) itemView.findViewById(R.id.btn_copy);
|
||||
user_noble_text = (TextView) itemView.findViewById(R.id.user_noble_text);
|
||||
img_setting = (ImageView) itemView.findViewById(R.id.img_setting);
|
||||
v_noble = (View) itemView.findViewById(R.id.v_noble);
|
||||
lt_noble = (LinearLayout) itemView.findViewById(R.id.lt_noble);
|
||||
user_noble_time = (TextView) itemView.findViewById(R.id.user_noble_time);
|
||||
banner_me = (Banner) itemView.findViewById(R.id.banner_me);
|
||||
lt_advertisement = (LinearLayout) itemView.findViewById(R.id.lt_advertisement);
|
||||
img_lv_pic = (ImageView) itemView.findViewById(R.id.img_lv_pic);
|
||||
tv_setting = (TextView) itemView.findViewById(R.id.tv_setting);
|
||||
itemView.findViewById(R.id.lt_star_coin).setOnClickListener(this);
|
||||
itemView.findViewById(R.id.btn_coin).setOnClickListener(this);
|
||||
itemView.findViewById(R.id.btn_gold).setOnClickListener(this);
|
||||
|
||||
itemView.findViewById(R.id.rt_kefu).setOnClickListener(this);
|
||||
itemView.findViewById(R.id.rt_setting).setOnClickListener(this);
|
||||
itemView.findViewById(R.id.lt_noble).setOnClickListener(this);
|
||||
itemView.findViewById(R.id.lt_name).setOnClickListener(this);
|
||||
itemView.findViewById(R.id.signature).setOnClickListener(this);
|
||||
|
||||
btnCopy.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ClipboardManager cm = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
cm.setText(mID.getText() + "");
|
||||
Toast.makeText(mContext, "複製成功", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
mRecyclerView = (RecyclerView) itemView.findViewById(R.id.recyclerView);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new GridLayoutManager(mContext, 4, GridLayoutManager.VERTICAL, false));
|
||||
banner_me.setOutlineProvider(new ViewOutlineProvider() {
|
||||
@Override
|
||||
public void getOutline(View view, Outline outline) {
|
||||
outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10);
|
||||
}
|
||||
});
|
||||
redPoint.setVisibility(APKManager.get().getApkVerNew() ? View.GONE : View.VISIBLE);
|
||||
ViewClicksAntiShake.clicksAntiShake(itemView.findViewById(R.id.complete_information), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
// mContext.startActivity(new Intent(mContext, EditProfileActivity.class));
|
||||
}
|
||||
});
|
||||
loadData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_my, container, false);
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mPaused = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// if (isShowed() && mPaused) {
|
||||
// loadData();
|
||||
// }
|
||||
mPaused = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO);
|
||||
}
|
||||
|
||||
|
||||
public void loadData() {
|
||||
MainHttpUtil.getGoogle(mCallback1);
|
||||
MainHttpUtil.getBaseInfo(mCallback);
|
||||
MainHttpUtil.getBalance(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
JSONObject obj = JSONObject.parseObject(info[0]);
|
||||
String golds = obj.getString("gold");
|
||||
String coins = obj.getString("coin");
|
||||
String yuanbaos = obj.getString("yuanbao");
|
||||
if (golds.length() > 8) {
|
||||
gold.setText(golds.substring(0, golds.length() - 6) + "M");
|
||||
} else if (golds.length() > 6) {
|
||||
gold.setText(golds.substring(0, golds.length() - 3) + "K");
|
||||
} else {
|
||||
gold.setText(golds);
|
||||
}
|
||||
if (coins.length() > 8) {
|
||||
coin.setText(coins.substring(0, coins.length() - 6) + "M");
|
||||
} else if (coins.length() > 6) {
|
||||
coin.setText(coins.substring(0, coins.length() - 3) + "K");
|
||||
} else {
|
||||
coin.setText(coins);
|
||||
}
|
||||
if (yuanbaos.length() > 8) {
|
||||
star_coin.setText(yuanbaos.substring(0, yuanbaos.length() - 6) + "M");
|
||||
} else if (yuanbaos.length() > 6) {
|
||||
star_coin.setText(yuanbaos.substring(0, yuanbaos.length() - 3) + "K");
|
||||
} else {
|
||||
star_coin.setText(yuanbaos);
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取谷歌
|
||||
//谷歌支付是否打开 1是打开 0 关闭
|
||||
String Is_hide = "1";
|
||||
private CommonCallback<GoogleBean> mCallback1 = new CommonCallback<GoogleBean>() {
|
||||
@Override
|
||||
public void callback(GoogleBean bean) {
|
||||
if (bean != null) {
|
||||
Is_hide = bean.getIs_hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private CommonCallback<UserBean> mCallback = new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean bean) {
|
||||
List<UserItemBean> list = CommonAppConfig.getInstance().getUserItemList();
|
||||
if (bean != null) {
|
||||
showData(bean, list);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// private List<SlideBean> mBannerListNew = new ArrayList<>();
|
||||
|
||||
private void showData(UserBean u, List<UserItemBean> list) {
|
||||
// mBannerList.clear();
|
||||
// mBannerListNew.clear();
|
||||
if (!StringUtil.isEmpty(u.getSlide())) {
|
||||
// mBannerListNew.addAll(JSON.parseArray(u.getSlide(), SlideBean.class));
|
||||
// for (SlideBean bean : mBannerListNew) {
|
||||
// if (bean.getSlide_status().equals("1")) {
|
||||
// mBannerList.add(bean);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
showBanner();
|
||||
ImgLoader.displayAvatar(mContext, u.getAvatar(), mAvatar);
|
||||
mName.setText(u.getUserNiceName());
|
||||
if (!"0".endsWith(u.getNoble_id())) {
|
||||
user_noble_text.setText(mContext.getResources().getString(R.string.now_noble) + u.getNoble_name());
|
||||
user_noble_time.setText(mContext.getResources().getString(R.string.now_noble_time) + u.getNoble_end_time());
|
||||
} else {
|
||||
user_noble_text.setText(u.getNoble_name());
|
||||
user_noble_time.setText(mContext.getResources().getString(R.string.open_noble_text));
|
||||
}
|
||||
String singnature = u.getSignature();
|
||||
if (TextUtils.equals(singnature, "這個人很懶,什麼也沒留下") || TextUtils.equals(singnature, "这家伙很懒,什么都没留下") || TextUtils.isEmpty(singnature)) {
|
||||
String ct = Locale.getDefault().getCountry();
|
||||
ct = TextUtils.equals("CN", ct) ? "HK" : ct;
|
||||
if (TextUtils.equals(ct, "CN")) {
|
||||
singnature = "這個人很懶,什麼也沒留下";
|
||||
} else {
|
||||
singnature = "The guy was lazy and didn't write anything.";
|
||||
}
|
||||
|
||||
}
|
||||
signature.setText(singnature);
|
||||
CommonAppConfig appConfig = CommonAppConfig.getInstance();
|
||||
LevelBean anchorLevelBean = appConfig.getAnchorLevel(u.getLevelAnchor());
|
||||
|
||||
if (u.getDress().getAvatar_frame() != null) {
|
||||
if (u.getDress().getAvatar_frame().contains("svga")) {
|
||||
try {
|
||||
new SVGAParser(mContext).parse(new URL(u.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
gift_svga.setImageDrawable(drawable);
|
||||
SVGAViewUtils.playEndClear(gift_svga, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
}
|
||||
});
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
ImgLoader.display(mContext, u.getDress().getAvatar_frame(), gift_svga);
|
||||
}
|
||||
}
|
||||
|
||||
if (u.getDress().getMedal() != null) {
|
||||
Log.e("tag", u.getDress().getMedal());
|
||||
ImgLoader.display(mContext, u.getDress().getMedal(), user_noble_ico);
|
||||
} else {
|
||||
user_noble_ico.setImageResource(R.mipmap.icon_vip_gold);
|
||||
}
|
||||
if ("C".equals(u.getUsers_type())) {
|
||||
Constants.isAnchor = true;
|
||||
good_nub_ico.setImageResource(R.mipmap.usercard_good_nub);
|
||||
if (anchorLevelBean != null) {
|
||||
ImgLoader.display(mContext, CommonAppConfig.getInstance().HOST + anchorLevelBean.getThumb(), mLevel);
|
||||
// ImgLoader.display(mContext, R.mipmap.icon_zhubolv, img_lv_pic);
|
||||
//主播等级
|
||||
tv_level.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String url = CommonAppConfig.HOST + "/h5/Grade/index.html?" + "token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&for";
|
||||
// ZhuangBanActivity.forward(mContext, url);
|
||||
}
|
||||
});
|
||||
tv_level.setText(anchorLevelBean.getLevel() + "");
|
||||
}
|
||||
} else {
|
||||
Constants.isAnchor = false;
|
||||
LevelBean levelBean = appConfig.getLevel(u.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
//用户等级
|
||||
tv_level.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String url = CommonAppConfig.HOST + "/h5/Grade/index.html?" + "token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&isZh=" + ((IMLoginManager.get(CommonAppContext.sInstance.getBaseContext()).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0");
|
||||
// ZhuangBanActivity.forward(mContext, url);
|
||||
}
|
||||
});
|
||||
tv_level.setText(levelBean.getLevel() + "");
|
||||
}
|
||||
}
|
||||
//修改靓号图标 个人中心
|
||||
if (u.getGoodnum() != null && !u.getGoodnum().equals("")) {
|
||||
good_nub_ico.setVisibility(View.VISIBLE);
|
||||
mID.setText(" " + u.getGoodnum());
|
||||
} else {
|
||||
good_nub_ico.setVisibility(View.GONE);
|
||||
mID.setText(u.getLiangNameTip());
|
||||
}
|
||||
if (list != null && list.size() > 0) {
|
||||
List<UserItemBean> listNow = new ArrayList<>();
|
||||
for (UserItemBean userItemBean : list) {
|
||||
if (userItemBean.getId() != 21 && userItemBean.getId() != 13) {
|
||||
listNow.add(userItemBean);
|
||||
} else if (userItemBean.getId() == 21) {
|
||||
beanKefu = userItemBean;
|
||||
} else if (userItemBean.getId() == 13) {
|
||||
beanStetting = userItemBean;
|
||||
}
|
||||
}
|
||||
// if (mAdapter == null) {
|
||||
// mAdapter = new MainMeAdapter(mContext, listNow);
|
||||
// mAdapter.setOnItemClickListener(this);
|
||||
//// mRecyclerView.setAdapter(mAdapter);
|
||||
// } else {
|
||||
//// mAdapter.setList(listNow);
|
||||
// }
|
||||
}
|
||||
if (beanKefu != null) {
|
||||
}
|
||||
if (beanStetting != null) {
|
||||
ImgLoader.display(mContext, beanStetting.getThumb(), img_setting);
|
||||
tv_setting.setText(beanStetting.getName());
|
||||
}
|
||||
Constants.myUid = u.getGoodnum();
|
||||
Constants.myAvatar = u.getAvatar();
|
||||
// if (u.getUserInfoComplete() == 1) {
|
||||
// findViewById(R.id.complete_information_radius).setVisibility(View.INVISIBLE);
|
||||
// findViewById(R.id.complete_information).setVisibility(View.INVISIBLE);
|
||||
// } else {
|
||||
// findViewById(R.id.complete_information_radius).setVisibility(View.VISIBLE);
|
||||
// findViewById(R.id.complete_information).setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// EventBus.getDefault().post(new CompleteInformationEvent().setCompleteInformation(findViewById(R.id.complete_information).getVisibility() == View.VISIBLE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(UserItemBean bean, int position) {
|
||||
String url = bean.getHref();
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
switch (bean.getId()) {
|
||||
case 1:
|
||||
forwardProfit();
|
||||
break;
|
||||
case 2:
|
||||
forwardCoin();
|
||||
break;
|
||||
case 13:
|
||||
// forwardSetting();
|
||||
break;
|
||||
case 19:
|
||||
forwardMyVideo();
|
||||
break;
|
||||
case 20:
|
||||
forwardRoomManage();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//21 在线客服
|
||||
Log.i("tag", bean.getId() + "");
|
||||
if (bean.getId() == 8) {//三级分销
|
||||
// forward(mContext, bean.getName(), url);
|
||||
} else {
|
||||
if (bean.getId() == 31) {
|
||||
//跳转网页版粉丝徽章
|
||||
// WebViewActivityMedal.forward(mContext, url);
|
||||
} else if (bean.getId() == 5) {
|
||||
Constants.isTitle = true;
|
||||
// ZhuangBanActivity.forward(mContext, CommonAppConfig.HOST + "/h5/Personality.html");
|
||||
} else if (bean.getId() == 23) { //獎勵中心
|
||||
Log.i("tsa", url);
|
||||
// RewardActivity.forward(mContext, url);
|
||||
} else if (bean.getId() == 4) {
|
||||
url = HtmlConfig.SHOP + "?t=" + Math.random() + "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&isZh=" + ((IMLoginManager.get(mContext).getLocaleLanguage() == Locale.SIMPLIFIED_CHINESE) ? "1" : "0");
|
||||
WebViewActivity.forward(mContext, url, false);
|
||||
} else if (bean.getId() == 3) {//我的等级
|
||||
Constants.myIntoIndex = 2;
|
||||
Constants.isTitle = false;
|
||||
// ZhuangBanActivity.forward(mContext, url);
|
||||
} else {
|
||||
WebViewActivity.forward(mContext, url, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
int i = v.getId();
|
||||
if (i == R.id.lt_name) {
|
||||
// mContext.startActivity(new Intent(mContext, EditProfileActivity.class));
|
||||
} else if (i == R.id.signature) {
|
||||
// mContext.startActivity(new Intent(mContext, EditProfileActivity.class));
|
||||
} else if (i == R.id.lt_star_coin) {
|
||||
// mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 1));
|
||||
} else if (i == R.id.btn_coin) {
|
||||
// mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 0));
|
||||
} else if (i == R.id.btn_gold) {
|
||||
// mContext.startActivity(new Intent(mContext, MyWalletActivity.class).putExtra("p", 2));
|
||||
String url = CommonAppConfig.HOST + "/index.php?g=Appapi&m=task&a=index";
|
||||
// RewardActivity.forward(mContext, url);
|
||||
} else if (i == R.id.rt_kefu) {
|
||||
WebViewActivity.forward(mContext, beanKefu.getHref(), false);
|
||||
} else if (i == R.id.rt_setting) {
|
||||
forwardSetting();
|
||||
} else if (i == R.id.lt_noble) {
|
||||
Constants.isTitle = true;
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
String url = CommonAppConfig.HOST + "/h5/Noble/index.html?nickname=" + u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&token=" + CommonAppConfig.getInstance().getToken() + "&uid=" + CommonAppConfig.getInstance().getUid();
|
||||
// ZhuangBanActivity.forward(mContext, url, false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑个人资料
|
||||
*/
|
||||
private void forwardEditProfile() {
|
||||
// mContext.startActivity(new Intent(mContext, EditProfileActivity.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的关注
|
||||
*/
|
||||
private void forwardFollow() {
|
||||
// FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的粉丝
|
||||
*/
|
||||
private void forwardFans() {
|
||||
// FansActivity.forward(mContext, CommonAppConfig.getInstance().getUid());
|
||||
}
|
||||
|
||||
/**
|
||||
* 直播记录
|
||||
*/
|
||||
private void forwardLiveRecord() {
|
||||
// LiveRecordActivity.forward(mContext, CommonAppConfig.getInstance().getUserBean());
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的收益
|
||||
*/
|
||||
private void forwardProfit() {
|
||||
// mContext.startActivity(new Intent(mContext, MyProfitActivity.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的钻石
|
||||
*/
|
||||
private void forwardCoin() {
|
||||
RouteUtil.forwardMyCoin(mContext);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置
|
||||
*/
|
||||
private void forwardSetting() {
|
||||
// mContext.startActivity(new Intent(mContext, SettingActivity.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 我的视频
|
||||
*/
|
||||
private void forwardMyVideo() {
|
||||
// mContext.startActivity(new Intent(mContext, MyVideoActivity.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 房间管理
|
||||
*/
|
||||
private void forwardRoomManage() {
|
||||
// mContext.startActivity(new Intent(mContext, RoomManageActivity.class));
|
||||
}
|
||||
|
||||
|
||||
// public static List<SlideBean> mBannerList = new ArrayList<>();
|
||||
|
||||
private void showBanner() {
|
||||
// if (mBannerList == null || mBannerList.size() <= 0 || banner_me == null) {
|
||||
// lt_advertisement.setVisibility(View.GONE);
|
||||
// return;
|
||||
// }
|
||||
// lt_advertisement.setVisibility(View.VISIBLE);
|
||||
// if (mBannerList.size() == 1) {
|
||||
// banner_me.setAutoPlay(false)
|
||||
// .setPages(mBannerList, new CustomMyViewHolder())
|
||||
// .setDelayTime(3000)
|
||||
// .setBannerStyle(BannerConfig.NOT_INDICATOR)
|
||||
// .setOnBannerClickListener(new OnBannerClickListener() {
|
||||
// @Override
|
||||
// public void onBannerClick(List datas, int p) {
|
||||
// if (mBannerList != null) {
|
||||
// if (p >= 0 && p < mBannerList.size()) {
|
||||
// SlideBean bean = mBannerList.get(p);
|
||||
// if (!bean.getSlide_url().equals("")) {
|
||||
// Constants.isTitle = true;
|
||||
// String url = bean.getSlide_url() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
// WebViewActivity.forward(mContext, url, false, false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// .start();
|
||||
// } else {
|
||||
// banner_me.setAutoPlay(true)
|
||||
// .setPages(mBannerList, new CustomMyViewHolder())
|
||||
// .setDelayTime(3000)
|
||||
// .setBannerStyle(BannerConfig.NOT_INDICATOR)
|
||||
// .setOnBannerClickListener(new OnBannerClickListener() {
|
||||
// @Override
|
||||
// public void onBannerClick(List datas, int p) {
|
||||
// if (mBannerList != null) {
|
||||
// if (p >= 0 && p < mBannerList.size()) {
|
||||
// SlideBean bean = mBannerList.get(p);
|
||||
// if (!bean.getSlide_url().equals("")) {
|
||||
// Constants.isTitle = true;
|
||||
// String url = bean.getSlide_url() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
// RouteUtil.forwardCustomerService(url);
|
||||
// /*if(bean.getSlide_id().equals("95")){
|
||||
// RouteUtil.forwardCustomerService(url);
|
||||
// }else {
|
||||
// ZhuangBanActivity.forward(mContext, url, false);
|
||||
// }*/
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// .start();
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,725 @@
|
||||
package com.shayu.onetoone.activity.login;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.graphics.Paint;
|
||||
import android.media.MediaPlayer;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.DeviceUtils;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.facebook.AccessToken;
|
||||
import com.facebook.CallbackManager;
|
||||
import com.facebook.FacebookCallback;
|
||||
import com.facebook.FacebookException;
|
||||
import com.facebook.Profile;
|
||||
import com.facebook.ProfileTracker;
|
||||
import com.facebook.login.LoginManager;
|
||||
import com.facebook.login.LoginResult;
|
||||
import com.fm.openinstall.OpenInstall;
|
||||
import com.fm.openinstall.listener.AppInstallAdapter;
|
||||
import com.fm.openinstall.model.AppData;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignIn;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||
import com.google.android.gms.common.api.ApiException;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.linecorp.linesdk.Scope;
|
||||
import com.linecorp.linesdk.auth.LineAuthenticationParams;
|
||||
import com.linecorp.linesdk.auth.LineLoginApi;
|
||||
import com.linecorp.linesdk.auth.LineLoginResult;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.twitter.sdk.android.core.Callback;
|
||||
import com.twitter.sdk.android.core.DefaultLogger;
|
||||
import com.twitter.sdk.android.core.Result;
|
||||
import com.twitter.sdk.android.core.Twitter;
|
||||
import com.twitter.sdk.android.core.TwitterAuthConfig;
|
||||
import com.twitter.sdk.android.core.TwitterAuthToken;
|
||||
import com.twitter.sdk.android.core.TwitterConfig;
|
||||
import com.twitter.sdk.android.core.TwitterException;
|
||||
import com.twitter.sdk.android.core.TwitterSession;
|
||||
import com.twitter.sdk.android.core.identity.TwitterLoginButton;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.FaceBookUpModel;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.LoginData;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.main.MainNetManager;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
||||
/**
|
||||
* 入口
|
||||
*/
|
||||
@Route(path = RouteUtil.PATH_ENTRY)
|
||||
public class EntryActivity extends AppCompatActivity {
|
||||
|
||||
private ImageView btn_phone, btn_line;
|
||||
private TextView btn_tip, btn_tip1, tv_customer;
|
||||
private TwitterLoginButton tt_login_button;
|
||||
private LinearLayout btn_google;
|
||||
public static Activity activity;
|
||||
private static String mLoginType = Constants.MOB_PHONE;//登录方式
|
||||
public String mPromoCode = "", UserID = "";//推广码
|
||||
|
||||
private String mUuidDevice = "";//手机唯一标识符
|
||||
private static boolean mFirstLogin;//是否是第一次登录
|
||||
private static boolean mShowInvite;//显示邀请码弹窗
|
||||
private static Context Contexts;
|
||||
private GoogleSignInClient mGoogleSignInClient;
|
||||
private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer;
|
||||
private String kefuUrl = "";
|
||||
private boolean mBtnClick = false;
|
||||
private Dialog loginLoadingDialog;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void close(String str) {
|
||||
if ("close_login".equals(str)) {
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置透明状态栏
|
||||
*/
|
||||
private void setStatusBar() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
Window window = getWindow();
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
window.setStatusBarColor(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Get_hash_key() {
|
||||
PackageInfo info;
|
||||
try {
|
||||
info = getPackageManager().getPackageInfo("com.pdlive.shayu", PackageManager.GET_SIGNATURES);
|
||||
for (Signature signature : info.signatures) {
|
||||
MessageDigest md;
|
||||
md = MessageDigest.getInstance("SHA");
|
||||
md.update(signature.toByteArray());
|
||||
String something = new String(Base64.encode(md.digest(), 0));
|
||||
//String something = new String(Base64.encodeBytes(md.digest()));
|
||||
Log.e("hash key", something);
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e1) {
|
||||
Log.e("name not found", e1.toString());
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.e("no such an algorithm", e.toString());
|
||||
} catch (Exception e) {
|
||||
Log.e("exception", e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_entry);
|
||||
if (getIntent().getBooleanExtra("forwardEntry", false)) {
|
||||
IMLoginManager.get(this).logout(this);
|
||||
ToastUtil.show(R.string.login_invalid);
|
||||
}
|
||||
Get_hash_key();
|
||||
activity = this;
|
||||
Contexts = this;
|
||||
setStatusBar();
|
||||
lt_btn_facebook = findViewById(R.id.lt_btn_facebook);
|
||||
lt_btn_twitter = findViewById(R.id.lt_btn_twitter);
|
||||
btn_tip = findViewById(R.id.btn_tip);
|
||||
btn_tip1 = findViewById(R.id.btn_tip1);
|
||||
|
||||
btn_google = findViewById(R.id.btn_google);
|
||||
tt_login_button = findViewById(R.id.tt_login_button);
|
||||
|
||||
tv_customer = findViewById(R.id.tv_customer);
|
||||
btn_phone = findViewById(R.id.btn_phone);
|
||||
btn_phone.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ToLogin();
|
||||
}
|
||||
});
|
||||
btn_line = findViewById(R.id.btn_line);
|
||||
lt_customer = findViewById(R.id.lt_customer);
|
||||
|
||||
btn_tip.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
btn_tip.getPaint().setAntiAlias(true);
|
||||
|
||||
btn_tip1.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||
btn_tip1.getPaint().setAntiAlias(true);
|
||||
|
||||
btn_tip1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY,false);
|
||||
}
|
||||
});
|
||||
|
||||
btn_tip.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
WebViewActivity.forward(EntryActivity.this, HtmlConfig.LOGIN_PRIVCAY1,false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
|
||||
getPromoCode();
|
||||
getUuidDevice();
|
||||
|
||||
|
||||
lt_btn_facebook.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(view);
|
||||
MainNetManager.get(EntryActivity.this)
|
||||
.FaceBookUp(new com.yunbao.common.http.base.HttpCallback<FaceBookUpModel>() {
|
||||
@Override
|
||||
public void onSuccess(FaceBookUpModel data) {
|
||||
if (data.getType().equals("0")) {
|
||||
LoginManager.getInstance().logInWithReadPermissions(EntryActivity.this, Arrays.asList("public_profile"));
|
||||
} else {
|
||||
WebViewActivity.forward(EntryActivity.this, data.getLink() + "?",false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
|
||||
@Override
|
||||
public void onSuccess(LoginResult loginResult) {
|
||||
updateUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(FacebookException error) {
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
});
|
||||
|
||||
googleLoginSet();
|
||||
twitterLoginSet();
|
||||
|
||||
btn_google.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(v);
|
||||
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
|
||||
startActivityForResult(signInIntent, 1002);
|
||||
}
|
||||
});
|
||||
|
||||
lt_btn_twitter.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(v);
|
||||
tt_login_button.performClick();
|
||||
}
|
||||
});
|
||||
|
||||
tt_login_button.setCallback(new Callback<TwitterSession>() {
|
||||
@Override
|
||||
public void success(Result<TwitterSession> result) {
|
||||
// Do something with result, which provides a TwitterSession for making API calls
|
||||
//result里面包含了用户的信息,我们可以从中取出token,tokenSecret
|
||||
//(如果我们有自己的后台服务器,发送这两个到我们自己的后台,后台再去验证)
|
||||
TwitterAuthToken authToken = result.data.getAuthToken();
|
||||
String token = authToken.token;
|
||||
String appId = "24315541";
|
||||
String tokenSecret = authToken.secret;
|
||||
|
||||
final String userName = result.data.getUserName();
|
||||
|
||||
LoginData data = new LoginData();
|
||||
data.setAvatar("");
|
||||
data.setNickName(userName);
|
||||
data.setOpenID(token);
|
||||
data.setType("twitter");
|
||||
|
||||
loginBuyThird(data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failure(TwitterException exception) {
|
||||
Log.i("Log", "TwitterException = " + exception);
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_line).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (isBtnClick()) {
|
||||
return;
|
||||
}
|
||||
timerOutBtn(view);
|
||||
try {
|
||||
// App-to-app login
|
||||
Intent loginIntent = LineLoginApi.getLoginIntent(
|
||||
view.getContext(),
|
||||
"1656399535",
|
||||
new LineAuthenticationParams.Builder()
|
||||
.scopes(Arrays.asList(Scope.PROFILE))
|
||||
// .nonce("<a randomly-generated string>") // nonce can be used to improve security
|
||||
.build());
|
||||
startActivityForResult(loginIntent, 1001);
|
||||
} catch (Exception e) {
|
||||
Log.e("ERROR", e.toString());
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
getUrl();
|
||||
|
||||
lt_customer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!"".equals(kefuUrl)) {
|
||||
Constants.LoginKefu = true;
|
||||
WebViewActivity.forward(EntryActivity.this, kefuUrl,false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getUrl() {
|
||||
MainHttpUtil.getCustomerService(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info != null) {
|
||||
if (info.length > 0) {
|
||||
kefuUrl = info[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void twitterLoginSet() {
|
||||
TwitterConfig config = new TwitterConfig.Builder(this)
|
||||
.logger(new DefaultLogger(Log.DEBUG))
|
||||
.twitterAuthConfig(new TwitterAuthConfig(getResources().getString(R.string.twitter_key), getResources().getString(R.string.twitter_secret)))
|
||||
.debug(true)
|
||||
.build();
|
||||
Twitter.initialize(config);
|
||||
}
|
||||
|
||||
private void googleLoginSet() {
|
||||
//TODO Google登录
|
||||
//配置登录以请求用户的ID,电子邮件地址和基本配置文件.ID和基本配置文件包含在DEFAULT_SIGN_IN中.
|
||||
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
|
||||
.requestEmail()
|
||||
// .requestIdToken("AIzaSyDVnuGnQzjI_vDrxh20Hv_S1OMUD7Vp3zU")
|
||||
.build();
|
||||
//使用gso指定的选项构建一个GoogleSignInClient.
|
||||
mGoogleSignInClient = GoogleSignIn.getClient(this, gso);
|
||||
|
||||
}
|
||||
|
||||
private void requestPermission() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {//30
|
||||
// 先判断有没有权限
|
||||
if (!Environment.isExternalStorageManager()) {
|
||||
//跳转到设置界面引导用户打开
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
startActivityForResult(intent, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CallbackManager callbackManager = CallbackManager.Factory.create();
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
Log.i("ttts1", requestCode + "a " + resultCode);
|
||||
|
||||
if (requestCode == 1001) {//line登录
|
||||
LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data);
|
||||
Log.i("ttts", result.getResponseCode() + "");
|
||||
switch (result.getResponseCode()) {
|
||||
case SUCCESS:
|
||||
// Login successful
|
||||
String accessToken = result.getLineCredential().getAccessToken().getTokenString();
|
||||
LoginData re_data = new LoginData();
|
||||
re_data.setOpenID(result.getLineProfile().getUserId());
|
||||
if (result.getLineProfile().getPictureUrl() != null) {
|
||||
re_data.setAvatar("" + result.getLineProfile().getPictureUrl().toString());
|
||||
}
|
||||
re_data.setNickName(result.getLineProfile().getDisplayName());
|
||||
re_data.setType("line");
|
||||
loginBuyThird(re_data);
|
||||
break;
|
||||
case CANCEL:
|
||||
// Login canceled by user
|
||||
Log.e("ERROR", "LINE Login Canceled by user.");
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
break;
|
||||
default:
|
||||
// Login canceled due to other error
|
||||
Log.e("ERROR", "Login FAILED!");
|
||||
Log.e("ERROR", result.getErrorData().toString());
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
} else if (requestCode == 1000) {//判断权限
|
||||
if (Environment.isExternalStorageManager()) {
|
||||
//自己的操作
|
||||
} else {
|
||||
|
||||
}
|
||||
} else if (requestCode == 1002) {//google登录
|
||||
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
|
||||
handleSignInResult(task);
|
||||
} else {
|
||||
tt_login_button.onActivityResult(requestCode, resultCode, data);//twitter登录回调
|
||||
callbackManager.onActivityResult(requestCode, resultCode, data);//facebook登录回调
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
}
|
||||
|
||||
private void handleSignInResult(Task<GoogleSignInAccount> completedTask) {
|
||||
try {
|
||||
GoogleSignInAccount account = completedTask.getResult(ApiException.class);
|
||||
//account里可以直接获取到ID,name,和头像
|
||||
String idToken = account.getIdToken();
|
||||
account.getFamilyName();
|
||||
account.getGivenName();
|
||||
|
||||
LoginData data = new LoginData();
|
||||
data.setAvatar("");
|
||||
data.setNickName(account.getDisplayName());
|
||||
data.setOpenID(account.getId());
|
||||
data.setType("google");
|
||||
|
||||
loginBuyThird(data);
|
||||
} catch (ApiException e) {
|
||||
e.printStackTrace();
|
||||
Log.i("Log", "ApiException = " + e);
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUI() {
|
||||
boolean enableButtons = AccessToken.getCurrentAccessToken() != null;
|
||||
Profile profile = Profile.getCurrentProfile();
|
||||
if (profile == null) {
|
||||
ProfileTracker tracker = new ProfileTracker() {
|
||||
|
||||
@Override
|
||||
protected void onCurrentProfileChanged(@Nullable Profile pf, @Nullable Profile profile1) {
|
||||
if (!enableButtons) {
|
||||
stopTracking();
|
||||
return;
|
||||
}
|
||||
if (pf != null) {
|
||||
loginFaceBookUpdateUI(pf);
|
||||
} else if (profile1 != null) {
|
||||
loginFaceBookUpdateUI(profile1);
|
||||
} else {
|
||||
ToastUtil.show(getResources().getString(R.string.user_login_outtime));
|
||||
}
|
||||
stopTracking();
|
||||
}
|
||||
};
|
||||
tracker.startTracking();
|
||||
} else {
|
||||
if (enableButtons) {
|
||||
loginFaceBookUpdateUI(profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loginFaceBookUpdateUI(Profile profile) {
|
||||
LoginData data = new LoginData();
|
||||
data.setAvatar(profile.getProfilePictureUri(150, 150).toString());
|
||||
data.setNickName(profile.getName());
|
||||
data.setOpenID(AccessToken.getCurrentAccessToken().getUserId());
|
||||
data.setType("facebook");
|
||||
loginBuyThird(data);
|
||||
}
|
||||
|
||||
//从网页获取推广码
|
||||
private void getPromoCode() {
|
||||
OpenInstall.getInstall(new AppInstallAdapter() {
|
||||
@Override
|
||||
public void onInstall(AppData appData) {
|
||||
//获取渠道数据
|
||||
String channelCode = appData.getChannel();
|
||||
Log.d("OpenInstall", "appData.getData()= " + appData.getData());
|
||||
//获取自定义数据
|
||||
if (appData.getData() != null && !appData.getData().equals("")) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
|
||||
} else {
|
||||
JSONObject data = JSON.parseObject(appData.getData());
|
||||
mPromoCode = data.getString("admin_id") + "";
|
||||
UserID = data.getString("user_id") + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void getUuidDevice() {
|
||||
mUuidDevice = DeviceUtils.getUniqueDeviceId();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
public static void ToLogin() {
|
||||
activity.startActivity(new Intent(activity, LoginActivity.class));
|
||||
activity.finish();
|
||||
}
|
||||
|
||||
private static final String EMAIL = "email";
|
||||
|
||||
/**
|
||||
* 三方登录
|
||||
*/
|
||||
private void loginBuyThird(LoginData data) {
|
||||
mLoginType = data.getType();
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
mPromoCode = "";
|
||||
}
|
||||
MainHttpUtil.loginByThird(UserID, data.getOpenID(), mPromoCode, mUuidDevice, data.getNickName(), data.getAvatar(), data.getType(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
onLoginSuccess(code, msg, info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//登录成功!
|
||||
private void onLoginSuccess(int code, String msg, String[] info) {
|
||||
Log.e("他", code + "code" + info.toString());
|
||||
if (code == 0 && info.length > 0) {
|
||||
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String uid = obj.getString("id");
|
||||
String token = obj.getString("token");
|
||||
if (obj.containsKey("need_bind") && obj.getString("need_bind").equals("0")) {
|
||||
mFirstLogin = obj.getIntValue("first_login") == 1;
|
||||
mShowInvite = obj.getIntValue("isagent") == 1;
|
||||
CommonAppConfig.getInstance().setLoginInfo(uid, token, true);
|
||||
//设置登录信息
|
||||
IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class);
|
||||
IMLoginManager.get(activity).setupLoginUser(model);
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(activity);
|
||||
getBaseUserInfo();
|
||||
|
||||
} else {
|
||||
// Contexts.startActivity(new Intent(Contexts, BindUserActivity.class).putExtra("uid", uid).putExtra("token", token));
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg + "11212");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
private void getBaseUserInfo() {
|
||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean bean) {
|
||||
|
||||
if (mFirstLogin) {
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
// EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class));
|
||||
} else {
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(EntryActivity.this).setNewUserGif(true);
|
||||
IMLoginManager.get(EntryActivity.this).setisNewUserOne(true);
|
||||
// MainActivity.forward(EntryActivity.this, false);
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(activity).setHomeZdyPop(obj.getString(
|
||||
"home_zdy_pop"));
|
||||
}
|
||||
|
||||
} else {
|
||||
// MainActivity.forward(EntryActivity.this, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// MainActivity.forward(EntryActivity.this, false);
|
||||
}
|
||||
EntryActivity.activity.finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void gotoLive(final String live_id) {
|
||||
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
new LiveRoomCheckLivePresenter(activity, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckError(String contextError) {
|
||||
|
||||
}
|
||||
});
|
||||
NoviceInstructorManager.get(activity).setFrist(false);
|
||||
|
||||
|
||||
} else {
|
||||
// MainActivity.forward(EntryActivity.this, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void timerOutBtn(View btn) {
|
||||
if (mBtnClick) {
|
||||
return;
|
||||
}
|
||||
loginLoadingDialog = DialogUitl.loadingDialog(EntryActivity.this, getString(R.string.login_wait));
|
||||
loginLoadingDialog.show();
|
||||
new Timer().schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
mBtnClick = false;
|
||||
if (loginLoadingDialog != null) {
|
||||
loginLoadingDialog.dismiss();
|
||||
loginLoadingDialog = null;
|
||||
}
|
||||
}
|
||||
}, 3000);
|
||||
mBtnClick = true;
|
||||
}
|
||||
|
||||
private boolean isBtnClick() {
|
||||
if (mBtnClick) {
|
||||
ToastUtil.show("請稍後再試");
|
||||
}
|
||||
return mBtnClick;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (loginLoadingDialog != null) {
|
||||
if (loginLoadingDialog.isShowing()) {
|
||||
loginLoadingDialog.dismiss();
|
||||
}
|
||||
loginLoadingDialog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,422 @@
|
||||
package com.shayu.onetoone.activity.login;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.DeviceUtils;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.sahooz.library.Country;
|
||||
import com.sahooz.library.CountryPicker;
|
||||
import com.sahooz.library.OnPick;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/25.
|
||||
*/
|
||||
|
||||
public class FindPwdActivity extends AbsActivity {
|
||||
|
||||
private EditText mEditPhone;
|
||||
private EditText mEditCode;
|
||||
private EditText mEditPwd1;
|
||||
private EditText mEditPwd2;
|
||||
private TextView mBtnCode;
|
||||
private View mBtnRegister;
|
||||
private Handler mHandler;
|
||||
private static final int TOTAL = 60;
|
||||
private int mCount = TOTAL;
|
||||
private String mGetCode;
|
||||
private String mGetCodeAgain;
|
||||
private Dialog mDialog;
|
||||
private int mPhoneMinLength=5;//输入手机号的最小位数
|
||||
private int mCountryCode = 852;//国家代码
|
||||
private ImageView mIvCountryCode;
|
||||
private TextView mTvCountryCode;
|
||||
private WebView webview;
|
||||
private WebSettings webSettings;
|
||||
private ArrayList<Country> allCountries = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_find_pwd;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(mContext.getString(R.string.find_pwd_forget));
|
||||
mEditPhone = (EditText) findViewById(R.id.edit_phone);
|
||||
mEditCode = (EditText) findViewById(R.id.edit_code);
|
||||
mIvCountryCode =findViewById(R.id.ivCountryCode);
|
||||
mTvCountryCode=findViewById(R.id.tvCountryCode);
|
||||
webview = (WebView)findViewById(R.id.webview);
|
||||
initView();
|
||||
mEditPwd1 = (EditText) findViewById(R.id.edit_pwd_1);
|
||||
mEditPwd2 = (EditText) findViewById(R.id.edit_pwd_2);
|
||||
mBtnCode = (TextView) findViewById(R.id.btn_code);
|
||||
mBtnRegister = findViewById(R.id.btn_register);
|
||||
mGetCode =mContext.getString(R.string.reg_get_code);
|
||||
mGetCodeAgain =mContext.getString(R.string.reg_get_code_again);
|
||||
mTvCountryCodeClick();
|
||||
mEditPhone.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (!TextUtils.isEmpty(s) && s.length() >= mPhoneMinLength) {
|
||||
mBtnCode.setEnabled(true);
|
||||
} else {
|
||||
mBtnCode.setEnabled(false);
|
||||
}
|
||||
changeEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
TextWatcher textWatcher = new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
changeEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
};
|
||||
mEditCode.addTextChangedListener(textWatcher);
|
||||
mEditPwd1.addTextChangedListener(textWatcher);
|
||||
mEditPwd2.addTextChangedListener(textWatcher);
|
||||
mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
mCount--;
|
||||
if (mCount > 0) {
|
||||
mBtnCode.setText(mGetCodeAgain + "(" + mCount + "s)");
|
||||
if (mHandler != null) {
|
||||
mHandler.sendEmptyMessageDelayed(0, 1000);
|
||||
}
|
||||
} else {
|
||||
mBtnCode.setText(mGetCode);
|
||||
mCount = TOTAL;
|
||||
if (mBtnCode != null) {
|
||||
mBtnCode.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mDialog = DialogUitl.loadingDialog(mContext);
|
||||
// EventBus.getDefault().register(this);
|
||||
|
||||
|
||||
allCountries.clear();
|
||||
allCountries.addAll(Country.getAll(mContext, null));
|
||||
|
||||
String ct = IMLoginManager.get(mContext).getString("sys_user_area");
|
||||
ct = TextUtils.equals("中国", ct) ? "中国香港" : ct;
|
||||
for (int i = 0; i < allCountries.size(); i++) {
|
||||
if (allCountries.get(i).chs.equals(ct)) {
|
||||
String countryName = allCountries.get(i).name;
|
||||
countryName = countryName.length() > 4 ? countryName.substring(0, 4) : countryName;
|
||||
mTvCountryCode.setText("+" + allCountries.get(i).code + " " + countryName);
|
||||
mCountryCode = allCountries.get(i).code;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void mTvCountryCodeClick() {
|
||||
mIvCountryCode.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showCountryCode();
|
||||
}
|
||||
});
|
||||
mTvCountryCode.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showCountryCode();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public class JsBridge {
|
||||
@JavascriptInterface
|
||||
public void getData(final String Randstr, final String Ticket) {
|
||||
|
||||
((FindPwdActivity) mContext).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i("tvss",Randstr);
|
||||
webview.setVisibility(View.GONE);
|
||||
//获取验证码
|
||||
getCode(Randstr,Ticket);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
webview = (WebView) findViewById(R.id.webview);
|
||||
webSettings = webview.getSettings();
|
||||
webSettings.setUseWideViewPort(true);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
// 禁用缓存
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
webview.setWebViewClient(new WebViewClient(){
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
// 开启js支持
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webview.addJavascriptInterface(new JsBridge(), "jsBridge");
|
||||
// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html"))
|
||||
webview.loadUrl(CommonAppConfig.HOST +"/h5/live/TCaptcha.html");
|
||||
}
|
||||
|
||||
private void showCountryCode(){
|
||||
CountryPicker.newInstance(null, new OnPick() {
|
||||
@Override
|
||||
public void onPick(Country country) {
|
||||
String countryName = country.name;
|
||||
countryName = countryName.length() > 4 ? countryName.substring(0, 4) + "..." : countryName;
|
||||
mTvCountryCode.setText(" +" + country.code + " " + countryName);
|
||||
mCountryCode=country.code;
|
||||
}
|
||||
}).show(getSupportFragmentManager(), "country");
|
||||
}
|
||||
|
||||
private void changeEnable() {
|
||||
String phone = mEditPhone.getText().toString();
|
||||
String code = mEditCode.getText().toString();
|
||||
String pwd1 = mEditPwd1.getText().toString();
|
||||
String pwd2 = mEditPwd2.getText().toString();
|
||||
mBtnRegister.setEnabled(!TextUtils.isEmpty(phone) && !TextUtils.isEmpty(code) && !TextUtils.isEmpty(pwd1) && !TextUtils.isEmpty(pwd2));
|
||||
}
|
||||
|
||||
public void registerClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_code) {
|
||||
webview.setVisibility(View.VISIBLE);
|
||||
} else if (i == R.id.btn_register) {
|
||||
register();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
private void getCode(String Randstr,String Ticket) {
|
||||
String phoneNum = mEditPhone.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(phoneNum)) {
|
||||
mEditPhone.setError(mContext.getString(R.string.reg_input_phone));
|
||||
mEditPhone.requestFocus();
|
||||
return;
|
||||
}
|
||||
//屏蔽,原因:国外手机号无法校验合法性
|
||||
// if (!ValidatePhoneUtil.validateMobileNumber(phoneNum)) {
|
||||
// mEditPhone.setError(mContext.getString(R.string.login_phone_error));
|
||||
// mEditPhone.requestFocus();
|
||||
// return;
|
||||
// }
|
||||
mEditCode.requestFocus();
|
||||
MainHttpUtil.getRegisterCode(Randstr,Ticket,phoneNum,mCountryCode, mGetCodeCallback);
|
||||
}
|
||||
|
||||
private HttpCallback mGetCodeCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
mBtnCode.setEnabled(false);
|
||||
if (mHandler != null) {
|
||||
mHandler.sendEmptyMessage(0);
|
||||
}
|
||||
if (!TextUtils.isEmpty(msg) && msg.contains("123456")) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 注册并登陆
|
||||
*/
|
||||
private void register() {
|
||||
final String phoneNum = mEditPhone.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(phoneNum)) {
|
||||
mEditPhone.setError(mContext.getString(R.string.reg_input_phone));
|
||||
mEditPhone.requestFocus();
|
||||
return;
|
||||
}
|
||||
//屏蔽,原因:国外手机号无法校验合法性
|
||||
// if (!ValidatePhoneUtil.validateMobileNumber(phoneNum)) {
|
||||
// mEditPhone.setError(mContext.getString(R.string.login_phone_error));
|
||||
// mEditPhone.requestFocus();
|
||||
// return;
|
||||
// }
|
||||
String code = mEditCode.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(code)) {
|
||||
mEditCode.setError(mContext.getString(R.string.reg_input_code));
|
||||
mEditCode.requestFocus();
|
||||
return;
|
||||
}
|
||||
final String pwd = mEditPwd1.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(pwd)) {
|
||||
mEditPwd1.setError(mContext.getString(R.string.reg_input_pwd_1));
|
||||
mEditPwd1.requestFocus();
|
||||
return;
|
||||
}
|
||||
String pwd2 = mEditPwd2.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(pwd2)) {
|
||||
mEditPwd2.setError(mContext.getString(R.string.reg_input_pwd_2));
|
||||
mEditPwd2.requestFocus();
|
||||
return;
|
||||
}
|
||||
if (!pwd.equals(pwd2)) {
|
||||
mEditPwd2.setError(mContext.getString(R.string.reg_pwd_error));
|
||||
mEditPwd2.requestFocus();
|
||||
return;
|
||||
}
|
||||
if (mDialog != null) {
|
||||
mDialog.show();
|
||||
}
|
||||
MainHttpUtil.findPwd(phoneNum, pwd, pwd2, code, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
login(phoneNum, pwd);
|
||||
} else {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
if (!TextUtils.isEmpty(msg)) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void login(String phoneNum, String pwd) {
|
||||
String uuid= DeviceUtils.getUniqueDeviceId();
|
||||
MainHttpUtil.login(phoneNum, pwd,uuid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String uid = obj.getString("id");
|
||||
String token = obj.getString("token");
|
||||
IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class);
|
||||
CommonAppConfig.getInstance().setLoginInfo(uid, token, true);
|
||||
getBaseUserInfo();
|
||||
} else {
|
||||
if (!TextUtils.isEmpty(msg)) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
private void getBaseUserInfo() {
|
||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean bean) {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
if (bean != null) {
|
||||
// MainActivity.forward(mContext);
|
||||
// EventBus.getDefault().post(new RegSuccessEvent());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onRegSuccessEvent(RegSuccessEvent e) {
|
||||
// finish();
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.GET_FIND_PWD_CODE);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.FIND_PWD);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.LOGIN);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO);
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
mHandler = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,432 @@
|
||||
package com.shayu.onetoone.activity.login;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.DeviceUtils;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.fm.openinstall.OpenInstall;
|
||||
import com.fm.openinstall.listener.AppInstallAdapter;
|
||||
import com.fm.openinstall.model.AppData;
|
||||
import com.lzy.okgo.model.Response;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.MainActivity;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.UserAreaBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.fragment.LoadingDialog;
|
||||
import com.yunbao.common.http.CommonHttpConsts;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.JsonBean;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/17.
|
||||
*/
|
||||
@Route(path = RouteUtil.PATH_LOGIN)
|
||||
public class LoginActivity extends AbsActivity {
|
||||
|
||||
private View mRoot;
|
||||
// private ImageView mBg;
|
||||
private ObjectAnimator mAnimator;
|
||||
private EditText mEditPhone;
|
||||
private EditText mEditPwd;
|
||||
private View mBtnLogin;
|
||||
private RecyclerView mRecyclerView;
|
||||
// private MobLoginUtil mLoginUtil;
|
||||
private boolean mFirstLogin;//是否是第一次登录
|
||||
private static boolean mShowInvite;//显示邀请码弹窗
|
||||
private static String mLoginType = Constants.MOB_PHONE;//登录方式
|
||||
private String mPromoCode = "";//推广码
|
||||
private String mUuidDevice = "";//手机唯一标识符
|
||||
static String phoneNum;
|
||||
static String pwd;
|
||||
private static Context Contexts;
|
||||
Activity activity;
|
||||
TextView btn_forget_pwd;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_login;
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onRegSuccessEvent(RegSuccessEvent e) {
|
||||
// if (!isFinishing()) {
|
||||
// finish();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
EventBus.getDefault().register(this);
|
||||
initUserArea();
|
||||
mRoot = findViewById(R.id.root);
|
||||
Contexts = this;
|
||||
activity = this;
|
||||
OpenInstall.getInstall(new AppInstallAdapter() {
|
||||
@Override
|
||||
public void onInstall(AppData appData) {
|
||||
//获取渠道数据
|
||||
String channelCode = appData.getChannel();
|
||||
//获取自定义数据
|
||||
String bindData = appData.getData();
|
||||
Log.d("OpenInstall", "getInstall : installData = " + appData.toString());
|
||||
}
|
||||
});
|
||||
|
||||
mEditPhone = (EditText) findViewById(R.id.edit_phone);
|
||||
mEditPwd = (EditText) findViewById(R.id.edit_pwd);
|
||||
mBtnLogin = findViewById(R.id.btn_login);
|
||||
btn_forget_pwd = findViewById(R.id.btn_forget_pwd);
|
||||
btn_forget_pwd.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
forgetPwd();
|
||||
}
|
||||
});
|
||||
TextView btn_register = findViewById(R.id.btn_register);
|
||||
btn_register.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
register();
|
||||
}
|
||||
});
|
||||
|
||||
// findViewById(R.id.btn_back).setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View view) {
|
||||
// //finish();
|
||||
// RouteUtil.forwardEntry2();
|
||||
// }
|
||||
// });
|
||||
|
||||
TextWatcher textWatcher = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
String phone = mEditPhone.getText().toString();
|
||||
String pwd = mEditPwd.getText().toString();
|
||||
mBtnLogin.setEnabled(!TextUtils.isEmpty(phone) && !TextUtils.isEmpty(pwd));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
};
|
||||
mEditPhone.addTextChangedListener(textWatcher);
|
||||
mEditPwd.addTextChangedListener(textWatcher);
|
||||
boolean otherLoginType = false;
|
||||
ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
|
||||
// if (!otherLoginType) {
|
||||
// findViewById(R.id.other_login_tip).setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
|
||||
getUuidDevice();
|
||||
getPromoCode();
|
||||
}
|
||||
|
||||
|
||||
public static void forward() {
|
||||
Intent intent = new Intent(CommonAppContext.sInstance, LoginActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
CommonAppContext.sInstance.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
public void loginClick(View v) {
|
||||
ViewClicksAntiShake.clicksAntiShake(v, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_login) {
|
||||
login();
|
||||
|
||||
} else if (i == R.id.btn_register) {
|
||||
register();
|
||||
} else if (i == R.id.btn_forget_pwd) {
|
||||
forgetPwd();
|
||||
|
||||
} else if (i == R.id.btn_tip) {
|
||||
forwardTip();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//注册
|
||||
private void register() {
|
||||
startActivity(new Intent(mContext, RegisterActivity.class));
|
||||
}
|
||||
|
||||
//忘记密码
|
||||
private void forgetPwd() {
|
||||
startActivity(new Intent(mContext, FindPwdActivity.class));
|
||||
}
|
||||
|
||||
private LoadingDialog loadingDialog;
|
||||
|
||||
//手机号密码登录
|
||||
private void login() {
|
||||
phoneNum = mEditPhone.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(phoneNum)) {
|
||||
mEditPhone.setError(mContext.getString(R.string.login_input_phone));
|
||||
mEditPhone.requestFocus();
|
||||
return;
|
||||
}
|
||||
pwd = mEditPwd.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(pwd)) {
|
||||
mEditPwd.setError(mContext.getString(R.string.login_input_pwd));
|
||||
mEditPwd.requestFocus();
|
||||
return;
|
||||
}
|
||||
mLoginType = Constants.MOB_PHONE;
|
||||
String uuid = DeviceUtils.getUniqueDeviceId();
|
||||
loadingDialog = new LoadingDialog();
|
||||
loadingDialog.show(getSupportFragmentManager(), "LoadingDialog");
|
||||
loadingDialog.setShowText(getString(R.string.login_ing));
|
||||
MainHttpUtil.login(phoneNum, pwd, uuid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
onLoginSuccess(code, msg, info);
|
||||
}
|
||||
});
|
||||
hideKeyboard(mEditPwd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强隐键盘
|
||||
*
|
||||
* @param view
|
||||
*/
|
||||
private void hideKeyboard(View view) {
|
||||
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
|
||||
//登录即代表同意服务和隐私条款
|
||||
private void forwardTip() {
|
||||
WebViewActivity.forward(mContext, HtmlConfig.LOGIN_PRIVCAY,false);
|
||||
}
|
||||
|
||||
|
||||
private void gotoLive(final String live_id) {
|
||||
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckError(String contextError) {
|
||||
|
||||
}
|
||||
});
|
||||
NoviceInstructorManager.get(activity).setFrist(false);
|
||||
|
||||
} else {
|
||||
// MainActivity.forward(LoginActivity.this, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//登录成功!
|
||||
private void onLoginSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String uid = obj.getString("id");
|
||||
String token = obj.getString("token");
|
||||
mFirstLogin = obj.getIntValue("first_login") == 1;
|
||||
mShowInvite = obj.getIntValue("isagent") == 1;
|
||||
CommonAppConfig.getInstance().setLoginInfo(uid, token, true);
|
||||
//设置登录信息
|
||||
IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class);
|
||||
IMLoginManager.get(activity).setupLoginUser(model);
|
||||
getBaseUserInfo();
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
loadingDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
private void getBaseUserInfo() {
|
||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean bean) {
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(activity);
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info != null && info.length > 0 && info[0] != null && mFirstLogin) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
startActivity(new Intent(LoginActivity.this,MainActivity.class));
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
IMLoginManager.get(mContext).setisNewUserOne(true);
|
||||
IMLoginManager.get(mContext).setNewUserGif(true);
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop"));
|
||||
}
|
||||
} else {
|
||||
startActivity(new Intent(LoginActivity.this,MainActivity.class));
|
||||
}
|
||||
loadingDialog.dismiss();
|
||||
finish();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Response<JsonBean> response) {
|
||||
super.onError(response);
|
||||
String message = response.message();
|
||||
System.out.println(">>>>>" + message);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void close(String str) {
|
||||
if ("close_login".equals(str)) {
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 三方登录
|
||||
// */
|
||||
// private void loginBuyThird(LoginData data) {
|
||||
// mLoginType = data.getType();
|
||||
// MainHttpUtil.loginByThird(data.getOpenID(), mPromoCode, mUuidDevice, data.getNickName(), data.getAvatar(), data.getType(), new HttpCallback() {
|
||||
// @Override
|
||||
// public void onSuccess(int code, String msg, String[] info) {
|
||||
// onLoginSuccess(code, msg, info);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
//从网页获取推广码
|
||||
private void getPromoCode() {
|
||||
OpenInstall.getInstall(new AppInstallAdapter() {
|
||||
@Override
|
||||
public void onInstall(AppData appData) {
|
||||
//获取渠道数据
|
||||
String channelCode = appData.getChannel();
|
||||
//获取自定义数据
|
||||
if (appData.getData() != null) {
|
||||
mPromoCode = appData.getData();
|
||||
}
|
||||
Log.d("OpenInstall", "appData.getData()= " + appData.getData());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getUuidDevice() {
|
||||
mUuidDevice = DeviceUtils.getUniqueDeviceId();
|
||||
}
|
||||
|
||||
private void initUserArea() {
|
||||
LiveNetManager.get(mContext).getUserArea(new com.yunbao.common.http.base.HttpCallback<UserAreaBean>() {
|
||||
@Override
|
||||
public void onSuccess(UserAreaBean data) {
|
||||
IMLoginManager.get(mContext).put("sys_user_area", data.getArea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mAnimator != null) {
|
||||
mAnimator.cancel();
|
||||
}
|
||||
mAnimator = null;
|
||||
EventBus.getDefault().unregister(this);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.LOGIN);
|
||||
// CommonHttpUtil.cancel(CommonHttpConsts.GET_QQ_LOGIN_UNION_ID);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.LOGIN_BY_THIRD);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO);
|
||||
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
RouteUtil.forwardEntry2();
|
||||
}
|
||||
}
|
@ -0,0 +1,569 @@
|
||||
package com.shayu.onetoone.activity.login;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.blankj.utilcode.util.DeviceUtils;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.fm.openinstall.OpenInstall;
|
||||
import com.fm.openinstall.listener.AppInstallAdapter;
|
||||
import com.fm.openinstall.model.AppData;
|
||||
import com.sahooz.library.Country;
|
||||
import com.sahooz.library.CountryPicker;
|
||||
import com.sahooz.library.OnPick;
|
||||
import com.shayu.onetoone.R;
|
||||
import com.shayu.onetoone.activity.MainActivity;
|
||||
import com.shayu.onetoone.utils.MainHttpUtil;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.http.LiveHttpUtil;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/25.
|
||||
*/
|
||||
|
||||
public class RegisterActivity extends AbsActivity {
|
||||
|
||||
private EditText mEditPhone;
|
||||
private EditText mEditCode;
|
||||
private EditText mEditPwd1;
|
||||
private EditText mEditPwd2;
|
||||
private EditText edit_invitecode_2;
|
||||
private TextView mBtnCode;
|
||||
private View mBtnRegister;
|
||||
private Handler mHandler;
|
||||
private static final int TOTAL = 60;
|
||||
private int mCount = TOTAL;
|
||||
private String mGetCode;
|
||||
private String mGetCodeAgain;
|
||||
private Dialog mDialog;
|
||||
private boolean mFirstLogin;//是否是第一次登录
|
||||
private boolean mShowInvite;
|
||||
private String mPromoCode = "";//推广码
|
||||
private String UserID = "";//用户推广码
|
||||
private String mUuidDevice = "";//手机唯一标识符
|
||||
private int mPhoneMinLength = 5;//输入手机号的最小位数
|
||||
private TextView mTvCountryCode;
|
||||
private int mCountryCode = 852;//国家代码
|
||||
private ImageView mIvCountryCode;
|
||||
private WebView webview;
|
||||
private WebSettings webSettings;
|
||||
private LinearLayout yqm_view;
|
||||
private ArrayList<Country> allCountries = new ArrayList<>();
|
||||
private RegisterActivity activity;
|
||||
//网络请求的回执
|
||||
private Handler netHandler = new Handler();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_register;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
activity = this;
|
||||
mEditPhone = (EditText) findViewById(R.id.edit_phone);
|
||||
webview = (WebView) findViewById(R.id.webview);
|
||||
initView();
|
||||
mTvCountryCode = findViewById(R.id.tvCountryCode);
|
||||
mIvCountryCode = findViewById(R.id.ivCountryCode);
|
||||
mEditCode = (EditText) findViewById(R.id.edit_code);
|
||||
mEditPwd1 = (EditText) findViewById(R.id.edit_pwd_1);
|
||||
mEditPwd2 = (EditText) findViewById(R.id.edit_pwd_2);
|
||||
mBtnCode = (TextView) findViewById(R.id.btn_code);
|
||||
mBtnRegister = findViewById(R.id.btn_register);
|
||||
edit_invitecode_2 = (EditText) findViewById(R.id.edit_invitecode_2);
|
||||
yqm_view = (LinearLayout) findViewById(R.id.yqm_view);
|
||||
//获取设备唯一标识符
|
||||
getUuidDevice();
|
||||
getPromoCode();
|
||||
|
||||
mGetCode =mContext.getString(R.string.reg_get_code);
|
||||
mGetCodeAgain =mContext.getString(R.string.reg_get_code_again);
|
||||
mTvCountryCodeClick();
|
||||
mEditPhone.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (!TextUtils.isEmpty(s) && s.length() >= mPhoneMinLength) {
|
||||
mBtnCode.setEnabled(true);
|
||||
} else {
|
||||
mBtnCode.setEnabled(false);
|
||||
}
|
||||
changeEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
});
|
||||
TextWatcher textWatcher = new TextWatcher() {
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
changeEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
||||
}
|
||||
};
|
||||
mEditCode.addTextChangedListener(textWatcher);
|
||||
mEditPwd1.addTextChangedListener(textWatcher);
|
||||
mEditPwd2.addTextChangedListener(textWatcher);
|
||||
mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
mCount--;
|
||||
if (mCount > 0) {
|
||||
mBtnCode.setText(mGetCodeAgain + "(" + mCount + "s)");
|
||||
if (mHandler != null) {
|
||||
mHandler.sendEmptyMessageDelayed(0, 1000);
|
||||
}
|
||||
} else {
|
||||
mBtnCode.setText(mGetCode);
|
||||
mCount = TOTAL;
|
||||
if (mBtnCode != null) {
|
||||
mBtnCode.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mDialog = DialogUitl.loadingDialog(mContext, getString(R.string.reg_register_ing));
|
||||
// EventBus.getDefault().register(this);
|
||||
|
||||
allCountries.clear();
|
||||
allCountries.addAll(Country.getAll(mContext, null));
|
||||
|
||||
//String ct = Locale.getDefault().getCountry();
|
||||
String ct = IMLoginManager.get(mContext).getString("sys_user_area");
|
||||
ct = TextUtils.equals("中国", ct) ? "中国香港" : ct;
|
||||
for (int i = 0; i < allCountries.size(); i++) {
|
||||
if (allCountries.get(i).chs.equals(ct)) {
|
||||
String countryName = allCountries.get(i).name;
|
||||
countryName = countryName.length() > 4 ? countryName.substring(0, 4) : countryName;
|
||||
mTvCountryCode.setText("+" + allCountries.get(i).code + " " + countryName);
|
||||
mCountryCode = allCountries.get(i).code;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class JsBridge {
|
||||
@JavascriptInterface
|
||||
public void getData(final String Randstr, final String Ticket) {
|
||||
|
||||
((RegisterActivity) mContext).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Log.i("tvss", Randstr);
|
||||
webview.setVisibility(View.GONE);
|
||||
//获取验证码
|
||||
getMessageCode(Randstr, Ticket);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
webview = (WebView) findViewById(R.id.webview);
|
||||
webSettings = webview.getSettings();
|
||||
webSettings.setUseWideViewPort(true);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
// 禁用缓存
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
|
||||
webview.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
// 开启js支持
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webview.addJavascriptInterface(new JsBridge(), "jsBridge");
|
||||
// 也可以加载本地html(webView.loadUrl("file:///android_asset/xxx.html"))
|
||||
webview.loadUrl(CommonAppConfig.HOST + "/h5/live/TCaptcha.html");
|
||||
}
|
||||
|
||||
|
||||
private void mTvCountryCodeClick() {
|
||||
mIvCountryCode.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showCountryCode();
|
||||
}
|
||||
});
|
||||
mTvCountryCode.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
showCountryCode();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void changeEnable() {
|
||||
}
|
||||
|
||||
private void showCountryCode() {
|
||||
CountryPicker.newInstance(null, new OnPick() {
|
||||
@Override
|
||||
public void onPick(Country country) {
|
||||
String countryName = country.name;
|
||||
countryName = countryName.length() > 4 ? countryName.substring(0, 4) + "..." : countryName;
|
||||
mTvCountryCode.setText(" +" + country.code + " " + countryName);
|
||||
mCountryCode = country.code;
|
||||
}
|
||||
}).show(getSupportFragmentManager(), "country");
|
||||
}
|
||||
|
||||
public void registerClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_code) {
|
||||
webview.setVisibility(View.VISIBLE);
|
||||
|
||||
} else if (i == R.id.btn_register) {
|
||||
register();
|
||||
} else if (i == R.id.btn_tip2) {
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY1,false);
|
||||
} else if (i == R.id.btn_tip3) {
|
||||
WebViewActivity.forward(mContext, HtmlConfig.REG_PRIVCAY2,false);
|
||||
}
|
||||
}
|
||||
|
||||
private void getUuidDevice() {
|
||||
String uuid = DeviceUtils.getUniqueDeviceId();
|
||||
if (uuid != null) {
|
||||
mUuidDevice = uuid;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取短信验证码
|
||||
*/
|
||||
private void getMessageCode(String Randstr, String Ticket) {
|
||||
String phoneNum = mEditPhone.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(phoneNum)) {
|
||||
mEditPhone.setError(mContext.getString(R.string.reg_input_phone));
|
||||
mEditPhone.requestFocus();
|
||||
return;
|
||||
}
|
||||
mEditCode.requestFocus();
|
||||
MainHttpUtil.getRegisterCode(Randstr, Ticket, phoneNum, mCountryCode, mGetCodeCallback);
|
||||
}
|
||||
|
||||
private HttpCallback mGetCodeCallback = new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
mBtnCode.setEnabled(false);
|
||||
if (mHandler != null) {
|
||||
mHandler.sendEmptyMessage(0);
|
||||
}
|
||||
if (!TextUtils.isEmpty(msg) && msg.contains("123456")) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 注册并登陆
|
||||
*/
|
||||
private void register() {
|
||||
final String phoneNum = mEditPhone.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(phoneNum)) {
|
||||
mEditPhone.setError(mContext.getString(R.string.reg_input_phone));
|
||||
mEditPhone.requestFocus();
|
||||
return;
|
||||
}
|
||||
String code = mEditCode.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(code)) {
|
||||
mEditCode.setError(mContext.getString(R.string.reg_input_code));
|
||||
mEditCode.requestFocus();
|
||||
return;
|
||||
}
|
||||
final String pwd = mEditPwd1.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(pwd)) {
|
||||
mEditPwd1.setError(mContext.getString(R.string.reg_input_pwd_1));
|
||||
mEditPwd1.requestFocus();
|
||||
return;
|
||||
}
|
||||
String pwd2 = mEditPwd2.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(pwd2)) {
|
||||
mEditPwd2.setError(mContext.getString(R.string.reg_input_pwd_2));
|
||||
mEditPwd2.requestFocus();
|
||||
return;
|
||||
}
|
||||
if (!pwd.equals(pwd2)) {
|
||||
mEditPwd2.setError(mContext.getString(R.string.reg_pwd_error));
|
||||
mEditPwd2.requestFocus();
|
||||
return;
|
||||
}
|
||||
if (mDialog != null) {
|
||||
mDialog.show();
|
||||
}
|
||||
String ti = "";
|
||||
if (edit_invitecode_2.getText().toString().trim().equals("此設備已註冊")){
|
||||
ti = "";
|
||||
}else{
|
||||
ti = edit_invitecode_2.getText().toString().trim();
|
||||
}
|
||||
MainHttpUtil.register(UserID,ti, phoneNum, mPromoCode, mUuidDevice, mCountryCode, pwd, pwd2, code, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
//注册成功
|
||||
login(phoneNum, pwd, mUuidDevice);
|
||||
OpenInstall.reportRegister();
|
||||
} else {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//从网页获取推广码
|
||||
private void getPromoCode() {
|
||||
|
||||
OpenInstall.getInstall(new AppInstallAdapter() {
|
||||
@Override
|
||||
public void onInstall(AppData appData) {
|
||||
//获取渠道数据
|
||||
String channelCode = appData.getChannel();
|
||||
//获取自定义数据
|
||||
if (appData.getData() != null && !appData.getData().equals("")) {
|
||||
JSONObject data = JSON.parseObject(appData.getData());
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
yqm_view.setVisibility(View.VISIBLE);
|
||||
MainHttpUtil.getDeviceLoginType(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 201){
|
||||
edit_invitecode_2.setText("此設備已註冊");
|
||||
edit_invitecode_2.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
yqm_view.setVisibility(View.GONE);
|
||||
//推广的码
|
||||
mPromoCode = data.getString("admin_id") + "";
|
||||
//用户的码
|
||||
UserID = data.getString("user_id") + "";
|
||||
}
|
||||
Log.d("OpenInstall", UserID+"appData.getData()1111= " + mPromoCode);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void login(String phoneNum, String pwd, String uuid) {
|
||||
MainHttpUtil.login(phoneNum, pwd, uuid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
String uid = obj.getString("id");
|
||||
String token = obj.getString("token");
|
||||
mFirstLogin = obj.getIntValue("first_login") == 1;
|
||||
mShowInvite = obj.getIntValue("isagent") == 1;
|
||||
CommonAppConfig.getInstance().setLoginInfo(uid, token, true);
|
||||
//设置登录信息
|
||||
IMLoginModel model = GsonUtils.fromJson(info[0], IMLoginModel.class);
|
||||
IMLoginManager.get(activity).setupLoginUser(model);
|
||||
//融云连接服务器
|
||||
RongcloudIMManager.connectIM(activity);
|
||||
getBaseUserInfo();
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
private void getBaseUserInfo() {
|
||||
MainHttpUtil.getBaseInfo(new CommonCallback<UserBean>() {
|
||||
@Override
|
||||
public void callback(UserBean bean) {
|
||||
if (mDialog != null) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
if (bean != null) {
|
||||
netHandler.post(getRandJoinAnchor);
|
||||
// EventBus.getDefault().post(new RegSuccessEvent());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户自动签到
|
||||
*/
|
||||
private Runnable getRandJoinAnchor = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IMLoginModel userInfo = IMLoginManager.get(activity).getUserInfo();
|
||||
HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor")
|
||||
.params("uid", userInfo.getId())
|
||||
.params("token", userInfo.getToken())
|
||||
.execute(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (info[0] != null) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
IMLoginManager.get(activity).setisNewUserOne(true);
|
||||
IMLoginManager.get(activity).setNewUserGif(true);
|
||||
if (obj.containsKey("home_zdy_img_us")) {
|
||||
home_zdy_img_us = obj.getString("home_zdy_img_us");
|
||||
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
|
||||
}
|
||||
gotoLive(obj.getString("anchor_id"));
|
||||
if (obj.containsKey("home_zdy_pop")) {
|
||||
NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop"));
|
||||
}
|
||||
jumpMain(false);
|
||||
} else {
|
||||
jumpMain(false);
|
||||
}
|
||||
// EventBus.getDefault().post(new RegSuccessEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
private void jumpMain(boolean showInvite) {
|
||||
Intent intent = new Intent(activity, MainActivity.class);
|
||||
intent.putExtra(Constants.SHOW_INVITE, showInvite);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
private void gotoLive(final String live_id) {
|
||||
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
new LiveRoomCheckLivePresenter(mContext, liveBean.getUid(), liveBean.getStream(), new LiveRoomCheckLivePresenter.NewActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(String liveUid, String stream, int liveType, String liveTypeVal, String liveSdk) {
|
||||
RouteUtil.forwardLiveAudienceActivity(liveBean, liveType, Integer.parseInt(liveSdk), Integer.parseInt(liveTypeVal));
|
||||
NoviceInstructorManager.get(mContext).setFrist(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCheckError(String contextError) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
// MainActivity.forward(RegisterActivity.this, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onRegSuccessEvent(RegSuccessEvent e) {
|
||||
// finish();
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.GET_REGISTER_CODE);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.REGISTER);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.LOGIN);
|
||||
// MainHttpUtil.cancel(MainHttpConsts.GET_BASE_INFO);
|
||||
if (mHandler != null) {
|
||||
mHandler.removeCallbacksAndMessages(null);
|
||||
mHandler = null;
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
15
OneToOne/src/main/res/drawable/background_8f7cdf.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<gradient
|
||||
android:startColor="#8F7CDF"
|
||||
android:endColor="#D56FF0"
|
||||
android:centerColor="#D56FF0"
|
||||
android:angle="40"
|
||||
/>
|
||||
<corners android:radius="30dp"></corners>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
9
OneToOne/src/main/res/drawable/background_fff.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="30dp" />
|
||||
<solid android:color="#ffffff" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
5
OneToOne/src/main/res/drawable/bg_me_data.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="10dp"/>
|
||||
<solid android:color="@color/white"/>
|
||||
</shape>
|
318
OneToOne/src/main/res/layout/activity_entry.xml
Normal file
@ -0,0 +1,318 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/video_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@mipmap/bg_login"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="30dp"
|
||||
android:layout_marginTop="95dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:text="Hello,"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="30dp"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:text="歡迎來到..."/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="21dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_btn_facebook"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginLeft="42dp"
|
||||
android:layout_marginRight="42dp"
|
||||
android:background="@drawable/background_8f7cdf"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/ykdl" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/user_login_guest_login"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="21dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_btn_facebook"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginLeft="42dp"
|
||||
android:layout_marginRight="42dp"
|
||||
android:background="@drawable/background_fff"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/facebook" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:text="@string/user_login_facebook"
|
||||
android:textColor="@color/black1"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="21dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_google"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:layout_marginLeft="42dp"
|
||||
android:layout_marginRight="42dp"
|
||||
android:background="@drawable/background_fff"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginRight="8dp"
|
||||
android:src="@mipmap/google" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/user_login_google"
|
||||
android:textColor="@color/black1"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- <RelativeLayout-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_gravity="center"-->
|
||||
<!-- android:layout_marginBottom="21dp"-->
|
||||
<!-- android:orientation="vertical">-->
|
||||
|
||||
<!-- <com.twitter.sdk.android.core.identity.TwitterLoginButton-->
|
||||
<!-- android:id="@+id/tt_login_button"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="54dp"-->
|
||||
<!-- android:layout_marginLeft="42dp"-->
|
||||
<!-- android:layout_marginRight="42dp"-->
|
||||
<!-- android:visibility="invisible" />-->
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:id="@+id/lt_btn_twitter"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="54dp"-->
|
||||
<!-- android:layout_marginLeft="42dp"-->
|
||||
<!-- android:layout_marginRight="42dp"-->
|
||||
<!-- android:background="@drawable/background_32aae0"-->
|
||||
<!-- android:gravity="center|left">-->
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:layout_width="30dp"-->
|
||||
<!-- android:layout_height="30dp"-->
|
||||
<!-- android:layout_gravity="center"-->
|
||||
<!-- android:layout_marginLeft="54dp"-->
|
||||
<!-- android:src="@mipmap/icon_twitter" />-->
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="21dp"-->
|
||||
<!-- android:text="@string/user_login_twitter"-->
|
||||
<!-- android:textColor="@color/white"-->
|
||||
<!-- android:textSize="14sp" />-->
|
||||
<!-- </LinearLayout>-->
|
||||
<!-- </RelativeLayout>-->
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_login_other"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="25dp"
|
||||
android:layout_marginRight="25dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_phone"
|
||||
android:layout_width="57dp"
|
||||
android:layout_height="57dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/phone" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="57dp"
|
||||
android:layout_height="57dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/apple" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_line"
|
||||
android:layout_width="57dp"
|
||||
android:layout_height="57dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/line"
|
||||
android:visibility="visible" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="57dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.twitter.sdk.android.core.identity.TwitterLoginButton
|
||||
android:id="@+id/tt_login_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_btn_twitter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="57dp"
|
||||
android:layout_height="57dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:src="@mipmap/tiw"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_customer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:gravity="center">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_customer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/customer_service2"
|
||||
android:textColor="#A279E4"
|
||||
android:textSize="11sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tip_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_marginBottom="22dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/next_step_is_consent"
|
||||
android:textColor="#ffb1b1b1"
|
||||
android:textSize="10sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_tip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:text="@string/user_protocol2"
|
||||
android:textColor="#A279E4"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:text="@string/and"
|
||||
android:textColor="#ffb1b1b1"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_tip1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:text="@string/privacy_terms"
|
||||
android:textColor="#A279E4"
|
||||
android:textSize="10sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
236
OneToOne/src/main/res/layout/activity_find_pwd.xml
Normal file
@ -0,0 +1,236 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_login"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@mipmap/bg_w">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="80dp"
|
||||
android:gravity="center"
|
||||
android:text="忘记密码"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="33sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="1dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:paddingLeft="0dp"
|
||||
android:background="@mipmap/eid"
|
||||
>
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCountryCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|right"
|
||||
android:minWidth="45dp"
|
||||
android:text="+852"
|
||||
android:textColor="#F5F5F5"
|
||||
android:layout_marginLeft="22dp"
|
||||
android:textSize="24sp"
|
||||
/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCountryCode"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@mipmap/xl"
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:hint="@string/reg_input_phone"
|
||||
android:inputType="number"
|
||||
android:maxLength="11"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
>
|
||||
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_code"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="22dp"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:hint="@string/reg_input_code"
|
||||
android:inputType="number"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_code"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:enabled="false"
|
||||
android:gravity="center_vertical"
|
||||
android:onClick="registerClick"
|
||||
android:text="@string/reg_get_code"
|
||||
android:layout_marginRight="20dp"
|
||||
android:textColor="#997BE2"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="1dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
|
||||
>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_pwd_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:hint="@string/modify_pwd_new_1"
|
||||
android:inputType="textPassword"
|
||||
android:layout_marginLeft="22dp"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid">
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_pwd_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="22dp"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:background="@null"
|
||||
android:hint="@string/reg_input_pwd_2"
|
||||
android:inputType="textPassword"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<Button
|
||||
android:id="@+id/btn_register"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/background_8f7cdf"
|
||||
android:gravity="center"
|
||||
android:onClick="registerClick"
|
||||
android:text="@string/find_pwd_find"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="600dp"
|
||||
android:layout_height="600dp"
|
||||
android:visibility="gone"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="100dp"/>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
@ -1,41 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout 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:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.LauncherActivity">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_user"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="322dp"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:hint="账号"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#000" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_password"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="34dp"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:hint="密码"
|
||||
app:layout_constraintStart_toStartOf="@+id/edit_user"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edit_user" />
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_skip_img"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="37dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:visibility="invisible">
|
||||
|
||||
<com.yunbao.common.custom.CircleProgress
|
||||
android:id="@+id/progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:cp_bg_color="@color/white"
|
||||
app:cp_cur_progress="0"
|
||||
app:cp_fg_color="#ff7200"
|
||||
app:cp_stroke_width="2dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/recommend_skip"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="11sp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_skip_video"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="37dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/recommend_skip"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="11sp"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cover"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="true"
|
||||
android:scaleType="centerCrop" />
|
||||
</FrameLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="34dp"
|
||||
android:text="登陆"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edit_password" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
149
OneToOne/src/main/res/layout/activity_login.xml
Normal file
@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_login"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@mipmap/bg_w">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="80dp"
|
||||
android:gravity="center"
|
||||
android:text="用户登录"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="33sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:layout_marginTop="40dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:gravity="left|center"
|
||||
android:hint="@string/login_input_phone"
|
||||
android:maxLength="20"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_pwd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:gravity="left|center"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:hint="@string/login_input_pwd"
|
||||
android:inputType="textPassword"
|
||||
android:maxLength="20"
|
||||
android:singleLine="true"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:id="@+id/btn_forget_pwd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="忘记密码?"
|
||||
android:layout_marginLeft="28dp"
|
||||
android:textColor="#ff9b7be2"
|
||||
android:textSize="14sp"
|
||||
android:onClick="loginClick"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="150dp"
|
||||
android:layout_alignParentBottom="true">
|
||||
<Button
|
||||
android:id="@+id/btn_login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:background="@drawable/background_8f7cdf"
|
||||
android:gravity="center"
|
||||
android:onClick="loginClick"
|
||||
android:text="@string/login_tip_4"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_register"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:background="@drawable/background_fff"
|
||||
android:gravity="center"
|
||||
android:onClick="loginClick"
|
||||
android:text="@string/reg"
|
||||
android:textColor="#333333"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
287
OneToOne/src/main/res/layout/activity_register.xml
Normal file
@ -0,0 +1,287 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/bg_login"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@mipmap/bg_w">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginBottom="25dp"
|
||||
android:text="用户注册"
|
||||
android:gravity="center"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textStyle="bold"
|
||||
android:textSize="33sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="0dp">
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCountryCode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|right"
|
||||
android:minWidth="45dp"
|
||||
android:text="+852"
|
||||
android:textColor="#F5F5F5"
|
||||
android:layout_marginLeft="22dp"
|
||||
android:textSize="20sp"
|
||||
/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivCountryCode"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@mipmap/xl"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@null"
|
||||
android:hint="@string/phone_number"
|
||||
android:inputType="number"
|
||||
android:maxLength="11"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_code"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@null"
|
||||
android:hint="@string/reg_input_code"
|
||||
android:inputType="number"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_code"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="20dp"
|
||||
android:enabled="false"
|
||||
android:gravity="center_vertical"
|
||||
android:onClick="registerClick"
|
||||
android:text="@string/reg_get_code"
|
||||
android:textColor="#997BE2"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_pwd_1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/reg_input_pwd_1"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_pwd_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/reg_input_pwd_2"
|
||||
android:inputType="textPassword"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/yqm_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginBottom="15dp"
|
||||
android:background="@mipmap/eid"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edit_invitecode_2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:background="@null"
|
||||
android:hint="@string/reg_input_pwd_3"
|
||||
android:inputType="text"
|
||||
android:textColor="#F5F5F5"
|
||||
android:textColorHint="#F5F5F5"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_register"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:background="@drawable/background_8f7cdf"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:onClick="registerClick"
|
||||
android:text="@string/register_and_log_in"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp"
|
||||
android:focusable="true" />
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_white"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tip_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="17dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/register_tip_1"
|
||||
android:textColor="@color/gray1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_tip2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:onClick="registerClick"
|
||||
android:text="@string/register_tip_2"
|
||||
android:textColor="@color/global"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:text="@string/register_tip_4"
|
||||
android:textColor="@color/gray1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_tip3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:onClick="registerClick"
|
||||
android:text="@string/register_tip_3"
|
||||
android:textColor="@color/global"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<WebView
|
||||
android:id="@+id/webview"
|
||||
android:layout_width="600dp"
|
||||
android:layout_height="600dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="100dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -1,15 +1,731 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<Button
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="357dp"
|
||||
android:layout_marginEnd="142dp"
|
||||
android:text="我的"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
android:background="@color/gray2"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="50dp">
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="240dp"
|
||||
android:background="@mipmap/new_bg" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_me_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="144dp"
|
||||
android:layout_marginTop="42dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/complete_information_radius"
|
||||
android:layout_width="7dp"
|
||||
android:layout_height="7dp"
|
||||
android:layout_marginStart="115.9dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
app:cardBackgroundColor="#FF5730"
|
||||
app:cardCornerRadius="20dp" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/complete_information"
|
||||
android:layout_width="107.9dp"
|
||||
android:layout_height="25.25dp"
|
||||
android:layout_marginStart="21dp"
|
||||
android:layout_marginTop="-5dp"
|
||||
android:background="@mipmap/icon_complete_information">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="@string/complete_information"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12.44sp" />
|
||||
</RelativeLayout>
|
||||
<!--完善资料-->
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="21dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="用戶名稱"
|
||||
android:textColor="@color/black2"
|
||||
android:textSize="19sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_edit"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:src="@mipmap/home_btn_edit" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/signature"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="21dp"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="这个人很懒,什么也没留下。"
|
||||
android:textColor="@color/gray_cccccc"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginLeft="21dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center|left">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/good_nub_ico"
|
||||
android:layout_width="21dp"
|
||||
android:layout_height="15dp"
|
||||
android:src="@mipmap/good_nub"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="15dp"
|
||||
android:src="@mipmap/icon_userid" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/id_val"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/gray_B1B1B1"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btn_copy"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/copy"
|
||||
android:textColor="#ff9f9f9f"
|
||||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center|left">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_lv_pic"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="15dp"
|
||||
android:src="@mipmap/icon_userlv" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/level_anchor"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/level"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_level"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center|left"
|
||||
android:text=""
|
||||
android:textColor="@color/gray_B1B1B1"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="11dp"
|
||||
android:layout_height="11dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:background="@mipmap/icon_arrow_right"
|
||||
android:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="114dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginRight="18dp"
|
||||
android:gravity="center|right">
|
||||
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/avatar"
|
||||
android:layout_width="86dp"
|
||||
android:layout_height="86dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="9dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:riv_border_color="#FFFFFF"
|
||||
app:riv_border_width="2dp"
|
||||
app:riv_oval="true" />
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/gift_svga"
|
||||
android:layout_width="104dp"
|
||||
android:layout_height="104dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:scaleType="centerCrop"
|
||||
app:autoPlay="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="114dp"
|
||||
android:layout_below="@id/lt_me_top"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:background="@drawable/bg_me_data"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="6dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="39dp"
|
||||
android:layout_height="39dp"
|
||||
android:src="@mipmap/home_me_diamonds" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/diamond"
|
||||
android:textColor="@color/gray1"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/coin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom">
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="42dp"
|
||||
android:background="@color/gray_dcdcdc" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="6dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="39dp"
|
||||
android:layout_height="39dp"
|
||||
android:src="@mipmap/icon_collectibles" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/coins"
|
||||
android:textColor="@color/gray1"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/star_coin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="bottom">
|
||||
|
||||
<View
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="42dp"
|
||||
android:background="@color/gray_dcdcdc" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="6dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="39dp"
|
||||
android:layout_height="39dp"
|
||||
android:src="@mipmap/home_me_gold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/golden_bean"
|
||||
android:textColor="@color/gray1"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/gold"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp"
|
||||
android:paddingBottom="3dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_coin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/charge"
|
||||
android:textColor="@color/gray_B1B1B1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="11dp"
|
||||
android:layout_height="11dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:background="@mipmap/icon_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_star_coin"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_star_coin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/charge"
|
||||
android:textColor="@color/gray_B1B1B1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="11dp"
|
||||
android:layout_height="11dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:background="@mipmap/icon_arrow_right" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_gold"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/receive"
|
||||
android:textColor="@color/gray_B1B1B1"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="11dp"
|
||||
android:layout_height="11dp"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:background="@mipmap/icon_arrow_right" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_advertisement"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:visibility="gone">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/cv_chatcontent_img1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:cardBackgroundColor="@color/transparent"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:cardElevation="0dp">
|
||||
|
||||
<com.ms.banner.Banner
|
||||
android:id="@+id/banner_me"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:delay_time="5000"
|
||||
app:indicator_height="8dp"
|
||||
app:indicator_width="8dp" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_noble"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="81dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:background="@drawable/bg_me_data"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/user_noble_ico"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginLeft="21dp"
|
||||
android:src="@mipmap/icon_vip_gold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
android:gravity="center|left"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="18dp"
|
||||
android:paddingRight="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_noble_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="16sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/user_noble_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="@string/open_noble_text"
|
||||
android:textColor="@color/gray1"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/v_noble"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:background="@mipmap/icon_more_gray"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:background="@drawable/bg_me_data">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="9dp"
|
||||
android:layout_marginBottom="9dp"
|
||||
android:focusable="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never"
|
||||
android:paddingLeft="6dp"
|
||||
android:paddingRight="6dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:background="@drawable/bg_me_data"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rt_kefu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:paddingLeft="21dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_kefu"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/me_msagess" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_toRightOf="@id/img_kefu"
|
||||
android:text="@string/customer_service"
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="42dp"
|
||||
android:text="@string/kefu_time"
|
||||
android:textColor="@color/gray3"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="21dp"
|
||||
android:background="@mipmap/icon_arrow_right" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.33dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:background="#D6D6D6" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rt_setting"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="54dp"
|
||||
android:paddingLeft="21dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/img_setting"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@mipmap/me_msagess" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_setting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_toRightOf="@id/img_setting"
|
||||
android:text="@string/set_up"
|
||||
android:textColor="@color/textColor"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<View
|
||||
android:id="@+id/red_point"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="12dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="15dp"
|
||||
android:layout_toEndOf="@id/tv_setting"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10dp"
|
||||
android:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="42dp"
|
||||
android:text=""
|
||||
android:textColor="@color/gray3"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="21dp"
|
||||
android:background="@mipmap/icon_arrow_right" />
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.33dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginRight="15dp"
|
||||
android:background="#D6D6D6"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
BIN
OneToOne/src/main/res/mipmap-xxhdpi/apple.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/bg_login.png
Normal file
After Width: | Height: | Size: 198 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/bg_w.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/eid.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/facebook.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/google.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/home_btn_edit.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/home_me_diamonds.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/home_me_gold.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/icon_arrow_right.png
Normal file
After Width: | Height: | Size: 244 B |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/icon_collectibles.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 33 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/icon_more_gray.png
Normal file
After Width: | Height: | Size: 972 B |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/icon_userid.png
Normal file
After Width: | Height: | Size: 944 B |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/icon_userlv.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/icon_vip_gold.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/line.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/me_msagess.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/new_bg.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/phone.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/tiw.png
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/xl.png
Normal file
After Width: | Height: | Size: 530 B |
BIN
OneToOne/src/main/res/mipmap-xxhdpi/ykdl.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
@ -65,7 +65,7 @@ repositories {
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
api fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
|
||||
api files('libs/jcc-bate-0.7.3.jar')
|
||||
compileOnly fileTree(dir: '../libs', include: ['*.aar'])
|
||||
api rootProject.ext.dependencies["appcompat-androidx"]
|
||||
@ -197,4 +197,9 @@ dependencies {
|
||||
api 'com.github.gzu-liyujiang.AndroidPicker:WheelView:4.1.11'
|
||||
//自定义圆角图片
|
||||
api 'com.makeramen:roundedimageview:2.3.0'
|
||||
api 'com.google.android.gms:play-services-auth:15.0.0'
|
||||
api 'com.google.android.material:material:1.4.0'
|
||||
api files('libs/OpenInstall_v2.3.0.jar')
|
||||
// api files('libs/svgaplayer-release-v1.2.1.aar')
|
||||
|
||||
}
|
||||
|
@ -845,6 +845,7 @@
|
||||
<string name="user_task_but">前置任務</string>
|
||||
|
||||
<string name="user_login_facebook">使用Facebook登錄</string>
|
||||
<string name="user_login_guest_login">遊客登錄</string>
|
||||
<string name="user_login_twitter">使用Twitter登錄</string>
|
||||
<string name="user_login_google">使用Google登錄</string>
|
||||
|
||||
|
@ -804,6 +804,7 @@
|
||||
|
||||
<string name="user_task_but">Predecessors</string>
|
||||
<string name="user_login_facebook">Sign in with Facebook</string>
|
||||
<string name="user_login_guest_login">guest login</string>
|
||||
<string name="user_login_twitter">Sign in with Twitter</string>
|
||||
<string name="user_login_google">Sign in with Google</string>
|
||||
|
||||
|
@ -1 +1 @@
|
||||
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlinOptions {
allWarningsAsErrors = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
mavenCentral()
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation (name:'../libs/beautysdk-202202241203',ext:'aar')
implementation (name:'../libs/svgaplayer-release-v1.2.1',ext:'aar')
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//common
api project(path: ':common')
api project(path:':FaceUnity')//新娱美颜
api project(':Share')//分享
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
//工具
api rootProject.ext.dependencies["blank-utilcode"]
implementation 'com.eightbitlab:blurview:1.6.6'
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.getkeepsafe.relinker:relinker:1.4.4"
//ExoPlayer,腾讯的播放器不支持无缝切换
implementation 'com.google.android.exoplayer:exoplayer:2.18.2'
implementation 'com.google.android.exoplayer:exoplayer-core:2.18.2@aar'
}
|
||||
apply plugin: 'com.android.library'
apply plugin: 'img-optimizer'
apply plugin: 'kotlin-android'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
buildToolsVersion rootProject.ext.android.buildToolsVersion
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
packagingOptions {
pickFirst "lib/armeabi/libyuvutils.so"
pickFirst "lib/arm64-v8a/libyuvutils.so"
pickFirst "lib/armeabi-v7a/libyuvutils.so"
pickFirst "lib/armeabi/libyuvtools.so"
pickFirst "lib/arm64-v8a/libyuvtools.so"
pickFirst "lib/armeabi-v7a/libyuvtools.so"
exclude "lib/arm64-v8a/libmmcv_api_handgesture.so"
exclude "lib/arm64-v8a/libmmcv_api_express.so"
exclude "lib/arm64-v8a/libMediaEncoder.so"
exclude "lib/arm64-v8a/libarcore_sdk_c.so"
exclude "lib/arm64-v8a/libmediadecoder.so"
exclude "lib/arm64-v8a/libMediaMuxer.so"
exclude "lib/arm64-v8a/libarcore_sdk_jni.so"
exclude "lib/arm64-v8a/libMediaUtils.so"
exclude "lib/arm64-v8a/libcosmosffmpeg.so"
}
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
manifestPlaceholders = rootProject.ext.manifestPlaceholders
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
kotlinOptions {
allWarningsAsErrors = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
flatDir {
dirs 'libs', '../libs'
}
mavenCentral()
}
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation (name:'../libs/beautysdk-202202241203',ext:'aar')
//socket.io
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
//common
api project(path: ':common')
api project(path:':FaceUnity')//新娱美颜
api project(':Share')//分享
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
//工具
api rootProject.ext.dependencies["blank-utilcode"]
implementation 'com.eightbitlab:blurview:1.6.6'
implementation 'com.google.code.gson:gson:2.8.6'
implementation "com.getkeepsafe.relinker:relinker:1.4.4"
//ExoPlayer,腾讯的播放器不支持无缝切换
implementation 'com.google.android.exoplayer:exoplayer:2.18.2'
implementation 'com.google.android.exoplayer:exoplayer-core:2.18.2@aar'
}
|
@ -66,7 +66,6 @@ dependencies {
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
compileOnly files('../libs/beautysdk-202202241203.aar')
|
||||
compileOnly files('../libs/svgaplayer-release-v1.2.1.aar')
|
||||
//直播
|
||||
api project(':live')
|
||||
//短视频
|
||||
@ -75,14 +74,11 @@ dependencies {
|
||||
api project(':FaceUnity')//新娱美颜
|
||||
api project(':Share')//分享
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0'
|
||||
implementation 'com.google.android.material:material:1.4.0'
|
||||
annotationProcessor rootProject.ext.dependencies["arouter-compiler"]
|
||||
api files('libs/OpenInstall_v2.3.0.jar')
|
||||
implementation project(path: ':lib_country_code')
|
||||
//抽屉菜单
|
||||
implementation 'com.justkiddingbaby:slidemenu:1.3.0'
|
||||
implementation 'com.xj.marqueeView:marqueeView:0.1.20'
|
||||
implementation 'com.google.android.gms:play-services-auth:15.0.0'
|
||||
//引导层
|
||||
implementation 'com.binioter:guideview:1.0.0'
|
||||
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.2.0'
|
||||
|