diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-06-13 14:15:16 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-06-13 14:15:16 +0300 |
commit | e63eb19ce41f367895db4f5da4c811303d0153b4 (patch) | |
tree | fcb1f95aa91bdac10262a2a22d08f8fa14ba1339 | |
parent | be0260950bdfc3e95267ddacf154aa6923e3e7a2 (diff) |
Adjust icon style to master
7 files changed, 71 insertions, 93 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java index 7b955de2..7caa120a 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java @@ -7,7 +7,6 @@ import android.content.Intent; import android.database.sqlite.SQLiteException; import android.graphics.Color; import android.graphics.PorterDuff; -import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; @@ -137,8 +136,6 @@ public class NotesListViewActivity extends LockedActivity implements NoteClickLi protected ItemAdapter adapter; - private Menu currentMenu; - protected NotesDatabase db = null; private NavigationAdapter adapterCategories; private NavigationItem itemRecent; @@ -397,6 +394,23 @@ public class NotesListViewActivity extends LockedActivity implements NoteClickLi } startActivityForResult(createIntent, create_note_cmd); }); + + activityBinding.sortingMethod.setOnClickListener((v) -> { + final String unexpectedSortMethod = "Unexpected sort method"; + CategorySortingMethod method; + + Log.d("onOptionsItemSelected", navigationSelection.category + localAccount.getId()); + method = db.getCategoryOrder(localAccount.getId(), navigationSelection); + + if (method == CategorySortingMethod.SORT_LEXICOGRAPHICAL_ASC) { + method = CategorySortingMethod.SORT_MODIFIED_DESC; + } else { + method = CategorySortingMethod.SORT_LEXICOGRAPHICAL_ASC; + } + db.modifyCategoryOrder(localAccount.getId(), navigationSelection, method); + refreshLists(); + updateSortMethodIcon(); + }); } private void setupNavigationList(final String selectedItem) { @@ -690,69 +704,17 @@ public class NotesListViewActivity extends LockedActivity implements NoteClickLi * Updates sorting method icon. */ private void updateSortMethodIcon() { - if (localAccount == null || currentMenu == null) { + if (localAccount == null) { return; } - MenuItem sortMethod = currentMenu.findItem(R.id.sorting_method); CategorySortingMethod method = db.getCategoryOrder(localAccount.getId(), navigationSelection); if (method == CategorySortingMethod.SORT_LEXICOGRAPHICAL_ASC) { - sortMethod.setIcon(R.drawable.alphabetical_asc); - } else { - sortMethod.setIcon(R.drawable.modification_desc); - } - } - - /** - * Responses to two sorting method icons on the menu. - * @param item The touched item. - * @return boolean - */ - @Override - public boolean onOptionsItemSelected(MenuItem item) { - final String unexpectedSortMethod = "Unexpected sort method"; - CategorySortingMethod method; - - if (item.getItemId() == R.id.sorting_method) { - Log.d("onOptionsItemSelected", navigationSelection.category + localAccount.getId()); - method = db.getCategoryOrder(localAccount.getId(), navigationSelection); - - if (method == CategorySortingMethod.SORT_LEXICOGRAPHICAL_ASC) { - method = CategorySortingMethod.SORT_MODIFIED_DESC; - } else { - method = CategorySortingMethod.SORT_LEXICOGRAPHICAL_ASC; - } - db.modifyCategoryOrder(localAccount.getId(), navigationSelection, method); - refreshLists(); - return true; + activityBinding.sortingMethod.setImageResource(R.drawable.alphabetical_asc); } else { - return super.onOptionsItemSelected(item); + activityBinding.sortingMethod.setImageResource(R.drawable.modification_desc); } } - /** - * Gets menu object. - * @param menu Menu. - * @return boolean - */ - @Override - public boolean onPrepareOptionsMenu(Menu menu) { - currentMenu = menu; - updateSortMethodIcon(); - return super.onPrepareOptionsMenu(menu); - } - - /** - * Adds the Menu Items to the Action Bar. - * - * @param menu Menu - * @return boolean - */ - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.menu_list_view, menu); - return true; - } - @Override protected void onNewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/AbstractNotesDatabase.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/AbstractNotesDatabase.java index 66635dd6..c97f4368 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/AbstractNotesDatabase.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/AbstractNotesDatabase.java @@ -14,6 +14,7 @@ import it.niedermann.owncloud.notes.persistence.migration.Migration_13_14; import it.niedermann.owncloud.notes.persistence.migration.Migration_14_15; import it.niedermann.owncloud.notes.persistence.migration.Migration_15_16; import it.niedermann.owncloud.notes.persistence.migration.Migration_16_17; +import it.niedermann.owncloud.notes.persistence.migration.Migration_17_18; import it.niedermann.owncloud.notes.persistence.migration.Migration_4_5; import it.niedermann.owncloud.notes.persistence.migration.Migration_5_6; import it.niedermann.owncloud.notes.persistence.migration.Migration_6_7; @@ -60,7 +61,6 @@ abstract class AbstractNotesDatabase extends SQLiteOpenHelper { protected static final String key_theme_mode = "THEME_MODE"; protected static final String key_mode = "MODE"; protected static final String key_scroll_y = "SCROLL_Y"; - protected static final String key_category_sorting_method = "CATEGORY_SORTING_METHOD"; protected AbstractNotesDatabase(@NonNull Context context, @Nullable String name, @Nullable SQLiteDatabase.CursorFactory factory) { @@ -189,10 +189,8 @@ abstract class AbstractNotesDatabase extends SQLiteOpenHelper { new Migration_15_16(db, context, this::notifyWidgets); case 16: new Migration_16_17(db); - case 17: { - // add a new column to store the sorting method for a category note list - db.execSQL("ALTER TABLE " + table_category + " ADD COLUMN " + key_category_sorting_method + " INTEGER DEFAULT 0"); - } + case 17: + new Migration_17_18(db); } } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_17_18.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_17_18.java new file mode 100644 index 00000000..6faa9016 --- /dev/null +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/migration/Migration_17_18.java @@ -0,0 +1,14 @@ +package it.niedermann.owncloud.notes.persistence.migration; + +import android.database.sqlite.SQLiteDatabase; + +import androidx.annotation.NonNull; + +public class Migration_17_18 { + /** + * Add a new column to store the sorting method for a category note list + */ + public Migration_17_18(@NonNull SQLiteDatabase db) { + db.execSQL("ALTER TABLE CATEGORIES ADD COLUMN CATEGORY_SORTING_METHOD INTEGER DEFAULT 0"); + } +} diff --git a/app/src/main/res/drawable/alphabetical_asc.xml b/app/src/main/res/drawable/alphabetical_asc.xml index d400979a..15fd9575 100644 --- a/app/src/main/res/drawable/alphabetical_asc.xml +++ b/app/src/main/res/drawable/alphabetical_asc.xml @@ -6,6 +6,6 @@ android:viewportHeight="26"> <path - android:fillColor="#ffffff" + android:fillColor="#757575" android:pathData="M20.401,13.623L18.877,13.621L18.868,20.218L17.228,18.57L16.145,19.651L19.627,23.145L23.12,19.663L22.039,18.58L20.392,20.219L20.401,13.623ZM15.034,12.122L15.034,13.376L10.691,19.609L10.691,19.684L15.1,19.684L15.1,21.481L7.847,21.481L7.847,20.302L12.292,13.967L12.292,13.91L8.268,13.91L8.268,12.122L15.034,12.122ZM13.051,1.85L15.981,11.208L13.678,11.208L12.949,8.68L10.244,8.68L9.571,11.208L7.352,11.208L10.244,1.85L13.051,1.85ZM12.64,7.165L12.05,5.182L11.807,4.273L11.573,3.374L11.545,3.374L11.339,4.283L11.114,5.2L10.553,7.165L12.64,7.165Z" /> </vector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/modification_desc.xml b/app/src/main/res/drawable/modification_desc.xml index bcad189b..acd49aba 100644 --- a/app/src/main/res/drawable/modification_desc.xml +++ b/app/src/main/res/drawable/modification_desc.xml @@ -6,6 +6,6 @@ android:viewportHeight="26"> <path - android:fillColor="#ffffff" + android:fillColor="#757575" android:pathData="M23.563,22.69L14.635,22.69L14.635,20.838L23.563,20.838L23.563,22.69ZM11.59,2.133C16.177,2.138 20.131,5.479 20.902,10L18.979,10C18.232,6.53 15.139,4.029 11.59,4.025C7.44,4.026 4.026,7.44 4.025,11.59C4.025,15.74 7.44,19.156 11.59,19.156C12.068,19.155 12.546,19.109 13.016,19.018L13.016,20.922C12.544,21 12.068,21.043 11.59,21.049C6.36,21.049 2.133,16.791 2.133,11.59C2.133,6.402 6.402,2.133 11.59,2.133ZM20.587,18.06L14.635,18.06L14.635,16.208L20.587,16.208L20.587,18.06ZM12.062,6.863L12.062,11.826L13.016,12.393L13.016,13.957L10.645,12.535L10.645,6.863L12.062,6.863ZM17.611,13.429L14.635,13.429L14.635,11.577L17.611,11.577L17.611,13.429Z" /> </vector>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_notes_list_view.xml b/app/src/main/res/layout/activity_notes_list_view.xml index 47aa0186..63233d8f 100644 --- a/app/src/main/res/layout/activity_notes_list_view.xml +++ b/app/src/main/res/layout/activity_notes_list_view.xml @@ -101,30 +101,44 @@ android:layout_height="match_parent" tools:context="it.niedermann.owncloud.notes.android.activity.NotesListViewActivity"> - <FrameLayout + <LinearLayout android:layout_width="match_parent" - android:layout_height="match_parent"> - - <include - android:id="@+id/empty_content_view" - layout="@layout/empty_content_view" /> + android:layout_height="match_parent" + android:orientation="vertical"> - <ProgressBar - android:id="@+id/progress_circular" + <androidx.appcompat.widget.AppCompatImageView + android:id="@+id/sorting_method" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="center" - android:indeterminateTint="@color/defaultBrand" - tools:targetApi="lollipop" - tools:visibility="gone" /> + android:contentDescription="@string/action_sorting_method" + android:padding="@dimen/spacer_1hx" + app:srcCompat="@drawable/alphabetical_asc" /> - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recycler_view" + <FrameLayout android:layout_width="match_parent" - android:layout_height="wrap_content" - android:scrollbars="vertical" - tools:listitem="@layout/item_notes_list_note_item_with_excerpt" /> - </FrameLayout> + android:layout_height="match_parent"> + + <include + android:id="@+id/empty_content_view" + layout="@layout/empty_content_view" /> + + <ProgressBar + android:id="@+id/progress_circular" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:indeterminateTint="@color/defaultBrand" + tools:targetApi="lollipop" + tools:visibility="gone" /> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_view" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:scrollbars="vertical" + tools:listitem="@layout/item_notes_list_note_item_with_excerpt" /> + </FrameLayout> + </LinearLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </LinearLayout> diff --git a/app/src/main/res/menu/menu_list_view.xml b/app/src/main/res/menu/menu_list_view.xml deleted file mode 100644 index e5d8f8dc..00000000 --- a/app/src/main/res/menu/menu_list_view.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto"> - - <item - android:id="@+id/sorting_method" - android:icon="@drawable/alphabetical_asc" - android:title="@string/action_sorting_method" - app:showAsAction="collapseActionView|always" /> -</menu>
\ No newline at end of file |