import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Bundle;
+import android.support.annotation.ColorInt;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
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;
onAccountSummaryClicked(null);
}
-
- @Override
- protected void onStart() {
- super.onStart();
- LinearLayout grp = drawer.findViewById(R.id.nav_actions);
- for (int i = 0; i < grp.getChildCount(); i++) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- grp.getChildAt(i).setBackgroundColor(
- getResources().getColor(R.color.drawer_background, getTheme()));
- }
- else {
- grp.getChildAt(i)
- .setBackgroundColor(getResources().getColor(R.color.drawer_background));
- }
- }
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- drawer.findViewById(R.id.nav_account_summary).setBackgroundColor(
- getResources().getColor(R.color.table_row_even_bg, getTheme()));
- }
- else {
- drawer.findViewById(R.id.nav_account_summary)
- .setBackgroundColor(getResources().getColor(R.color.table_row_even_bg));
- }
- }
-
public void fab_new_transaction_clicked(View view) {
Intent intent = new Intent(this, NewTransactionActivity.class);
startActivity(intent);
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()));
}
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);
for (int i = 0; i < actions.getChildCount(); i++) {
View view = actions.getChildAt(i);
if (view.getId() != id) {
- view.setBackgroundColor(getResources().getColor(android.R.color.transparent));
+ view.setBackgroundColor(transparent);
}
}
}