Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d019015 authored by Felix Nüsse's avatar Felix Nüsse Committed by Niedermann IT-Dienstleistungen
Browse files

allow EditNoteActivity to open main application when called from widget.

parent 3999f8ea
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.accountpicker.AccountPickerListener;
import it.niedermann.owncloud.notes.databinding.ActivityEditBinding;
import it.niedermann.owncloud.notes.edit.category.CategoryViewModel;
import it.niedermann.owncloud.notes.main.MainActivity;
import it.niedermann.owncloud.notes.persistence.entity.Account;
import it.niedermann.owncloud.notes.persistence.entity.Note;
import it.niedermann.owncloud.notes.shared.model.NavigationCategory;
@@ -283,9 +284,17 @@ public class EditNoteActivity extends LockedActivity implements BaseNoteFragment
            preferences.edit().putString(prefKeyLastMode, getString(R.string.pref_value_mode_preview)).apply();
        }
        fragment.onCloseNote();

        if(isTaskRoot()) {
            Intent intent = new Intent(EditNoteActivity.this, MainActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
        } else {
            finish();
        }

    }

    @Override
    public void onNoteUpdated(Note note) {
        if (note != null) {
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFa

        args.putLong(EditNoteActivity.PARAM_NOTE_ID, note.getId());
        args.putLong(EditNoteActivity.PARAM_ACCOUNT_ID, note.getAccountId());
        //args.putBoolean(EditNoteActivity.PARAM_WIDGET_CALLED, true);
        fillInIntent.putExtras(args);

        final var note_content = new RemoteViews(context.getPackageName(), R.layout.widget_single_note_content);