修复用户名片渲染用户等级时所使用的Activity被销毁导致的闪退问题
This commit is contained in:
parent
80fe5271f6
commit
b82c87d5d6
@ -1,5 +1,6 @@
|
|||||||
package com.yunbao.live.utils;
|
package com.yunbao.live.utils;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@ -424,6 +425,11 @@ public class LiveTextRender {
|
|||||||
*/
|
*/
|
||||||
public void getLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) {
|
public void getLevelImage(Context mContext, int userLevel, ImgLoader.DrawableCallback callback) {
|
||||||
mCallback = callback;
|
mCallback = callback;
|
||||||
|
if(mContext instanceof Activity){
|
||||||
|
if(((Activity)mContext).isDestroyed()){
|
||||||
|
mContext=CommonAppContext.getTopActivity();
|
||||||
|
}
|
||||||
|
}
|
||||||
List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels();
|
List<NewLevelModel> models = new NewLevelManager(mContext).getNewLevelModels();
|
||||||
String imgUrl = "https://downs.yaoulive.com/level/user_lv1_bg.png";
|
String imgUrl = "https://downs.yaoulive.com/level/user_lv1_bg.png";
|
||||||
for (NewLevelModel newLevelModel : models) {
|
for (NewLevelModel newLevelModel : models) {
|
||||||
|
Loading…
Reference in New Issue
Block a user