From 511c2cdbe0569ddd40688eecf0b856d25e916429 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Jul 2026 16:49:28 +0100 Subject: [PATCH] fix(BreadActivity): remove dead bottom-nav/toolbar cruft causing startup NPE The "Techdebt/improve shop" refactor (d0886db0) deleted initializeViews(), which was the only place binding bottomNav, menuBut, drawerLayout, primaryPrice, and secondaryPrice via findViewById. The refactor left onCreate/setListeners still dereferencing those never-assigned fields, so BreadActivity crashed with a guaranteed NullPointerException on BottomNavigationView.setOnNavigationItemSelectedListener on every launch. These views were already non-functional before the crash: the bottom nav's menu was only ever wired up via a design-time-only tools:menu attribute (never inflated at runtime), and primaryPrice/secondaryPrice had no code left to populate their text. Rather than resurrect dead legacy UI, remove it outright: drop the associated fields, listeners, and R.id.bottomNav/menuBut/drawerLayout/primary_price/secondary_price views plus the now-unreferenced R.menu.bottom_nav_menu resource, and fix the layout refs that pointed at the removed views. Co-Authored-By: Claude Sonnet 5 --- .../presenter/activities/BreadActivity.java | 37 ------------- app/src/main/res/layout/activity_bread.xml | 54 +------------------ app/src/main/res/menu/bottom_nav_menu.xml | 22 -------- 3 files changed, 2 insertions(+), 111 deletions(-) delete mode 100644 app/src/main/res/menu/bottom_nav_menu.xml diff --git a/app/src/main/java/com/brainwallet/presenter/activities/BreadActivity.java b/app/src/main/java/com/brainwallet/presenter/activities/BreadActivity.java index 29c94850..ae947471 100644 --- a/app/src/main/java/com/brainwallet/presenter/activities/BreadActivity.java +++ b/app/src/main/java/com/brainwallet/presenter/activities/BreadActivity.java @@ -14,8 +14,6 @@ import android.os.Handler; import android.view.ViewTreeObserver; import android.view.animation.AnimationUtils; -import android.widget.Button; -import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import android.widget.ViewFlipper; @@ -27,7 +25,6 @@ import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.ConstraintSet; import androidx.core.app.ActivityCompat; -import androidx.drawerlayout.widget.DrawerLayout; import androidx.transition.ChangeBounds; import androidx.transition.Fade; import androidx.transition.TransitionManager; @@ -40,7 +37,6 @@ import com.brainwallet.presenter.activities.util.BRActivity; import com.brainwallet.presenter.customviews.BRNotificationBar; import com.brainwallet.presenter.history.HistoryFragment; -import com.brainwallet.tools.animation.BRAnimator; import com.brainwallet.tools.animation.TextSizeTransition; import com.brainwallet.tools.manager.AnalyticsManager; import com.brainwallet.tools.manager.BRSharedPrefs; @@ -63,7 +59,6 @@ import com.brainwallet.wallet.BRPeerManager; import com.brainwallet.wallet.BRWalletManager; import com.google.android.gms.tasks.Task; -import com.google.android.material.bottomnavigation.BottomNavigationView; import com.google.android.material.navigation.NavigationView; import com.google.android.play.core.review.ReviewInfo; import com.google.android.play.core.review.ReviewManager; @@ -77,15 +72,9 @@ public class BreadActivity extends BRActivity implements BRWalletManager.OnBalan TransactionDataSource.OnTxAddedListener, InternetManager.ConnectionReceiverListener { public static final Point screenParametersPoint = new Point(); - private static final float PRIMARY_TEXT_SIZE = 24f; - private static final float SECONDARY_TEXT_SIZE = 12.8f; - private int mSelectedBottomNavItem = -1; private InternetManager mConnectionReceiver; - private Button primaryPrice; - private Button secondaryPrice; private TextView equals; - private ImageButton menuBut; private TextView balanceTxtV; public static boolean appVisible = false; @@ -94,11 +83,9 @@ public class BreadActivity extends BRActivity implements BRWalletManager.OnBalan private boolean uiIsDone; private static BreadActivity app; - private BottomNavigationView bottomNav; private Handler mHandler = new Handler(); private NavigationView navigationDrawer; - private DrawerLayout drawerLayout; private HomeSettingDrawerComposeView homeSettingDrawerComposeView; public static BreadActivity getApp() { @@ -115,12 +102,7 @@ protected void onCreate(Bundle savedInstanceState) { app = this; getWindowManager().getDefaultDisplay().getSize(screenParametersPoint); - setListeners(); - - primaryPrice.setTextSize(PRIMARY_TEXT_SIZE); - secondaryPrice.setTextSize(SECONDARY_TEXT_SIZE); onConnectionChanged(InternetManager.getInstance().isConnected(this)); - bottomNav.setSelectedItemId(R.id.nav_history); } private void addObservers() { @@ -147,25 +129,6 @@ protected void onNewIntent(Intent intent) { setUrlHandler(intent); } - private void setListeners() { - bottomNav.setOnNavigationItemSelectedListener(item -> handleNavigationItemSelected(item.getItemId())); - - menuBut.setOnClickListener(v -> { - if (BRAnimator.isClickAllowed()) { - drawerLayout.open(); - } - }); - } - - public boolean handleNavigationItemSelected(int menuItemId) { - if (mSelectedBottomNavItem == menuItemId) return true; - mSelectedBottomNavItem = menuItemId; - //TODO: Removal as Compose Send workflow is live and in Production - // Will remove as cruft as a backlog item - - return true; - } - @Override protected void onRestart() { super.onRestart(); diff --git a/app/src/main/res/layout/activity_bread.xml b/app/src/main/res/layout/activity_bread.xml index 1a22edc4..282801de 100644 --- a/app/src/main/res/layout/activity_bread.xml +++ b/app/src/main/res/layout/activity_bread.xml @@ -2,7 +2,6 @@ @@ -71,23 +70,9 @@ android:text="@string/ManageWallet.balance" android:textColor="@color/white" android:textSize="18sp" - app:layout_constraintBottom_toTopOf="@+id/primary_price" + app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintVertical_bias="0.0" /> - -