diff --git a/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java b/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java new file mode 100644 index 000000000..26f4c60bb --- /dev/null +++ b/common/src/main/java/com/yunbao/common/bean/NoviceInstructorModel.java @@ -0,0 +1,22 @@ +package com.yunbao.common.bean; + +import com.google.gson.annotations.SerializedName; + +/** + * 用户面向指导员的数据类 + */ +public class NoviceInstructorModel extends BaseModel { + @SerializedName("sendFirstMessage") + private String sendFirstMessage = ""; + + public String getSendFirstMessage() { + return sendFirstMessage; + } + + public NoviceInstructorModel setSendFirstMessage(String sendFirstMessage) { + this.sendFirstMessage = sendFirstMessage; + return this; + } + + +} diff --git a/common/src/main/java/com/yunbao/common/event/NoviceInstructorEvent.java b/common/src/main/java/com/yunbao/common/event/NoviceInstructorEvent.java new file mode 100644 index 000000000..9e8cd51cd --- /dev/null +++ b/common/src/main/java/com/yunbao/common/event/NoviceInstructorEvent.java @@ -0,0 +1,31 @@ +package com.yunbao.common.event; + +import com.yunbao.common.bean.BaseModel; + +/** + * 指引用户与指导员交互的通讯数据类 + */ +public class NoviceInstructorEvent extends BaseModel { + //是否展示指引弹窗 + private boolean isShowHomeDialoh = false; + //是否展示指引icon + private boolean isShowHomeIcon = false; + + public boolean isShowHomeDialoh() { + return isShowHomeDialoh; + } + + public NoviceInstructorEvent setShowHomeDialoh(boolean showHomeDialoh) { + isShowHomeDialoh = showHomeDialoh; + return this; + } + + public boolean isShowHomeIcon() { + return isShowHomeIcon; + } + + public NoviceInstructorEvent setShowHomeIcon(boolean showHomeIcon) { + isShowHomeIcon = showHomeIcon; + return this; + } +} diff --git a/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java new file mode 100644 index 000000000..61f54e0f2 --- /dev/null +++ b/common/src/main/java/com/yunbao/common/manager/NoviceInstructorManager.java @@ -0,0 +1,94 @@ +package com.yunbao.common.manager; + +import android.content.Context; +import android.os.Handler; + +import androidx.annotation.NonNull; + +import com.google.gson.Gson; +import com.yunbao.common.bean.NoviceInstructorModel; +import com.yunbao.common.event.NoviceInstructorEvent; +import com.yunbao.common.manager.base.BaseCacheManager; + +import org.greenrobot.eventbus.EventBus; + +/*** + * 新手指导员管理引导 + */ +public class NoviceInstructorManager extends BaseCacheManager { + private NoviceInstructorModel model = null; + private final static String KEY_NOVICE_INSTRUCTOR = "NoviceInstructor"; + private static NoviceInstructorManager manager; + private Context context; + //展示新手指导员福利 + private Handler netHandler = new Handler(); + + public NoviceInstructorManager(Context context) { + super(context); + this.context = context; + } + + + /** + * 获取单利 + * + * @return + */ + public static NoviceInstructorManager get(Context context) { + if (null == manager) { + manager = new NoviceInstructorManager(context); + } + return manager; + } + + /** + * 新手指导员相关信息类 + * + * @return + */ + public NoviceInstructorModel getNoviceInstructor() { + if (null == model) { + model = new Gson().fromJson( + getString(KEY_NOVICE_INSTRUCTOR), NoviceInstructorModel.class); + } + return model; + } + + /** + * 请求接口,保存相应序列化数据 + * + * @param model + */ + public void setNoviceInstructor(@NonNull NoviceInstructorModel model) { + this.model = model; + put(KEY_NOVICE_INSTRUCTOR, new Gson().toJson(model)); + } + + /** + * 清除相关信息 + */ + public void removeNoviceInstructor() { + deleteByKey(KEY_NOVICE_INSTRUCTOR); + } + + /** + * 请求接口获取是否展示 + */ + public void getNetNoviceInstructor() { + if (null != model) { + netHandler.post(instructorOperationRunnable); + } + } + + /** + * 指导员操作 + */ + private Runnable instructorOperationRunnable = new Runnable() { + + @Override + public void run() { + //展示指引弹窗 + EventBus.getDefault().post(new NoviceInstructorEvent().setShowHomeIcon(true)); + } + }; +} 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 d42666369..d7b396e37 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -18,6 +18,8 @@ import android.view.Display; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; @@ -47,6 +49,7 @@ import com.yunbao.common.bean.LiveSvgGiftBean; import com.yunbao.common.bean.UpdataListBean; import com.yunbao.common.custom.TabButtonGroup; import com.yunbao.common.event.MessageIMEvent; +import com.yunbao.common.event.NoviceInstructorEvent; import com.yunbao.common.event.RongIMConnectionStatusEvent; import com.yunbao.common.event.UpdateTablePointMe; import com.yunbao.common.http.CommonHttpConsts; @@ -147,6 +150,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene public static boolean isTabClose = false; private boolean isFirstOpen = true; private int messageNumber = 0, numberMe = 1; + private ImageView waitingTip; @Override protected int getLayoutId() { @@ -258,6 +262,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene mRootView = (ViewGroup) findViewById(R.id.rootView); mTabButtonGroup = (TabButtonGroup) findViewById(R.id.tab_group); mViewPager = (ViewPager) findViewById(R.id.viewPager); + waitingTip = findViewById(R.id.waiting_tip); mViewPager.setOffscreenPageLimit(4); mViewList = new ArrayList<>(); for (int i = 0; i < 4; i++) { @@ -1004,5 +1009,21 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene ConversationIMListManager.get(mContext).jumpConversation(mContext, model.getTargetId()); } + /** + * 用户被踢下线 + * + * @param event + */ + @Subscribe(threadMode = ThreadMode.MAIN) + public void onNoviceInstructorEvent(NoviceInstructorEvent event) { + //是否展示指引弹窗 + boolean isShowHomeDialoh = event.isShowHomeDialoh(); + //是否展示指引icon + boolean isShowHomeIcon = event.isShowHomeIcon(); + + if (isShowHomeIcon) { + + } + } } diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java index 1b7128b6b..b03d43441 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeLiveWeekItemViewHolder.java @@ -17,7 +17,6 @@ import com.opensource.svgaplayer.SVGAParser; import com.opensource.svgaplayer.SVGAVideoEntity; import com.yunbao.common.bean.WeekListBean; import com.yunbao.common.glide.ImgLoader; -import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.bean.LiveBean; import com.yunbao.main.R; @@ -55,7 +54,7 @@ public class MainHomeLiveWeekItemViewHolder extends RecyclerView.ViewHolder { } - public void upSvga(){ + public void upSvga() { new SVGAParser(itemView.getContext()).decodeFromAssets("week_bg.svga", new SVGAParser.ParseCompletion() { @Override public void onComplete(SVGAVideoEntity videoItem) { @@ -67,7 +66,7 @@ public class MainHomeLiveWeekItemViewHolder extends RecyclerView.ViewHolder { @Override public void onError() { - Log.e("errqs","errl"); + Log.e("errqs", "errl"); } }); @@ -116,6 +115,8 @@ public class MainHomeLiveWeekItemViewHolder extends RecyclerView.ViewHolder { @Override public void onClick(View v) { if (listener != null) { + WeekListBean model = mWeekList.get(viewflipperBanner.getDisplayedChild()); + bean.setUid(model.getAnchor_id()); listener.onItemClick(bean, position); } } diff --git a/main/src/main/res/layout/view_homemain.xml b/main/src/main/res/layout/view_homemain.xml index 9609f669e..fda0ea433 100644 --- a/main/src/main/res/layout/view_homemain.xml +++ b/main/src/main/res/layout/view_homemain.xml @@ -144,4 +144,33 @@ android:src="@mipmap/icon_main_start" /> + + + + + + + + + + diff --git a/main/src/main/res/mipmap-xxhdpi/waiting_tip.png b/main/src/main/res/mipmap-xxhdpi/waiting_tip.png new file mode 100644 index 000000000..7b3d0ec17 Binary files /dev/null and b/main/src/main/res/mipmap-xxhdpi/waiting_tip.png differ