diff --git a/app/src/main/java/com/shayu/phonelive/AppContext.java b/app/src/main/java/com/shayu/phonelive/AppContext.java index dd2740281..bed092f91 100644 --- a/app/src/main/java/com/shayu/phonelive/AppContext.java +++ b/app/src/main/java/com/shayu/phonelive/AppContext.java @@ -111,17 +111,21 @@ public class AppContext extends CommonAppContext { MessageSayHiNotifyManager.getInstance().stop(); return; } - if(activity instanceof MainHomeCommunityActivity){ + if (activity instanceof MainHomeCommunityActivity) { MessageSayHiNotifyManager.getInstance().stop(); return; } - if(activity instanceof SudGameActivity){ + if (activity instanceof SudGameActivity) { MessageSayHiNotifyManager.getInstance().stop(); return; } if (activity instanceof MainActivity && !MessageSayHiNotifyManager.getInstance().isInit()) { return; } + if (activity instanceof CompleteUserInfoActivity) { + MessageSayHiNotifyManager.getInstance().stop(); + return; + } MessageSayHiNotifyManager.getInstance().reload(); } @@ -265,9 +269,10 @@ public class AppContext extends CommonAppContext { } else if (message.getConversationType() == Conversation.ConversationType.PRIVATE) {//私聊信息 EventBus.getDefault().post(message); - if(AppManager.getInstance().getLastActivity() instanceof CompleteUserInfoActivity){ + if (AppManager.getInstance().getLastActivity() instanceof CompleteUserInfoActivity) { return false; } + MessageChatNotifyManager.getInstance().setShieldClass(CompleteUserInfoActivity.class); MessageChatNotifyManager.getInstance().push(AppManager.getInstance().getLastActivity() , message.getTargetId(), content.getContent() diff --git a/common/src/main/java/com/yunbao/common/bean/FirstLoginBean.java b/common/src/main/java/com/yunbao/common/bean/FirstLoginBean.java new file mode 100644 index 000000000..cb70f4911 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/FirstLoginBean.java @@ -0,0 +1,16 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +public class FirstLoginBean extends BaseModel{ + @SerializedName("status") + int status;//0是第一次登陸,1是已經登錄過的 + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } +} diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 1f85509a1..c71798c37 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -23,6 +23,7 @@ import com.yunbao.common.bean.FaceBookUpModel; import com.yunbao.common.bean.FansCheckRed; import com.yunbao.common.bean.FansGroupGiftPack; import com.yunbao.common.bean.FansGroupGiftPackInfo; +import com.yunbao.common.bean.FirstLoginBean; import com.yunbao.common.bean.GiftAlreadyWallModel; import com.yunbao.common.bean.GiftGuideModel; import com.yunbao.common.bean.GiftNamingInfoModel; @@ -1288,4 +1289,7 @@ public interface PDLiveApi { Observable>> setHobby( @Query("labels") String labelsId ); + @GET("/api/public/?service=Pdlinfos.getIsSet") + Observable> isFirstLogin( + ); } diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index 8998844cb..07bfaa97e 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -26,6 +26,7 @@ import com.yunbao.common.bean.EnterRoomNewModel; import com.yunbao.common.bean.FansCheckRed; import com.yunbao.common.bean.FansGroupGiftPack; import com.yunbao.common.bean.FansGroupGiftPackInfo; +import com.yunbao.common.bean.FirstLoginBean; import com.yunbao.common.bean.GiftAlreadyWallModel; import com.yunbao.common.bean.GiftGuideModel; import com.yunbao.common.bean.GiftNamingInfoModel; @@ -3477,6 +3478,25 @@ public class LiveNetManager { } }).isDisposed(); } + public void isFirstLogin(HttpCallback callback) { + API.get().pdLiveApi(mContext) + .isFirstLogin() + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(roomMicStatusModelResponseModel -> { + if (callback != null) { + callback.onSuccess(roomMicStatusModelResponseModel.getData().getInfo()); + } + }, new Consumer() { + @Override + public void accept(Throwable throwable) throws Exception { + throwable.printStackTrace(); + if (callback != null) { + callback.onError(mContext.getString(R.string.net_error)); + } + } + }).isDisposed(); + } private MultipartBody.Part createUploadFile(File file) { RequestBody requestBody = RequestBody.create(MediaType.parse("multipart/form-data"), file); return MultipartBody.Part.createFormData("file", file.getName(), requestBody); diff --git a/common/src/main/java/com/yunbao/common/utils/MessageChatNotifyManager.java b/common/src/main/java/com/yunbao/common/utils/MessageChatNotifyManager.java index 797aac2f5..733feea7e 100644 --- a/common/src/main/java/com/yunbao/common/utils/MessageChatNotifyManager.java +++ b/common/src/main/java/com/yunbao/common/utils/MessageChatNotifyManager.java @@ -13,6 +13,7 @@ import java.util.List; public class MessageChatNotifyManager { private static MessageChatNotifyManager instance; private List startListNotifyList = new ArrayList<>(); + Class clazz; public static MessageChatNotifyManager getInstance() { if (instance == null) { @@ -21,6 +22,10 @@ public class MessageChatNotifyManager { return instance; } + public void setShieldClass(Class clazz) { + this.clazz = clazz; + } + public void push(Context mContext, MessageUserInfoBean userInfo) { if (startListNotifyList.isEmpty()) { startListNotifyList.add(userInfo); @@ -31,6 +36,10 @@ public class MessageChatNotifyManager { } private void notifyLiveFlot(Context mContext) { + if (AppManager.getInstance().getLastActivity().getClass().getSimpleName().equals(clazz.getSimpleName())) { + ToastUtil.showDebug("屏蔽类,不展示"); + return; + } if (startListNotifyList.iterator().hasNext()) { MessageUserInfoBean bean = startListNotifyList.iterator().next(); new MessageChatNotifyDialog(AppManager.getInstance().getLastActivity(), bean).setOnDismissListener(dialog -> { 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 38f3fc68e..9c285b2b8 100644 --- a/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/CompleteUserInfoActivity.java @@ -27,6 +27,7 @@ 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.IMLoginManager; import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.L; @@ -71,6 +72,7 @@ public class CompleteUserInfoActivity extends AbsActivity { initView(); } + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_ESCAPE || keyCode == KeyEvent.KEYCODE_BACK) { @@ -82,7 +84,7 @@ public class CompleteUserInfoActivity extends AbsActivity { @Override public void onBackPressed() { - // super.onBackPressed(); + // super.onBackPressed(); } int year; @@ -98,6 +100,9 @@ public class CompleteUserInfoActivity extends AbsActivity { birthday = findViewById(R.id.birthday); submit = findViewById(R.id.submit); + userName.setHint(R.string.complete_user_info_username_hint); + userName.setText(IMLoginManager.get(this).getUserInfo().getUserNicename()); + initSexView(); initBirthdayView(); initAvatarView(); @@ -221,6 +226,7 @@ public class CompleteUserInfoActivity extends AbsActivity { @Override public void onItemClick(String bean, int position) { avatar.setTag(bean); + ImgLoader.display(mContext,bean,avatar); loading.dismiss(); } }); @@ -231,7 +237,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_bg).setBackgroundResource(R.drawable.complete_user_info_sex_man); ViewUtils.findViewById(man, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF"))); ViewUtils.findViewById(man, R.id.sex_top_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF"))); ViewUtils.findViewById(woman, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_unselect); @@ -243,7 +249,7 @@ public class CompleteUserInfoActivity extends AbsActivity { man.setTag("man"); woman.setTag(null); man.setOnClickListener(view -> { - ViewUtils.findViewById(man, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_select); + ViewUtils.findViewById(man, R.id.sex_bg).setBackgroundResource(R.drawable.complete_user_info_sex_man); ViewUtils.findViewById(woman, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_unselect); ViewUtils.findViewById(man, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF"))); ViewUtils.findViewById(man, R.id.sex_top_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#00A3FF"))); @@ -255,7 +261,7 @@ public class CompleteUserInfoActivity extends AbsActivity { woman.setTag(null); }); woman.setOnClickListener(view -> { - ViewUtils.findViewById(woman, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_select); + ViewUtils.findViewById(woman, R.id.sex_bg).setBackgroundResource(R.drawable.complete_user_info_sex_woman); ViewUtils.findViewById(man, R.id.sex_bg).setBackgroundResource(R.drawable.dialog_bg_chat_status_config_unselect); ViewUtils.findViewById(woman, R.id.sex_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#FF4874"))); ViewUtils.findViewById(woman, R.id.sex_top_icon, ImageView.class).setImageTintList(ColorStateList.valueOf(Color.parseColor("#FF4874"))); diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index 421f70aba..41c5f96c7 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -59,6 +59,7 @@ import com.yunbao.common.bean.AnchorRecommendModel; import com.yunbao.common.bean.AnchorStartLiveBean; import com.yunbao.common.bean.ChatRemarksBean; import com.yunbao.common.bean.ConfigBean; +import com.yunbao.common.bean.FirstLoginBean; import com.yunbao.common.bean.IMLoginModel; import com.yunbao.common.bean.LiveBean; import com.yunbao.common.bean.LiveSvgGiftBean; @@ -82,6 +83,7 @@ import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.LiveHttpConsts; import com.yunbao.common.http.LiveHttpUtil; +import com.yunbao.common.http.live.LiveNetManager; import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.interfaces.CommonCallback; import com.yunbao.common.manager.APKManager; @@ -540,6 +542,23 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene ConversationIMListManager.get(this).getUserInstructor(this); checkVersion(); MessageSayHiNotifyManager.getInstance().start(); + showFirstLogin(); + } + private void showFirstLogin(){ + LiveNetManager.get(mContext) + .isFirstLogin(new com.yunbao.common.http.base.HttpCallback() { + @Override + public void onSuccess(FirstLoginBean data) { + if(data.getStatus()==0){ + mContext.startActivity(new Intent(mContext, CompleteUserInfoActivity.class)); + } + } + + @Override + public void onError(String error) { + + } + }); } /** diff --git a/main/src/main/java/com/yunbao/main/adapter/MainHomeComAdapter.java b/main/src/main/java/com/yunbao/main/adapter/MainHomeComAdapter.java index 31834cdc6..d00cd46ab 100644 --- a/main/src/main/java/com/yunbao/main/adapter/MainHomeComAdapter.java +++ b/main/src/main/java/com/yunbao/main/adapter/MainHomeComAdapter.java @@ -96,11 +96,16 @@ public class MainHomeComAdapter extends RefreshAdapter { isVideo.setVisibility(View.VISIBLE); } name.setText(bean.getUser_name()); - JSONObject json = JSONObject.parseObject(bean.getContent()); - if (json != null) { - String content = (String) json.get("msg"); - title.setText(content); + try { + JSONObject json = JSONObject.parseObject(bean.getContent()); + if (json != null) { + String content = (String) json.get("msg"); + title.setText(content); + } + }catch (Exception e){ + e.printStackTrace(); } + likeCount.setText(bean.getLove_num()); ImgLoader.display(mContext, bean.getUser_avatar(), author); diff --git a/main/src/main/res/drawable/complete_user_info_sex_man.xml b/main/src/main/res/drawable/complete_user_info_sex_man.xml new file mode 100644 index 000000000..ea98b66d7 --- /dev/null +++ b/main/src/main/res/drawable/complete_user_info_sex_man.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/drawable/complete_user_info_sex_woman.xml b/main/src/main/res/drawable/complete_user_info_sex_woman.xml new file mode 100644 index 000000000..722de9f67 --- /dev/null +++ b/main/src/main/res/drawable/complete_user_info_sex_woman.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/activity_user_info.xml b/main/src/main/res/layout/activity_user_info.xml index 6475fed08..ddc2ac72c 100644 --- a/main/src/main/res/layout/activity_user_info.xml +++ b/main/src/main/res/layout/activity_user_info.xml @@ -38,7 +38,7 @@ android:src="@mipmap/ic_message_hi_config_image_add" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/title" - app:riv_corner_radius="10dp" /> + app:riv_corner_radius="25dp" />