Commit 274e47f9 authored by Leonardo Aramaki's avatar Leonardo Aramaki

Add nullity checks

parent 8d985b42
...@@ -340,28 +340,30 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -340,28 +340,30 @@ public class RoomFragment extends AbstractChatRoomFragment implements
SlidingPaneLayout subPane = getActivity().findViewById(R.id.sub_sliding_pane); SlidingPaneLayout subPane = getActivity().findViewById(R.id.sub_sliding_pane);
sidebarFragment = (SidebarMainFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.sidebar_fragment_container); sidebarFragment = (SidebarMainFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.sidebar_fragment_container);
pane.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() { if (pane != null) {
@Override pane.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() {
public void onPanelSlide(View view, float v) { @Override
messageFormManager.enableComposingText(false); public void onPanelSlide(View view, float v) {
sidebarFragment.clearSearchViewFocus(); messageFormManager.enableComposingText(false);
//Ref: ActionBarDrawerToggle#setProgress sidebarFragment.clearSearchViewFocus();
toolbar.setNavigationIconProgress(v); //Ref: ActionBarDrawerToggle#setProgress
} toolbar.setNavigationIconProgress(v);
}
@Override @Override
public void onPanelOpened(View view) { public void onPanelOpened(View view) {
toolbar.setNavigationIconVerticalMirror(true); toolbar.setNavigationIconVerticalMirror(true);
} }
@Override @Override
public void onPanelClosed(View view) { public void onPanelClosed(View view) {
messageFormManager.enableComposingText(true); messageFormManager.enableComposingText(true);
toolbar.setNavigationIconVerticalMirror(false); toolbar.setNavigationIconVerticalMirror(false);
subPane.closePane(); subPane.closePane();
closeUserActionContainer(); closeUserActionContainer();
} }
}); });
}
} }
public void closeUserActionContainer() { public void closeUserActionContainer() {
...@@ -657,12 +659,16 @@ public class RoomFragment extends AbstractChatRoomFragment implements ...@@ -657,12 +659,16 @@ public class RoomFragment extends AbstractChatRoomFragment implements
} }
private void showRoomListFragment(int actionId) { private void showRoomListFragment(int actionId) {
Intent intent = new Intent(getActivity(), RoomActivity.class).putExtra("actionId", actionId) //TODO: oddly sometimes getActivity() yields null. Investigate the situations this might happen
.putExtra("roomId", roomId) //and fix it, removing this null-check
.putExtra("roomType", roomType) if (getActivity() != null) {
.putExtra("hostname", hostname) Intent intent = new Intent(getActivity(), RoomActivity.class).putExtra("actionId", actionId)
.putExtra("token", token) .putExtra("roomId", roomId)
.putExtra("userId", userId); .putExtra("roomType", roomType)
startActivity(intent); .putExtra("hostname", hostname)
.putExtra("token", token)
.putExtra("userId", userId);
startActivity(intent);
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment