|
16 | 16 | import android.view.MenuItem;
|
17 | 17 | import android.view.View;
|
18 | 18 | import android.view.ViewGroup;
|
| 19 | +import android.widget.TextView; |
19 | 20 | import android.widget.Toast;
|
20 | 21 |
|
21 | 22 | import com.j256.ormlite.stmt.QueryBuilder;
|
@@ -86,6 +87,7 @@ public interface Listener {
|
86 | 87 | boolean paused = false;
|
87 | 88 | boolean initialized = false;
|
88 | 89 | List<Message> messageList;
|
| 90 | + TextView emptyTextView; |
89 | 91 |
|
90 | 92 | public MessageListFragment() {
|
91 | 93 | app = ZulipApp.get();
|
@@ -135,6 +137,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
135 | 137 | View view = inflater.inflate(R.layout.fragment_message_list, container,
|
136 | 138 | false);
|
137 | 139 |
|
| 140 | + emptyTextView = (TextView) view.findViewById(R.id.emptyList); |
138 | 141 | if (filter != null && ((AppCompatActivity) getActivity()).getSupportActionBar() != null)
|
139 | 142 | ((AppCompatActivity) getActivity()).getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
|
140 | 143 | else
|
@@ -250,13 +253,22 @@ public void onReadyToDisplay(boolean registered) {
|
250 | 253 | initialized = true;
|
251 | 254 | }
|
252 | 255 |
|
| 256 | + private void showEmptyView() { |
| 257 | + Log.d("ErrorRecieving", "No Messages found for current list" + ((filter != null) ? ":" + filter.getTitle() : "")); |
| 258 | + recyclerView.setVisibility(View.GONE); |
| 259 | + emptyTextView.setVisibility(View.VISIBLE); |
| 260 | + } |
| 261 | + |
253 | 262 | private void fetch() {
|
254 | 263 | final AsyncGetOldMessages oldMessagesReq = new AsyncGetOldMessages(this);
|
255 | 264 | oldMessagesReq.setCallback(new ZulipAsyncPushTask.AsyncTaskCompleteListener() {
|
256 | 265 | @Override
|
257 | 266 | public void onTaskComplete(String result, JSONObject jsonObject) {
|
258 | 267 | loadingMessages = false;
|
259 | 268 | adapter.setHeaderShowing(false);
|
| 269 | + if(result.equals("0")){ |
| 270 | + showEmptyView(); |
| 271 | + } |
260 | 272 | }
|
261 | 273 |
|
262 | 274 | @Override
|
|
0 commit comments