diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index a05b83b..dd27402 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -62,6 +62,7 @@ import com.yunbao.live.socket.SocketRyClient; import com.yunbao.live.utils.LiveImDeletUtil; import com.yunbao.live.views.PortraitLiveManager; import com.yunbao.live.views.RecommendLiveRoomProvider; +import com.yunbao.main.activity.CompleteUserInfoActivity; import com.yunbao.main.activity.MainActivity; import com.yunbao.main.activity.MainHomeCommunityActivity; import com.yunbao.main.activity.MsgSettActivity; @@ -264,6 +265,9 @@ public class AppContext extends CommonAppContext { } else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息 EventBus.getDefault().post(message); + if(AppManager.getInstance().getLastActivity() instanceof CompleteUserInfoActivity){ + return false; + } MessageChatNotifyManager.getInstance().push(AppManager.getInstance().getLastActivity() , message.getTargetId(), content.getContent() @@ -362,9 +366,9 @@ public class AppContext extends CommonAppContext { activity.get().finish(); } } + setFirebaseCrashData(); Process.killProcess(Process.myPid()); System.exit(0); - setFirebaseCrashData(); new Handler(Looper.getMainLooper()).postDelayed(() -> { throw new RuntimeException(e); }, 100); diff --git a/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java b/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java index 243b7cc..38f3fc6 100644 --- a/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java @@ -1,29 +1,38 @@ package com.yunbao.main.activity; import android.app.Dialog; +import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; import android.os.Bundle; +import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; +import com.alibaba.fastjson.JSON; import com.bigkoo.pickerview.builder.TimePickerBuilder; import com.bigkoo.pickerview.listener.OnTimeSelectListener; import com.bigkoo.pickerview.view.TimePickerView; import com.lxj.xpopup.XPopup; +import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.bean.BaseModel; +import com.yunbao.common.bean.LiveBean; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.http.LiveHttpUtil; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.interfaces.ImageResultCallback; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.L; +import com.yunbao.common.utils.LiveRoomCheckLivePresenter; import com.yunbao.common.utils.ProcessImageUtil; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.StringUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ViewUtils; @@ -62,6 +71,19 @@ public class CompleteUserInfoActivity extends AbsActivity { initView(); } + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_ESCAPE || keyCode == KeyEvent.KEYCODE_BACK) { + //onBackPressed(); + return true; + } + return super.onKeyDown(keyCode, event); + } + + @Override + public void onBackPressed() { + // super.onBackPressed(); + } int year; int month; @@ -102,8 +124,15 @@ public class CompleteUserInfoActivity extends AbsActivity { new HttpCallback>() { @Override public void onSuccess(List data) { - ToastUtil.show("註冊成功"); - finish(); + String anchorId = getIntent().getStringExtra("anchor_id"); + if (StringUtil.isEmpty(anchorId)) { + Intent intent = new Intent(CompleteUserInfoActivity.this, MainActivity.class); + intent.putExtra(Constants.SHOW_INVITE, false); + startActivity(intent); + finish(); + } else { + gotoLive(anchorId); + } } @Override @@ -200,6 +229,7 @@ public class CompleteUserInfoActivity extends AbsActivity { } + void initSexView() { ViewUtils.findViewById(man, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_select); ViewUtils.findViewById(man, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF"))); @@ -237,4 +267,34 @@ public class CompleteUserInfoActivity extends AbsActivity { woman.setTag("man"); }); } + + private void gotoLive(final String live_id) { + LiveHttpUtil.getLiveInfo(live_id, new com.yunbao.common.http.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(CompleteUserInfoActivity.this, false); + } + } + }); + } } diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java index 11491f7..de72741 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -404,7 +404,7 @@ public class RegisterActivity extends AbsActivity { //获取自定义数据 if (appData.getData() != null && !appData.getData().equals("")) { JSONObject data = JSON.parseObject(appData.getData()); - if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2|| CommonAppConfig.IS_GOOGLE_PLAY == 3) { + if (CommonAppConfig.IS_GOOGLE_PLAY == 1 || CommonAppConfig.IS_GOOGLE_PLAY == 2 || CommonAppConfig.IS_GOOGLE_PLAY == 3) { yqm_view.setVisibility(View.VISIBLE); MainHttpUtil.getDeviceLoginType(new HttpCallback() { @Override @@ -496,13 +496,13 @@ public class RegisterActivity extends AbsActivity { 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")); + // gotoLive(obj.getString("anchor_id")); if (obj.containsKey("home_zdy_pop")) { NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop")); } - jumpMain(false); + jumpMain(false, obj.getString("anchor_id")); } else { - jumpMain(false); + jumpMain(false, null); } EventBus.getDefault().post(new RegSuccessEvent()); } @@ -510,9 +510,10 @@ public class RegisterActivity extends AbsActivity { } }; - private void jumpMain(boolean showInvite) { - Intent intent = new Intent(activity, MainActivity.class); + private void jumpMain(boolean showInvite, String anchorId) { + Intent intent = new Intent(activity, CompleteUserInfoActivity.class); intent.putExtra(Constants.SHOW_INVITE, showInvite); + intent.putExtra("anchor_id", anchorId); startActivity(intent); }