import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
import android.content.res.ColorStateList;
-import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.Icon;
import android.os.AsyncTask;
barDrawerToggle = null;
if (mViewPager != null) mViewPager.removeOnPageChangeListener(pageChangeListener);
pageChangeListener = null;
- if (mProfileListAdapter != null) mProfileListAdapter.deleteEditingProfilesObserver(editingProfilesObserver);
+ if (mProfileListAdapter != null)
+ mProfileListAdapter.deleteEditingProfilesObserver(editingProfilesObserver);
editingProfilesObserver = null;
super.onDestroy();
}
}
if (barDrawerToggle == null) {
- barDrawerToggle = new ActionBarDrawerToggle(this, drawer, mToolbar, R.string.navigation_drawer_open,
- R.string.navigation_drawer_close);
+ barDrawerToggle = new ActionBarDrawerToggle(this, drawer, mToolbar,
+ R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(barDrawerToggle);
}
barDrawerToggle.syncState();
markDrawerItemCurrent(R.id.nav_latest_transactions);
break;
default:
- Log.e("MainActivity", String.format("Unexpected page index %d", position));
+ Log.e("MainActivity",
+ String.format("Unexpected page index %d", position));
}
super.onPageSelected(position);
drawer.addDrawerListener(drawerListener);
}
+ findViewById(R.id.nav_profile_list_head_layout)
+ .setOnClickListener(this::navProfilesHeadClicked);
+ findViewById(R.id.nav_profiles_label).setOnClickListener(this::navProfilesHeadClicked);
setupProfile();
onProfileChanged(null);
}
}
private void createShortcuts() {
- Resources rm = getResources();
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return;
+
List<ShortcutInfo> shortcuts = new ArrayList<>();
try (LockHolder lh = Data.profiles.lockForReading()) {
for (int i = 0; i < Data.profiles.size(); i++) {
.setIcon(Icon.createWithResource(this, R.drawable.svg_thick_plus_white))
.setIntent(new Intent(Intent.ACTION_VIEW, null, this,
NewTransactionActivity.class).putExtra("profile_uuid", p.getUuid()))
- .setRank(i)
- .build();
+ .setRank(i).build();
shortcuts.add(si);
}
}