Commit 756134cf authored by Hussein's avatar Hussein

Merge branch 'P4A-571' into develop

parents bbb341c3 83f47fc4
......@@ -39,6 +39,7 @@ import android.view.ViewTreeObserver;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
......@@ -92,6 +93,7 @@ import com.fsck.k9.search.SearchSpecification;
import com.fsck.k9.search.SearchSpecification.SearchCondition;
import com.fsck.k9.search.SearchSpecification.SearchField;
import com.fsck.k9.search.SqlQueryBuilder;
import com.google.android.material.textview.MaterialTextView;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
......@@ -161,10 +163,22 @@ public class MessageListFragment extends PEpFragment implements ConfirmationDial
loadingView.setVisibility(View.VISIBLE);
}
public void hideLoadingMessages() {
listView.setVisibility(View.VISIBLE);
public void hideLoadingMessages(int messageCount) {
if(isManualSearch()) {
if(messageCount == 0) {
noResultsFound.setVisibility(View.VISIBLE);
// show empty search
}
else {
listView.setVisibility(View.VISIBLE);
}
}
else {
listView.setVisibility(View.VISIBLE);
// fab.setVisibility(View.VISIBLE);
fab.show();
fab.show();
}
loadingView.setVisibility(View.GONE);
}
......@@ -206,6 +220,8 @@ public class MessageListFragment extends PEpFragment implements ConfirmationDial
private SwipeRefreshLayout swipeRefreshLayout;
Parcelable savedListState;
private MaterialTextView noResultsFound;
private MessageListAdapter adapter;
private View footerView;
private FolderInfoHolder currentFolder;
......@@ -546,6 +562,7 @@ public class MessageListFragment extends PEpFragment implements ConfirmationDial
listView = (ListView) rootView.findViewById(R.id.message_list);
swipeRefreshLayout = (SwipeRefreshLayout) rootView.findViewById(R.id.message_swipe);
loadingView = (ProgressBar) rootView.findViewById(R.id.loading_view);
noResultsFound = rootView.findViewById(R.id.no_results_found_layout);
initializeFabButton(rootView);
......@@ -833,7 +850,7 @@ public class MessageListFragment extends PEpFragment implements ConfirmationDial
toolBarCustomizer.setToolbarColor(worstThreadRating);
toolBarCustomizer.setStatusBarPepColor(worstThreadRating);
}
if (isThreadDisplay) {
if (isThreadDisplay || isManualSearch()) {
fab.hide();
} else {
fab.show();
......@@ -3031,7 +3048,7 @@ public class MessageListFragment extends PEpFragment implements ConfirmationDial
fragmentListener.updateMenu();
}
hideLoadingMessages();
hideLoadingMessages(cursor.getCount());
}
private void updateToolbarColor(Cursor cursor) {
......
......@@ -46,4 +46,16 @@
app:elevation="4dp"
app:layout_anchorGravity="right|bottom" />
<com.google.android.material.textview.MaterialTextView
android:id="@+id/no_results_found_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:text="@string/no_results_found"
android:drawableTop="?attr/iconActionSearch"
android:drawablePadding="8dp"
android:visibility="gone"
tools:visibility="visible"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
......@@ -273,6 +273,7 @@
<string name="change_language_title">Change Language</string>
<string name="change_language_explanation">App will return to main screen to change language</string>
<string name="no_results_found">No results found</string>
<string name="pgp_key_import_title">PGP Key import from filesystem</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment