allow EditNoteActivity to open main application when called from widget.

This commit is contained in:
Felix Nüsse 2022-06-25 12:02:50 +02:00 committed by Niedermann IT-Dienstleistungen
parent 3999f8eaec
commit 0d01901578
2 changed files with 11 additions and 1 deletions

View file

@ -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,7 +284,15 @@ public class EditNoteActivity extends LockedActivity implements BaseNoteFragment
preferences.edit().putString(prefKeyLastMode, getString(R.string.pref_value_mode_preview)).apply();
}
fragment.onCloseNote();
finish();
if(isTaskRoot()) {
Intent intent = new Intent(EditNoteActivity.this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
} else {
finish();
}
}
@Override

View file

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