diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index 50257bea6..5fa86e5fe 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index 33cbef52d..2716086ad 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index a70ceeb93..0fe307d42 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 072f87ff3..a4b64e0a9 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index 335db4ff6..edbe22569 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -72,8 +72,8 @@ public class CommonAppConfig { public static boolean isGetNewWrap = false;//是否获取到新的包裹礼物 public static int alert_time = 1; public static int alert_end_time = 1; - //是否是新用户 - public static boolean isNewUser = true; + + private CommonAppConfig() { diff --git a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java index 8fd8734ce..9d63882f8 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java @@ -33,6 +33,15 @@ public class LiveGiftBean { private String swf; private String isweek; private String end_time; + private String tag; + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } public String getEnd_time() { return end_time; diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index 101df0ad5..ba9dadc38 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -25,6 +25,8 @@ public class IMLoginManager extends BaseCacheManager { private final static String KEY_USER_INFO = "keyUserInfo"; private static IMLoginManager manager; private IMLoginModel userInfo; + + //根据用户信息 private Handler netHandler = new Handler(); private Context context; @@ -33,6 +35,25 @@ public class IMLoginManager extends BaseCacheManager { super(context); this.context = context; } + //新用戶是否送了禮物 + public boolean isNewUserGif(){ + return getBoolean("isNewUserGif",false); + } + //新用戶是否送了禮物 + public void setNewUserGif(boolean t){ + put("isNewUserGif",t); + } + + // 是否新用户第一次進直播間 + public boolean isisNewUserOne(){ + return getBoolean("isNewUserOne",false); + } + //新用戶是否送了禮物 + public void setisNewUserOne(boolean t){ + put("isNewUserOne",t); + } + + /** * 获取单利 diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index c81e75990..e67be1136 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -25,6 +25,7 @@ public class RouteUtil { public static final String PATH_MYWEBVIEWACTIVTITY = "/main/MyWebViewActivity"; public static final String PATH_ZHUANGBANACTIVITY = "/main/ZhuangBanActivity"; public static final String PATH_FACEBOOKACTIVITY = "/baidu/FacebookLoginActivity"; + public static final String PATH_MAIN= "/main/MainActivity"; /** * 启动页 diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index 132df8e86..4d58d5890 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -65,6 +65,17 @@ Signature modification autograph Binding phone + TASK1 + TASK2 + TASK3 + Give a\nfree gift + Incomplete + Complete + Follow\nanchor + light UP\nRoom + + + ApplyMic Cancel Mic Quit Mic diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 79dec4e08..95043a15c 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -55,6 +55,15 @@ 修改簽名 簽名 綁定手機 + 任務1 + 任務2 + 任務3 + 赠送一个\n免费礼物 + 未完成 + 完成 + 關注主播 + 點亮直播間 + 生日 性別 申请連麥 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index ba6278d3f..591dd21af 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -8,11 +8,13 @@ import android.os.Bundle; import android.os.CountDownTimer; import android.os.Handler; import android.os.Looper; + import androidx.annotation.IdRes; import androidx.annotation.NonNull; import androidx.viewpager.widget.PagerAdapter; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; + import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; @@ -24,6 +26,7 @@ import android.widget.ImageView; import com.adjust.sdk.Adjust; import com.adjust.sdk.AdjustEvent; +import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.opensource.svgaplayer.SVGAImageView; @@ -41,6 +44,7 @@ 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.manager.IMLoginManager; import com.yunbao.common.pay.PayCallback; import com.yunbao.common.pay.PayPresenter; import com.yunbao.common.utils.DialogUitl; @@ -102,9 +106,11 @@ import io.rong.imlib.model.Conversation; import io.rong.message.TextMessage; import pl.droidsonroids.gif.GifImageView; -import static com.yunbao.common.CommonAppConfig.isNewUser; + import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; +import static com.yunbao.common.utils.RouteUtil.PATH_GOOGLE; +import static com.yunbao.common.utils.RouteUtil.PATH_MAIN; import static com.yunbao.live.presenter.LiveLinkMicPresenter.mBannerList2; import static com.yunbao.live.views.LivePlayKsyViewHolder.setViewUP; import static com.yunbao.live.views.LivePlayRyViewHolder.Micing; @@ -122,6 +128,7 @@ public class LiveAudienceActivity extends LiveActivity { public static JSONObject pkInfo; public static LiveAudienceActivity liveAudienceActivity; + public static void forward(Context context, LiveBean liveBean, int liveType, int liveTypeVal, String key, int position, int liveSdk) { Intent intent = new Intent(context, LiveAudienceActivity.class); intent.putExtra(Constants.LIVE_BEAN, liveBean); @@ -184,7 +191,6 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void main() { - liveImDeletUtil = new LiveImDeletUtil(); if (getIntent().getIntExtra("isry", 0) == 1) { isRy = true; @@ -326,7 +332,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override public void onTick(long millisUntilFinished) { - if (isNewUser == true && timeIndex == 5 ){ + if (IMLoginManager.get(mContext).isisNewUserOne() == true && timeIndex == 5) { NewUserDialog fragment1 = new NewUserDialog(); fragment1.show(((LiveActivity) mContext).getSupportFragmentManager(), "NewUserDialog"); } @@ -473,6 +479,7 @@ public class LiveAudienceActivity extends LiveActivity { mChatLevel = obj.getIntValue("speak_limit"); mDanMuLevel = obj.getIntValue("barrage_limit"); + //进入直播间 AdjustEvent adjustEvent1 = new AdjustEvent("hiepcu"); Adjust.trackEvent(adjustEvent1); @@ -480,13 +487,13 @@ public class LiveAudienceActivity extends LiveActivity { logger.logEvent("FB_enterroom"); //观看十分钟并且有充值(优质用户) - if(obj.getIntValue("see_time")>=600&&obj.getIntValue("un_charge")==1){ + if (obj.getIntValue("see_time") >= 600 && obj.getIntValue("un_charge") == 1) { AdjustEvent good_user = new AdjustEvent("val8lv"); Adjust.trackEvent(good_user); CommonHttpUtil.setAdvertisingChannels("val8lv", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if(code == 0) { + if (code == 0) { mFirebaseAnalytics.logEvent("FS_good_user", null); logger.logEvent("FB_good_user", null); } @@ -494,13 +501,13 @@ public class LiveAudienceActivity extends LiveActivity { }); //有效用户 - }else if(obj.getIntValue("see_time")>=600){ + } else if (obj.getIntValue("see_time") >= 600) { AdjustEvent valid_user = new AdjustEvent("xuf8ep"); Adjust.trackEvent(valid_user); CommonHttpUtil.setAdvertisingChannels("xuf8ep", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if(code == 0) { + if (code == 0) { mFirebaseAnalytics.logEvent("FS_Valid_user", null); logger.logEvent("FB_Valid_user", null); } @@ -958,6 +965,7 @@ public class LiveAudienceActivity extends LiveActivity { } public void end() { + IMLoginManager.get(this).setisNewUserOne(false); if (!mEnd && !canBackPressed()) { return; } @@ -1204,5 +1212,4 @@ public class LiveAudienceActivity extends LiveActivity { } - } diff --git a/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java b/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java index 850944155..7160dcbc0 100644 --- a/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java +++ b/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java @@ -20,6 +20,7 @@ import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.LiveGiftBean2; import com.yunbao.common.custom.MyRadioButton; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.live.R; import com.yunbao.live.custom.GiftMarkView; @@ -171,6 +172,11 @@ public class LiveGiftAdapter extends RecyclerView.Adapter { } void setData(LiveGiftBean bean, int position, Object payload) { + if( IMLoginManager.get(mContext).isNewUserGif()== false) { + if (position == 0 && bean.getTag()!=null) { + mRadioButton.setBackgroundResource(R.mipmap.live_gift_light_bg); + } + } if (payload == null) { ImgLoader.display(mContext,bean.getIcon(), mIcon); bean.setView(mIcon); diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java index 08d70354d..1890e0074 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -36,6 +36,7 @@ import com.yunbao.common.bean.UserBean; import com.yunbao.common.dialog.AbsDialogFragment; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.interfaces.OnItemClickListener; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -50,6 +51,8 @@ import com.yunbao.live.http.LiveHttpConsts; import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.utils.ToolsButton; +import org.greenrobot.eventbus.EventBus; + import java.util.ArrayList; import java.util.List; @@ -57,6 +60,7 @@ import static com.yunbao.common.CommonAppConfig.isGetNewWrap; import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; import static com.yunbao.common.utils.RouteUtil.PATH_COIN; +import static com.yunbao.live.presenter.LiveLinkMicPresenter.bean1; //import cn.jmessage.support.qiniu.android.utils.Json; @@ -418,6 +422,10 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On } private void showGiftList(List list) { + ToastUtil.show( IMLoginManager.get(mContext).isNewUserGif()+""); + if( IMLoginManager.get(mContext).isNewUserGif() == false) { + list.add(0,bean1); + } mGiftList = list; mLiveGiftPagerAdapter = new LiveGiftPagerAdapter(mContext, list); mLiveGiftPagerAdapter.setActionListener(this); @@ -665,20 +673,32 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On * 赠送礼物 */ public void sendGift() { - if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream) || mLiveGiftBean == null) { - return; - } - if (mLiveGuardInfo != null) { - if (mLiveGiftBean.getMark() == LiveGiftBean2.MARK_GUARD && mLiveGuardInfo.getMyGuardType() != Constants.GUARD_TYPE_YEAR) { - ToastUtil.show(R.string.guard_gift_tip); + if(mLiveGiftBean.getTag()!=null){ + LiveHttpUtil.setFrontTask("sendgift", mLiveUid,new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if(code == 0){ + EventBus.getDefault().post("stop_new_user_gif"); + } + dismiss(); + } + }); + }else { + if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream) || mLiveGiftBean == null) { return; } - } - SendGiftCallback callback = new SendGiftCallback(mLiveGiftBean); - if (by != null) { - LiveHttpUtil.sendGift("1", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, callback); - } else { - LiveHttpUtil.sendGift("0", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, callback); + if (mLiveGuardInfo != null) { + if (mLiveGiftBean.getMark() == LiveGiftBean2.MARK_GUARD && mLiveGuardInfo.getMyGuardType() != Constants.GUARD_TYPE_YEAR) { + ToastUtil.show(R.string.guard_gift_tip); + return; + } + } + SendGiftCallback callback = new SendGiftCallback(mLiveGiftBean); + if (by != null) { + LiveHttpUtil.sendGift("1", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, callback); + } else { + LiveHttpUtil.sendGift("0", mLiveUid, mStream, mLiveGiftBean.getId(), mCount, callback); + } } } diff --git a/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java b/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java index 5d868faa1..435fc6b47 100644 --- a/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java @@ -98,17 +98,11 @@ public class NewUserDialog extends AbsDialogFragment { btn_confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { -// follow(); -// LiveHttpUtil.sendGift("0", mLiveUid, LiveActivity.mStream, gif_id, "1", new HttpCallback() { -// @Override -// public void onSuccess(int code, String msg, String[] info) { -// ToastUtil.show(msg); -// } -// }); + EventBus.getDefault().post("showBanner"); EventBus.getDefault().post("svga_new_user_gif"); -// countDownTimer.cancel(); + countDownTimer.cancel(); dismiss(); } }); diff --git a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java index 3ce2a246e..d551a016f 100644 --- a/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java +++ b/live/src/main/java/com/yunbao/live/http/LiveHttpUtil.java @@ -599,7 +599,7 @@ public class LiveHttpUtil { .execute(callback); } - /** + /** * 用户获取主播的心愿单列表 */ public static void getWishList(String liveId, HttpCallback callback) { @@ -609,6 +609,41 @@ public class LiveHttpUtil { .execute(callback); } + /** + * 獲取新手任務 + * @param callback + */ + public static void getFrontTask(HttpCallback callback) { + HttpClient.getInstance().get("User.getFrontTask", "User.getFrontTask") + .params("token", CommonAppConfig.getInstance().getToken()) + .params("uid", CommonAppConfig.getInstance().getUid()) + .execute(callback); + } + + + + /** + * 完成新手任務 + */ + public static void setFrontTask(String type , HttpCallback callback) { + HttpClient.getInstance().get("User.setFrontTask", "User.setFrontTask") + .params("token", CommonAppConfig.getInstance().getToken()) + .params("uid", CommonAppConfig.getInstance().getUid()) + .params("type", type) + .execute(callback); + } + + /** + * 完成新手任務 + */ + public static void setFrontTask(String type ,String liveuid , HttpCallback callback) { + HttpClient.getInstance().get("User.setFrontTask", "User.setFrontTask") + .params("token", CommonAppConfig.getInstance().getToken()) + .params("uid", CommonAppConfig.getInstance().getUid()) + .params("type", type) + .params("liveuid", liveuid) + .execute(callback); + } /** * 修改心愿单列表 */ diff --git a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java index 2a324f624..51155633f 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java @@ -4,6 +4,7 @@ import android.Manifest; import android.app.Dialog; import android.content.Context; import android.content.Intent; +import android.graphics.Color; import android.graphics.Outline; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; @@ -20,20 +21,26 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.TextView; +import android.widget.Toast; + +import androidx.cardview.widget.CardView; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ms.banner.Banner; import com.ms.banner.BannerConfig; +import com.ms.banner.holder.BannerViewHolder; import com.ms.banner.listener.OnBannerClickListener; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.bean.BannerBean; import com.yunbao.common.bean.LevelBean; +import com.yunbao.common.bean.LiveGiftBean; import com.yunbao.common.bean.UserBean; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.ClickUtil; import com.yunbao.common.utils.CommonIconUtil; import com.yunbao.common.utils.DialogUitl; @@ -114,7 +121,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { private ImageView imgEvent; private String eventUrl; private Banner mBanner1; - public static Banner mBanner2,mBanner3; + public static Banner mBanner2, mBanner3; private List mBannerList1 = new ArrayList<>(); private List mBannerList3 = new ArrayList<>(); @@ -123,14 +130,89 @@ public class LiveLinkMicPresenter implements View.OnClickListener { public static String link = ""; LinearLayout btn_event2; + public static LiveGiftBean bean1 = new LiveGiftBean(); @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdata(String str) { if ("showBanner".equals(str)) { showBanner3(); + } else if ("stop_svga_new_user_double".equals(str)) { + mBannerList3.get(2).setLink("1"); + mBanner3.update(mBannerList3); + } else if ("stop_svga_new_user_follow".equals(str)) { + mBannerList3.get(1).setLink("1"); + mBanner3.update(mBannerList3); + } else if ("stop_new_user_gif".equals(str)) { + mBannerList3.get(0).setLink("1"); + mBanner3.update(mBannerList3); } } + + public void publicToast(Context content){ +// 定义Toast对象 + Toast toast = new Toast(content); +// 1、加载布局 + View view = LayoutInflater.from(content).inflate(R.layout.diy_toast_view,null); +// 2、获取组件 +// TextView tv_toast = view.findViewById(R.id.textView13); +//// 3、设置组件内容 +// tv_toast.setText(content); +// 4、将获取的view视图设置进Toast对象中 + toast.setView(view); +// 5、设置toast位置 +// 5-1、Gravity.CENTER | Gravity.TOP是设置toast在中间上方显示 +// 5-2、300 表示距离左边300dp +// 5-3、250 表示距离上方250dp + toast.setGravity(Gravity.CENTER | Gravity.TOP,300,250); +// 6、显示toast + toast.show(); + } + + class MyCustomViewHolder implements BannerViewHolder { + + private TextView task, status; + private TextView task_name; + private ImageView indicator1, indicator2, indicator3; + + @Override + public View createView(Context context, int position, BannerBean data) { + View view = LayoutInflater.from(context).inflate(R.layout.banner_new_user, null); + task = (TextView) view.findViewById(R.id.task); + task_name = (TextView) view.findViewById(R.id.task_name); + status = (TextView) view.findViewById(R.id.status); + indicator1 = (ImageView) view.findViewById(R.id.indicator1); + indicator2 = (ImageView) view.findViewById(R.id.indicator2); + indicator3 = (ImageView) view.findViewById(R.id.indicator3); + if (data.getLink().equals("0")) { + status.setText(R.string.incomplete); + } else { + status.setText(R.string.complete); + } + if (position == 0) { + task.setText(R.string.task1); + task_name.setText(R.string.give_a_free_gift); + indicator1.setImageResource(R.drawable.bg_home_indicator_selected); + indicator2.setImageResource(R.drawable.bg_home_indicator_unselected); + indicator3.setImageResource(R.drawable.bg_home_indicator_unselected); + } else if (position == 1) { + task.setText(R.string.task2); + task_name.setText(R.string.follow_anchor); + indicator1.setImageResource(R.drawable.bg_home_indicator_unselected); + indicator2.setImageResource(R.drawable.bg_home_indicator_selected); + indicator3.setImageResource(R.drawable.bg_home_indicator_unselected); + } else if (position == 2) { + task.setText(R.string.task3); + task_name.setText(R.string.light_up_room); + indicator1.setImageResource(R.drawable.bg_home_indicator_unselected); + indicator2.setImageResource(R.drawable.bg_home_indicator_unselected); + indicator3.setImageResource(R.drawable.bg_home_indicator_selected); + } + + return view; + } + } + public LiveLinkMicPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, int liveSdk, View root) { mContext = context; EventBus.getDefault().register(this); @@ -138,6 +220,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener { mIsAnchor = isAnchor; mLiveSdk = liveSdk; Log.e("ry", "画面来了"); + publicToast(mContext); mSmallContainer = linkMicViewHolder.getSmallContainer(); if (!isAnchor && root != null) { View btnLinkMic = root.findViewById(R.id.btn_link_mic); @@ -178,19 +261,53 @@ public class LiveLinkMicPresenter implements View.OnClickListener { bannerBean.setLink("zxb"); mBannerList1.add(bannerBean); - BannerBean banner3Bean = new BannerBean(); - banner3Bean.setImageUrl("https://qny.shayucm.com/live_Mission_box.png"); - banner3Bean.setLink("lw"); - mBannerList3.add(banner3Bean); - BannerBean banner3Bean1 = new BannerBean(); - banner3Bean1.setImageUrl("https://qny.shayucm.com/live_Mission_box.png"); - banner3Bean1.setLink("gz"); - mBannerList3.add(banner3Bean1); - BannerBean banner3Bean2 = new BannerBean(); - banner3Bean2.setImageUrl("https://qny.shayucm.com/live_Mission_box.png"); - banner3Bean2.setLink("dl"); - mBannerList3.add(banner3Bean2); + LiveHttpUtil.getFrontTask(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + JSONObject old_obj = JSON.parseObject(info[0]); + + JSONObject obj = old_obj.getJSONObject("task"); + JSONObject obj1 = old_obj.getJSONObject("gift"); + + bean1.setSwf(obj1.getString("swf")); + bean1.setChecked(false); + bean1.setIcon(obj1.getString("gifticon")); + bean1.setId(obj1.getIntValue("id")); + bean1.setName(obj1.getString("giftname")); + bean1.setTag("1"); + + + BannerBean banner3Bean = new BannerBean(); + banner3Bean.setImageUrl("https://qny.shayucm.com/live_Mission_box.png"); + banner3Bean.setLink(obj.getString("sendgift")); + mBannerList3.add(banner3Bean); + + if(obj.getString("sendgift").equals("0")){ + EventBus.getDefault().post("svga_new_user_gif"); + } + + BannerBean banner3Bean1 = new BannerBean(); + banner3Bean1.setImageUrl("https://qny.shayucm.com/live_Mission_box.png"); + banner3Bean1.setLink(obj.getString("attent")); + mBannerList3.add(banner3Bean1); + + BannerBean banner3Bean2 = new BannerBean(); + banner3Bean2.setImageUrl("https://qny.shayucm.com/live_Mission_box.png"); + banner3Bean2.setLink(obj.getString("illumine")); + mBannerList3.add(banner3Bean2); + + if(obj.getString("sendgift").equals("0")&& IMLoginManager.get(context).isisNewUserOne() == false) { + showBanner3(); + }else if(obj.getString("attent").equals("0")&& IMLoginManager.get(context).isisNewUserOne() == false){ + showBanner3(); + }else if(obj.getString("illumine").equals("0")&& IMLoginManager.get(context).isisNewUserOne()== false){ + showBanner3(); + } + } + }); + + btn_onecz_event = root.findViewById(R.id.btn_onecz_event); btn_onecz_event.setOnClickListener(new View.OnClickListener() { @@ -783,19 +900,22 @@ public class LiveLinkMicPresenter implements View.OnClickListener { if (mBannerList3 == null || mBannerList3.size() == 0 || mBanner3 == null) { return; } - mBanner1.setAutoPlay(true) - .setPages(mBannerList3, new CustomViewHolder()) + mBanner3.setAutoPlay(true) + .setPages(mBannerList3, new MyCustomViewHolder()) .setDelayTime(3000) .setBannerStyle(BannerConfig.NOT_INDICATOR) .setOnBannerClickListener(new OnBannerClickListener() { @Override public void onBannerClick(List datas, int p) { if (mBannerList3 != null) { - if (p >= 0 && p < mBannerList3.size()) { - BannerBean bean = mBannerList3.get(p); - if (bean != null) { - String link = bean.getLink(); - + if (mBannerList3.get(p).getLink().equals("0")) { + if (p == 0) { + ((LiveAudienceActivity) mContext).openGiftWindow("1530", "1"); + EventBus.getDefault().post("svga_new_user_gif"); + } else if (p == 1) { + EventBus.getDefault().post("svga_new_user_follow"); + } else if (p == 2) { + EventBus.getDefault().post("svga_new_user_double"); } } } diff --git a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java index 18991e73e..a0e8961a6 100644 --- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java +++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java @@ -13,6 +13,8 @@ import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.http.LiveHttpUtil; +import org.greenrobot.eventbus.EventBus; + import io.rong.imlib.IRongCallback; import io.rong.imlib.RongIMClient; import io.rong.imlib.model.Conversation; @@ -186,6 +188,13 @@ public class SocketRyChatUtil { public void onSuccess(Message message) { Log.i("tx", "发送成功"); LiveHttpUtil.sendZAN(mLiveUid + "", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + EventBus.getDefault().post("stop_svga_new_user_double"); + } + }); + + LiveHttpUtil.setFrontTask("illumine", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { diff --git a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java index 81bb7f6c5..73fa8c4cc 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -71,9 +71,23 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { svga_new_user_double(); }else if ("svga_new_user_follow".equals(str)) { svga_new_user_follow(); + }else if("stop_svga_new_user_double".equals(str)){ + svga_new_user_double.setVisibility(View.GONE); + svga_new_user_double.stopAnimation(); + svga_new_user_double.clear(); + } else if("stop_svga_new_user_follow".equals(str)) { + svga_new_user_follow.setVisibility(View.GONE); + svga_new_user_follow.stopAnimation(); + svga_new_user_follow.clear(); + }else if("stop_svga_new_user_follow".equals(str)) { + svga_new_user_follow.setVisibility(View.GONE); + svga_new_user_follow.stopAnimation(); + svga_new_user_follow.clear(); } + } + private void svga_new_user_gif(){ new SVGAParser(mContext).decodeFromAssets("free_gift_tip.svga", new SVGAParser.ParseCompletion() { @Override @@ -95,6 +109,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { public void onComplete(SVGAVideoEntity videoItem) { SVGADrawable drawable = new SVGADrawable(videoItem); svga_new_user_double.setImageDrawable(drawable); + svga_new_user_double.setBackgroundResource(R.mipmap.black_bg); svga_new_user_double.startAnimation(); } @@ -180,7 +195,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { v_msg_redpoint = (View) findViewById(R.id.v_msg_redpoint); //获取系统未读消息 - MessageIMManager.get(context).getSystemMessages(); + MessageIMManager.get(mContext).getSystemMessages(); } public static Handler handler = new Handler(); diff --git a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java index 7d755e4fa..a4167d434 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java @@ -85,6 +85,8 @@ import com.yunbao.live.presenter.LiveGiftAnimPresenter; import com.yunbao.live.presenter.LiveLightAnimPresenter; import com.yunbao.live.socket.SocketChatUtil; +import org.greenrobot.eventbus.EventBus; + import java.lang.ref.WeakReference; import java.net.MalformedURLException; import java.net.URL; @@ -1190,6 +1192,15 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis * 关注主播 */ public static void follow() { + EventBus.getDefault().post("stop_svga_new_user_follow"); + + LiveHttpUtil.setFrontTask("attent", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + + } + }); + if (TextUtils.isEmpty(mLiveUid)) { return; } diff --git a/live/src/main/res/drawable/bg_home_indicator_selected.xml b/live/src/main/res/drawable/bg_home_indicator_selected.xml new file mode 100644 index 000000000..822c7b024 --- /dev/null +++ b/live/src/main/res/drawable/bg_home_indicator_selected.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/bg_home_indicator_unselected.xml b/live/src/main/res/drawable/bg_home_indicator_unselected.xml new file mode 100644 index 000000000..18ac50645 --- /dev/null +++ b/live/src/main/res/drawable/bg_home_indicator_unselected.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/live/src/main/res/drawable/drawable_toast.xml b/live/src/main/res/drawable/drawable_toast.xml new file mode 100644 index 000000000..a8b409b1d --- /dev/null +++ b/live/src/main/res/drawable/drawable_toast.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/live/src/main/res/layout/banner_new_user.xml b/live/src/main/res/layout/banner_new_user.xml new file mode 100644 index 000000000..c75e71870 --- /dev/null +++ b/live/src/main/res/layout/banner_new_user.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/live/src/main/res/layout/diy_toast_view.xml b/live/src/main/res/layout/diy_toast_view.xml new file mode 100644 index 000000000..b722e6e32 --- /dev/null +++ b/live/src/main/res/layout/diy_toast_view.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index 3bf677ee3..1ecd4823b 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -70,10 +70,12 @@ @@ -453,7 +455,6 @@ android:layout_height="match_parent" android:layout_marginBottom="40dp" android:layout_gravity="center_vertical" - android:background="@mipmap/black_bg" app:autoPlay="true"/> diff --git a/live/src/main/res/mipmap-xhdpi/black_tip_bg.png b/live/src/main/res/mipmap-xhdpi/black_tip_bg.png new file mode 100644 index 000000000..a047958b5 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/black_tip_bg.png differ diff --git a/live/src/main/res/mipmap-xhdpi/icon_live_beans.png b/live/src/main/res/mipmap-xhdpi/icon_live_beans.png new file mode 100644 index 000000000..8678d3641 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_live_beans.png differ diff --git a/live/src/main/res/mipmap-xhdpi/icon_live_exp.png b/live/src/main/res/mipmap-xhdpi/icon_live_exp.png new file mode 100644 index 000000000..039b887f6 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/icon_live_exp.png differ diff --git a/live/src/main/res/mipmap-xhdpi/live_gift_light_bg.png b/live/src/main/res/mipmap-xhdpi/live_gift_light_bg.png new file mode 100644 index 000000000..7187697c0 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/live_gift_light_bg.png differ diff --git a/live/src/main/res/mipmap-xhdpi/live_mission_box.png b/live/src/main/res/mipmap-xhdpi/live_mission_box.png new file mode 100644 index 000000000..62d6212e1 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/live_mission_box.png differ 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 a5975f2e5..f957f8d2e 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -26,6 +26,7 @@ import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; import androidx.viewpager.widget.ViewPager; +import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.android.billingclient.api.Purchase; @@ -65,6 +66,7 @@ import com.yunbao.common.utils.GoogleBillingUtil; import com.yunbao.common.utils.LocationUtil; import com.yunbao.common.utils.OnGoogleBillingListener; import com.yunbao.common.utils.ProcessResultUtil; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.VersionUtil; @@ -112,6 +114,7 @@ import io.rong.imlib.RongIMClient; import static com.yunbao.common.CommonAppContext.isReady; +@Route(path = RouteUtil.PATH_MAIN) public class MainActivity extends AbsActivity implements MainAppBarLayoutListener { public static RelativeLayout rt_main_tab; @@ -576,7 +579,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene super.onResume(); if (mFristLoad) { mFristLoad = false; - getLocation(); +// getLocation(); loadPageData(0, false); if (mHomeLiveViewHolder != null) { mHomeLiveViewHolder.setShowed(true); diff --git a/main/src/main/java/com/yunbao/main/activity/OneLoginActivity.java b/main/src/main/java/com/yunbao/main/activity/OneLoginActivity.java index 464b3c477..3d854344d 100644 --- a/main/src/main/java/com/yunbao/main/activity/OneLoginActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/OneLoginActivity.java @@ -39,7 +39,7 @@ public class OneLoginActivity extends AbsActivity { EditText edit_user,edit_code; Button btn_enter; - + public static OneLoginActivity act; @Override protected int getLayoutId() { @@ -65,6 +65,7 @@ public class OneLoginActivity extends AbsActivity { @Override protected void main() { super.main(); + act = this; avatar = (RoundedImageView)findViewById(R.id.avatar); edit_user = (EditText)findViewById(R.id.edit_user); edit_code = (EditText)findViewById(R.id.edit_code); 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 2c5ae6bcf..397772b72 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.glide.ImgLoader; 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.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; import com.yunbao.live.activity.LiveAudienceActivity; @@ -31,6 +32,7 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; import com.yunbao.main.activity.EntryActivity; import com.yunbao.main.activity.MainActivity; +import com.yunbao.main.activity.OneLoginActivity; import static com.yunbao.common.CommonAppContext.logger; import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics; @@ -118,12 +120,16 @@ public class OneLoginDialog extends AbsDialogFragment { .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { + dismiss(); if (info[0]!=null) { JSONObject obj = JSON.parseObject(info[0]); - CommonAppConfig.isNewUser = true; + MainActivity.forward(getContext(), false); gotoLive(obj.getString("anchor_id")); + IMLoginManager.get(mContext).setisNewUserOne(true); +// OneLoginActivity.act.finish(); }else{ MainActivity.forward(getContext(), false); +// OneLoginActivity.act.finish(); } } });