Loading app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java +6 −1 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V @NonNull private Category navigationSelection = new Category(null, null); private String navigationOpen = ""; boolean canMoveNoteToAnotherAccounts = false; private ActionMode mActionMode; private final ISyncCallback syncCallBack = () -> { adapter.clearSelection(listView); Loading Loading @@ -197,6 +198,8 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V setupNavigationList(categoryAdapterSelectedItem); setupNavigationMenu(); setupNotesList(); new Thread(() -> canMoveNoteToAnotherAccounts = db.getAccountsCount() > 1).start(); } @Override Loading Loading @@ -774,6 +777,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V if (resultCode == RESULT_FIRST_USER) { selectAccount(null); } new Thread(() -> canMoveNoteToAnotherAccounts = db.getAccountsCount() > 1).start(); break; } default: { Loading @@ -786,6 +790,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V Log.i(TAG, "Refreshing capabilities for " + ssoAccount.name); final Capabilities capabilities = CapabilitiesClient.getCapabilities(getApplicationContext(), ssoAccount, null); db.addAccount(ssoAccount.url, ssoAccount.userId, ssoAccount.name, capabilities); new Thread(() -> canMoveNoteToAnotherAccounts = db.getAccountsCount() > 1).start(); Log.i(TAG, capabilities.toString()); runOnUiThread(() -> selectAccount(ssoAccount.name)); } catch (SQLiteException e) { Loading Loading @@ -880,7 +885,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V if (selected) { v.setSelected(true); mActionMode = startSupportActionMode(new MultiSelectedActionModeCallback( this, this, db, localAccount.getId(), adapter, listView, this::refreshLists, getSupportFragmentManager(), activityBinding.searchView this, this, db, localAccount.getId(), canMoveNoteToAnotherAccounts, adapter, listView, this::refreshLists, getSupportFragmentManager(), activityBinding.searchView )); int checkedItemCount = adapter.getSelected().size(); mActionMode.setTitle(getResources().getQuantityString(R.plurals.ab_selected, checkedItemCount, checkedItemCount)); Loading app/src/main/java/it/niedermann/owncloud/notes/main/MultiSelectedActionModeCallback.java +4 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ public class MultiSelectedActionModeCallback implements Callback { private final ViewProvider viewProvider; private final NotesDatabase db; private final long currentLocalAccountId; private final boolean canMoveNoteToAnotherAccounts; private final ItemAdapter adapter; private final RecyclerView recyclerView; private final Runnable refreshLists; Loading @@ -50,11 +51,12 @@ public class MultiSelectedActionModeCallback implements Callback { private final SearchView searchView; public MultiSelectedActionModeCallback( Context context, ViewProvider viewProvider, NotesDatabase db, long currentLocalAccountId, ItemAdapter adapter, RecyclerView recyclerView, Runnable refreshLists, FragmentManager fragmentManager, SearchView searchView) { Context context, ViewProvider viewProvider, NotesDatabase db, long currentLocalAccountId, boolean canMoveNoteToAnotherAccounts, ItemAdapter adapter, RecyclerView recyclerView, Runnable refreshLists, FragmentManager fragmentManager, SearchView searchView) { this.context = context; this.viewProvider = viewProvider; this.db = db; this.currentLocalAccountId = currentLocalAccountId; this.canMoveNoteToAnotherAccounts = canMoveNoteToAnotherAccounts; this.adapter = adapter; this.recyclerView = recyclerView; this.refreshLists = refreshLists; Loading @@ -70,6 +72,7 @@ public class MultiSelectedActionModeCallback implements Callback { public boolean onCreateActionMode(ActionMode mode, Menu menu) { // inflate contextual menu mode.getMenuInflater().inflate(R.menu.menu_list_context_multiple, menu); menu.findItem(R.id.menu_move).setVisible(canMoveNoteToAnotherAccounts); for (int i = 0; i < menu.size(); i++) { Drawable drawable = menu.getItem(i).getIcon(); if (drawable != null) { Loading app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java +0 −4 Original line number Diff line number Diff line Loading @@ -722,10 +722,6 @@ public class NotesDatabase extends AbstractNotesDatabase { }).start(); } public boolean hasAccounts() { return DatabaseUtils.queryNumEntries(getReadableDatabase(), table_accounts) > 0; } public long getAccountsCount() { return DatabaseUtils.queryNumEntries(getReadableDatabase(), table_accounts); } Loading Loading
app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java +6 −1 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V @NonNull private Category navigationSelection = new Category(null, null); private String navigationOpen = ""; boolean canMoveNoteToAnotherAccounts = false; private ActionMode mActionMode; private final ISyncCallback syncCallBack = () -> { adapter.clearSelection(listView); Loading Loading @@ -197,6 +198,8 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V setupNavigationList(categoryAdapterSelectedItem); setupNavigationMenu(); setupNotesList(); new Thread(() -> canMoveNoteToAnotherAccounts = db.getAccountsCount() > 1).start(); } @Override Loading Loading @@ -774,6 +777,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V if (resultCode == RESULT_FIRST_USER) { selectAccount(null); } new Thread(() -> canMoveNoteToAnotherAccounts = db.getAccountsCount() > 1).start(); break; } default: { Loading @@ -786,6 +790,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V Log.i(TAG, "Refreshing capabilities for " + ssoAccount.name); final Capabilities capabilities = CapabilitiesClient.getCapabilities(getApplicationContext(), ssoAccount, null); db.addAccount(ssoAccount.url, ssoAccount.userId, ssoAccount.name, capabilities); new Thread(() -> canMoveNoteToAnotherAccounts = db.getAccountsCount() > 1).start(); Log.i(TAG, capabilities.toString()); runOnUiThread(() -> selectAccount(ssoAccount.name)); } catch (SQLiteException e) { Loading Loading @@ -880,7 +885,7 @@ public class MainActivity extends LockedActivity implements NoteClickListener, V if (selected) { v.setSelected(true); mActionMode = startSupportActionMode(new MultiSelectedActionModeCallback( this, this, db, localAccount.getId(), adapter, listView, this::refreshLists, getSupportFragmentManager(), activityBinding.searchView this, this, db, localAccount.getId(), canMoveNoteToAnotherAccounts, adapter, listView, this::refreshLists, getSupportFragmentManager(), activityBinding.searchView )); int checkedItemCount = adapter.getSelected().size(); mActionMode.setTitle(getResources().getQuantityString(R.plurals.ab_selected, checkedItemCount, checkedItemCount)); Loading
app/src/main/java/it/niedermann/owncloud/notes/main/MultiSelectedActionModeCallback.java +4 −1 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ public class MultiSelectedActionModeCallback implements Callback { private final ViewProvider viewProvider; private final NotesDatabase db; private final long currentLocalAccountId; private final boolean canMoveNoteToAnotherAccounts; private final ItemAdapter adapter; private final RecyclerView recyclerView; private final Runnable refreshLists; Loading @@ -50,11 +51,12 @@ public class MultiSelectedActionModeCallback implements Callback { private final SearchView searchView; public MultiSelectedActionModeCallback( Context context, ViewProvider viewProvider, NotesDatabase db, long currentLocalAccountId, ItemAdapter adapter, RecyclerView recyclerView, Runnable refreshLists, FragmentManager fragmentManager, SearchView searchView) { Context context, ViewProvider viewProvider, NotesDatabase db, long currentLocalAccountId, boolean canMoveNoteToAnotherAccounts, ItemAdapter adapter, RecyclerView recyclerView, Runnable refreshLists, FragmentManager fragmentManager, SearchView searchView) { this.context = context; this.viewProvider = viewProvider; this.db = db; this.currentLocalAccountId = currentLocalAccountId; this.canMoveNoteToAnotherAccounts = canMoveNoteToAnotherAccounts; this.adapter = adapter; this.recyclerView = recyclerView; this.refreshLists = refreshLists; Loading @@ -70,6 +72,7 @@ public class MultiSelectedActionModeCallback implements Callback { public boolean onCreateActionMode(ActionMode mode, Menu menu) { // inflate contextual menu mode.getMenuInflater().inflate(R.menu.menu_list_context_multiple, menu); menu.findItem(R.id.menu_move).setVisible(canMoveNoteToAnotherAccounts); for (int i = 0; i < menu.size(); i++) { Drawable drawable = menu.getItem(i).getIcon(); if (drawable != null) { Loading
app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesDatabase.java +0 −4 Original line number Diff line number Diff line Loading @@ -722,10 +722,6 @@ public class NotesDatabase extends AbstractNotesDatabase { }).start(); } public boolean hasAccounts() { return DatabaseUtils.queryNumEntries(getReadableDatabase(), table_accounts) > 0; } public long getAccountsCount() { return DatabaseUtils.queryNumEntries(getReadableDatabase(), table_accounts); } Loading