diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4f6c9738..f281f628 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -47,6 +47,17 @@ android:value=".android.activity.NotesListViewActivity" /> + + + + + + + + + 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 c2b355fa..04bfa159 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 @@ -97,8 +97,8 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter */ private boolean notAuthorizedAccountHandled = false; - private SingleSignOnAccount ssoAccount; - private LocalAccount localAccount; + protected SingleSignOnAccount ssoAccount; + protected LocalAccount localAccount; protected DrawerLayoutBinding binding; @@ -109,6 +109,7 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter protected ItemAdapter adapter = null; + protected NotesDatabase db = null; private ActionBarDrawerToggle drawerToggle; private NavigationAdapter adapterCategories; private NavigationItem itemRecent; @@ -117,7 +118,6 @@ public class NotesListViewActivity extends LockedActivity implements ItemAdapter private Category navigationSelection = new Category(null, null); private String navigationOpen = ""; private ActionMode mActionMode; - private NotesDatabase db = null; private SearchView searchView = null; private final ISyncCallback syncCallBack = () -> { adapter.clearSelection(listView); diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SelectNoteActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SelectNoteActivity.java new file mode 100644 index 00000000..6c28834e --- /dev/null +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SelectNoteActivity.java @@ -0,0 +1,47 @@ +package it.niedermann.owncloud.notes.android.activity; + +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.Toast; + +import it.niedermann.owncloud.notes.R; +import it.niedermann.owncloud.notes.model.DBNote; + +public class SelectNoteActivity extends NotesListViewActivity { + + private static final String TAG = SelectNoteActivity.class.getSimpleName(); + + String receivedText = ""; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + final Intent receivedIntent = getIntent(); + receivedText = receivedIntent.getStringExtra(Intent.EXTRA_TEXT); + } + + @Override + public void onNoteClick(int position, View v) { + if(receivedText != null && receivedText.length() > 0) { + final DBNote note = db.getNote(localAccount.getId(), ((DBNote) adapter.getItem(position)).getId()); + final String oldContent = note.getContent(); + String newContent; + if (oldContent != null && oldContent.length() > 0) { + newContent = oldContent + "\n\n" + receivedText; + } else { + newContent = receivedText; + } + db.updateNoteAndSync(ssoAccount, localAccount.getId(), note, newContent, () -> Toast.makeText(this, getString(R.string.added_content, receivedText), Toast.LENGTH_SHORT).show()); + } else { + Toast.makeText(this, R.string.shared_text_empty, Toast.LENGTH_SHORT).show(); + } + finish(); + } + + @Override + public boolean onNoteLongClick(int position, View v) { + return false; + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7fc63a41..0adf46d5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -181,6 +181,9 @@ We need the following technical information to help you: Please make sure you have installed and enabled the "Notes" app on your server. Your server did respond with a HTTP 302 status code, which implies, that you do not have installed the Notes app on your server or something is misconfigured. This can be caused by custom overrides in a .htaccess-file or by Nextcloud apps like OID Client. + Added "%1$s" + Shared text was empty + Append to note diff --git a/fastlane/metadata/android/en-US/changelogs/2012000.txt b/fastlane/metadata/android/en-US/changelogs/2012000.txt index 864a6e65..ffec7341 100644 --- a/fastlane/metadata/android/en-US/changelogs/2012000.txt +++ b/fastlane/metadata/android/en-US/changelogs/2012000.txt @@ -1,2 +1,3 @@ - ⚡️ Speed up synchronization by supporting ETags for capabilities endpoint -- 🐞 Fix upgrading from version <= 1.0.1 to a current version \ No newline at end of file +- 🐞 Fix upgrading from version <= 1.0.1 to a current version +- ➕ Allow to share into exiting note (#174) \ No newline at end of file