Show "No messages" when there's no items on message list
Show this when there's no messages, and no "Load more messages" footer. i.e. Only Outbox, Drafts, and exchange mailboxes can show "No messages". Also removed an obsolete comment. Bug 2363624 Change-Id: If483d33cfacb186d0fe54b4f4382333a332be84c
This commit is contained in:
parent
92f30bedf2
commit
9c293eb65a
@ -18,26 +18,42 @@
|
||||
The default ListFragment layout (include) + the "send outgoing message" button.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout android:id="@+id/send_panel"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/no_messages_panel"
|
||||
android:text="@string/message_list_no_messages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:id="@+id/list_panel"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
<LinearLayout
|
||||
android:id="@+id/send_panel"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<Button
|
||||
android:id="@+id/send_messages"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/message_list_send_pending_messages_action" />
|
||||
<Button
|
||||
android:id="@+id/send_messages"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/message_list_send_pending_messages_action" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@android:layout/list_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@android:layout/list_content" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
@ -268,6 +268,9 @@
|
||||
<item quantity="one" ><xliff:g id="message_count" example="1">%d</xliff:g> selected</item>
|
||||
<item quantity="other"><xliff:g id="message_count" example="9">%d</xliff:g> selected</item>
|
||||
</plurals>
|
||||
<!-- Message to show when there are no messages (emails) in the selected mailbox.
|
||||
[CHAR LIMIT=26] -->
|
||||
<string name="message_list_no_messages">No messages</string>
|
||||
<!-- Hint text in To field -->
|
||||
<string name="message_compose_to_hint">To</string>
|
||||
<!-- Hint text in Cc field -->
|
||||
|
@ -94,6 +94,8 @@ public class MessageListFragment extends ListFragment
|
||||
private TextView mListFooterText;
|
||||
private View mListFooterProgress;
|
||||
private View mSendPanel;
|
||||
private View mListPanel;
|
||||
private View mNoMessagesPanel;
|
||||
|
||||
private static final int LIST_FOOTER_MODE_NONE = 0;
|
||||
private static final int LIST_FOOTER_MODE_MORE = 1;
|
||||
@ -200,6 +202,8 @@ public class MessageListFragment extends ListFragment
|
||||
// Use a custom layout, which includes the original layout with "send messages" panel.
|
||||
View root = inflater.inflate(R.layout.message_list_fragment,null);
|
||||
mSendPanel = root.findViewById(R.id.send_panel);
|
||||
mListPanel = root.findViewById(R.id.list_panel);
|
||||
mNoMessagesPanel = root.findViewById(R.id.no_messages_panel);
|
||||
((Button) mSendPanel.findViewById(R.id.send_messages)).setOnClickListener(this);
|
||||
return root;
|
||||
}
|
||||
@ -842,6 +846,17 @@ public class MessageListFragment extends ListFragment
|
||||
mSendPanel.setVisibility(show ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void showNoMessageText(boolean visible) {
|
||||
mNoMessagesPanel.setVisibility(visible ? View.VISIBLE : View.GONE);
|
||||
mListPanel.setVisibility(visible ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
|
||||
private void showNoMessageTextIfNecessary() {
|
||||
boolean noItem = (mListFooterMode == LIST_FOOTER_MODE_NONE)
|
||||
&& (mListView.getCount() == 0);
|
||||
showNoMessageText(noItem);
|
||||
}
|
||||
|
||||
private void startLoading() {
|
||||
if (Email.DEBUG_LIFECYCLE && Email.DEBUG) {
|
||||
Log.d(Email.LOG_TAG, "MessageListFragment startLoading");
|
||||
@ -849,6 +864,7 @@ public class MessageListFragment extends ListFragment
|
||||
mOpenRequested = false;
|
||||
|
||||
// Clear the list. (ListFragment will show the "Loading" animation)
|
||||
showNoMessageText(false);
|
||||
setListShown(false);
|
||||
hideSendPanel();
|
||||
|
||||
@ -969,11 +985,11 @@ public class MessageListFragment extends ListFragment
|
||||
setListShown(true);
|
||||
|
||||
// Various post processing...
|
||||
// (resetNewMessageCount should be here. See above.)
|
||||
autoRefreshStaleMailbox();
|
||||
addFooterView();
|
||||
updateSelectionMode();
|
||||
showSendPanelIfNecessary();
|
||||
showNoMessageTextIfNecessary();
|
||||
|
||||
// We want to make selection visible only when the loader was explicitly started.
|
||||
// i.e. Refresh caused by content changed events shouldn't scroll the list.
|
||||
|
Loading…
Reference in New Issue
Block a user