修复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);

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,8 +729,10 @@ 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);
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]);
NoviceInstructorManager.get(mContext).getNetNoviceInstructor(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,7 +118,7 @@ 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")) {
home_zdy_img_us = obj.getString("home_zdy_img_us");

View File

@ -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")) {