set title when fragment is changed
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 31 Dec 2018 19:20:21 +0000 (19:20 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 31 Dec 2018 19:20:21 +0000 (19:20 +0000)
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index 5aa6ace2adb5d3abbca451002ed48336b786bb49..64f613827dc730e2e6f9efe654dabddb58bb1a85 100644 (file)
@@ -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);