aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-10-24 20:54:20 +0200
committerChristian Schneppe <christian@pix-art.de>2018-10-24 20:54:20 +0200
commit71720104f5ebcf2ff1d7d31bf8dee5e038175817 (patch)
treee1343a6a3f8a2c82c238e62ee81521a8a1b0822d
parenta62b9226d312e95c6653e4487fc3b7bb3034ba94 (diff)
code cleanup, null check not necessary when using instance of
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationsActivity.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
index 932ab452b..787942b8d 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationsActivity.java
@@ -280,7 +280,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
return;
}
final Fragment fragment = getFragmentManager().findFragmentById(R.id.main_fragment);
- if (fragment != null && fragment instanceof ConversationsOverviewFragment) {
+ if (fragment instanceof ConversationsOverviewFragment) {
+
if (ExceptionHelper.checkForCrash(this)) {
return;
}
@@ -335,14 +336,14 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
private void notifyFragmentOfBackendConnected(@IdRes int id) {
final Fragment fragment = getFragmentManager().findFragmentById(id);
- if (fragment != null && fragment instanceof OnBackendConnected) {
+ if (fragment instanceof OnBackendConnected) {
((OnBackendConnected) fragment).onBackendConnected();
}
}
private void refreshFragment(@IdRes int id) {
final Fragment fragment = getFragmentManager().findFragmentById(id);
- if (fragment != null && fragment instanceof XmppFragment) {
+ if (fragment instanceof XmppFragment) {
((XmppFragment) fragment).refresh();
}
}
@@ -530,7 +531,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
if (conversationFragment == null) {
mainNeedsRefresh = false;
Fragment mainFragment = getFragmentManager().findFragmentById(R.id.main_fragment);
- if (mainFragment != null && mainFragment instanceof ConversationFragment) {
+ if (mainFragment instanceof ConversationFragment) {
conversationFragment = (ConversationFragment) mainFragment;
} else {
conversationFragment = new ConversationFragment();
@@ -686,7 +687,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
return;
}
} else {
- if (secondaryFragment != null && secondaryFragment instanceof ConversationFragment) {
+ if (secondaryFragment instanceof ConversationFragment) {
Log.d(Config.LOGTAG, "lost secondary fragment. moving...");
transaction.remove(secondaryFragment);
transaction.commit();
@@ -712,7 +713,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
final ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
Fragment mainFragment = getFragmentManager().findFragmentById(R.id.main_fragment);
- if (mainFragment != null && mainFragment instanceof ConversationFragment) {
+ if (mainFragment instanceof ConversationFragment) {
final Conversation conversation = ((ConversationFragment) mainFragment).getConversation();
if (conversation != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
@@ -895,7 +896,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
return;
}
Fragment mainFragment = getFragmentManager().findFragmentById(R.id.main_fragment);
- if (mainFragment != null && mainFragment instanceof ConversationFragment) {
+ if (mainFragment instanceof ConversationFragment) {
try {
getFragmentManager().popBackStack();
} catch (IllegalStateException e) {
@@ -905,7 +906,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
return;
}
Fragment secondaryFragment = getFragmentManager().findFragmentById(R.id.secondary_fragment);
- if (secondaryFragment != null && secondaryFragment instanceof ConversationFragment) {
+ if (secondaryFragment instanceof ConversationFragment) {
if (((ConversationFragment) secondaryFragment).getConversation() == conversation) {
Conversation suggestion = ConversationsOverviewFragment.getSuggestion(this, conversation);
if (suggestion != null) {
@@ -918,7 +919,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
@Override
public void onConversationsListItemUpdated() {
Fragment fragment = getFragmentManager().findFragmentById(R.id.main_fragment);
- if (fragment != null && fragment instanceof ConversationsOverviewFragment) {
+ if (fragment instanceof ConversationsOverviewFragment) {
((ConversationsOverviewFragment) fragment).refresh();
}
}