Added empty views to the PlayBack History, Queue,and Downloads

This commit is contained in:
Jatin Kumar 2019-03-21 03:05:01 -04:00
parent 0a9735e7da
commit 6662205167
11 changed files with 170 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import java.util.List;
@ -106,6 +107,12 @@ public class CompletedDownloadsFragment extends ListFragment {
if (items != null && getActivity() != null) {
onFragmentLoaded();
}
//empty view
View emptyView = getActivity().getLayoutInflater().inflate(R.layout.completed_downloads_empty_view, null);
((ViewGroup)getListView().getParent()).addView(emptyView);
getListView().setEmptyView(emptyView);
}
@Override

View File

@ -11,6 +11,7 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextView;
@ -75,6 +76,11 @@ public class DownloadLogFragment extends ListFragment {
if (itemsLoaded) {
onFragmentLoaded();
}
//empty view
View emptyView = getActivity().getLayoutInflater().inflate(R.layout.download_log_empty_view, null);
((ViewGroup)getListView().getParent()).addView(emptyView);
getListView().setEmptyView(emptyView);
}
private void onFragmentLoaded() {

View File

@ -10,6 +10,7 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import java.util.List;
@ -81,6 +82,11 @@ public class PlaybackHistoryFragment extends ListFragment {
if (itemsLoaded) {
onFragmentLoaded();
}
//empty view
View emptyView = getActivity().getLayoutInflater().inflate(R.layout.playback_history_empty_view, null);
((ViewGroup)getListView().getParent()).addView(emptyView);
getListView().setEmptyView(emptyView);
}

View File

@ -73,6 +73,7 @@ public class QueueFragment extends Fragment {
private RecyclerView recyclerView;
private QueueRecyclerAdapter recyclerAdapter;
private TextView txtvEmpty;
private TextView txtvHeadEmpty;
private ProgressBar progLoading;
private List<FeedItem> queue;
@ -496,6 +497,9 @@ public class QueueFragment extends Fragment {
txtvEmpty = root.findViewById(android.R.id.empty);
txtvEmpty.setVisibility(View.GONE);
txtvHeadEmpty = root.findViewById(R.id.emptyQueueHeader);
txtvHeadEmpty.setVisibility(View.GONE);
progLoading = root.findViewById(R.id.progLoading);
progLoading.setVisibility(View.VISIBLE);
@ -513,9 +517,11 @@ public class QueueFragment extends Fragment {
if(queue == null || queue.size() == 0) {
recyclerView.setVisibility(View.GONE);
txtvEmpty.setVisibility(View.VISIBLE);
txtvHeadEmpty.setVisibility(View.VISIBLE);
} else {
txtvEmpty.setVisibility(View.GONE);
recyclerView.setVisibility(View.VISIBLE);
txtvHeadEmpty.setVisibility(View.GONE);
}
if (restoreScrollPosition) {
@ -629,6 +635,7 @@ public class QueueFragment extends Fragment {
if (queue == null) {
recyclerView.setVisibility(View.GONE);
txtvEmpty.setVisibility(View.GONE);
txtvHeadEmpty.setVisibility(View.GONE);
progLoading.setVisibility(View.VISIBLE);
}
disposable = Observable.fromCallable(DBReader::getQueue)

View File

@ -4,6 +4,7 @@ import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.Toast;
@ -44,6 +45,11 @@ public class RunningDownloadsFragment extends ListFragment {
adapter = new DownloadlistAdapter(getActivity(), itemAccess);
setListAdapter(adapter);
//empty view
View emptyView = getActivity().getLayoutInflater().inflate(R.layout.running_downloads_empty_view, null);
((ViewGroup)getListView().getParent()).addView(emptyView);
getListView().setEmptyView(emptyView);
}
@Override

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/no_comp_downloads_head_label"
android:textSize="20dp"
android:textStyle="bold"
android:paddingBottom="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="@string/no_comp_downloads_label"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textAlignment="center"/>
</LinearLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/no_log_downloads_head_label"
android:textSize="20dp"
android:textStyle="bold"
android:paddingBottom="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="@string/no_log_downloads_label"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textAlignment="center"/>
</LinearLayout>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/no_history_head_label"
android:textSize="20dp"
android:textStyle="bold"
android:paddingBottom="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="@string/no_history_label"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:textAlignment="center"/>
</LinearLayout>

View File

@ -27,13 +27,31 @@
android:layout_below="@id/divider"
android:scrollbars="vertical"/>
<TextView
android:id="@+id/emptyQueueHeader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/no_items_header_label"
android:paddingBottom="80dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textSize="20dp"
android:textStyle="bold"
/>
<TextView
android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/no_items_label" />
android:text="@string/no_items_label"
android:textSize="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textAlignment="center"/>
<ProgressBar
android:id="@+id/progLoading"

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="@string/no_run_downloads_head_label"
android:textSize="20dp"
android:textStyle="bold"
android:paddingBottom="10dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15dp"
android:text="@string/no_log_downloads_label"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textAlignment="center"/>
</LinearLayout>

View File

@ -314,10 +314,20 @@
<string name="enable_sonic">Enable Sonic</string>
<!-- Empty list labels -->
<string name="no_items_label">There are no items in this list.</string>
<string name="no_items_header_label">No queued episodes</string>
<string name="no_items_label">You can add episodes to the queue by long-pressing or downloading them.</string>
<string name="no_feeds_label">You haven\'t subscribed to any podcasts yet.</string>
<string name="no_chapters_label">This episode has no chapters.</string>
<string name="no_shownotes_label">This episode has no shownotes.</string>
<string name="no_run_downloads_head_label">No download running</string>
<string name="no_run_downloads_label">You can download episodes on the podcast details screen.</string>
<string name="no_comp_downloads_head_label">No download episodes</string>
<string name="no_comp_downloads_label">You can download episodes on the podcast details screen.</string>
<string name="no_log_downloads_head_label">No download log</string>
<string name="no_log_downloads_label">Download logs will appear here when available.</string>
<string name="no_history_head_label">No History</string>
<string name="no_history_label">After you listen to an episode, it will appear here.</string>
<!-- Preferences -->
<string name="storage_pref">Storage</string>