diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml
index 76ef40d85..aba6f6f0c 100644
--- a/common/src/main/res/values-en/strings.xml
+++ b/common/src/main/res/values-en/strings.xml
@@ -73,6 +73,7 @@
Complete
Follow\nanchor
light UP\nRoom
+ completing mission
@@ -153,6 +154,7 @@
Fans
Opps… The anchor did not open the voice link
Fans
+ Free
My fans
TA fans
You don\'t have fans yet
@@ -166,6 +168,8 @@
Open guard
Renewal Guardian
My
+ GET
+ Only one can be given away~
Guard
Contribution this week
Become the girst Guard of he/she
diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml
index 652d31615..f63211ec1 100644
--- a/common/src/main/res/values/strings.xml
+++ b/common/src/main/res/values/strings.xml
@@ -61,9 +61,11 @@
赠送一个\n免费礼物
未完成
完成
- 關注主播
- 點亮直播間
-
+ 任意關注\n一名主播
+ 雙擊點亮\n 直播間
+ 恭喜你完成任務
+ 获得
+ 這個禮物只能送一個哦~
生日
性別
申请連麥
@@ -102,6 +104,8 @@
Opps… 主播沒有開啟語音連麥
粉絲
貴族
+ 免費贈送
+
我的粉絲
TA的粉絲
你還沒有粉絲
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 591dd21af..22ba52537 100644
--- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
+++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java
@@ -332,7 +332,7 @@ public class LiveAudienceActivity extends LiveActivity {
@Override
public void onTick(long millisUntilFinished) {
- if (IMLoginManager.get(mContext).isisNewUserOne() == true && timeIndex == 5) {
+ if (IMLoginManager.get(mContext).isisNewUserOne() == true && timeIndex == 10) {
NewUserDialog fragment1 = new NewUserDialog();
fragment1.show(((LiveActivity) mContext).getSupportFragmentManager(), "NewUserDialog");
}
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 7160dcbc0..c5fcd42e7 100644
--- a/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java
+++ b/live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java
@@ -4,6 +4,8 @@ import android.content.Context;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
+
+import android.graphics.Color;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -190,6 +192,12 @@ public class LiveGiftAdapter extends RecyclerView.Adapter {
mPayico.setImageResource(R.mipmap.diamond);
}
mPrice.setText(bean.getPrice());
+
+ if (IMLoginManager.get(mContext).isNewUserGif() == false && position == 0 && bean.getTag() != null) {
+ mPayico.setVisibility(View.GONE);
+ mPrice.setText(R.string.free);
+ mPrice.setTextColor(Color.parseColor("#FFF269"));
+ }
expire.setVisibility(View.GONE);
if(bean.getEnd_time()!=null){
expire.setVisibility(View.VISIBLE);
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 1890e0074..f4c6544e5 100644
--- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java
+++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java
@@ -21,6 +21,7 @@ import android.widget.PopupWindow;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
+import android.widget.Toast;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent;
@@ -187,6 +188,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
}
} else {
+
//点击包裹,展示包裹列表
mCurrentId = 1;
loadWrapListData();
@@ -422,8 +424,8 @@ 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) {
+ mWishGiftId = ""+bean1.getId();
list.add(0,bean1);
}
mGiftList = list;
@@ -674,15 +676,21 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
*/
public void sendGift() {
if(mLiveGiftBean.getTag()!=null){
- LiveHttpUtil.setFrontTask("sendgift", mLiveUid,new HttpCallback() {
- @Override
- public void onSuccess(int code, String msg, String[] info) {
- if(code == 0){
+ if(mCount.equals("1")) {
+ LiveHttpUtil.setFrontTask("sendgift", mLiveUid, new HttpCallback() {
+ @Override
+ public void onSuccess(int code, String msg, String[] info) {
+ EventBus.getDefault().post("stop_svga_new_user_gif");
EventBus.getDefault().post("stop_new_user_gif");
+ if (code == 0) {
+ EventBus.getDefault().post("stop_new_user_gif1");
+ }
+ dismiss();
}
- dismiss();
- }
- });
+ });
+ }else {
+ ToastUtil.show(R.string.only_one);
+ }
}else {
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mStream) || mLiveGiftBean == null) {
return;
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 435fc6b47..1ea279c9d 100644
--- a/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java
+++ b/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java
@@ -14,6 +14,8 @@ import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
import com.yunbao.common.dialog.AbsDialogFragment;
import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.ToastUtil;
@@ -90,18 +92,25 @@ public class NewUserDialog extends AbsDialogFragment {
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- ImageView btn_close = (ImageView) mRootView.findViewById(R.id.btn_close);
+ TextView gold = (TextView) mRootView.findViewById(R.id.gold);
+ TextView exp = (TextView) mRootView.findViewById(R.id.exp);
+ 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("reward_all");
+ gold.setText(obj.getString("gold"));
+ exp.setText(obj.getString("experience"));
+ }});
TextView btn_confirm = (TextView) mRootView.findViewById(R.id.btn_confirm);
btn_confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
-
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 51155633f..8ea38a215 100644
--- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java
+++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java
@@ -117,6 +117,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
private View btnWishList;
private View btnTurnTable;
private View btnEvent;
+ private View btnEvent3;
private View btn_onecz_event;
private ImageView imgEvent;
private String eventUrl;
@@ -131,7 +132,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
public static String link = "";
LinearLayout btn_event2;
public static LiveGiftBean bean1 = new LiveGiftBean();
-
+ String gold,experience;
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUpdata(String str) {
@@ -140,12 +141,40 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
} else if ("stop_svga_new_user_double".equals(str)) {
mBannerList3.get(2).setLink("1");
mBanner3.update(mBannerList3);
+ if(mBannerList3.get(0).getLink().equals("1")){
+ if(mBannerList3.get(1).getLink().equals("1")){
+ if(mBannerList3.get(2).getLink().equals("1")){
+ btnEvent3.setVisibility(View.GONE);
+ }
+ }
+ }
} else if ("stop_svga_new_user_follow".equals(str)) {
mBannerList3.get(1).setLink("1");
mBanner3.update(mBannerList3);
+ if(mBannerList3.get(0).getLink().equals("1")){
+ if(mBannerList3.get(1).getLink().equals("1")){
+ if(mBannerList3.get(2).getLink().equals("1")){
+ btnEvent3.setVisibility(View.GONE);
+ }
+ }
+ }
} else if ("stop_new_user_gif".equals(str)) {
+ IMLoginManager.get(mContext).setNewUserGif(true);
mBannerList3.get(0).setLink("1");
mBanner3.update(mBannerList3);
+ if(mBannerList3.get(0).getLink().equals("1")){
+ if(mBannerList3.get(1).getLink().equals("1")){
+ if(mBannerList3.get(2).getLink().equals("1")){
+ btnEvent3.setVisibility(View.GONE);
+ }
+ }
+ }
+ }else if("stop_svga_new_user_double1".equals(str)){
+ publicToast(mContext);
+ }else if ("stop_svga_new_user_follow1".equals(str)) {
+ publicToast(mContext);
+ }else if ("stop_new_user_gif1".equals(str)) {
+ publicToast(mContext);
}
}
@@ -155,16 +184,19 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
// 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);
+ TextView gold_text = view.findViewById(R.id.gold);
+// 3、设置组件内容
+ gold_text.setText(gold);
+ TextView exp_txt = view.findViewById(R.id.exp);
+// 3、设置组件内容
+ exp_txt.setText(experience);
// 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);
+ toast.setGravity(Gravity.CENTER ,Gravity.CENTER ,Gravity.CENTER );
// 6、显示toast
toast.show();
}
@@ -220,7 +252,6 @@ 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);
@@ -231,6 +262,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
btnWishList.setOnClickListener(this);
btnTurnTable.setOnClickListener(this);
btnEvent = root.findViewById(R.id.btn_event);
+ btnEvent3 = root.findViewById(R.id.btn_event3);
mBanner1 = (Banner) root.findViewById(R.id.banner1);
mBanner2 = (Banner) root.findViewById(R.id.banner2);
mBanner3 = (Banner) root.findViewById(R.id.banner3);
@@ -269,23 +301,29 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
JSONObject obj = old_obj.getJSONObject("task");
JSONObject obj1 = old_obj.getJSONObject("gift");
+ JSONObject reward_one = old_obj.getJSONObject("reward_one");
- bean1.setSwf(obj1.getString("swf"));
+ gold = reward_one.getString("gold");
+ experience = reward_one.getString("experience");
+
+ bean1.setSwf("111");
bean1.setChecked(false);
bean1.setIcon(obj1.getString("gifticon"));
bean1.setId(obj1.getIntValue("id"));
bean1.setName(obj1.getString("giftname"));
bean1.setTag("1");
-
+ if( IMLoginManager.get(mContext).isisNewUserOne() == false) {
+ if(obj.getString("sendgift").equals("0")) {
+ EventBus.getDefault().post("svga_new_user_gif");
+ }
+ }
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");
@@ -897,6 +935,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
}
private void showBanner3() {
+ btnEvent3.setVisibility(View.VISIBLE);
if (mBannerList3 == null || mBannerList3.size() == 0 || mBanner3 == null) {
return;
}
@@ -910,7 +949,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
if (mBannerList3 != null) {
if (mBannerList3.get(p).getLink().equals("0")) {
if (p == 0) {
- ((LiveAudienceActivity) mContext).openGiftWindow("1530", "1");
+ ((LiveAudienceActivity) mContext).openGiftWindow(""+bean1.getId(), "1");
EventBus.getDefault().post("svga_new_user_gif");
} else if (p == 1) {
EventBus.getDefault().post("svga_new_user_follow");
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 a0e8961a6..e5d9374f4 100644
--- a/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java
+++ b/live/src/main/java/com/yunbao/live/socket/SocketRyChatUtil.java
@@ -1,6 +1,9 @@
package com.yunbao.live.socket;
import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.Toast;
import com.adjust.sdk.Adjust;
import com.adjust.sdk.AdjustEvent;
@@ -12,6 +15,7 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.R;
import com.yunbao.live.http.LiveHttpUtil;
+import com.yunbao.live.views.LiveRoomViewHolder;
import org.greenrobot.eventbus.EventBus;
@@ -197,6 +201,9 @@ public class SocketRyChatUtil {
LiveHttpUtil.setFrontTask("illumine", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
+ if(code == 0) {
+ EventBus.getDefault().post("stop_svga_new_user_double1");
+ }
}
});
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 73fa8c4cc..4906f84e2 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveAudienceViewHolder.java
@@ -79,10 +79,10 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
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();
+ }else if("stop_svga_new_user_gif".equals(str)) {
+ svga_new_user_gif.setVisibility(View.GONE);
+ svga_new_user_gif.stopAnimation();
+ svga_new_user_gif.clear();
}
}
@@ -152,7 +152,12 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
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);
-
+ svga_new_user_double.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ((LiveAudienceActivity) mContext).light();
+ }
+ });
findViewById(R.id.btn_mic).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
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 a4167d434..adb9e41be 100644
--- a/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
+++ b/live/src/main/java/com/yunbao/live/views/LiveRoomViewHolder.java
@@ -8,6 +8,7 @@ import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
@@ -16,6 +17,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
+import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
@@ -105,7 +107,7 @@ import static com.yunbao.live.activity.LiveAudienceActivity.countDownTimer;
*/
public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickListener {
- private static Context Contexts;
+ public static Context Contexts;
private int mOffsetY;
private ViewGroup mRoot;
LinearLayout gif_view;
@@ -1197,7 +1199,9 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
LiveHttpUtil.setFrontTask("attent", new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
-
+ if(code == 0){
+ EventBus.getDefault().post("stop_svga_new_user_follow1");
+ }
}
});
diff --git a/live/src/main/res/layout/banner_new_user.xml b/live/src/main/res/layout/banner_new_user.xml
index c75e71870..d96f6305f 100644
--- a/live/src/main/res/layout/banner_new_user.xml
+++ b/live/src/main/res/layout/banner_new_user.xml
@@ -1,9 +1,8 @@
@@ -66,10 +65,10 @@
-
@@ -103,9 +102,9 @@
@@ -127,10 +126,10 @@
android:layout_centerHorizontal="true"
/>
-
diff --git a/live/src/main/res/layout/diy_toast_view.xml b/live/src/main/res/layout/diy_toast_view.xml
index b722e6e32..0d5e3eb14 100644
--- a/live/src/main/res/layout/diy_toast_view.xml
+++ b/live/src/main/res/layout/diy_toast_view.xml
@@ -1,6 +1,5 @@
-
+
+ android:textSize="12sp" />
+
-
+
+
+ android:textSize="12sp" />
-
diff --git a/live/src/main/res/layout/view_live_audience.xml b/live/src/main/res/layout/view_live_audience.xml
index 1ecd4823b..ca6fe2715 100644
--- a/live/src/main/res/layout/view_live_audience.xml
+++ b/live/src/main/res/layout/view_live_audience.xml
@@ -60,19 +60,21 @@
0) {
JSONObject obj = JSON.parseObject(info[0]);
@@ -672,53 +673,53 @@ public class EntryActivity extends AppCompatActivity {
Adjust.trackEvent(adjustEvent);
//完成第三方登录
- if(mLoginType.equals("twitter")){
+ 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) {
+ if (code == 0) {
mFirebaseAnalytics.logEvent("FS_reg_twitter", null);
logger.logEvent("FB_reg_twitter");
}
}
});
- }else if(mLoginType.equals("facebook")){
+ } 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) {
+ if (code == 0) {
mFirebaseAnalytics.logEvent("FS_reg_fb", null);
logger.logEvent("FB_reg_fb");
}
}
});
- }else if(mLoginType.equals("google")){
+ } 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) {
+ if (code == 0) {
mFirebaseAnalytics.logEvent("FS_reg_google", null);
logger.logEvent("FB_reg_google");
}
}
});
- }else if(mLoginType.equals("line")){
+ } 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) {
+ if (code == 0) {
mFirebaseAnalytics.logEvent("FS_reg_line", null);
logger.logEvent("FB_reg_line");
}
@@ -727,9 +728,23 @@ public class EntryActivity extends AppCompatActivity {
}
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class));
- }else{
- gotoLive("97714");
- MainActivity.forward(EntryActivity.this, false);
+ } else {
+ 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]);
+ MainActivity.forward(EntryActivity.this, false);
+ gotoLive(obj.getString("anchor_id"));
+ IMLoginManager.get(EntryActivity.this).setisNewUserOne(true);
+ } else {
+ MainActivity.forward(EntryActivity.this, false);
+ }
+ }
+ });
}
} else {
MainActivity.forward(EntryActivity.this, false);
diff --git a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java
index 0abb94bba..6cd959c82 100644
--- a/main/src/main/java/com/yunbao/main/activity/LoginActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/LoginActivity.java
@@ -38,11 +38,16 @@ import com.yunbao.common.bean.UserBean;
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.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
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.event.RegSuccessEvent;
import com.yunbao.main.http.MainHttpConsts;
@@ -70,7 +75,7 @@ public class LoginActivity extends AbsActivity {
private View mBtnLogin;
private RecyclerView mRecyclerView;
// private MobLoginUtil mLoginUtil;
- private static boolean mFirstLogin;//是否是第一次登录
+ private boolean mFirstLogin;//是否是第一次登录
private static boolean mShowInvite;//显示邀请码弹窗
private static String mLoginType = Constants.MOB_PHONE;//登录方式
private String mPromoCode = "";//推广码
@@ -217,21 +222,53 @@ public class LoginActivity extends AbsActivity {
});
hideKeyboard(mEditPwd);
}
+
/**
* 强隐键盘
+ *
* @param view
*/
private void hideKeyboard(View view) {
InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
+
//登录即代表同意服务和隐私条款
private void forwardTip() {
WebViewActivity.forward(mContext, HtmlConfig.LOGIN_PRIVCAY);
}
+ 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(LoginActivity.this, new LiveRoomCheckLivePresenter.ActionListener() {
+ @Override
+ public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
+ if (liveBean == null) {
+ return;
+ }
+ LiveAudienceActivity.forward(LoginActivity.this, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
+
+ }
+ });
+ }
+ mCheckLivePresenter.checkLive(liveBean);
+ } else {
+ MainActivity.forward(LoginActivity.this, false);
+ }
+ }
+ });
+ }
+
//登录成功!
- private static void onLoginSuccess(int code, String msg, String[] info) {
+ private void onLoginSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
JSONObject obj = JSON.parseObject(info[0]);
String uid = obj.getString("id");
@@ -258,7 +295,7 @@ public class LoginActivity extends AbsActivity {
/**
* 获取用户信息
*/
- private static void getBaseUserInfo() {
+ private void getBaseUserInfo() {
MainHttpUtil.getBaseInfo(new CommonCallback() {
@Override
public void callback(UserBean bean) {
@@ -267,9 +304,28 @@ public class LoginActivity extends AbsActivity {
mFirebaseAnalytics.logEvent("FS_login", null);
logger.logEvent("FB_login");
Adjust.trackEvent(adjustEvent1);
- MainActivity.forward(Contexts, mShowInvite);
- EntryActivity.activity.finish();
- activity.finish();
+ ToastUtil.show(mFirstLogin+"");
+ 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 && mFirstLogin == true) {
+ JSONObject obj = JSON.parseObject(info[0]);
+ MainActivity.forward(LoginActivity.this, false);
+ gotoLive(obj.getString("anchor_id"));
+ IMLoginManager.get(mContext).setisNewUserOne(true);
+ EntryActivity.activity.finish();
+ activity.finish();
+ } else {
+ MainActivity.forward(LoginActivity.this, false);
+ EntryActivity.activity.finish();
+ activity.finish();
+ }
+ }
+ });
+
}
});
}
diff --git a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java
index 6c8d78e28..bc221dc1c 100644
--- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java
+++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java
@@ -39,12 +39,17 @@ import com.yunbao.common.bean.IMLoginModel;
import com.yunbao.common.bean.UserBean;
import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback;
+import com.yunbao.common.http.HttpClient;
import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.DialogUitl;
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.event.RegSuccessEvent;
import com.yunbao.main.http.MainHttpConsts;
@@ -490,6 +495,7 @@ public class RegisterActivity extends AbsActivity {
IMLoginManager.get(activity).setupLoginUser(model);
//融云连接服务器
RongcloudIMManager.connectIM(activity);
+
} else {
ToastUtil.show(msg);
}
@@ -516,9 +522,22 @@ public class RegisterActivity extends AbsActivity {
}
if (bean != null) {
if (mFirstLogin) {
- RecommendActivity.forward(mContext, mShowInvite);
- } else {
- MainActivity.forward(mContext, mShowInvite);
+ 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]);
+ MainActivity.forward(RegisterActivity.this, false);
+ gotoLive(obj.getString("anchor_id"));
+ IMLoginManager.get(RegisterActivity.this).setisNewUserOne(true);
+ } else {
+ MainActivity.forward(RegisterActivity.this, false);
+ }
+ }
+ });
}
EventBus.getDefault().post(new RegSuccessEvent());
}
@@ -526,6 +545,35 @@ public class RegisterActivity extends AbsActivity {
});
}
+ 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(RegisterActivity.this, new LiveRoomCheckLivePresenter.ActionListener() {
+ @Override
+ public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
+ if (liveBean == null) {
+ return;
+ }
+ LiveAudienceActivity.forward(RegisterActivity.this, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
+
+ }
+ });
+ }
+ mCheckLivePresenter.checkLive(liveBean);
+ } else {
+ MainActivity.forward(RegisterActivity.this, false);
+ }
+ }
+ });
+ }
+
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRegSuccessEvent(RegSuccessEvent e) {
finish();