Skip to content

Commit 22525c1

Browse files
committed
Fixed Mr. Jingles appearance. It was important.
1 parent 445ee78 commit 22525c1

File tree

1 file changed

+4
-31
lines changed

1 file changed

+4
-31
lines changed

omniNotes/src/main/java/it/feio/android/omninotes/ListFragment.java

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle s
249249
itemAnimator.setRemoveDuration(1000);
250250
list.setItemAnimator(itemAnimator);
251251

252+
// Replace listview with Mr. Jingles if it is empty
253+
list.setEmptyView(empyListItem);
254+
252255
return view;
253256
}
254257

@@ -1054,7 +1057,7 @@ private void emptyTrash () {
10541057
/**
10551058
* Notes list adapter initialization and association to view
10561059
*
1057-
* @FIXME: This method is a divine opprobrium and MUST be refactored. I'm ashamed by myself.
1060+
* @FIXME: This method is a divine disgrace and MUST be refactored. I'm ashamed by myself.
10581061
*/
10591062
void initNotesList (Intent intent) {
10601063
LogDelegate.d("initNotesList intent: " + intent.getAction());
@@ -1185,11 +1188,6 @@ public void onEvent (NotesLoadedEvent notesLoadedEvent) {
11851188

11861189
list.setAdapter(listAdapter);
11871190

1188-
// Replace listview with Mr. Jingles if it is empty
1189-
if (notesLoadedEvent.notes.isEmpty()) {
1190-
list.setEmptyView(empyListItem);
1191-
}
1192-
11931191
// Restores listview position when turning back to list or when navigating reminders
11941192
if (!notesLoadedEvent.notes.isEmpty()) {
11951193
if (Navigation.checkNavigation(Navigation.REMINDERS)) {
@@ -1308,11 +1306,6 @@ public void trashNotes (boolean trash) {
13081306
trashNote(getSelectedNotes(), false);
13091307
}
13101308

1311-
// If list is empty again Mr Jingles will appear again
1312-
if (listAdapter.getItemCount() == 0) {
1313-
list.setEmptyView(empyListItem);
1314-
}
1315-
13161309
finishActionMode();
13171310

13181311
// Advice to user
@@ -1395,13 +1388,8 @@ private void deleteNotes () {
13951388
private void deleteNotesExecute () {
13961389
listAdapter.remove(getSelectedNotes());
13971390
new NoteProcessorDelete(getSelectedNotes()).process();
1398-
// list.clearChoices();
13991391
selectedNotes.clear();
14001392
finishActionMode();
1401-
// If list is empty again Mr Jingles will appear again
1402-
if (listAdapter.getItemCount() == 0) {
1403-
list.setEmptyView(empyListItem);
1404-
}
14051393
mainActivity.showMessage(R.string.note_deleted, ONStyle.ALERT);
14061394
}
14071395

@@ -1442,11 +1430,6 @@ public void archiveNotes (boolean archive) {
14421430
listAdapter.notifyDataSetChanged();
14431431
finishActionMode();
14441432

1445-
// If list is empty again Mr Jingles will appear again
1446-
if (listAdapter.getItemCount() == 0) {
1447-
list.setEmptyView(empyListItem);
1448-
}
1449-
14501433
// Advice to user
14511434
int msg = archive ? R.string.note_archived : R.string.note_unarchived;
14521435
Style style = archive ? ONStyle.WARN : ONStyle.INFO;
@@ -1548,11 +1531,6 @@ private void categorizeNotesExecute (Category category) {
15481531

15491532
finishActionMode();
15501533

1551-
// If list is empty again Mr Jingles will appear again
1552-
if (listAdapter.getItemCount() == 0) {
1553-
list.setEmptyView(empyListItem);
1554-
}
1555-
15561534
// Advice to user
15571535
String msg;
15581536
if (category != null) {
@@ -1613,11 +1591,6 @@ private void tagNotesExecute (List<Tag> tags, Integer[] selectedTags, Integer[]
16131591
tagNote(tags, selectedTags, note);
16141592
}
16151593

1616-
// If list is empty again Mr Jingles will appear again
1617-
if (listAdapter.getItemCount() == 0) {
1618-
list.setEmptyView(empyListItem);
1619-
}
1620-
16211594
if (getActionMode() != null) {
16221595
getActionMode().finish();
16231596
}

0 commit comments

Comments
 (0)