fix rare NPE

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/27/head
androidacy-user 2 years ago
parent 1a45f984fe
commit 289d7a84d6

@ -64,7 +64,6 @@ import timber.log.Timber;
public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRefreshListener, SearchView.OnQueryTextListener, SearchView.OnCloseListener, OverScrollManager.OverScrollHelper {
private static final int PRECISION = 10000;
private static MainActivity INSTANCE;
public static boolean doSetupNowRunning = true;
public static boolean doSetupRestarting = false;
public static List<LocalModuleInfo> localModuleInfoList = new ArrayList<>();
@ -491,8 +490,12 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
if (MainApplication.isBlurEnabled()) {
// set bottom navigation bar color to transparent blur
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
bottomNavigationView.setBackgroundColor(Color.TRANSPARENT);
bottomNavigationView.setAlpha(0.8F);
if (bottomNavigationView != null) {
bottomNavigationView.setBackgroundColor(Color.TRANSPARENT);
bottomNavigationView.setAlpha(0.8F);
} else {
Timber.w("Bottom navigation view not found");
}
// set dialogs to have transparent blur
getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}

@ -32,6 +32,7 @@ import org.matomo.sdk.extra.TrackHelper;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Objects;
import timber.log.Timber;
@ -77,7 +78,7 @@ public class MarkdownActivity extends FoxActivity {
this.forceBackPressed();
return;
}
String url = intent.getExtras().getString(Constants.EXTRA_MARKDOWN_URL);
String url = Objects.requireNonNull(intent.getExtras()).getString(Constants.EXTRA_MARKDOWN_URL);
String title = intent.getExtras().getString(Constants.EXTRA_MARKDOWN_TITLE);
String config = intent.getExtras().getString(Constants.EXTRA_MARKDOWN_CONFIG);
boolean change_boot = intent.getExtras().getBoolean(Constants.EXTRA_MARKDOWN_CHANGE_BOOT);
@ -152,8 +153,12 @@ public class MarkdownActivity extends FoxActivity {
if (MainApplication.isBlurEnabled()) {
// set bottom navigation bar color to transparent blur
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
bottomNavigationView.setBackgroundColor(Color.TRANSPARENT);
bottomNavigationView.setAlpha(0.8F);
if (bottomNavigationView != null) {
bottomNavigationView.setBackgroundColor(Color.TRANSPARENT);
bottomNavigationView.setAlpha(0.8F);
} else {
Timber.w("Bottom navigation view not found");
}
// set dialogs to have transparent blur
getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}

Loading…
Cancel
Save