Compare commits
15 Commits
6.4.4_fix_
...
change_liv
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c57486b69c | ||
|
|
0f2fbeb114 | ||
|
|
a50abb5b2c | ||
|
|
2102acd9e5 | ||
|
|
b8ee197e52 | ||
|
|
ba81a46e2f | ||
|
|
6841f47ac3 | ||
| a2fef0990a | |||
| 7e9b794c7f | |||
|
|
e70a5e09f6 | ||
| 3e8db9ec7e | |||
| 34f70bb4cd | |||
|
|
12f78dc3b8 | ||
| 89a54276b3 | |||
| 73fb523ddc |
@@ -10,6 +10,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@@ -54,8 +55,8 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
Intent intent=getIntent();
|
||||
if(intent!=null) {
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
isFullWindow = getIntent().getBooleanExtra("isFull", false);
|
||||
if (isFullWindow) {
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
@@ -358,4 +359,15 @@ public abstract class AbsActivity extends AppCompatActivity {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level) {
|
||||
super.onTrimMemory(level);
|
||||
Log.i("memory", "onTrimMemory: " + level);
|
||||
switch (level) {
|
||||
case TRIM_MEMORY_RUNNING_CRITICAL://内存低值危险值
|
||||
break;
|
||||
case TRIM_MEMORY_RUNNING_LOW://内存过低
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,10 +60,14 @@ public class CrashSaveBean {
|
||||
}
|
||||
|
||||
public String getActivitySize() {
|
||||
StringBuilder builder=new StringBuilder();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (WeakReference<Activity> activity : activities) {
|
||||
if(activity.get()!=null){
|
||||
builder.append(activity.get()).append(",");
|
||||
try {
|
||||
if (activity.get() != null) {
|
||||
builder.append(activity.get().getClass().getSimpleName()).append(",");
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
@@ -679,6 +681,15 @@ public class IMLoginModel extends BaseModel {
|
||||
return usersType;
|
||||
}
|
||||
|
||||
/**
|
||||
* usersType ==C 是主播身份
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean anchorUserType() {
|
||||
return !TextUtils.equals("C", usersType);
|
||||
}
|
||||
|
||||
public IMLoginModel setUsersType(String usersType) {
|
||||
this.usersType = usersType;
|
||||
return this;
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 新用户等级牌
|
||||
*/
|
||||
public class NewLevelModel extends BaseModel {
|
||||
|
||||
@SerializedName("id")
|
||||
private String id;
|
||||
@SerializedName("levemin")
|
||||
private String levemin;
|
||||
@SerializedName("levemax")
|
||||
private String levemax;
|
||||
@SerializedName("thumb")
|
||||
private String thumb;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public NewLevelModel setId(String id) {
|
||||
this.id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLevemin() {
|
||||
return levemin;
|
||||
}
|
||||
|
||||
public int getLeveMin() {
|
||||
return Integer.parseInt(levemin);
|
||||
}
|
||||
|
||||
public int getLeveMax() {
|
||||
return Integer.parseInt(levemax);
|
||||
}
|
||||
|
||||
public NewLevelModel setLevemin(String levemin) {
|
||||
this.levemin = levemin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLevemax() {
|
||||
return levemax;
|
||||
}
|
||||
|
||||
public NewLevelModel setLevemax(String levemax) {
|
||||
this.levemax = levemax;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getThumb() {
|
||||
return thumb;
|
||||
}
|
||||
|
||||
public NewLevelModel setThumb(String thumb) {
|
||||
this.thumb = thumb;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class ImgLoader {
|
||||
}
|
||||
RequestBuilder<Drawable> builder = Glide.with(context)
|
||||
.load(url)
|
||||
|
||||
|
||||
.thumbnail(thumbnail)
|
||||
.dontAnimate()
|
||||
.placeholder(imageView.getDrawable());
|
||||
@@ -87,7 +87,21 @@ public class ImgLoader {
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(url)
|
||||
|
||||
|
||||
.thumbnail(thumbnail)
|
||||
.placeholder(imageView.getDrawable())
|
||||
.dontAnimate()
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
}
|
||||
|
||||
public static void display2(Context context, Drawable drawable, ImageView imageView) {
|
||||
if (!contextIsExist(context)) {
|
||||
return;
|
||||
}
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(drawable)
|
||||
.thumbnail(thumbnail)
|
||||
.placeholder(imageView.getDrawable())
|
||||
.dontAnimate()
|
||||
@@ -142,7 +156,7 @@ public class ImgLoader {
|
||||
RequestBuilder<Drawable> builder = Glide.with(context)
|
||||
.load(url)
|
||||
.thumbnail(thumbnail)
|
||||
|
||||
|
||||
.error(R.mipmap.icon_avatar_placeholder);
|
||||
if (width != -1 && height != -1) {
|
||||
builder = builder.override(width, height);
|
||||
@@ -165,7 +179,7 @@ public class ImgLoader {
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(file)
|
||||
|
||||
|
||||
.thumbnail(thumbnail)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
@@ -178,7 +192,7 @@ public class ImgLoader {
|
||||
Glide.with(context)
|
||||
.asDrawable()
|
||||
.load(res)
|
||||
|
||||
|
||||
.thumbnail(thumbnail)
|
||||
.skipMemoryCache(SKIP_MEMORY_CACHE)
|
||||
.into(imageView);
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.util.Log;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.callback.StringCallback;
|
||||
@@ -18,6 +19,7 @@ import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.event.FollowEvent;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.manager.NewLevelManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
@@ -190,6 +192,10 @@ public class CommonHttpUtil {
|
||||
if (obj.containsKey("is_chat")) {
|
||||
IMLoginManager.get(context).initChat(String.valueOf(obj.getInteger("is_chat")));
|
||||
}
|
||||
if (obj.containsKey("level_new")) {//缓存等级数据
|
||||
JSONArray levelArray = obj.getJSONArray("level_new");
|
||||
new NewLevelManager(context).UpDataLevel(levelArray.toJSONString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
|
||||
ErrorActivity.forward("GetConfig接口返回数据异常", error);
|
||||
|
||||
@@ -7,8 +7,10 @@ import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.cosmos.baseutil.app.AppContext;
|
||||
import com.google.gson.Gson;
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.event.DataUserInfoEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
@@ -25,18 +27,18 @@ import org.greenrobot.eventbus.EventBus;
|
||||
* 登录者信息管理
|
||||
*/
|
||||
public class IMLoginManager extends BaseCacheManager {
|
||||
private final static String KEY_USER_INFO = "keyUserInfo";
|
||||
private final String KEY_USER_INFO = "keyUserInfo";
|
||||
private static IMLoginManager manager;
|
||||
private IMLoginModel userInfo;
|
||||
private final static String isNewUserGif = "isNewUserGif";
|
||||
private final static String isNewUserOne = "isNewUserOne";
|
||||
private final static String GiftEffect = "giftEffect";
|
||||
private final static String MountEffect = "mountEffect";
|
||||
private final static String IS_CHAT = "isChat";
|
||||
private final static String IS_SLIDE = "isSlide";
|
||||
private final static String IS_FLOAT = "is_float";
|
||||
private final static String IS_HINT = "is_hint";
|
||||
private final static String IS_HINT2 = "is_hint2";
|
||||
private final String isNewUserGif = "isNewUserGif";
|
||||
private final String isNewUserOne = "isNewUserOne";
|
||||
private final String GiftEffect = "giftEffect";
|
||||
private final String MountEffect = "mountEffect";
|
||||
private final String IS_CHAT = "isChat";
|
||||
private final String IS_SLIDE = "isSlide";
|
||||
private final String IS_FLOAT = "is_float";
|
||||
private final String IS_HINT = "is_hint";
|
||||
private final String IS_HINT2 = "is_hint2";
|
||||
|
||||
|
||||
public boolean isHint() {
|
||||
@@ -151,7 +153,7 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
*/
|
||||
public static IMLoginManager get(Context context) {
|
||||
if (null == manager) {
|
||||
manager = new IMLoginManager(context);
|
||||
manager = new IMLoginManager(CommonAppContext.sInstance.getBaseContext());
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.yunbao.common.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.bean.NewLevelModel;
|
||||
import com.yunbao.common.manager.base.BaseCacheManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新粉丝牌管理
|
||||
*/
|
||||
public class NewLevelManager extends BaseCacheManager {
|
||||
private final String KEY_USER_LEVEL = "keyUserLevel";
|
||||
private List<NewLevelModel> newLevelModels = new ArrayList<>();
|
||||
|
||||
public NewLevelManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存等级图标
|
||||
*
|
||||
* @param json
|
||||
*/
|
||||
public void UpDataLevel(String json) {
|
||||
newLevelModels = new Gson().fromJson(json, new TypeToken<List<NewLevelModel>>() {
|
||||
}.getType());
|
||||
put(KEY_USER_LEVEL, newLevelModels);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取等级数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<NewLevelModel> getNewLevelModels() {
|
||||
return getList(KEY_USER_LEVEL, new TypeToken<List<NewLevelModel>>() {
|
||||
}.getType());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.yunbao.common.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -69,4 +70,14 @@ public class DeviceUtils {
|
||||
return "0";
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前是否处于低内存状态
|
||||
*/
|
||||
public static boolean isLowMemory(Context context) {
|
||||
ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
||||
ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
|
||||
am.getMemoryInfo(mi);
|
||||
return mi.lowMemory;// 将获取的内存大小规格化
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
public void onViewClicks() {
|
||||
mPlayer.stopPlay();
|
||||
APPEasyFloat.getInstance().dismiss(mContext);
|
||||
if (IMLoginManager.get(mContext).isHint2()) {
|
||||
if (IMLoginManager.get(mContext).isHint2()&& !((FragmentActivity) mContext).getSupportFragmentManager().isDestroyed()) {
|
||||
HintDialog fragment = new HintDialog();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("close", "1");
|
||||
@@ -100,7 +100,7 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
}
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(magnetView, () -> {
|
||||
ViewClicksAntiShake.clicksAntiShake(videoView, () -> {
|
||||
mPlayer.stopPlay();
|
||||
APPEasyFloat.getInstance().dismiss(mContext);
|
||||
new Handler().post(liveCheck);
|
||||
|
||||
@@ -4,15 +4,15 @@ ext {
|
||||
buildToolsVersion: "28.0.3",
|
||||
minSdkVersion : 21,
|
||||
targetSdkVersion : 31,
|
||||
versionCode : 302,
|
||||
versionCode : 305,
|
||||
versionName : "6.4.4"
|
||||
]
|
||||
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",
|
||||
@@ -27,6 +27,6 @@ ext {
|
||||
// true表示谷歌支付 false
|
||||
isGooglePlay : true,
|
||||
//是否上报异常日志
|
||||
isUploadLog : true
|
||||
isUploadLog : false
|
||||
]
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import com.yunbao.common.event.FollowEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.interfaces.KeyBoardHeightChangeListener;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.KeyBoardHeightUtil2;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
@@ -77,7 +78,6 @@ import com.yunbao.live.socket.SocketClient;
|
||||
import com.yunbao.live.socket.SocketMessageListener;
|
||||
import com.yunbao.live.socket.SocketRyChatUtil;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.utils.LiveTextRender;
|
||||
import com.yunbao.live.utils.LoadDian9TuUtil;
|
||||
import com.yunbao.live.utils.UnzipFromAssets;
|
||||
import com.yunbao.live.views.AbsLiveViewHolder;
|
||||
@@ -949,7 +949,7 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
}
|
||||
}
|
||||
int guardType = mLiveGuardInfo != null ? mLiveGuardInfo.getMyGuardType() : Constants.GUARD_TYPE_NONE;
|
||||
SocketRyChatUtil.sendChatMessage(mLiveUid, content, mIsAnchor, mSocketUserType, guardType, atUserID, atUserName);
|
||||
SocketRyChatUtil.sendChatMessage(mLiveUid, content, IMLoginManager.get(mContext).getUserInfo().anchorUserType(), mSocketUserType, guardType, atUserID, atUserName);
|
||||
|
||||
}
|
||||
|
||||
@@ -1522,12 +1522,9 @@ public abstract class LiveActivity extends AbsActivity implements SocketMessageL
|
||||
mLiveContributeViewHolder = null;
|
||||
mLiveMedalRankViewHolder = null;
|
||||
mLiveLuckGiftTipViewHolder = null;
|
||||
// mMobShareUtil = null;
|
||||
mImageUtil = null;
|
||||
SVGAViewUtils.clearSVGA();
|
||||
LiveTextRender.clear();
|
||||
L.e("LiveActivity--------release------>");
|
||||
|
||||
Constants.isSend = "0";
|
||||
}
|
||||
|
||||
|
||||
@@ -657,7 +657,6 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
super.onResume();
|
||||
manager.onResume();
|
||||
GiftCacheUtil.getInstance().restart();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -874,7 +873,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
+ "&stream=" + mStream
|
||||
+ "&uid=" + CommonAppConfig.getInstance().getUid()
|
||||
+ "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
|
||||
LiveHDDialogFragment liveHDDialogFragment = new LiveHDDialogFragment();
|
||||
bundle.putString("url", url);
|
||||
bundle.putInt("show_type", 0);
|
||||
liveHDDialogFragment.setArguments(bundle);
|
||||
|
||||
@@ -333,23 +333,23 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
} else if (bean.getType() == RECOMMEND_CARD_NOTIFY) {
|
||||
//加载.9图聊天气泡
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||
LiveTextRender.recommendCardNotify(mContext, mTextView, bean);
|
||||
new LiveTextRender().recommendCardNotify(mContext, mTextView, bean);
|
||||
} else if (bean.getType() == AI_AUTOMATIC_SPEECH) {
|
||||
//加载.9图聊天气泡
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getAiAutomaticSpeechModel().getSystemBubble(), 1);
|
||||
LiveTextRender.aiAutomaticSpeech(mContext, mTextView, bean.getAiAutomaticSpeechModel());
|
||||
new LiveTextRender().aiAutomaticSpeech(mContext, mTextView, bean.getAiAutomaticSpeechModel());
|
||||
} else if (bean.getType() == STAR_CHALLENGE_UPGRADE_NOTIFY) {
|
||||
//加载.9图聊天气泡
|
||||
if (!TextUtils.isEmpty(bean.getMsgModel().getSystemBubble())) {
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystemBubble(), 1);
|
||||
LiveTextRender.starChallengeUpgradeNotify(mContext, mTextView, bean.getMsgModel());
|
||||
new LiveTextRender().starChallengeUpgradeNotify(mContext, mTextView, bean.getMsgModel());
|
||||
}
|
||||
} else if (bean.getType() == LUCKY_ANGEL) {
|
||||
if (!TextUtils.isEmpty(bean.getMsgModel().getSystem_bubble())) {
|
||||
bean.setId(bean.getMsgModel().getUserId());
|
||||
itemView.setTag(bean);
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getMsgModel().getSystem_bubble(), 1);
|
||||
LiveTextRender.luckyAngel(mContext, mTextView, bean.getMsgModel());
|
||||
new LiveTextRender().luckyAngel(mContext, mTextView, bean.getMsgModel());
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -365,7 +365,7 @@ public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
mTextView.setTextColor(0xffffffff);
|
||||
}
|
||||
|
||||
LiveTextRender.render(mContext, mTextView, bean);
|
||||
new LiveTextRender().render(mContext, mTextView, bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
|
||||
import com.yunbao.live.utils.LiveTextRender;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
@@ -279,7 +280,18 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
new LiveTextRender().getLevelImage(mContext, levelBean.getLevel(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
ImgLoader.display2(mContext, drawable, mLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
if (bean.isHide() && (type.equals("5") || type.equals("4"))) {
|
||||
mName.setText(R.string.mystery_man);
|
||||
@@ -287,7 +299,7 @@ public class UserMoreInfoAdapter extends RefreshAdapter<UserBean> {
|
||||
itemView.findViewById(R.id.state).setVisibility(View.GONE);
|
||||
gift_svga.setVisibility(View.GONE);
|
||||
} else {
|
||||
ImgLoader.display2(mContext, bean.getAvatar(), mAvatar,100,100);
|
||||
ImgLoader.display2(mContext, bean.getAvatar(), mAvatar, 100, 100);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
itemView.findViewById(R.id.state).setVisibility(View.VISIBLE);
|
||||
gift_svga.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -460,10 +460,10 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On
|
||||
mLevelAnchorText.setText(String.valueOf(levelAnchor));
|
||||
mLevelText.setText(String.valueOf(level));
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(obj.getIntValue("sex")));
|
||||
mFollow.setText(LiveTextRender.renderLiveUserDialogData(obj.getLongValue("follows")));
|
||||
mFans.setText(LiveTextRender.renderLiveUserDialogData(obj.getLongValue("fans")));
|
||||
mConsume.setText(LiveTextRender.renderLiveUserDialogData(obj.getLongValue("consumption")));
|
||||
mVotes.setText(LiveTextRender.renderLiveUserDialogData(obj.getLongValue("votestotal")));
|
||||
mFollow.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("follows")));
|
||||
mFans.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("fans")));
|
||||
mConsume.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("consumption")));
|
||||
mVotes.setText(new LiveTextRender().renderLiveUserDialogData(obj.getLongValue("votestotal")));
|
||||
mConsumeTip.setText(WordUtil.getString(R.string.live_user_send) + appConfig.getCoinName());
|
||||
mVotesTip.setText(WordUtil.getString(R.string.live_user_get) + appConfig.getVotesName());
|
||||
if (mType == TYPE_AUD_ANC) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.yunbao.common.http.JsonBean;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.MD5Util;
|
||||
import com.yunbao.common.utils.VersionUtil;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -40,6 +41,7 @@ public class LiveHttpUtil {
|
||||
.params("stream", stream)
|
||||
.params("type", type)
|
||||
.params("p", p)
|
||||
.params("version", "" + VersionUtil.getVersion())
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
|
||||
@@ -431,7 +431,7 @@ public class LiveEnterRoomAnimPresenter {
|
||||
if (u.getVipType() != 0 || liveChatBean.getGuardType() != Constants.GUARD_TYPE_NONE) {
|
||||
needAnim = true;
|
||||
ImgLoader.displayAvatar(mContext, bean.getUserBean().getAvatar(), mAvatar);
|
||||
LiveTextRender.renderEnterRoom(mContext, mName, liveChatBean);
|
||||
new LiveTextRender().renderEnterRoom(mContext, mName, liveChatBean);
|
||||
mBgAnimator1.start();
|
||||
mUserAnimator1.start();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class LiveLinkMicAnchorPresenter implements View.OnClickListener {
|
||||
private String mPkUid;//正在连麦的对方主播的uid
|
||||
private TextView mLinkMicWaitText;
|
||||
private int mLinkMicWaitCount;//连麦弹窗等待倒计时
|
||||
private static final int LINK_MIC_COUNT_MAX = 10;
|
||||
private final int LINK_MIC_COUNT_MAX = 10;
|
||||
private String mLinkMicWaitString;
|
||||
private PopupWindow mLinkMicPopWindow;
|
||||
private Handler mHandler;
|
||||
@@ -326,23 +326,10 @@ public class LiveLinkMicAnchorPresenter implements View.OnClickListener {
|
||||
}
|
||||
if (mLiveSdk == Constants.LIVE_SDK_TX) {
|
||||
mLiveLinkMicPlayViewHolder = new LiveLinkMicPlayTxViewHolder(mContext, mRightContainer);
|
||||
} else {
|
||||
// mLiveLinkMicPlayViewHolder = new LiveLinkMicPlayKsyViewHolder(mContext, mRightContainer);
|
||||
}
|
||||
mLiveLinkMicPlayViewHolder.setOnCloseListener(mIsAnchor ? this : null);
|
||||
mLiveLinkMicPlayViewHolder.addToParent();
|
||||
mLiveLinkMicPlayViewHolder.play(playUrl);
|
||||
// if (mIsAnchor){
|
||||
// try {
|
||||
// int index=playUrl.indexOf("?");
|
||||
// String subUrl= playUrl.substring(0,index);
|
||||
// Log.d("subUrl",playUrl+" "+subUrl);
|
||||
// mLiveLinkMicPlayViewHolder.play(subUrl);
|
||||
// }catch (Exception e){e.printStackTrace();}
|
||||
// }else {
|
||||
// mLiveLinkMicPlayViewHolder.play(playUrl);
|
||||
// }
|
||||
|
||||
if (mIsAnchor) {
|
||||
ToastUtil.show(R.string.link_mic_anchor_accept_2);
|
||||
((LiveAnchorActivity) mContext).setPkBtnVisible(true);
|
||||
|
||||
@@ -29,7 +29,6 @@ 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.CommonHttpUtil;
|
||||
@@ -58,7 +57,6 @@ import com.yunbao.live.interfaces.ILiveLinkMicViewHolder;
|
||||
import com.yunbao.live.interfaces.LivePushListener;
|
||||
import com.yunbao.live.socket.SocketClient;
|
||||
import com.yunbao.live.socket.SocketLinkMicUtil;
|
||||
import com.yunbao.live.utils.CountDownView;
|
||||
import com.yunbao.live.views.AbsLiveLinkMicPlayViewHolder;
|
||||
import com.yunbao.live.views.AbsLiveLinkMicPushViewHolder;
|
||||
import com.yunbao.live.views.LiveLinkMicPlayTxViewHolder;
|
||||
@@ -95,7 +93,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
private boolean mAcceptLinkMic;//是否接受连麦
|
||||
private String mLinkMicWaitString;
|
||||
private int mLinkMicWaitCount;//连麦弹窗等待倒计时
|
||||
private static final int LINK_MIC_COUNT_MAX = 10;
|
||||
private final int LINK_MIC_COUNT_MAX = 10;
|
||||
private PopupWindow mLinkMicPopWindow;
|
||||
private Handler mHandler;
|
||||
private AbsLiveLinkMicPlayViewHolder mLiveLinkMicPlayViewHolder;//连麦播放小窗口
|
||||
@@ -113,14 +111,11 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
private List<BannerBean> mBannerList3 = new ArrayList<>();
|
||||
|
||||
|
||||
public static CountDownView date;
|
||||
|
||||
public static String link = "";
|
||||
String gold, experience;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onUpdata(String str) {
|
||||
if ("stop_svga_new_user_double1".equals(str)) {
|
||||
if ("stop_svga_new_user_double1".equals(str)) {
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("80lzdi");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
CommonHttpUtil.setAdvertisingChannels("80lzdi", new HttpCallback() {
|
||||
@@ -225,7 +220,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public LiveLinkMicPresenter(Context context, ILiveLinkMicViewHolder linkMicViewHolder, boolean isAnchor, int liveSdk, View root) {
|
||||
mContext = context;
|
||||
EventBus.getDefault().register(this);
|
||||
@@ -244,7 +238,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
btnTurnTable.setOnClickListener(this);
|
||||
|
||||
|
||||
|
||||
//周星
|
||||
BannerBean bannerBean = new BannerBean();
|
||||
bannerBean.setImageUrl("https://downs.yaoulive.com/img/BTN_WEEKSTAR%20%281%29.png");
|
||||
@@ -252,8 +245,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
mBannerList1.add(bannerBean);
|
||||
|
||||
|
||||
|
||||
|
||||
btn_onecz_event = root.findViewById(R.id.btn_onecz_event);
|
||||
btn_onecz_event.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -625,7 +616,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取活动
|
||||
private void getEvent() {
|
||||
if (btn_onecz_event != null) {
|
||||
|
||||
@@ -2,7 +2,9 @@ package com.yunbao.live.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -20,16 +22,23 @@ import android.view.View.MeasureSpec;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.target.CustomTarget;
|
||||
import com.bumptech.glide.request.transition.Transition;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.AiAutomaticSpeechModel;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.MsgModel;
|
||||
import com.yunbao.common.bean.NewLevelModel;
|
||||
import com.yunbao.common.custom.VerticalImageSpan;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.manager.NewLevelManager;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
@@ -37,27 +46,36 @@ import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveChatBean;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/11.
|
||||
*/
|
||||
|
||||
public class LiveTextRender {
|
||||
|
||||
private static StyleSpan sBoldSpan;
|
||||
private static StyleSpan sNormalSpan;
|
||||
private static ForegroundColorSpan sWhiteColorSpan;
|
||||
private static ForegroundColorSpan sGlobalColorSpan;
|
||||
private static AbsoluteSizeSpan sFontSizeSpan;
|
||||
private static AbsoluteSizeSpan sFontSizeSpan2;
|
||||
private static AbsoluteSizeSpan sFontSizeSpan3;
|
||||
private static final Map<LiveChatBean, Drawable> mDrawableMedalMap = new HashMap<>();
|
||||
private static final Map<LiveChatBean, Drawable> gzDrawablesMap = new HashMap<>();
|
||||
private static final Map<LiveChatBean, Drawable> ryxzDrawablesMap = new HashMap<>();
|
||||
private static final Map<LiveChatBean, Drawable> nhDrawablesMap = new HashMap<>();
|
||||
private StyleSpan sBoldSpan;
|
||||
private StyleSpan sNormalSpan;
|
||||
private ForegroundColorSpan sWhiteColorSpan;
|
||||
private ForegroundColorSpan sGlobalColorSpan;
|
||||
private AbsoluteSizeSpan sFontSizeSpan;
|
||||
private AbsoluteSizeSpan sFontSizeSpan2;
|
||||
private AbsoluteSizeSpan sFontSizeSpan3;
|
||||
private final Map<LiveChatBean, Drawable> mDrawableMedalMap = new HashMap<>();
|
||||
private final Map<LiveChatBean, Drawable> gzDrawablesMap = new HashMap<>();
|
||||
private final Map<LiveChatBean, Drawable> ryxzDrawablesMap = new HashMap<>();
|
||||
private final Map<LiveChatBean, Drawable> nhDrawablesMap = new HashMap<>();
|
||||
|
||||
static {
|
||||
public LiveTextRender() {
|
||||
sBoldSpan = new StyleSpan(Typeface.BOLD);
|
||||
sNormalSpan = new StyleSpan(Typeface.NORMAL);
|
||||
sWhiteColorSpan = new ForegroundColorSpan(0xffffffff);
|
||||
@@ -73,7 +91,7 @@ public class LiveTextRender {
|
||||
* @param textView
|
||||
* @param bean
|
||||
*/
|
||||
public static void recommendCardNotify(Context context, TextView textView, LiveChatBean bean) {
|
||||
public void recommendCardNotify(Context context, TextView textView, LiveChatBean bean) {
|
||||
String recommend;
|
||||
Drawable drawable;
|
||||
if (TextUtils.equals(bean.getMsgModel().getRecommendCardType(), "1")) {
|
||||
@@ -107,7 +125,7 @@ public class LiveTextRender {
|
||||
* @param textView
|
||||
* @param model
|
||||
*/
|
||||
public static void starChallengeUpgradeNotify(Context activity, TextView textView, MsgModel model) {
|
||||
public void starChallengeUpgradeNotify(Context activity, TextView textView, MsgModel model) {
|
||||
String star = activity.getString(R.string.star);
|
||||
String starString = String.format(activity.getString(R.string.star_success), model.getAncherName(), model.getCompetitionArea(), model.getStar());
|
||||
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
|
||||
@@ -126,7 +144,7 @@ public class LiveTextRender {
|
||||
/**
|
||||
* 幸运天使
|
||||
*/
|
||||
public static void luckyAngel(Context mContext, TextView mTextView, MsgModel msgModel) {
|
||||
public void luckyAngel(Context mContext, TextView mTextView, MsgModel msgModel) {
|
||||
String msg = mContext.getString(R.string.lucky_angel);
|
||||
msg = String.format(msg, msgModel.getUserName(), msgModel.getGiftName());
|
||||
int unameIndexOf = msg.indexOf(msgModel.getUserName());
|
||||
@@ -140,7 +158,7 @@ public class LiveTextRender {
|
||||
mTextView.setText(builder);
|
||||
}
|
||||
|
||||
public static void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) {
|
||||
public void aiAutomaticSpeech(Context activity, TextView textView, AiAutomaticSpeechModel model) {
|
||||
ImgLoader.displayDrawable(activity, model.getIcon(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
@@ -207,13 +225,13 @@ public class LiveTextRender {
|
||||
/**
|
||||
* 生成前缀
|
||||
*/
|
||||
private static SpannableStringBuilder createPrefix(Drawable levelDrawable, LiveChatBean bean) {
|
||||
private SpannableStringBuilder createPrefix(Drawable levelDrawable, LiveChatBean bean) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
int index = 0;
|
||||
|
||||
if (levelDrawable != null) {
|
||||
builder.append(" ");
|
||||
levelDrawable.setBounds(0, 0, DpUtil.dp2px(28), DpUtil.dp2px(14));
|
||||
levelDrawable.setBounds(0, 0, DpUtil.dp2px(32), DpUtil.dp2px(14));
|
||||
builder.setSpan(new VerticalImageSpan(levelDrawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
index += 2;
|
||||
}
|
||||
@@ -263,8 +281,7 @@ public class LiveTextRender {
|
||||
Drawable drawable = getMedalImage(bean);
|
||||
if (drawable != null) {
|
||||
builder.append(" ");
|
||||
drawable.setBounds(0, 0, DpUtil.dp2px(42), DpUtil.dp2px(14));
|
||||
// drawable.setBounds(0, 0, DpUtil.dp2px(50), DpUtil.dp2px(20));//切图为138*38
|
||||
drawable.setBounds(0, 0, DpUtil.dp2px(44), DpUtil.dp2px(17));
|
||||
builder.setSpan(new VerticalImageSpan(drawable), index, index + 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
index += 2;
|
||||
}
|
||||
@@ -296,22 +313,20 @@ public class LiveTextRender {
|
||||
return builder;
|
||||
}
|
||||
|
||||
private static Drawable getMedalImage(final LiveChatBean bean) {
|
||||
private Drawable getMedalImage(final LiveChatBean bean) {
|
||||
View view = LayoutInflater.from(CommonAppContext.sInstance).inflate(R.layout.live_medal_icon, null, false);
|
||||
final ImageView iv = view.findViewById(R.id.ivIcon);
|
||||
if (mDrawableMedalMap.containsKey(bean))
|
||||
iv.setImageDrawable(mDrawableMedalMap.get(bean));
|
||||
TextView tv = view.findViewById(R.id.tvName);
|
||||
tv.setText(bean.getMedalNmae());
|
||||
//字体加粗
|
||||
// tv.setTextSize(TypedValue.COMPLEX_UNIT_SP,13);
|
||||
tv.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
Bitmap bitmap = convertViewToBitmap(view);
|
||||
Drawable drawable = new BitmapDrawable(bitmap);
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public static Bitmap convertViewToBitmap(View view) {
|
||||
public Bitmap convertViewToBitmap(View view) {
|
||||
view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
|
||||
view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredWidth() / 3);
|
||||
// 153 72
|
||||
@@ -321,7 +336,7 @@ public class LiveTextRender {
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static void render(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
public void render(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
ImgLoader.displayDrawable(context, bean.getMedalLevelImageUrl(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
@@ -337,7 +352,7 @@ public class LiveTextRender {
|
||||
}
|
||||
|
||||
|
||||
public static void ryxz(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
public void ryxz(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
ImgLoader.displayDrawable(context, bean.getMedal_honor(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
@@ -352,7 +367,7 @@ public class LiveTextRender {
|
||||
});
|
||||
}
|
||||
|
||||
public static void nh(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
public void nh(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
if (bean.getGood_nub() != null && !bean.getGood_nub().equals("")) {
|
||||
nhDrawablesMap.put(bean, ContextCompat.getDrawable(CommonAppContext.sInstance, R.mipmap.good_nub));
|
||||
renderTMP(context, textView, bean);
|
||||
@@ -361,7 +376,7 @@ public class LiveTextRender {
|
||||
}
|
||||
}
|
||||
|
||||
public static void gz(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
public void gz(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
ImgLoader.displayDrawable(context, TextUtils.isEmpty(bean.getMedal_new()) ? bean.getMedal() : bean.getMedal_new(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
@@ -376,7 +391,71 @@ public class LiveTextRender {
|
||||
});
|
||||
}
|
||||
|
||||
private static void renderTMP(Context context, final TextView textView, final LiveChatBean bean) {
|
||||
private ImgLoader.DrawableCallback mCallback;
|
||||
|
||||
/**
|
||||
* 等级设置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void getLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) {
|
||||
mCallback = callback;
|
||||
List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels();
|
||||
String imgUrl = "https://downs.yaoulive.com/level/user_lv1_bg.png";
|
||||
for (NewLevelModel newLevelModel : models) {
|
||||
if (newLevelModel.getLeveMin() <= userLevel && userLevel <= newLevelModel.getLeveMax()) {
|
||||
imgUrl = newLevelModel.getThumb();
|
||||
}
|
||||
}
|
||||
|
||||
Glide.with(mContext).asBitmap().load(imgUrl).into(new CustomTarget<Bitmap>() {
|
||||
@Override
|
||||
public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition<? super Bitmap> transition) {
|
||||
Observable.create(new ObservableOnSubscribe<Bitmap>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Bitmap> emitter) throws Exception {
|
||||
emitter.onNext(AddTimeWatermark(resource, String.valueOf(userLevel)));
|
||||
}
|
||||
}).subscribeOn(Schedulers.newThread())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<Bitmap>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Bitmap bitmap) {
|
||||
BitmapDrawable drawable = new BitmapDrawable(bitmap);
|
||||
if (callback != null) {
|
||||
callback.onLoadSuccess(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadCleared(@Nullable Drawable placeholder) {
|
||||
if (callback != null) {
|
||||
callback.onLoadFailed();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void renderTMP(Context context, final TextView textView, final LiveChatBean bean) {
|
||||
final LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
|
||||
if (levelBean == null) {
|
||||
@@ -395,10 +474,10 @@ public class LiveTextRender {
|
||||
textView.setText(builder);
|
||||
}
|
||||
} else {
|
||||
ImgLoader.displayDrawable(context, levelBean.getThumb(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
if (textView != null) {
|
||||
if (textView != null) {
|
||||
getLevelImage(context, bean.getLevel(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
SpannableStringBuilder builder = createPrefix(drawable, bean);
|
||||
int color = 0;
|
||||
if (bean.isAnchor()) {
|
||||
@@ -420,17 +499,19 @@ public class LiveTextRender {
|
||||
}
|
||||
textView.setText(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadFailed() {
|
||||
if (textView != null) {
|
||||
@Override
|
||||
public void onLoadFailed() {
|
||||
SpannableStringBuilder builder = createPrefix(null, bean);
|
||||
int color = 0;
|
||||
if (bean.isAnchor()) {
|
||||
color = 0xffffdd00;
|
||||
} else {
|
||||
color = Color.parseColor(levelBean.getColor());
|
||||
try {
|
||||
color = Color.parseColor(levelBean.getColor());
|
||||
} catch (Exception e) {
|
||||
color = Color.parseColor("#ffffff");
|
||||
}
|
||||
}
|
||||
switch (bean.getType()) {
|
||||
case LiveChatBean.GIFT:
|
||||
@@ -442,17 +523,43 @@ public class LiveTextRender {
|
||||
}
|
||||
textView.setText(builder);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bitmap添加文字
|
||||
*
|
||||
* @param mBitmap
|
||||
* @return
|
||||
*/
|
||||
private Bitmap AddTimeWatermark(Bitmap mBitmap, String level) {
|
||||
//获取原始图片与水印图片的宽与高
|
||||
int mBitmapWidth = mBitmap.getWidth();
|
||||
int mBitmapHeight = mBitmap.getHeight();
|
||||
Bitmap mNewBitmap = Bitmap.createBitmap(mBitmapWidth, mBitmapHeight, Bitmap.Config.ARGB_8888);
|
||||
Canvas mCanvas = new Canvas(mNewBitmap);
|
||||
//向位图中开始画入MBitmap原始图片
|
||||
mCanvas.drawBitmap(mBitmap, 0, 0, null);
|
||||
//添加文字
|
||||
Paint mPaint = new Paint();
|
||||
Typeface font = Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD);
|
||||
mPaint.setColor(Color.WHITE);
|
||||
mPaint.setTextSize(50);
|
||||
mPaint.setTypeface(font);
|
||||
//水印的位置坐标
|
||||
mCanvas.drawText(level, 80, 53, mPaint);
|
||||
mCanvas.save();
|
||||
mCanvas.restore();
|
||||
return mNewBitmap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染普通聊天消息
|
||||
*/
|
||||
private static SpannableStringBuilder renderChat(int color, SpannableStringBuilder builder, LiveChatBean bean) {
|
||||
private SpannableStringBuilder renderChat(int color, SpannableStringBuilder builder, LiveChatBean bean) {
|
||||
int length = builder.length();
|
||||
String name = bean.getUserNiceName();
|
||||
if (bean.getType() != LiveChatBean.ENTER_ROOM) {//产品规定,进场消息不允许加冒号
|
||||
@@ -487,7 +594,7 @@ public class LiveTextRender {
|
||||
/**
|
||||
* 渲染送礼物消息
|
||||
*/
|
||||
private static SpannableStringBuilder renderGift(int color, SpannableStringBuilder builder, LiveChatBean bean) {
|
||||
private SpannableStringBuilder renderGift(int color, SpannableStringBuilder builder, LiveChatBean bean) {
|
||||
int length = builder.length();
|
||||
String name = bean.getUserNiceName() + ":";
|
||||
builder.append(name);
|
||||
@@ -503,7 +610,7 @@ public class LiveTextRender {
|
||||
/**
|
||||
* 渲染用户进入房间消息
|
||||
*/
|
||||
public static void renderEnterRoom(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
public void renderEnterRoom(final Context context, final TextView textView, final LiveChatBean bean) {
|
||||
ImgLoader.displayDrawable(context, bean.getMedalLevelImageUrl(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
@@ -519,7 +626,7 @@ public class LiveTextRender {
|
||||
|
||||
}
|
||||
|
||||
private static void renderEnterRoomTMP(Context context, final TextView textView, final LiveChatBean bean) {
|
||||
private void renderEnterRoomTMP(Context context, final TextView textView, final LiveChatBean bean) {
|
||||
final LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean == null) {
|
||||
return;
|
||||
@@ -532,10 +639,6 @@ public class LiveTextRender {
|
||||
int start = builder.length();
|
||||
String name = bean.getUserNiceName() + " ";
|
||||
builder.append(name);
|
||||
//int end = start + name.length();
|
||||
//builder.setSpan(sWhiteColorSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
//builder.setSpan(sFontSizeSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
//builder.setSpan(sBoldSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.append(bean.getContent());
|
||||
textView.setText(builder);
|
||||
}
|
||||
@@ -548,11 +651,6 @@ public class LiveTextRender {
|
||||
int start = builder.length();
|
||||
String name = bean.getUserNiceName() + " ";
|
||||
builder.append(name);
|
||||
// int end = start + name.length();
|
||||
// builder.setSpan(sWhiteColorSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
// builder.setSpan(sFontSizeSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
// builder.setSpan(sBoldSpan, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
// builder.append(bean.getContent());
|
||||
textView.setText(builder);
|
||||
}
|
||||
}
|
||||
@@ -561,7 +659,7 @@ public class LiveTextRender {
|
||||
}
|
||||
|
||||
|
||||
public static SpannableStringBuilder renderGiftInfo2(String giftName) {
|
||||
public SpannableStringBuilder renderGiftInfo2(String giftName) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
String s1 = WordUtil.getString(R.string.live_send_gift_1);
|
||||
String content = s1 + " " + giftName;
|
||||
@@ -571,7 +669,7 @@ public class LiveTextRender {
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static SpannableStringBuilder renderGiftInfo(int giftCount, String giftName) {
|
||||
public SpannableStringBuilder renderGiftInfo(int giftCount, String giftName) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
String s1 = WordUtil.getString(R.string.live_send_gift_1);
|
||||
String s2 = WordUtil.getString(R.string.live_send_gift_2) + giftName;
|
||||
@@ -585,7 +683,7 @@ public class LiveTextRender {
|
||||
}
|
||||
|
||||
|
||||
public static SpannableStringBuilder renderGiftCount(int count) {
|
||||
public SpannableStringBuilder renderGiftCount(int count) {
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
String s = String.valueOf(count);
|
||||
builder.append(s);
|
||||
@@ -606,7 +704,7 @@ public class LiveTextRender {
|
||||
/**
|
||||
* 渲染直播间用户弹窗数据
|
||||
*/
|
||||
public static CharSequence renderLiveUserDialogData(long num) {
|
||||
public CharSequence renderLiveUserDialogData(long num) {
|
||||
if (num < 10000) {
|
||||
return String.valueOf(num);
|
||||
}
|
||||
@@ -622,7 +720,7 @@ public class LiveTextRender {
|
||||
return builder;
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
public void clear() {
|
||||
mDrawableMedalMap.clear();
|
||||
gzDrawablesMap.clear();
|
||||
ryxzDrawablesMap.clear();
|
||||
|
||||
@@ -389,11 +389,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
}
|
||||
};
|
||||
|
||||
public static Handler handler = new Handler();
|
||||
public static Runnable runnable;
|
||||
public Handler handler = new Handler();
|
||||
public Runnable runnable;
|
||||
|
||||
public static Handler handler1 = new Handler();
|
||||
public static Runnable runnable1;
|
||||
public Handler handler1 = new Handler();
|
||||
public Runnable runnable1;
|
||||
|
||||
|
||||
public void removeCallbacks() {
|
||||
|
||||
@@ -83,7 +83,7 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
}
|
||||
if (mGiftCount != null && mGiftCount.getVisibility() != View.VISIBLE) {
|
||||
mGiftCount.setVisibility(View.VISIBLE);
|
||||
mGiftCount.setText(LiveTextRender.renderGiftCount(mLianCount));
|
||||
mGiftCount.setText(new LiveTextRender().renderGiftCount(mLianCount));
|
||||
}
|
||||
if (mGiftCount != null) {
|
||||
mGiftCount.clearAnimation();
|
||||
@@ -152,7 +152,7 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
}
|
||||
if (TextUtils.isEmpty(mLastGiftKey) || !mLastGiftKey.equals(bean.getKey())) {
|
||||
ImgLoader.display(mContext, bean.getGiftIcon(), mGiftIcon);
|
||||
mContent.setText(LiveTextRender.renderGiftInfo2(bean.getGiftName()));
|
||||
mContent.setText(new LiveTextRender().renderGiftInfo2(bean.getGiftName()));
|
||||
if (bean.getGiftCount() > 1) {
|
||||
mGiftGroupCount.setText("x" + bean.getGiftCount());
|
||||
mMulSign.setText(R.string.live_gift_send_lian_3);
|
||||
@@ -174,7 +174,7 @@ public class LiveGiftViewHolder extends AbsViewHolder {
|
||||
mLianCount = bean.getLianCount();
|
||||
}
|
||||
if (mGiftCount != null && mGiftCount.getVisibility() == View.VISIBLE) {
|
||||
mGiftCount.setText(LiveTextRender.renderGiftCount(mLianCount));
|
||||
mGiftCount.setText(new LiveTextRender().renderGiftCount(mLianCount));
|
||||
}
|
||||
mLastGiftKey = bean.getKey();
|
||||
if (lian && mGiftCount != null && mAnimation != null) {
|
||||
|
||||
@@ -96,12 +96,9 @@ public class LuckLiveGiftViewHolder extends AbsViewHolder {
|
||||
if (mBg != null) {
|
||||
mBg.setTranslationX(-mDp214);
|
||||
}
|
||||
// if (mStar != null && mStar.getVisibility() == View.VISIBLE) {
|
||||
// mStar.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
if (mGiftCount != null && mGiftCount.getVisibility() != View.VISIBLE) {
|
||||
mGiftCount.setVisibility(View.VISIBLE);
|
||||
mGiftCount.setText(LiveTextRender.renderGiftCount(mLianCount));
|
||||
mGiftCount.setText(new LiveTextRender().renderGiftCount(mLianCount));
|
||||
}
|
||||
if (mGiftCount != null) {
|
||||
mGiftCount.clearAnimation();
|
||||
@@ -204,7 +201,7 @@ public class LuckLiveGiftViewHolder extends AbsViewHolder {
|
||||
}
|
||||
if (TextUtils.isEmpty(mLastGiftKey) || !mLastGiftKey.equals(bean.getKey())) {
|
||||
ImgLoader.display(mContext, bean.getGiftIcon(), mGiftIcon);
|
||||
mContent.setText(LiveTextRender.renderGiftInfo2(bean.getGiftName()));
|
||||
mContent.setText(new LiveTextRender().renderGiftInfo2(bean.getGiftName()));
|
||||
if (bean.getGiftCount() > 1) {
|
||||
mGiftGroupCount.setText("x" + bean.getGiftCount());
|
||||
mMulSign.setText(R.string.live_gift_send_lian_3);
|
||||
@@ -226,7 +223,7 @@ public class LuckLiveGiftViewHolder extends AbsViewHolder {
|
||||
mLianCount = bean.getLianCount();
|
||||
}
|
||||
if (mGiftCount != null && mGiftCount.getVisibility() == View.VISIBLE) {
|
||||
mGiftCount.setText(LiveTextRender.renderGiftCount(mLianCount));
|
||||
mGiftCount.setText(new LiveTextRender().renderGiftCount(mLianCount));
|
||||
}
|
||||
mLastGiftKey = bean.getKey();
|
||||
if (lian && mGiftCount != null && mAnimation != null) {
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
android:layout_marginBottom="1dp"/>
|
||||
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/vpWrapList"
|
||||
@@ -139,7 +139,7 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<RadioGroup
|
||||
@@ -160,7 +160,7 @@
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="66dp"
|
||||
android:layout_height="55dp"
|
||||
android:layout_weight="0"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp">
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:mfl_ratio="1.1"
|
||||
app:mfl_ratio="1"
|
||||
android:background="@drawable/bg_live_gift_items"
|
||||
>
|
||||
|
||||
|
||||
@@ -120,12 +120,13 @@
|
||||
<ImageView
|
||||
android:id="@+id/sex"
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="15dp" />
|
||||
android:layout_height="18dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/level"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="18dp"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginLeft="5dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -2,22 +2,22 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivIcon"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvName"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="主播"
|
||||
android:layout_gravity="center"
|
||||
android:paddingLeft="13dp"
|
||||
android:text="主播"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="10sp"
|
||||
/>
|
||||
android:textSize="10sp" />
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
@@ -948,13 +948,13 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
if (curTime - mLastClickBackTime > 2000) {
|
||||
mLastClickBackTime = curTime;
|
||||
ToastUtil.show(R.string.main_click_next_exit);
|
||||
APPEasyFloat.getInstance().dismiss(mContext);
|
||||
//判断是否有直播悬浮窗,有直接关闭
|
||||
if (EasyFloat.isShow("LiveFloatView")) {
|
||||
EasyFloat.dismiss("LiveFloatView", true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
APPEasyFloat.getInstance().dismiss(mContext);
|
||||
//判断是否有直播悬浮窗,有直接关闭
|
||||
if (EasyFloat.isShow("LiveFloatView")) {
|
||||
EasyFloat.dismiss("LiveFloatView", true);
|
||||
}
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="right">
|
||||
|
||||
@@ -109,7 +110,6 @@
|
||||
android:id="@+id/v_table_redpoint"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:background="@drawable/background_ff5075"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
|
||||
Reference in New Issue
Block a user