From e3fc7786a8ffaab2181b6632613e9c825257fd13 Mon Sep 17 00:00:00 2001 From: 18142669586 <1669783059@qq.com> Date: Sat, 7 Oct 2023 09:55:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=A1=B5=20=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=B3=A8=E5=86=8C=20=E4=B8=AA=E4=BA=BA=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OneToOne/build.gradle | 1 + OneToOne/src/main/AndroidManifest.xml | 15 + .../onetoone/activity/LauncherActivity.java | 584 ++++++++++++-- .../activity/fragments/MyFragment.java | 615 ++++++++++++++- .../activity/login/EntryActivity.java | 725 +++++++++++++++++ .../activity/login/FindPwdActivity.java | 422 ++++++++++ .../activity/login/LoginActivity.java | 432 ++++++++++ .../activity/login/RegisterActivity.java | 569 ++++++++++++++ .../main/res/drawable/background_8f7cdf.xml | 15 + .../src/main/res/drawable/background_fff.xml | 9 + OneToOne/src/main/res/drawable/bg_me_data.xml | 5 + .../src/main/res/layout/activity_entry.xml | 318 ++++++++ .../src/main/res/layout/activity_find_pwd.xml | 236 ++++++ .../src/main/res/layout/activity_launcher.xml | 91 ++- .../src/main/res/layout/activity_login.xml | 149 ++++ .../src/main/res/layout/activity_register.xml | 287 +++++++ OneToOne/src/main/res/layout/fragment_my.xml | 740 +++++++++++++++++- OneToOne/src/main/res/mipmap-xxhdpi/apple.png | Bin 0 -> 5238 bytes .../src/main/res/mipmap-xxhdpi/bg_login.png | Bin 0 -> 203244 bytes OneToOne/src/main/res/mipmap-xxhdpi/bg_w.png | Bin 0 -> 53089 bytes OneToOne/src/main/res/mipmap-xxhdpi/eid.png | Bin 0 -> 10984 bytes .../src/main/res/mipmap-xxhdpi/facebook.png | Bin 0 -> 1745 bytes .../src/main/res/mipmap-xxhdpi/google.png | Bin 0 -> 3130 bytes .../main/res/mipmap-xxhdpi/home_btn_edit.png | Bin 0 -> 1883 bytes .../res/mipmap-xxhdpi/home_me_diamonds.png | Bin 0 -> 3747 bytes .../main/res/mipmap-xxhdpi/home_me_gold.png | Bin 0 -> 3432 bytes .../res/mipmap-xxhdpi/icon_arrow_right.png | Bin 0 -> 244 bytes .../res/mipmap-xxhdpi/icon_collectibles.png | Bin 0 -> 3316 bytes .../icon_complete_information.png | Bin 0 -> 33340 bytes .../main/res/mipmap-xxhdpi/icon_more_gray.png | Bin 0 -> 972 bytes .../main/res/mipmap-xxhdpi/icon_userid.png | Bin 0 -> 944 bytes .../main/res/mipmap-xxhdpi/icon_userlv.png | Bin 0 -> 1094 bytes .../main/res/mipmap-xxhdpi/icon_vip_gold.png | Bin 0 -> 2393 bytes OneToOne/src/main/res/mipmap-xxhdpi/line.png | Bin 0 -> 14584 bytes .../src/main/res/mipmap-xxhdpi/me_msagess.png | Bin 0 -> 1763 bytes .../src/main/res/mipmap-xxhdpi/new_bg.png | Bin 0 -> 13596 bytes OneToOne/src/main/res/mipmap-xxhdpi/phone.png | Bin 0 -> 5469 bytes OneToOne/src/main/res/mipmap-xxhdpi/tiw.png | Bin 0 -> 6763 bytes OneToOne/src/main/res/mipmap-xxhdpi/xl.png | Bin 0 -> 530 bytes OneToOne/src/main/res/mipmap-xxhdpi/ykdl.png | Bin 0 -> 2439 bytes common/build.gradle | 7 +- .../libs}/svgaplayer-release-v1.2.1.aar | Bin common/src/main/res/values-zh/strings.xml | 1 + common/src/main/res/values/strings.xml | 1 + live/build.gradle | 2 +- main/build.gradle | 4 - main/libs/OpenInstall_v2.3.0.jar | Bin 86069 -> 0 bytes 47 files changed, 5111 insertions(+), 117 deletions(-) create mode 100644 OneToOne/src/main/java/com/shayu/onetoone/activity/login/EntryActivity.java create mode 100644 OneToOne/src/main/java/com/shayu/onetoone/activity/login/FindPwdActivity.java create mode 100644 OneToOne/src/main/java/com/shayu/onetoone/activity/login/LoginActivity.java create mode 100644 OneToOne/src/main/java/com/shayu/onetoone/activity/login/RegisterActivity.java create mode 100644 OneToOne/src/main/res/drawable/background_8f7cdf.xml create mode 100644 OneToOne/src/main/res/drawable/background_fff.xml create mode 100644 OneToOne/src/main/res/drawable/bg_me_data.xml create mode 100644 OneToOne/src/main/res/layout/activity_entry.xml create mode 100644 OneToOne/src/main/res/layout/activity_find_pwd.xml create mode 100644 OneToOne/src/main/res/layout/activity_login.xml create mode 100644 OneToOne/src/main/res/layout/activity_register.xml create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/apple.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/bg_login.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/bg_w.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/eid.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/facebook.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/google.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/home_btn_edit.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/home_me_diamonds.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/home_me_gold.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_arrow_right.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_collectibles.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_complete_information.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_more_gray.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_userid.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_userlv.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/icon_vip_gold.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/line.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/me_msagess.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/new_bg.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/phone.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/tiw.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/xl.png create mode 100644 OneToOne/src/main/res/mipmap-xxhdpi/ykdl.png rename {libs => common/libs}/svgaplayer-release-v1.2.1.aar (100%) delete mode 100644 main/libs/OpenInstall_v2.3.0.jar diff --git a/OneToOne/build.gradle b/OneToOne/build.gradle index 72e86dffc..dc7b73b2e 100644 --- a/OneToOne/build.gradle +++ b/OneToOne/build.gradle @@ -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 diff --git a/OneToOne/src/main/AndroidManifest.xml b/OneToOne/src/main/AndroidManifest.xml index eb9bd8076..367ccfff4 100644 --- a/OneToOne/src/main/AndroidManifest.xml +++ b/OneToOne/src/main/AndroidManifest.xml @@ -103,6 +103,11 @@ + + + @@ -114,6 +119,16 @@ android:name=".activity.message.ChatActivity" android:windowSoftInputMode="stateHidden|adjustResize"/> + + + + mAdList; + private List 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() { + @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 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 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); } -} \ No newline at end of file + + @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(); + } + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java index b9a30fb0b..a1597fd8d 100644 --- a/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/fragments/MyFragment.java @@ -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, 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 mCallback1 = new CommonCallback() { + @Override + public void callback(GoogleBean bean) { + if (bean != null) { + Is_hide = bean.getIs_hide(); + } + } + }; + + private CommonCallback mCallback = new CommonCallback() { + @Override + public void callback(UserBean bean) { + List list = CommonAppConfig.getInstance().getUserItemList(); + if (bean != null) { + showData(bean, list); + } + } + }; + +// private List mBannerListNew = new ArrayList<>(); + + private void showData(UserBean u, List 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 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 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(); +// } + } + } + diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/login/EntryActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/EntryActivity.java new file mode 100644 index 000000000..3df91b69e --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/EntryActivity.java @@ -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() { + @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() { + @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() { + @Override + public void success(Result 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("") // 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 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 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() { + @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; + } + } +} + diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/login/FindPwdActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/FindPwdActivity.java new file mode 100644 index 000000000..359195068 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/FindPwdActivity.java @@ -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 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() { + @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(); + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/login/LoginActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/LoginActivity.java new file mode 100644 index 000000000..097c8db80 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/LoginActivity.java @@ -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() { + @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 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() { + @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(); + } +} diff --git a/OneToOne/src/main/java/com/shayu/onetoone/activity/login/RegisterActivity.java b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/RegisterActivity.java new file mode 100644 index 000000000..d16d358c3 --- /dev/null +++ b/OneToOne/src/main/java/com/shayu/onetoone/activity/login/RegisterActivity.java @@ -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 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() { + @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(); + } +} diff --git a/OneToOne/src/main/res/drawable/background_8f7cdf.xml b/OneToOne/src/main/res/drawable/background_8f7cdf.xml new file mode 100644 index 000000000..81bd439a2 --- /dev/null +++ b/OneToOne/src/main/res/drawable/background_8f7cdf.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/OneToOne/src/main/res/drawable/background_fff.xml b/OneToOne/src/main/res/drawable/background_fff.xml new file mode 100644 index 000000000..8b466e367 --- /dev/null +++ b/OneToOne/src/main/res/drawable/background_fff.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/OneToOne/src/main/res/drawable/bg_me_data.xml b/OneToOne/src/main/res/drawable/bg_me_data.xml new file mode 100644 index 000000000..a08cadd3e --- /dev/null +++ b/OneToOne/src/main/res/drawable/bg_me_data.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/OneToOne/src/main/res/layout/activity_entry.xml b/OneToOne/src/main/res/layout/activity_entry.xml new file mode 100644 index 000000000..9a1f102d6 --- /dev/null +++ b/OneToOne/src/main/res/layout/activity_entry.xml @@ -0,0 +1,318 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OneToOne/src/main/res/layout/activity_find_pwd.xml b/OneToOne/src/main/res/layout/activity_find_pwd.xml new file mode 100644 index 000000000..234e59950 --- /dev/null +++ b/OneToOne/src/main/res/layout/activity_find_pwd.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +