Merge remote-tracking branch 'origin/share-into-existing-note'

# Conflicts:
#	fastlane/metadata/android/en-US/changelogs/2012000.txt
This commit is contained in:
Stefan Niedermann 2020-05-11 12:42:13 +02:00
commit dfc3943124
5 changed files with 66 additions and 4 deletions

View file

@ -47,6 +47,17 @@
android:value=".android.activity.NotesListViewActivity" />
</activity>
<activity
android:name=".android.activity.SelectNoteActivity"
android:label="@string/append_to_note">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/*" />
</intent-filter>
</activity>
<activity
android:name=".android.activity.ExceptionActivity"
android:label="@string/app_name" />

View file

@ -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);

View file

@ -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;
}
}

View file

@ -181,6 +181,9 @@
<string name="error_dialog_we_need_info">We need the following technical information to help you:</string>
<string name="error_dialog_server_app_enabled">Please make sure you have installed and enabled the "Notes" app on your server.</string>
<string name="error_dialog_redirect">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.</string>
<string name="added_content">Added "%1$s"</string>
<string name="shared_text_empty">Shared text was empty</string>
<string name="append_to_note">Append to note</string>
<!-- Array: note modes -->
<string-array name="noteMode_entries">

View file

@ -1,2 +1,3 @@
- ⚡️ Speed up synchronization by supporting ETags for capabilities endpoint
- 🐞 Fix upgrading from version <= 1.0.1 to a current version
- 🐞 Fix upgrading from version <= 1.0.1 to a current version
- Allow to share into exiting note (#174)