fix:修复首页ViewPager.setCurrentItem(int)为null导致的闪退问题
This commit is contained in:
parent
092b2ac519
commit
5317f6d88f
@ -85,7 +85,7 @@ public class IMRTCManager {
|
|||||||
callback.onFailed(RTCErrorCode.RongRTCCodeJoinRepeatedRoom);
|
callback.onFailed(RTCErrorCode.RongRTCCodeJoinRepeatedRoom);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (rtcRoom != null) {
|
if (rtcRoom != null && rtcRoom.getLocalUser() != null) {
|
||||||
/*
|
/*
|
||||||
inviteeRoomId - 被邀请者所在房间 id
|
inviteeRoomId - 被邀请者所在房间 id
|
||||||
inviteeUserId - 被邀请用户 id
|
inviteeUserId - 被邀请用户 id
|
||||||
@ -100,7 +100,7 @@ public class IMRTCManager {
|
|||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
callback.onSuccess();
|
callback.onSuccess();
|
||||||
if(!RandomPkManager.getInstance().isRandomModel()) {
|
if (!RandomPkManager.getInstance().isRandomModel()) {
|
||||||
ToastUtil.show("发起邀请成功");
|
ToastUtil.show("发起邀请成功");
|
||||||
}
|
}
|
||||||
requestUid.add(liveUid);
|
requestUid.add(liveUid);
|
||||||
@ -109,7 +109,7 @@ public class IMRTCManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(RTCErrorCode errorCode) {
|
public void onFailed(RTCErrorCode errorCode) {
|
||||||
if(!RandomPkManager.getInstance().isRandomModel()) {
|
if (!RandomPkManager.getInstance().isRandomModel()) {
|
||||||
ToastUtil.show("邀请失败 " + errorCode.getValue());
|
ToastUtil.show("邀请失败 " + errorCode.getValue());
|
||||||
}
|
}
|
||||||
if (RandomPkManager.getInstance().isRequestPk()) {
|
if (RandomPkManager.getInstance().isRequestPk()) {
|
||||||
@ -130,7 +130,7 @@ public class IMRTCManager {
|
|||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
public void registerRoomListener(IRCRTCRoomEventsListener listener) {
|
public void registerRoomListener(IRCRTCRoomEventsListener listener) {
|
||||||
if (rtcRoom != null) {
|
if (rtcRoom != null && rtcRoom.getLocalUser() != null) {
|
||||||
rtcRoom.registerRoomListener(new IRCRTCRoomEventsListener() {
|
rtcRoom.registerRoomListener(new IRCRTCRoomEventsListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRemoteUserPublishResource(RCRTCRemoteUser remoteUser, List<RCRTCInputStream> streams) {
|
public void onRemoteUserPublishResource(RCRTCRemoteUser remoteUser, List<RCRTCInputStream> streams) {
|
||||||
@ -188,7 +188,7 @@ public class IMRTCManager {
|
|||||||
* @param callback 回调
|
* @param callback 回调
|
||||||
*/
|
*/
|
||||||
public void cancelRequestJoinOtherRoom(String liveUid, String extra, IRCRTCResultCallback callback) {
|
public void cancelRequestJoinOtherRoom(String liveUid, String extra, IRCRTCResultCallback callback) {
|
||||||
if (rtcRoom != null) {
|
if (rtcRoom != null && rtcRoom.getLocalUser() != null) {
|
||||||
rtcRoom.getLocalUser().cancelRequestJoinOtherRoom(liveUid, liveUid, extra, new IRCRTCResultCallback() {
|
rtcRoom.getLocalUser().cancelRequestJoinOtherRoom(liveUid, liveUid, extra, new IRCRTCResultCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
|
@ -10,9 +10,9 @@ ext {
|
|||||||
manifestPlaceholders = [
|
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",
|
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",
|
||||||
|
@ -135,7 +135,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
|
|||||||
mRandomPkSwitch.setOnClickListener(this);
|
mRandomPkSwitch.setOnClickListener(this);
|
||||||
mPkBtn.setOnClickListener(this);
|
mPkBtn.setOnClickListener(this);
|
||||||
mPkBtn.setTag(false);
|
mPkBtn.setTag(false);
|
||||||
/* mPkBtn.setOnLongClickListener(v -> {
|
mPkBtn.setOnLongClickListener(v -> {
|
||||||
DialogUitl.showSimpleInputDialog(mContext, "输入指定UID", new DialogUitl.SimpleCallback() {
|
DialogUitl.showSimpleInputDialog(mContext, "输入指定UID", new DialogUitl.SimpleCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onConfirmClick(Dialog dialog, String content) {
|
public void onConfirmClick(Dialog dialog, String content) {
|
||||||
@ -145,7 +145,7 @@ public class RandomPkDialogFragment extends AbsDialogFragment implements View.On
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});*/
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initData() {
|
private void initData() {
|
||||||
|
@ -259,8 +259,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
});
|
});
|
||||||
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("2")) {
|
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("2")) {
|
||||||
//跳转消息列表
|
//跳转消息列表
|
||||||
|
if (mViewPager != null) {
|
||||||
mViewPager.setCurrentItem(2);
|
mViewPager.setCurrentItem(2);
|
||||||
mTabButtonGroup.setCurPosition(2);
|
mTabButtonGroup.setCurPosition(2);
|
||||||
|
}
|
||||||
|
|
||||||
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("8")) {
|
} else if (getIntent().getStringExtra("type") != null && getIntent().getStringExtra("type").equals("8")) {
|
||||||
WebViewActivity.forward(mContext, getIntent().getStringExtra("activityUrl"), true);
|
WebViewActivity.forward(mContext, getIntent().getStringExtra("activityUrl"), true);
|
||||||
@ -381,8 +383,10 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
mUrlCsd = configBean.getCustomerServerUrl();
|
mUrlCsd = configBean.getCustomerServerUrl();
|
||||||
init();
|
init();
|
||||||
initTXIM();
|
initTXIM();
|
||||||
|
if (mViewPager != null) {
|
||||||
mViewPager.setCurrentItem(0);
|
mViewPager.setCurrentItem(0);
|
||||||
mTabButtonGroup.setCurPosition(0);
|
mTabButtonGroup.setCurPosition(0);
|
||||||
|
}
|
||||||
isInstructor();
|
isInstructor();
|
||||||
|
|
||||||
RongConfigCenter.notificationConfig().setInterceptor(new NotificationConfig.Interceptor() {
|
RongConfigCenter.notificationConfig().setInterceptor(new NotificationConfig.Interceptor() {
|
||||||
@ -1160,7 +1164,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
finish();
|
finish();
|
||||||
} else if (event.getPage() == 17) {
|
} else if (event.getPage() == 17) {
|
||||||
showStartDialog();
|
showStartDialog();
|
||||||
} else {
|
} else if (mViewPager != null) {
|
||||||
mViewPager.setCurrentItem(event.getPage());
|
mViewPager.setCurrentItem(event.getPage());
|
||||||
mTabButtonGroup.setCurPosition(event.getPage());
|
mTabButtonGroup.setCurPosition(event.getPage());
|
||||||
if (event.getPage() == 0) {
|
if (event.getPage() == 0) {
|
||||||
@ -1229,10 +1233,12 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onInstructorOperationEvent(InstructorOperationEvent event) {
|
public void onInstructorOperationEvent(InstructorOperationEvent event) {
|
||||||
//跳转消息列表
|
//跳转消息列表
|
||||||
|
if (mViewPager != null) {
|
||||||
mViewPager.setCurrentItem(2);
|
mViewPager.setCurrentItem(2);
|
||||||
mTabButtonGroup.setCurPosition(2);
|
mTabButtonGroup.setCurPosition(2);
|
||||||
mainMessageViewHolder.setHomeZdyPop(NoviceInstructorManager.get(this).getHomeZdyPop());
|
mainMessageViewHolder.setHomeZdyPop(NoviceInstructorManager.get(this).getHomeZdyPop());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新人面向指导员的引导
|
* 新人面向指导员的引导
|
||||||
@ -1262,9 +1268,11 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
//跳转消息列表
|
//跳转消息列表
|
||||||
|
if (mViewPager != null) {
|
||||||
mViewPager.setCurrentItem(2);
|
mViewPager.setCurrentItem(2);
|
||||||
mTabButtonGroup.setCurPosition(2);
|
mTabButtonGroup.setCurPosition(2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) floatBanner.getLayoutParams();
|
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) floatBanner.getLayoutParams();
|
||||||
|
Loading…
Reference in New Issue
Block a user