修复firebase反馈的空指针问题

This commit is contained in:
zlzw 2022-10-28 13:50:34 +08:00
parent 07ae094bed
commit b394a8f9b5
7 changed files with 33 additions and 15 deletions

View File

@ -287,6 +287,9 @@ public class AppContext extends CommonAppContext {
public boolean isMainProcess() {
int pid = android.os.Process.myPid();
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
if (activityManager.getRunningAppProcesses() == null) {
return true;
}
for (ActivityManager.RunningAppProcessInfo appProcess : activityManager.getRunningAppProcesses()) {
if (appProcess.pid == pid) {
return getApplicationInfo().packageName.equals(appProcess.processName);
@ -338,8 +341,8 @@ public class AppContext extends CommonAppContext {
FirebaseApp.initializeApp(this);
}
private void setFirebaseCrashData(){
private void setFirebaseCrashData() {
if (!CommonAppConfig.IS_UPLOAD_ERROR_LOG) {
return;
}

View File

@ -131,7 +131,7 @@ public class ImgLoader {
}
public static void displayAvatar(Context context, String url, ImageView imageView, int width, int height) {
if (!contextIsExist(context)) {
if (!contextIsExist(context) || imageView == null) {
return;
}

View File

@ -147,7 +147,7 @@ public class StringUtil {
return sStringBuilder.toString();
}
public static boolean isEmpty(String bgColor) {
return bgColor == null || "".equals(bgColor.trim()) || bgColor.trim().length() == 0;
public static boolean isEmpty(String str) {
return str == null || "".equals(str.trim()) || str.trim().length() == 0;
}
}

View File

@ -508,6 +508,9 @@ public class PortraitLiveManager implements LivePlayListener, SocketMessageListe
DialogUitl.showSimpleDialog(mContext, null, "連麥中,退出將斷開語音連麥!", false, new DialogUitl.SimpleCallback3() {
@Override
public void onConfirmClick(Dialog dialog) {
if (RCRTCEngine.getInstance().getRoom() == null || RCRTCEngine.getInstance().getRoom().getLocalUser() == null) {
return;
}
ToastUtil.show("下麥中,稍等.....");
RCRTCEngine.getInstance().getRoom().getLocalUser().switchToAudience(new IRCRTCSwitchRoleCallback() {

View File

@ -202,6 +202,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
@Override
public void callback(ConfigBean bean) {
if(bean==null){
return;
}
//是否需要老用户回归弹窗
if (TextUtils.equals(bean.getIsReturnUser(), "1")) {
new Handler().postDelayed(new Runnable() {
@ -726,7 +729,9 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
bundle.putString("send_exp", obj.getString("send_exp"));
bundle.putString("sign_day", obj.getString("sign_day"));
fragment.setArguments(bundle);
fragment.show(getSupportFragmentManager(), "SigninDialog");
if(!getSupportFragmentManager().isStateSaved()) {
fragment.show(getSupportFragmentManager(), "SigninDialog");
}
}
if (obj != null && obj.containsKey("msg_zdy_send") && obj.containsKey("msg_zdy_send_text")) {
Log.e("MainActivity333", info[0]);

View File

@ -23,6 +23,7 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.http.HttpClient;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.NoviceInstructorManager;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.activity.LiveAudienceActivity;
@ -117,9 +118,9 @@ public class OneLoginDialog extends AbsDialogFragment {
@Override
public void onSuccess(int code, String msg, String[] info) {
dismiss();
if (info[0] != null) {
if (info.length > 0 && !StringUtil.isEmpty(info[0])) {
JSONObject obj = JSON.parseObject(info[0]);
if(obj.containsKey("home_zdy_img_us")) {
if (obj.containsKey("home_zdy_img_us")) {
home_zdy_img_us = obj.getString("home_zdy_img_us");
home_zdy_img_cn = obj.getString("home_zdy_img_cn");
}

View File

@ -106,7 +106,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
mRefreshView.showRefreshBar();
mRefreshView.mRecyclerView.scrollToPosition(0);
}
}else if ("blacklist".equals(str)) {
} else if ("blacklist".equals(str)) {
if (mRefreshView != null) {
mRefreshView.showRefreshBar();
}
@ -199,8 +199,14 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
JSONObject obj = JSON.parseObject(info[0]);
if (select == 0) {
mBannerList = JSON.parseArray(obj.getString("slide"), BannerBean.class);
if (!obj.containsKey("list")) {
return new_data;
}
List<LiveBean> old_data = JSON.parseArray(obj.getString("list"), LiveBean.class);
LiveBean liveModel = null;
if (old_data == null) {
return new_data;
}
for (LiveBean model : old_data) {
//判断周星榜数据
if (TextUtils.equals(model.getIs_week(), "1")) {
@ -322,7 +328,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
return;
}
intoIndex = 1;
if (gotoRoomKey!=null&&gotoRoomKey.isEmpty()) {
if (gotoRoomKey != null && gotoRoomKey.isEmpty()) {
gotoRoomKey = null;
}
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", gotoRoomKey, 0, liveSdk);
@ -363,8 +369,8 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
ToastUtil.show("暫無法簽到,請稍後再試");
return;
} else {
if(gotoRoomKey==null){
gotoRoomKey=new HashMap<>();
if (gotoRoomKey == null) {
gotoRoomKey = new HashMap<>();
}
gotoRoomKey.put("OPEN", "NEWUSER");
}
@ -386,7 +392,7 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
/**
* Banner双击可能会导致进入两次直播间点击Banner后需要展示加载中动画
*/
private void showLoadingDialog(){
private void showLoadingDialog() {
mShowLoadingDialog = DialogUitl.loadingDialog(mContext);
mShowLoadingDialog.show();
}
@ -469,9 +475,9 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
@Override
public void onPause() {
super.onPause();
if(mShowLoadingDialog !=null){
if (mShowLoadingDialog != null) {
mShowLoadingDialog.dismiss();
mShowLoadingDialog =null;
mShowLoadingDialog = null;
}
}
}