diff --git a/common/src/main/java/com/yunbao/common/CommonAppConfig.java b/common/src/main/java/com/yunbao/common/CommonAppConfig.java index d21123f11..335db4ff6 100644 --- a/common/src/main/java/com/yunbao/common/CommonAppConfig.java +++ b/common/src/main/java/com/yunbao/common/CommonAppConfig.java @@ -72,6 +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/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index bbdf86e1b..132df8e86 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -638,6 +638,11 @@ Preservation Register No one is currently in the voice link + Welcome to PDLIVE + Newcomer Bonus + EXP + Complete newcomer tasks for more rewards + ReceiveAwards Send out diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index da56ec69f..79dec4e08 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -621,7 +621,8 @@ TA還沒有勛章 座駕 TA還沒有座騎 - + 歡迎來到PDLIVE + 恭喜你獲得了新人獎勵 com.pdlive.shayu.fileprovider @@ -744,7 +745,9 @@ 開通了 續費了 進入直播間 - + 经验 + 領取獎勵 + 完成新人任務領取更多獎勵 金豆 給這篇動態的作者鼓鼓勵吧! 確認鼓勵 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 2465f3348..ba6278d3f 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -58,6 +58,7 @@ import com.yunbao.live.bean.LivePKUserListBean; import com.yunbao.live.bean.LiveUserGiftBean; import com.yunbao.live.dialog.BlowkissDialog; import com.yunbao.live.dialog.LiveGiftDialogFragment; +import com.yunbao.live.dialog.NewUserDialog; import com.yunbao.live.event.LinkMicTxAccEvent; import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.http.LiveHttpConsts; @@ -82,6 +83,7 @@ import com.yunbao.live.views.LivePlayTxViewHolder; import com.yunbao.live.views.LiveRoomPlayViewHolder; import com.yunbao.live.views.LiveRoomViewHolder; +import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; @@ -100,6 +102,7 @@ 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.live.presenter.LiveLinkMicPresenter.mBannerList2; @@ -181,6 +184,7 @@ public class LiveAudienceActivity extends LiveActivity { @Override protected void main() { + liveImDeletUtil = new LiveImDeletUtil(); if (getIntent().getIntExtra("isry", 0) == 1) { isRy = true; @@ -321,6 +325,11 @@ public class LiveAudienceActivity extends LiveActivity { countDownTimer = new CountDownTimer(CommonAppConfig.getInstance().alert_end_time * 1000, 1000) { @Override public void onTick(long millisUntilFinished) { + + if (isNewUser == true && timeIndex == 5 ){ + NewUserDialog fragment1 = new NewUserDialog(); + fragment1.show(((LiveActivity) mContext).getSupportFragmentManager(), "NewUserDialog"); + } if (timeIndex == CommonAppConfig.getInstance().alert_time) { if (mLiveRoomViewHolder.isAttention == 0) { BlowkissDialog fragment1 = new BlowkissDialog(); 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 248eb3e53..5d868faa1 100644 --- a/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java @@ -21,6 +21,8 @@ import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.http.LiveHttpUtil; +import org.greenrobot.eventbus.EventBus; + import java.lang.reflect.Field; import static com.yunbao.live.activity.LiveAudienceActivity.countDownTimer; @@ -89,61 +91,24 @@ public class NewUserDialog extends AbsDialogFragment { public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ImageView btn_close = (ImageView) mRootView.findViewById(R.id.btn_close); - btn_close.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - dismiss(); - } - }); - RelativeLayout btn_rose = (RelativeLayout) mRootView.findViewById(R.id.btn_rose); - RelativeLayout btn_roses = (RelativeLayout) mRootView.findViewById(R.id.btn_roses); - RelativeLayout btn_lollipop = (RelativeLayout) mRootView.findViewById(R.id.btn_lollipop); + + TextView btn_confirm = (TextView) mRootView.findViewById(R.id.btn_confirm); - btn_rose.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - gif = 1; - gif_id = 210; - btn_rose.setBackgroundResource(R.drawable.button_ffb6c4); - btn_roses.setBackgroundResource(R.drawable.button_fff8f6f8); - btn_lollipop.setBackgroundResource(R.drawable.button_fff8f6f8); - } - }); - - btn_roses.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - gif = 2; - gif_id = 224; - btn_rose.setBackgroundResource(R.drawable.button_fff8f6f8); - btn_roses.setBackgroundResource(R.drawable.button_ffb6c4); - btn_lollipop.setBackgroundResource(R.drawable.button_fff8f6f8); - } - }); - - btn_lollipop.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - gif = 0; - gif_id = 1093; - btn_rose.setBackgroundResource(R.drawable.button_fff8f6f8); - btn_roses.setBackgroundResource(R.drawable.button_fff8f6f8); - btn_lollipop.setBackgroundResource(R.drawable.button_ffb6c4); - } - }); - 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); - } - }); - countDownTimer.cancel(); +// 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(); dismiss(); } }); 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 db0b8ff33..2a324f624 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java @@ -68,6 +68,8 @@ import com.yunbao.live.views.LiveLinkMicPushTxViewHolder; import com.yunbao.live.activity.ZhuangBanActivity; import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; +import org.greenrobot.eventbus.ThreadMode; import java.util.ArrayList; import java.util.List; @@ -112,8 +114,9 @@ public class LiveLinkMicPresenter implements View.OnClickListener { private ImageView imgEvent; private String eventUrl; private Banner mBanner1; - public static Banner mBanner2; + public static Banner mBanner2,mBanner3; private List mBannerList1 = new ArrayList<>(); + private List mBannerList3 = new ArrayList<>(); public static List mBannerList2 = new ArrayList<>(); public static CountDownView date; @@ -121,8 +124,16 @@ public class LiveLinkMicPresenter implements View.OnClickListener { public static String link = ""; LinearLayout btn_event2; + + @Subscribe(threadMode = ThreadMode.MAIN) + public void onUpdata(String str) { + if ("showBanner".equals(str)) { + showBanner3(); + } + } public LiveLinkMicPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, int liveSdk, View root) { mContext = context; + EventBus.getDefault().register(this); mRoot = root; mIsAnchor = isAnchor; mLiveSdk = liveSdk; @@ -139,6 +150,9 @@ public class LiveLinkMicPresenter implements View.OnClickListener { btnEvent = root.findViewById(R.id.btn_event); mBanner1 = (Banner) root.findViewById(R.id.banner1); mBanner2 = (Banner) root.findViewById(R.id.banner2); + mBanner3 = (Banner) root.findViewById(R.id.banner3); + + btn_event2 = root.findViewById(R.id.btn_event2); mBanner1.setOutlineProvider(new ViewOutlineProvider() { @Override @@ -152,13 +166,32 @@ public class LiveLinkMicPresenter implements View.OnClickListener { outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); } }); - + mBanner3.setOutlineProvider(new ViewOutlineProvider() { + @Override + public void getOutline(View view, Outline outline) { + outline.setRoundRect(0, 0, view.getWidth(), view.getHeight(), 10); + } + }); //周星 BannerBean bannerBean = new BannerBean(); bannerBean.setImageUrl("https://qny.shayucm.com/img/BTN_WEEKSTAR%20%281%29.png"); 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); + btn_onecz_event = root.findViewById(R.id.btn_onecz_event); btn_onecz_event.setOnClickListener(new View.OnClickListener() { @Override @@ -746,6 +779,31 @@ public class LiveLinkMicPresenter implements View.OnClickListener { } } + private void showBanner3() { + if (mBannerList3 == null || mBannerList3.size() == 0 || mBanner3 == null) { + return; + } + mBanner1.setAutoPlay(true) + .setPages(mBannerList3, new CustomViewHolder()) + .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(); + + } + } + } + } + }) + .start(); + } + //获取活动 private void getEvent() { if (btn_onecz_event != null) { 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 7bcf15f29..81bb7f6c5 100644 --- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java +++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java @@ -56,31 +56,28 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { private TextView tv_trickery_time; private View v_msg_redpoint; private Activity context; - private SVGAImageView svga_new_user_gif; + private SVGAImageView svga_new_user_gif,svga_new_user_double,svga_new_user_follow; public LiveAudienceViewHolder(Context context, ViewGroup parentView) { super(context, parentView); this.context = (Activity) context; } - @Override - protected int getLayoutId() { - return R.layout.view_live_audience; + @Subscribe(threadMode = ThreadMode.MAIN) + public void onUpdata(String str) { + if ("svga_new_user_gif".equals(str)) { + svga_new_user_gif(); + }else if ("svga_new_user_double".equals(str)) { + svga_new_user_double(); + }else if ("svga_new_user_follow".equals(str)) { + svga_new_user_follow(); + } } - @Override - public void init() { - super.init(); - findViewById(R.id.btn_close).setOnClickListener(this); - findViewById(R.id.btn_share).setOnClickListener(this); - findViewById(R.id.btn_red_pack).setOnClickListener(this); - findViewById(R.id.btn_gift).setOnClickListener(this); - findViewById(R.id.btn_zg).setOnClickListener(this); - svga_new_user_gif = (SVGAImageView)findViewById(R.id.svga_new_user_gif); + private void svga_new_user_gif(){ new SVGAParser(mContext).decodeFromAssets("free_gift_tip.svga", new SVGAParser.ParseCompletion() { @Override public void onComplete(SVGAVideoEntity videoItem) { - ToastUtil.show("1212"); SVGADrawable drawable = new SVGADrawable(videoItem); svga_new_user_gif.setImageDrawable(drawable); svga_new_user_gif.startAnimation(); @@ -91,6 +88,55 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { Log.e("errqs","errl"); } }); + } + private void svga_new_user_double() { + new SVGAParser(mContext).decodeFromAssets("double_click_tip.svga", new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + svga_new_user_double.setImageDrawable(drawable); + svga_new_user_double.startAnimation(); + } + + @Override + public void onError() { + Log.e("errqs", "errl"); + } + }); + } + private void svga_new_user_follow() { + new SVGAParser(mContext).decodeFromAssets("live_follow_tip.svga", new SVGAParser.ParseCompletion() { + @Override + public void onComplete(SVGAVideoEntity videoItem) { + SVGADrawable drawable = new SVGADrawable(videoItem); + svga_new_user_follow.setImageDrawable(drawable); + svga_new_user_follow.startAnimation(); + } + + @Override + public void onError() { + Log.e("errqs", "errl"); + } + }); + + } + @Override + protected int getLayoutId() { + return R.layout.view_live_audience; + } + + @Override + public void init() { + super.init(); + EventBus.getDefault().register(this); + findViewById(R.id.btn_close).setOnClickListener(this); + findViewById(R.id.btn_share).setOnClickListener(this); + findViewById(R.id.btn_red_pack).setOnClickListener(this); + findViewById(R.id.btn_gift).setOnClickListener(this); + findViewById(R.id.btn_zg).setOnClickListener(this); + svga_new_user_gif = (SVGAImageView)findViewById(R.id.svga_new_user_gif); + svga_new_user_double = (SVGAImageView)findViewById(R.id.svga_new_user_double); + svga_new_user_follow = (SVGAImageView)findViewById(R.id.svga_new_user_follow); findViewById(R.id.btn_mic).setOnClickListener(new View.OnClickListener() { @Override @@ -135,7 +181,6 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder { v_msg_redpoint = (View) findViewById(R.id.v_msg_redpoint); //获取系统未读消息 MessageIMManager.get(context).getSystemMessages(); - EventBus.getDefault().register(LiveAudienceViewHolder.this); } public static Handler handler = new Handler(); diff --git a/live/src/main/res/drawable/border_fdbe40.xml b/live/src/main/res/drawable/border_fdbe40.xml new file mode 100644 index 000000000..3fda70d15 --- /dev/null +++ b/live/src/main/res/drawable/border_fdbe40.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/live/src/main/res/layout/dialog_live_new_user.xml b/live/src/main/res/layout/dialog_live_new_user.xml index ad93e1823..a8cdb93bf 100644 --- a/live/src/main/res/layout/dialog_live_new_user.xml +++ b/live/src/main/res/layout/dialog_live_new_user.xml @@ -8,244 +8,162 @@ + android:orientation="vertical"> + android:layout_marginBottom="20dp" + /> + android:layout_height="60dp" + android:layout_marginLeft="22dp" + android:layout_marginRight="22dp" + android:background="@mipmap/freegift_box"> - + android:layout_centerHorizontal="true" + /> - + + + + + + + - - - + - + - + - - - - - - - - - - - - - - - - - + android:layout_centerHorizontal="true" + android:layout_centerVertical="true" + android:orientation="vertical"> - + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + /> + android:background="@drawable/border_fdbe40"/> - - - - + \ No newline at end of file diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml index d67155313..3bf677ee3 100644 --- a/live/src/main/res/layout/view_live_audience.xml +++ b/live/src/main/res/layout/view_live_audience.xml @@ -58,7 +58,28 @@ - + + + + + + + + + + + + \ No newline at end of file diff --git a/live/src/main/res/mipmap-xhdpi/black_bg.png b/live/src/main/res/mipmap-xhdpi/black_bg.png new file mode 100644 index 000000000..74bbfc3c6 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/black_bg.png differ diff --git a/live/src/main/res/mipmap-xhdpi/exp_box.png b/live/src/main/res/mipmap-xhdpi/exp_box.png new file mode 100644 index 000000000..4cf37b0bf Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/exp_box.png differ diff --git a/live/src/main/res/mipmap-xhdpi/freegift_box.png b/live/src/main/res/mipmap-xhdpi/freegift_box.png new file mode 100644 index 000000000..f531739da Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/freegift_box.png differ diff --git a/live/src/main/res/mipmap-xhdpi/jindou_box.png b/live/src/main/res/mipmap-xhdpi/jindou_box.png new file mode 100644 index 000000000..d94f61761 Binary files /dev/null and b/live/src/main/res/mipmap-xhdpi/jindou_box.png differ diff --git a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java index d90d3e7bc..ab899a519 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -665,78 +665,76 @@ public class EntryActivity extends AppCompatActivity { @Override public void callback(UserBean bean) { - gotoLive("97714"); -// -// if (mFirstLogin) { -// //绑定广告渠道用户 -// AdjustEvent adjustEvent = new AdjustEvent("s1or0t"); -// adjustEvent.addCallbackParameter("userid", "bar"); -// Adjust.trackEvent(adjustEvent); -// -// //完成第三方登录 -// if(mLoginType.equals("twitter")){ -// AdjustEvent adjustEvent1 = new AdjustEvent("ea6lld"); -// Adjust.trackEvent(adjustEvent1); -// CommonHttpUtil.setAdvertisingChannels("ea6lld", new HttpCallback() { -// @Override -// public void onSuccess(int code, String msg, String[] info) { -// if(code == 0) { -// mFirebaseAnalytics.logEvent("FS_reg_twitter", null); -// logger.logEvent("FB_reg_twitter"); -// } -// } -// }); -// -// }else if(mLoginType.equals("facebook")){ -// AdjustEvent adjustEvent1 = new AdjustEvent("5jbk95"); -// Adjust.trackEvent(adjustEvent1); -// CommonHttpUtil.setAdvertisingChannels("5jbk95", new HttpCallback() { -// @Override -// public void onSuccess(int code, String msg, String[] info) { -// if(code == 0) { -// mFirebaseAnalytics.logEvent("FS_reg_fb", null); -// logger.logEvent("FB_reg_fb"); -// } -// } -// }); -// -// }else if(mLoginType.equals("google")){ -// AdjustEvent adjustEvent1 = new AdjustEvent("krap47"); -// Adjust.trackEvent(adjustEvent1); -// CommonHttpUtil.setAdvertisingChannels("krap47", new HttpCallback() { -// @Override -// public void onSuccess(int code, String msg, String[] info) { -// if(code == 0) { -// mFirebaseAnalytics.logEvent("FS_reg_google", null); -// logger.logEvent("FB_reg_google"); -// } -// } -// }); -// -// }else if(mLoginType.equals("line")){ -// AdjustEvent adjustEvent1 = new AdjustEvent("uaacbn"); -// Adjust.trackEvent(adjustEvent1); -// -// CommonHttpUtil.setAdvertisingChannels("uaacbn", new HttpCallback() { -// @Override -// public void onSuccess(int code, String msg, String[] info) { -// if(code == 0) { -// mFirebaseAnalytics.logEvent("FS_reg_line", null); -// logger.logEvent("FB_reg_line"); -// } -// } -// }); -// } -// if (CommonAppConfig.IS_GOOGLE_PLAY == true) { -// EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class)); -// }else{ -// gotoLive("97714"); -// MainActivity.forward(EntryActivity.this, false); -// } -// } else { -// MainActivity.forward(EntryActivity.this, false); -// } -// EntryActivity.activity.finish(); + if (mFirstLogin) { + //绑定广告渠道用户 + AdjustEvent adjustEvent = new AdjustEvent("s1or0t"); + adjustEvent.addCallbackParameter("userid", "bar"); + Adjust.trackEvent(adjustEvent); + + //完成第三方登录 + if(mLoginType.equals("twitter")){ + AdjustEvent adjustEvent1 = new AdjustEvent("ea6lld"); + Adjust.trackEvent(adjustEvent1); + CommonHttpUtil.setAdvertisingChannels("ea6lld", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if(code == 0) { + mFirebaseAnalytics.logEvent("FS_reg_twitter", null); + logger.logEvent("FB_reg_twitter"); + } + } + }); + + }else if(mLoginType.equals("facebook")){ + AdjustEvent adjustEvent1 = new AdjustEvent("5jbk95"); + Adjust.trackEvent(adjustEvent1); + CommonHttpUtil.setAdvertisingChannels("5jbk95", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if(code == 0) { + mFirebaseAnalytics.logEvent("FS_reg_fb", null); + logger.logEvent("FB_reg_fb"); + } + } + }); + + }else if(mLoginType.equals("google")){ + AdjustEvent adjustEvent1 = new AdjustEvent("krap47"); + Adjust.trackEvent(adjustEvent1); + CommonHttpUtil.setAdvertisingChannels("krap47", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if(code == 0) { + mFirebaseAnalytics.logEvent("FS_reg_google", null); + logger.logEvent("FB_reg_google"); + } + } + }); + + }else if(mLoginType.equals("line")){ + AdjustEvent adjustEvent1 = new AdjustEvent("uaacbn"); + Adjust.trackEvent(adjustEvent1); + + CommonHttpUtil.setAdvertisingChannels("uaacbn", new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if(code == 0) { + mFirebaseAnalytics.logEvent("FS_reg_line", null); + logger.logEvent("FB_reg_line"); + } + } + }); + } + if (CommonAppConfig.IS_GOOGLE_PLAY == true) { + EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class)); + }else{ + gotoLive("97714"); + MainActivity.forward(EntryActivity.this, false); + } + } else { + MainActivity.forward(EntryActivity.this, false); + } + EntryActivity.activity.finish(); } }); } 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 4c249d41a..34f2e3b6e 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -245,6 +245,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Override protected void main() { + ConversationIMListManager.get(this); //谷歌支付 GoogleBillingUtil.setIsAutoAcknowledgePurchase(true);//设置自动确认购买 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 906eb901b..2c5ae6bcf 100644 --- a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java @@ -1,6 +1,7 @@ package com.yunbao.main.dialog; import android.os.Bundle; + import androidx.annotation.Nullable; import android.view.Gravity; @@ -12,6 +13,8 @@ import android.widget.TextView; import com.adjust.sdk.Adjust; import com.adjust.sdk.AdjustEvent; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.dialog.AbsDialogFragment; @@ -21,7 +24,12 @@ import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpClient; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; +import com.yunbao.live.activity.LiveAudienceActivity; +import com.yunbao.live.bean.LiveBean; +import com.yunbao.live.http.LiveHttpUtil; +import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.main.R; +import com.yunbao.main.activity.EntryActivity; import com.yunbao.main.activity.MainActivity; import static com.yunbao.common.CommonAppContext.logger; @@ -74,11 +82,11 @@ public class OneLoginDialog extends AbsDialogFragment { return; } ImgLoader.displayAvatar(mContext, CommonAppConfig.getInstance().getUserBean().getAvatar(), avatar); - text_username.setText( WordUtil.getString(R.string.edit_profile_nickname)+":"+bundle.getString("name")); - if(!bundle.getString("code").equals("")) { - text_code.setText( WordUtil.getString(R.string.invite_code)+":"+bundle.getString("code")); - }else{ - text_code.setText( WordUtil.getString(R.string.invite_code)+":無"); + text_username.setText(WordUtil.getString(R.string.edit_profile_nickname) + ":" + bundle.getString("name")); + if (!bundle.getString("code").equals("")) { + text_code.setText(WordUtil.getString(R.string.invite_code) + ":" + bundle.getString("code")); + } else { + text_code.setText(WordUtil.getString(R.string.invite_code) + ":無"); } btn_enter.setOnClickListener(new View.OnClickListener() { @@ -92,23 +100,37 @@ public class OneLoginDialog extends AbsDialogFragment { .execute(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if(code == 0){ + if (code == 0) { AdjustEvent adjustEvent = new AdjustEvent("neb317"); Adjust.trackEvent(adjustEvent); CommonHttpUtil.setAdvertisingChannels("neb317", new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { - if(code == 0) { + if (code == 0) { mFirebaseAnalytics.logEvent("FS_binding_success", null); logger.logEvent("FB_binding_success"); } } }); - MainActivity.forward(getContext(), false); - }else{ - if(msg.contains("暱稱重複,請重新輸入")){ + HttpClient.getInstance().post("Home.getRandJoinAnchor", "Home.getRandJoinAnchor") + .params("uid", CommonAppConfig.getInstance().getUid()) + .params("token", CommonAppConfig.getInstance().getToken()) + .execute(new HttpCallback() { + @Override + public void onSuccess(int code, String msg, String[] info) { + if (info[0]!=null) { + JSONObject obj = JSON.parseObject(info[0]); + CommonAppConfig.isNewUser = true; + gotoLive(obj.getString("anchor_id")); + }else{ + MainActivity.forward(getContext(), false); + } + } + }); + } else { + if (msg.contains("暱稱重複,請重新輸入")) { ToastUtil.show(R.string.edit_one_5); - }else if(msg.contains("該邀請碼不存在,請重新輸入")){ + } else if (msg.contains("該邀請碼不存在,請重新輸入")) { ToastUtil.show(R.string.edit_one_6); } else if (msg.contains("暱稱不合法")) { ToastUtil.show(R.string.edit_one_7); @@ -120,4 +142,34 @@ public class OneLoginDialog extends AbsDialogFragment { }); } + + + private LiveRoomCheckLivePresenter mCheckLivePresenter; + + private void gotoLive(final String live_id) { + LiveHttpUtil.getLiveInfo(live_id, new 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 (mCheckLivePresenter == null) { + mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() { + @Override + public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) { + if (liveBean == null) { + return; + } + LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk); + + } + }); + } + mCheckLivePresenter.checkLive(liveBean); + } else { + MainActivity.forward(mContext, false); + } + } + }); + } }