|
39 | 39 | import android.widget.TextView; |
40 | 40 | import android.widget.Toast; |
41 | 41 |
|
| 42 | +import androidx.annotation.DrawableRes; |
42 | 43 | import androidx.annotation.NonNull; |
43 | 44 | import androidx.appcompat.widget.PopupMenu; |
44 | 45 | import androidx.fragment.app.ListFragment; |
|
54 | 55 | import com.automattic.simplenote.utils.DateTimeUtils; |
55 | 56 | import com.automattic.simplenote.utils.DisplayUtils; |
56 | 57 | import com.automattic.simplenote.utils.DrawableUtils; |
57 | | -import com.automattic.simplenote.utils.HtmlCompat; |
58 | 58 | import com.automattic.simplenote.utils.PrefUtils; |
59 | 59 | import com.automattic.simplenote.utils.SearchSnippetFormatter; |
60 | 60 | import com.automattic.simplenote.utils.SearchTokenizer; |
@@ -125,7 +125,8 @@ public void onNoteSelected(String noteID, int position, String matchOffsets, boo |
125 | 125 | private Bucket<Tag> mBucket; |
126 | 126 | private ActionMode mActionMode; |
127 | 127 | private View mRootView; |
128 | | - private TextView mEmptyListTextView; |
| 128 | + private ImageView mEmptyViewImage; |
| 129 | + private TextView mEmptyViewText; |
129 | 130 | private View mDividerLine; |
130 | 131 | private FloatingActionButton mFloatingActionButton; |
131 | 132 | private boolean mIsCondensedNoteList; |
@@ -162,12 +163,6 @@ public void onNoteSelected(String noteID, int position, String matchOffsets, boo |
162 | 163 | public NoteListFragment() { |
163 | 164 | } |
164 | 165 |
|
165 | | - public void setEmptyListViewClickable(boolean isClickable) { |
166 | | - if (mEmptyListTextView != null) { |
167 | | - mEmptyListTextView.setClickable(isClickable); |
168 | | - } |
169 | | - } |
170 | | - |
171 | 166 | @Override |
172 | 167 | public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long l) { |
173 | 168 | getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); |
@@ -277,14 +272,10 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { |
277 | 272 |
|
278 | 273 | LinearLayout emptyView = view.findViewById(android.R.id.empty); |
279 | 274 | emptyView.setVisibility(View.GONE); |
280 | | - mEmptyListTextView = view.findViewById(R.id.empty_message); |
281 | | - mEmptyListTextView.setOnClickListener(new View.OnClickListener() { |
282 | | - @Override |
283 | | - public void onClick(View v) { |
284 | | - addNote(); |
285 | | - } |
286 | | - }); |
287 | | - setEmptyListMessage("<strong>" + getString(R.string.no_notes_here) + "</strong><br />" + String.format(getString(R.string.why_not_create_one), "<u>", "</u>")); |
| 275 | + mEmptyViewImage = emptyView.findViewById(R.id.image); |
| 276 | + mEmptyViewText = emptyView.findViewById(R.id.text); |
| 277 | + setEmptyListImage(R.drawable.ic_notes_24dp); |
| 278 | + setEmptyListMessage(getString(R.string.empty_notes_all)); |
288 | 279 | mDividerLine = view.findViewById(R.id.divider_line); |
289 | 280 |
|
290 | 281 | if (DisplayUtils.isLargeScreenLandscape(notesActivity)) { |
@@ -468,9 +459,21 @@ public void onDetach() { |
468 | 459 | mCallbacks = sCallbacks; |
469 | 460 | } |
470 | 461 |
|
| 462 | + public void setEmptyListImage(@DrawableRes int image) { |
| 463 | + if (mEmptyViewImage != null) { |
| 464 | + if (image != -1) { |
| 465 | + mEmptyViewImage.setVisibility(View.VISIBLE); |
| 466 | + mEmptyViewImage.setImageResource(image); |
| 467 | + } else { |
| 468 | + mEmptyViewImage.setVisibility(View.GONE); |
| 469 | + } |
| 470 | + } |
| 471 | + } |
| 472 | + |
471 | 473 | public void setEmptyListMessage(String message) { |
472 | | - if (mEmptyListTextView != null && message != null) |
473 | | - mEmptyListTextView.setText(HtmlCompat.fromHtml(message)); |
| 474 | + if (mEmptyViewText != null && message != null) { |
| 475 | + mEmptyViewText.setText(message); |
| 476 | + } |
474 | 477 | } |
475 | 478 |
|
476 | 479 | @Override |
|
0 commit comments