diff --git a/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java b/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java index f8ec9204e..36122a342 100644 --- a/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java +++ b/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java @@ -13,22 +13,11 @@ public class NoviceInstructorModel extends BaseModel { * msg_zdy_send : 1 * msg_zdy_send_text : 您好 */ - @SerializedName("home_zdy_pop") - private int homeZdyPop; @SerializedName("msg_zdy_send") private String msgZdySend; @SerializedName("msg_zdy_send_text") private String msgZdySendText; - public int getHomeZdyPop() { - return homeZdyPop; - } - - public NoviceInstructorModel setHomeZdyPop(int homeZdyPop) { - this.homeZdyPop = homeZdyPop; - return this; - } - public String getMsgZdySend() { return msgZdySend; } diff --git a/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java b/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java new file mode 100644 index 000000000..bffb2a483 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java @@ -0,0 +1,68 @@ +package com.yunbao.common.dialog; + +import android.view.Gravity; +import android.view.Window; +import android.view.WindowManager; + +import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentTransaction; + +import com.yunbao.common.R; + +import java.lang.reflect.Field; + +public class InstructorOperationDialog extends AbsDialogFragment { + + @Override + protected int getLayoutId() { + return R.layout.view_instructor_operation; + } + /** + * 主要时这个方法。上面两个方法只是获取布局用的,可以不要 + * + * @param manager + * @param tag + */ + @Override + public void show(FragmentManager manager, String tag) { + try { + Field dismissed = DialogFragment.class.getDeclaredField("mDismissed"); + dismissed.setAccessible(true); + dismissed.set(this, false); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + + try { + Field showByMe = DialogFragment.class.getDeclaredField("mShownByMe"); + showByMe.setAccessible(true); + showByMe.set(this, true); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + + FragmentTransaction ft = manager.beginTransaction(); + ft.add(this, tag); + ft.commitAllowingStateLoss(); + } + @Override + protected int getDialogStyle() { + return R.style.dialog2; + } + + @Override + protected boolean canCancel() { + return false; + } + + @Override + protected void setWindowAttributes(Window window) { + window.setWindowAnimations(R.style.bottomToTopAnim); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = WindowManager.LayoutParams.MATCH_PARENT; + params.height = WindowManager.LayoutParams.WRAP_CONTENT; + params.gravity = Gravity.CENTER; + window.setAttributes(params); + } +} diff --git a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java index 653744765..9b6e867ba 100644 --- a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java +++ b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java @@ -31,12 +31,24 @@ public class NoviceInstructorManager extends BaseCacheManager { private Context context; //展示新手指导员福利 private Handler netHandler = new Handler(); + //是否弹出指导员引导弹窗 + private String homeZdyPop = ""; public NoviceInstructorManager(Context context) { super(context); this.context = context; } + /** + * 呼出指导员引导弹窗 + * + * @return + */ + public NoviceInstructorManager setHomeZdyPop(String homeZdyPop) { + this.homeZdyPop = homeZdyPop; + netHandler.post(instructorOperationOpenRunnable); + return this; + } /** * 获取单利 @@ -128,4 +140,15 @@ public class NoviceInstructorManager extends BaseCacheManager { EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(TextUtils.equals(model.getMsgZdySend(), "1"))); } }; + /** + * 呼出指导员引导操作 + */ + private Runnable instructorOperationOpenRunnable = new Runnable() { + + @Override + public void run() { + //展示指引弹窗 + EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(false).setShowHomeDialoh(true)); + } + }; } diff --git a/common/src/main/res/layout/view_instructor_operation.xml b/common/src/main/res/layout/view_instructor_operation.xml new file mode 100644 index 000000000..d23329136 --- /dev/null +++ b/common/src/main/res/layout/view_instructor_operation.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/mipmap-xxhdpi/icon_love_message.png b/common/src/main/res/mipmap-xxhdpi/icon_love_message.png new file mode 100644 index 000000000..74fde880d Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/icon_love_message.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/tip_box.png b/common/src/main/res/mipmap-xxhdpi/tip_box.png new file mode 100644 index 000000000..ef26ae233 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/tip_box.png differ diff --git a/common/src/main/res/mipmap-xxhdpi/top_zhidao_bg.png b/common/src/main/res/mipmap-xxhdpi/top_zhidao_bg.png new file mode 100644 index 000000000..144121651 Binary files /dev/null and b/common/src/main/res/mipmap-xxhdpi/top_zhidao_bg.png differ diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 95043a15c..13883a3ec 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -840,4 +840,9 @@ 熱度卡生效多久? 對指定主播使用熱度卡後,將會立即生效,效果時長為24小時,不管主播是否在線,熱度時長都將會持續減少 引用 + 歡迎來到PD LIVE + 這有各類好看有趣的主播\n還有各種豐富的活動玩法 + 在找您喜歡的主播嗎? + 聯系您的專屬指導員,\n給您匹配更多風格的主播唷! + 趕快聯系他/她吧! 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 c0eb9618e..71a124683 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -49,6 +49,7 @@ import com.yunbao.common.bean.LiveSvgGiftBean; import com.yunbao.common.bean.NoviceInstructorModel; import com.yunbao.common.bean.UpdataListBean; import com.yunbao.common.custom.TabButtonGroup; +import com.yunbao.common.dialog.InstructorOperationDialog; import com.yunbao.common.event.MessageIMEvent; import com.yunbao.common.event.NoviceInstructorEvent; import com.yunbao.common.event.RongIMConnectionStatusEvent; @@ -591,6 +592,8 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene } Constants.isShowPage = -1; NoviceInstructorManager.get(mContext).getNoviceInstructor(); + NoviceInstructorManager.get(mContext).setHomeZdyPop("1"); + } /** @@ -1032,7 +1035,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene boolean isShowHomeDialoh = event.isShowHomeDialoh(); //是否展示指引icon boolean isShowHomeIcon = event.isShowHomeIcon(); - + if (isShowHomeDialoh) { + InstructorOperationDialog fragment1 = new InstructorOperationDialog(); + fragment1.show(getSupportFragmentManager(), "InstructorOperationDialog"); + } if (isShowHomeIcon) { waitingTip.setVisibility(View.VISIBLE); //跳转消息中心 diff --git a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java index 0dc794029..dc737a7d9 100644 --- a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java @@ -22,6 +22,7 @@ import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.manager.IMLoginManager; +import com.yunbao.common.manager.NoviceInstructorManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.activity.LiveAudienceActivity; @@ -124,7 +125,7 @@ public class OneLoginDialog extends AbsDialogFragment { gotoLive(obj.getString("anchor_id")); IMLoginManager.get(mContext).setisNewUserOne(true); if (obj.containsKey("home_zdy_pop")) { - + NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop")); } // OneLoginActivity.act.finish(); } else {