update App Bar labels

This commit is contained in:
korelstar 2018-03-11 09:44:11 +01:00 committed by Niedermann IT-Dienstleistungen
parent e0fa2a848a
commit d82af245db
3 changed files with 14 additions and 12 deletions

View file

@ -45,13 +45,14 @@
<activity
android:name="it.niedermann.owncloud.notes.android.activity.SettingsActivity"
android:label="@string/app_name"
android:label="@string/settings_server_settings"
android:parentActivityName="it.niedermann.owncloud.notes.android.activity.PreferencesActivity"
android:windowSoftInputMode="stateVisible"
/>
<activity
android:name="it.niedermann.owncloud.notes.android.activity.PreferencesActivity"
android:label="@string/app_name"
android:label="@string/action_settings"
android:parentActivityName="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity"
android:windowSoftInputMode="stateHidden"
/>

View file

@ -68,7 +68,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
private ActionBarDrawerToggle drawerToggle;
private ItemAdapter adapter = null;
private NavigationAdapter adapterCategories;
private NavigationAdapter.NavigationItem itemRecent, itemStarred, itemUncategorized;
private NavigationAdapter.NavigationItem itemRecent, itemFavorites, itemUncategorized;
private Category navigationSelection = new Category(null, null);
private String navigationOpen = "";
private ActionMode mActionMode;
@ -190,8 +190,8 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
}
private void setupNavigationList(final String selectedItem) {
itemRecent = new NavigationAdapter.NavigationItem(ADAPTER_KEY_RECENT, getString(R.string.action_recent), null, R.drawable.ic_clock_grey600_24dp);
itemStarred = new NavigationAdapter.NavigationItem(ADAPTER_KEY_STARRED, getString(R.string.action_starred), null, R.drawable.ic_star_grey600_24dp);
itemRecent = new NavigationAdapter.NavigationItem(ADAPTER_KEY_RECENT, getString(R.string.label_all_notes), null, R.drawable.ic_clock_grey600_24dp);
itemFavorites = new NavigationAdapter.NavigationItem(ADAPTER_KEY_STARRED, getString(R.string.label_favorites), null, R.drawable.ic_star_grey600_24dp);
adapterCategories = new NavigationAdapter(new NavigationAdapter.ClickListener() {
@Override
public void onItemClick(NavigationAdapter.NavigationItem item) {
@ -204,7 +204,7 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
// update current selection
if(itemRecent == item) {
navigationSelection = new Category(null, null);
} else if(itemStarred == item) {
} else if(itemFavorites == item) {
navigationSelection = new Category(null, true);
} else if(itemUncategorized == item) {
navigationSelection = new Category("", null);
@ -261,12 +261,12 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
Map<String, Integer> favorites = db.getFavoritesCount();
int numFavorites = favorites.containsKey("1") ? favorites.get("1") : 0;
int numNonFavorites = favorites.containsKey("0") ? favorites.get("0") : 0;
itemStarred.count = numFavorites;
itemFavorites.count = numFavorites;
itemRecent.count = numFavorites + numNonFavorites;
ArrayList<NavigationAdapter.NavigationItem> items = new ArrayList<>();
items.add(itemRecent);
items.add(itemStarred);
items.add(itemFavorites);
NavigationAdapter.NavigationItem lastPrimaryCategory = null, lastSecondaryCategory = null;
for (NavigationAdapter.NavigationItem item : categories) {
int slashIndex = item.label.indexOf('/');
@ -460,11 +460,11 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap
subtitle = NoteUtil.extendCategory(navigationSelection.category);
}
} else if(navigationSelection.favorite!=null && navigationSelection.favorite) {
subtitle = getString(R.string.action_starred);
subtitle = getString(R.string.label_favorites);
} else {
subtitle = getString(R.string.action_recent);
subtitle = getString(R.string.app_name);
}
getSupportActionBar().setSubtitle(subtitle);
setTitle(subtitle);
CharSequence query = null;
if(searchView != null && !searchView.isIconified() && searchView.getQuery().length() != 0) {
query = searchView.getQuery();

View file

@ -3,6 +3,8 @@
<string name="app_name">Notes</string>
<string name="no_notes">No notes yet</string>
<string name="label_all_notes">All notes</string>
<string name="label_favorites">Favorites</string>
<string name="action_create">New note</string>
<string name="action_settings">Settings</string>
<string name="action_search">Search</string>
@ -21,7 +23,6 @@
<string name="action_drawer_open">open navigation</string>
<string name="action_drawer_close">close navigation</string>
<string name="action_recent">Recent</string>
<string name="action_starred">Starred</string>
<string name="action_uncategorized">Uncategorized</string>
<string name="menu_delete">Delete</string>
<string name="menu_copy">Copy</string>