From 1fc6a3adfe80849073b384ff82da67d480baac30 Mon Sep 17 00:00:00 2001 From: 18142669586 <1669783059@qq.com> Date: Wed, 27 Jul 2022 20:44:55 +0800 Subject: [PATCH] 111 --- .../dialog/InstructorOperationDialog.java | 2 +- .../yunbao/common/manager/IMLoginManager.java | 2 +- .../res/layout/view_instructor_operation.xml | 2 +- common/src/main/res/values-en/strings.xml | 2 +- common/src/main/res/values/strings.xml | 3 ++ config.gradle | 8 ++-- .../yunbao/live/activity/LiveActivity.java | 8 ++-- .../live/dialog/LiveGiftDialogFragment.java | 4 +- .../dialog/LivePromotionDialogFragment.java | 3 +- .../com/yunbao/live/dialog/NewUserDialog.java | 2 + .../live/presenter/LiveLinkMicPresenter.java | 15 +++--- .../com/yunbao/live/utils/CenterTextView.java | 47 +++++++++++++++++++ live/src/main/res/layout/banner_new_user.xml | 3 +- .../main/res/layout/dialog_live_new_user.xml | 22 +++++---- .../main/res/layout/view_live_audience.xml | 4 +- .../yunbao/main/activity/EntryActivity.java | 7 ++- .../yunbao/main/activity/MainActivity.java | 10 ++-- .../main/activity/RegisterActivity.java | 27 ++++++++--- .../yunbao/main/dialog/OneLoginDialog.java | 4 +- .../main/res/layout/activity_one_login.xml | 3 +- 20 files changed, 124 insertions(+), 54 deletions(-) create mode 100644 live/src/main/java/com/yunbao/live/utils/CenterTextView.java diff --git a/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java b/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java index 049993ce5..e28a439f9 100644 --- a/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/InstructorOperationDialog.java @@ -62,7 +62,7 @@ public class InstructorOperationDialog extends AbsDialogFragment { @Override protected boolean canCancel() { - return false; + return true; } @Override 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 da5fbc07e..d1b2a4325 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -41,7 +41,7 @@ public class IMLoginManager extends BaseCacheManager { public boolean isNewUserGif(){ return getBoolean(isNewUserGif,false); } - //新用戶是否送了禮物 + //是否是新用戶還沒有送禮物 public void setNewUserGif(boolean t){ put(isNewUserGif,t); } diff --git a/common/src/main/res/layout/view_instructor_operation.xml b/common/src/main/res/layout/view_instructor_operation.xml index 95f73f99a..1e9454b69 100644 --- a/common/src/main/res/layout/view_instructor_operation.xml +++ b/common/src/main/res/layout/view_instructor_operation.xml @@ -58,7 +58,7 @@ EXP Complete newcomer tasks for more rewards ReceiveAwards - + One free gift privilege! Send out I am sorry diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 876821101..0607c7048 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -633,6 +633,9 @@ 立即註冊 TA還沒有勛章 座駕 + 一次免費贈送禮物特權! + + TA還沒有座騎 歡迎來到PDLIVE 恭喜你獲得了新人獎勵 diff --git a/config.gradle b/config.gradle index 53e2161f5..9b81eafd5 100644 --- a/config.gradle +++ b/config.gradle @@ -4,14 +4,14 @@ ext { buildToolsVersion: "28.0.3", minSdkVersion : 21, targetSdkVersion : 30, - versionCode : 189, - versionName : "6.3.5" + versionCode : 200, + versionName : "6.3.6" ] manifestPlaceholders = [ //正式 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", //測試 - serverHost : "https://ceshi.yaoulive.com", +// serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java index 7de5f415c..6201948aa 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveActivity.java @@ -858,7 +858,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL * 打开聊天输入框 */ public void openChatWindow() { - if ("1".equals(Constants.isSend)) { +// if ("1".equals(Constants.isSend)) { if (mKeyBoardHeightUtil == null) { mKeyBoardHeightUtil = new KeyBoardHeightUtil2(mContext, super.findViewById(android.R.id.content), this); mKeyBoardHeightUtil.start(); @@ -872,9 +872,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL bundle.putString(Constants.COIN_NAME, mCoinName); fragment.setArguments(bundle); fragment.show(getSupportFragmentManager(), "LiveInputDialogFragment"); - } else { - showTaskDialog(); - } +// } else { +// showTaskDialog(); +// } } private void showTaskDialog() { 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 c35f675f2..604dbf53e 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveGiftDialogFragment.java @@ -275,7 +275,6 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On if (bundle != null) { mLiveUid = bundle.getString(Constants.LIVE_UID); mStream = bundle.getString(Constants.LIVE_STREAM); - ToastUtil.show("啊"+ bundle.getString(Constants.LIVE_WISH_GIFTID)); mWishGiftId = bundle.getString(Constants.LIVE_WISH_GIFTID); by = bundle.getString("by"); } @@ -428,9 +427,8 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On private void showGiftList(List list) { if (IMLoginManager.get(mContext).isNewUserGif() == true && type_name.equals("熱門")|| type_name.equals("Hot")) { - + list.add(0, bean1); if(mWishGiftId==null) { - mWishGiftId = "" + bean1.getId(); } } diff --git a/live/src/main/java/com/yunbao/live/dialog/LivePromotionDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LivePromotionDialogFragment.java index bdcc86b93..cb3794f20 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LivePromotionDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LivePromotionDialogFragment.java @@ -59,6 +59,7 @@ public class LivePromotionDialogFragment extends AbsDialogFragment { mRefreshView = mRootView.findViewById(R.id.refreshView); livePromotionAdapter = new LivePromotionAdapter(mContext, LiveActivity.mLiveUid,this ); mRefreshView.setLayoutManager(new GridLayoutManager(mContext, 4)); + mRefreshView.setLoadMoreEnable(false); mRefreshView.setDataHelper(new CommonRefreshView.DataHelper() { @Override public RefreshAdapter getAdapter() { @@ -89,7 +90,7 @@ public class LivePromotionDialogFragment extends AbsDialogFragment { @Override public void onLoadMoreSuccess(List loadItemList, int loadItemCount) { - livePromotionAdapter.insertList(loadItemList); +// livePromotionAdapter.insertList(loadItemList); } 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 1ea279c9d..fba1ad136 100644 --- a/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java +++ b/live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java @@ -18,6 +18,7 @@ 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.manager.IMLoginManager; import com.yunbao.common.utils.ToastUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; @@ -111,6 +112,7 @@ public class NewUserDialog extends AbsDialogFragment { public void onClick(View view) { EventBus.getDefault().post("showBanner"); EventBus.getDefault().post("svga_new_user_gif"); + IMLoginManager.get(mContext).setNewUserGif(true); 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 3b3ad5861..c47a3085b 100644 --- a/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java +++ b/live/src/main/java/com/yunbao/live/presenter/LiveLinkMicPresenter.java @@ -299,7 +299,8 @@ public class LiveLinkMicPresenter implements View.OnClickListener { public void onSuccess(int code, String msg, String[] info) { JSONObject old_obj = JSON.parseObject(info[0]); - JSONObject obj = old_obj.getJSONObject("task"); + JSONObject obj = old_obj.getJSONObject("task"); + if (obj != null) { JSONObject obj1 = old_obj.getJSONObject("gift"); JSONObject reward_one = old_obj.getJSONObject("reward_one"); @@ -313,8 +314,8 @@ public class LiveLinkMicPresenter implements View.OnClickListener { bean1.setName(obj1.getString("giftname")); bean1.setTag("1"); - if( IMLoginManager.get(mContext).isisNewUserOne() == false) { - if(obj.getString("sendgift").equals("0")) { + if (IMLoginManager.get(mContext).isisNewUserOne() == false) { + if (obj.getString("sendgift").equals("0")) { EventBus.getDefault().post("svga_new_user_gif"); } } @@ -324,7 +325,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener { mBannerList3.add(banner3Bean); - BannerBean banner3Bean1 = new BannerBean(); banner3Bean1.setImageUrl("https://qny.shayucm.com/live_Mission_box.png"); banner3Bean1.setLink(obj.getString("attent")); @@ -335,14 +335,15 @@ public class LiveLinkMicPresenter implements View.OnClickListener { banner3Bean2.setLink(obj.getString("illumine")); mBannerList3.add(banner3Bean2); - if(obj.getString("sendgift").equals("0")&& IMLoginManager.get(context).isisNewUserOne() == false) { + if (obj.getString("sendgift").equals("0") && IMLoginManager.get(context).isisNewUserOne() == false) { showBanner3(); - }else if(obj.getString("attent").equals("0")&& IMLoginManager.get(context).isisNewUserOne() == false){ + } 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){ + } else if (obj.getString("illumine").equals("0") && IMLoginManager.get(context).isisNewUserOne() == false) { showBanner3(); } } + } }); diff --git a/live/src/main/java/com/yunbao/live/utils/CenterTextView.java b/live/src/main/java/com/yunbao/live/utils/CenterTextView.java new file mode 100644 index 000000000..9d593c19b --- /dev/null +++ b/live/src/main/java/com/yunbao/live/utils/CenterTextView.java @@ -0,0 +1,47 @@ +package com.yunbao.live.utils; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.text.Layout; +import android.text.StaticLayout; +import android.text.TextPaint; +import android.util.AttributeSet; +import android.widget.TextView; + +@SuppressLint("AppCompatCustomView") +public class CenterTextView extends TextView { + private StaticLayout mStaticLayout; + private TextPaint mTextPaint; + + public CenterTextView(Context context) { + super(context); + } + + public CenterTextView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public CenterTextView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + protected void onSizeChanged(int w, int h, int oldw, int oldh) { + super.onSizeChanged(w, h, oldw, oldh); + initView(); + } + + private void initView() { + mTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); + mTextPaint.setTextSize(getTextSize()); + mTextPaint.setColor(getCurrentTextColor()); + mStaticLayout = new StaticLayout(getText(), mTextPaint, getWidth(), Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); + } + + @Override + protected void onDraw(Canvas canvas) { + mStaticLayout.draw(canvas); + } +} \ 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 index d96f6305f..4cadef1d0 100644 --- a/live/src/main/res/layout/banner_new_user.xml +++ b/live/src/main/res/layout/banner_new_user.xml @@ -23,9 +23,10 @@ android:text="Task 1" android:textColor="#ffffffff" android:textSize="8sp" + android:layout_marginBottom="3dp" /> - + android:paddingLeft="53dp" + android:paddingRight="53dp"> + android:textSize="20sp" + android:layout_marginTop="5dp"/> @@ -93,6 +93,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" + android:textStyle="bold" android:textColor="#fffff69f" android:textSize="12sp" /> @@ -130,6 +131,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" + android:textStyle="bold" android:textColor="#fffff69f" android:textSize="12sp" /> @@ -145,7 +147,7 @@ android:text="@string/new_rewards" android:textColor="#ffb3b3b3" android:textSize="10sp" - android:layout_marginTop="10dp" + android:layout_marginTop="18dp" /> 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 e3f3ccec1..669d37a27 100644 --- a/main/src/main/java/com/yunbao/main/activity/EntryActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/EntryActivity.java @@ -529,12 +529,10 @@ public class EntryActivity extends AppCompatActivity { private void updateUI() { boolean enableButtons = AccessToken.getCurrentAccessToken() != null; - ToastUtil.show(enableButtons + ""); Profile profile = Profile.getCurrentProfile(); if (enableButtons && profile != null) { - ToastUtil.show(profile.getId() + ""); LoginData data = new LoginData(); -// data.setAvatar(profile.getProfilePictureUri(150, 150).toString()); + data.setAvatar(profile.getProfilePictureUri(150, 150).toString()); data.setNickName(profile.getName()); data.setOpenID(AccessToken.getCurrentAccessToken().getUserId()); data.setType("facebook"); @@ -734,9 +732,10 @@ public class EntryActivity extends AppCompatActivity { public void onSuccess(int code, String msg, String[] info) { if (info[0] != null) { JSONObject obj = JSON.parseObject(info[0]); + IMLoginManager.get(EntryActivity.this).setNewUserGif(true); + IMLoginManager.get(EntryActivity.this).setisNewUserOne(true); MainActivity.forward(EntryActivity.this, false); gotoLive(obj.getString("anchor_id")); - IMLoginManager.get(EntryActivity.this).setisNewUserOne(true); if (obj.containsKey("home_zdy_pop")) { NoviceInstructorManager.get(activity).setHomeZdyPop(obj.getString("home_zdy_pop")); } 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 bd29d8fe4..54d5bd070 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -999,11 +999,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene @Subscribe(threadMode = ThreadMode.MAIN) public void onUpdateFieldEvent(UpdateTablePointMe updateTablePointMe) { numberMe = updateTablePointMe.getPoint(); - if (updateTablePointMe.getPoint() == 0) { - v_table_redpoint_me.setVisibility(View.VISIBLE); - } else { - v_table_redpoint_me.setVisibility(View.GONE); - } +// if (updateTablePointMe.getPoint() == 0) { +// v_table_redpoint_me.setVisibility(View.VISIBLE); +// } else { +// v_table_redpoint_me.setVisibility(View.GONE); +// } } /** 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 048ab034b..b62f6ecf7 100644 --- a/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/RegisterActivity.java @@ -38,9 +38,11 @@ import com.yunbao.common.HtmlConfig; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.WebViewActivity; 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.NoviceInstructorManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; @@ -470,16 +472,11 @@ public class RegisterActivity extends AbsActivity { IMLoginManager.get(activity).setupLoginUser(model); //融云连接服务器 RongcloudIMManager.connectIM(activity); - if (mFirstLogin) { - if (mDialog != null) { - mDialog.dismiss(); - } + getBaseUserInfo(); //绑定广告渠道用户 AdjustEvent adjustEvent = new AdjustEvent("s1or0t"); adjustEvent.addCallbackParameter("userid", CommonAppConfig.getInstance().getUid()); Adjust.trackEvent(adjustEvent); - netHandler.post(getRandJoinAnchor); - } } else { @@ -496,6 +493,23 @@ public class RegisterActivity extends AbsActivity { }); } + /** + * 获取用户信息 + */ + private void getBaseUserInfo() { + MainHttpUtil.getBaseInfo(new CommonCallback() { + @Override + public void callback(UserBean bean) { + if (mDialog != null) { + mDialog.dismiss(); + } + if (bean != null) { + netHandler.post(getRandJoinAnchor); +// EventBus.getDefault().post(new RegSuccessEvent()); + } + } + }); + } /** * 用户自动签到 */ @@ -512,6 +526,7 @@ public class RegisterActivity extends AbsActivity { if (info[0] != null) { JSONObject obj = JSON.parseObject(info[0]); IMLoginManager.get(activity).setisNewUserOne(true); + IMLoginManager.get(activity).setNewUserGif(true); gotoLive(obj.getString("anchor_id")); if (obj.containsKey("home_zdy_pop")) { NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop")); 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 9f4e98064..6db60e826 100644 --- a/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java +++ b/main/src/main/java/com/yunbao/main/dialog/OneLoginDialog.java @@ -30,6 +30,7 @@ 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; @@ -122,8 +123,9 @@ public class OneLoginDialog extends AbsDialogFragment { if (info[0] != null) { JSONObject obj = JSON.parseObject(info[0]); MainActivity.forward(getContext(), false); - gotoLive(obj.getString("anchor_id")); + IMLoginManager.get(mContext).setNewUserGif(true); IMLoginManager.get(mContext).setisNewUserOne(true); + gotoLive(obj.getString("anchor_id")); if (obj.containsKey("home_zdy_pop")) { NoviceInstructorManager.get(mContext).setHomeZdyPop(obj.getString("home_zdy_pop")); } diff --git a/main/src/main/res/layout/activity_one_login.xml b/main/src/main/res/layout/activity_one_login.xml index 9aca6ba29..d0a0367cd 100644 --- a/main/src/main/res/layout/activity_one_login.xml +++ b/main/src/main/res/layout/activity_one_login.xml @@ -72,8 +72,7 @@ android:gravity="left|center" android:hint="@string/edit_profile_name_empty" android:background="@null" - android:maxLines="10" - android:maxLength="20" + android:maxLength="10" android:singleLine="true" android:textColor="#161616" android:textColorHint="#B6B6B6"