From bd8dd1b3d4cd6265bde05827e68f2a2bf2841fa0 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Mon, 31 Dec 2018 19:20:21 +0000 Subject: [PATCH] set title when fragment is changed --- .../java/net/ktnx/mobileledger/ui/activity/MainActivity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index 5aa6ace2..64f61382 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -35,6 +35,7 @@ import android.view.ContextMenu; import android.view.MenuItem; import android.view.View; import android.widget.LinearLayout; +import android.widget.TextView; import net.ktnx.mobileledger.R; import net.ktnx.mobileledger.model.LedgerAccount; @@ -93,7 +94,7 @@ public class MainActivity extends AppCompatActivity { startActivity(intent); } public void markDrawerItemCurrent(int id) { - View item = drawer.findViewById(id); + TextView item = drawer.findViewById(id); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { item.setBackgroundColor(getResources().getColor(R.color.table_row_even_bg, getTheme())); } @@ -101,6 +102,8 @@ public class MainActivity extends AppCompatActivity { item.setBackgroundColor(getResources().getColor(R.color.table_row_even_bg)); } + setTitle(item.getText()); + @ColorInt int transparent = getResources().getColor(android.R.color.transparent); LinearLayout actions = drawer.findViewById(R.id.nav_actions); -- 2.39.5