Skip to content

Commit da11f89

Browse files
committed
Extract common getEditNoteIntent
Signed-off-by: alperozturk <[email protected]>
1 parent abbf284 commit da11f89

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

app/src/main/java/it/niedermann/owncloud/notes/widget/notelist/NoteListWidgetFactory.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,7 @@ public int getCount() {
9393
return dbNotes.size() + 1;
9494
}
9595

96-
private Intent getCreateNoteIntent(Account localAccount ) {
97-
final Bundle bundle = new Bundle();
98-
bundle.putSerializable(PARAM_CATEGORY, data.getMode() == MODE_DISPLAY_STARRED ? new NavigationCategory(ENavigationCategoryType.FAVORITES) : new NavigationCategory(localAccount.getId(), data.getCategory()));
99-
bundle.putLong(EditNoteActivity.PARAM_ACCOUNT_ID, data.getAccountId());
100-
96+
private Intent getEditNoteIntent(Bundle bundle) {
10197
final Intent intent = new Intent(context, EditNoteActivity.class);
10298
intent.setPackage(context.getPackageName());
10399
intent.putExtras(bundle);
@@ -106,16 +102,20 @@ private Intent getCreateNoteIntent(Account localAccount ) {
106102
return intent;
107103
}
108104

105+
private Intent getCreateNoteIntent(Account localAccount ) {
106+
final Bundle bundle = new Bundle();
107+
bundle.putSerializable(PARAM_CATEGORY, data.getMode() == MODE_DISPLAY_STARRED ? new NavigationCategory(ENavigationCategoryType.FAVORITES) : new NavigationCategory(localAccount.getId(), data.getCategory()));
108+
bundle.putLong(EditNoteActivity.PARAM_ACCOUNT_ID, data.getAccountId());
109+
110+
return getEditNoteIntent(bundle);
111+
}
112+
109113
private Intent getOpenNoteIntent(Note note) {
110114
final Bundle bundle = new Bundle();
111115
bundle.putLong(EditNoteActivity.PARAM_NOTE_ID, note.getId());
112116
bundle.putLong(EditNoteActivity.PARAM_ACCOUNT_ID, note.getAccountId());
113117

114-
final Intent intent = new Intent(context, EditNoteActivity.class);
115-
intent.putExtras(bundle);
116-
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
117-
118-
return intent;
118+
return getEditNoteIntent(bundle);
119119
}
120120

121121
@Override

0 commit comments

Comments
 (0)