Added include to the queue and episode layout

This commit is contained in:
Jatin Kumar 2019-04-01 20:40:58 -04:00
parent 7f035b8b4b
commit c661be344e
6 changed files with 27 additions and 85 deletions

View File

@ -19,8 +19,8 @@ import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration; import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
@ -75,7 +75,7 @@ public class AllEpisodesFragment extends Fragment {
RecyclerView recyclerView; RecyclerView recyclerView;
AllEpisodesRecycleAdapter listAdapter; AllEpisodesRecycleAdapter listAdapter;
private ProgressBar progLoading; private ProgressBar progLoading;
private LinearLayout layoutEmpty; private View emptyView;
List<FeedItem> episodes; List<FeedItem> episodes;
private List<Downloader> downloaderList; private List<Downloader> downloaderList;
@ -333,8 +333,10 @@ public class AllEpisodesFragment extends Fragment {
onFragmentLoaded(); onFragmentLoaded();
} }
layoutEmpty = (LinearLayout) root.findViewById(R.id.llEmpty); emptyView = (View) root.findViewById(R.id.emptyView);
layoutEmpty.setVisibility(View.GONE); emptyView.setVisibility(View.GONE);
((TextView)emptyView.findViewById(R.id.txtvtitle)).setText(R.string.no_all_episodes_head_label);
((TextView)emptyView.findViewById(R.id.txtvmessage)).setText(R.string.no_all_episodes_label);
return root; return root;
} }
@ -349,9 +351,9 @@ public class AllEpisodesFragment extends Fragment {
} }
if (episodes == null || episodes.size() == 0) { if (episodes == null || episodes.size() == 0) {
recyclerView.setVisibility(View.GONE); recyclerView.setVisibility(View.GONE);
layoutEmpty.setVisibility(View.VISIBLE); emptyView.setVisibility(View.VISIBLE);
} else { } else {
layoutEmpty.setVisibility(View.GONE); emptyView.setVisibility(View.GONE);
recyclerView.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.VISIBLE);
} }
@ -486,7 +488,7 @@ public class AllEpisodesFragment extends Fragment {
} }
if (viewsCreated && !itemsLoaded) { if (viewsCreated && !itemsLoaded) {
recyclerView.setVisibility(View.GONE); recyclerView.setVisibility(View.GONE);
layoutEmpty.setVisibility(View.GONE); emptyView.setVisibility(View.GONE);
progLoading.setVisibility(View.VISIBLE); progLoading.setVisibility(View.VISIBLE);
} }
disposable = Observable.fromCallable(this::loadData) disposable = Observable.fromCallable(this::loadData)

View File

@ -51,8 +51,8 @@ public class FavoriteEpisodesFragment extends AllEpisodesFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = super.onCreateViewHelper(inflater, container, savedInstanceState, View root = super.onCreateViewHelper(inflater, container, savedInstanceState,
R.layout.all_episodes_fragment); R.layout.all_episodes_fragment);
((TextView)root.findViewById(R.id.emptyHeader)).setText(R.string.no_fav_episodes_head_label); ((TextView)root.findViewById(R.id.txtvtitle)).setText(R.string.no_fav_episodes_head_label);
((TextView)root.findViewById(R.id.empty)).setText(R.string.no_fav_episodes_label); ((TextView)root.findViewById(R.id.txtvmessage)).setText(R.string.no_fav_episodes_label);
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
@Override @Override

View File

@ -46,8 +46,8 @@ public class NewEpisodesFragment extends AllEpisodesFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = super.onCreateViewHelper(inflater, container, savedInstanceState, View root = super.onCreateViewHelper(inflater, container, savedInstanceState,
R.layout.all_episodes_fragment); R.layout.all_episodes_fragment);
((TextView)root.findViewById(R.id.emptyHeader)).setText(R.string.no_new_episodes_head_label); ((TextView)root.findViewById(R.id.txtvtitle)).setText(R.string.no_new_episodes_head_label);
((TextView)root.findViewById(R.id.empty)).setText(R.string.no_new_episodes_label); ((TextView)root.findViewById(R.id.txtvmessage)).setText(R.string.no_new_episodes_label);
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
@Override @Override

View File

@ -19,7 +19,6 @@ import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
@ -73,7 +72,7 @@ public class QueueFragment extends Fragment {
private TextView infoBar; private TextView infoBar;
private RecyclerView recyclerView; private RecyclerView recyclerView;
private QueueRecyclerAdapter recyclerAdapter; private QueueRecyclerAdapter recyclerAdapter;
private LinearLayout layoutEmpty; private View emptyView;
private ProgressBar progLoading; private ProgressBar progLoading;
private List<FeedItem> queue; private List<FeedItem> queue;
@ -495,8 +494,10 @@ public class QueueFragment extends Fragment {
); );
itemTouchHelper.attachToRecyclerView(recyclerView); itemTouchHelper.attachToRecyclerView(recyclerView);
//empty view //empty view
layoutEmpty = (LinearLayout) root.findViewById(R.id.llEmpty); emptyView = (View) root.findViewById(R.id.emptyView);
layoutEmpty.setVisibility(View.GONE); emptyView.setVisibility(View.GONE);
((TextView)emptyView.findViewById(R.id.txtvtitle)).setText(R.string.no_items_header_label);
((TextView)emptyView.findViewById(R.id.txtvmessage)).setText(R.string.no_items_label);
progLoading = root.findViewById(R.id.progLoading); progLoading = root.findViewById(R.id.progLoading);
progLoading.setVisibility(View.VISIBLE); progLoading.setVisibility(View.VISIBLE);
@ -514,9 +515,9 @@ public class QueueFragment extends Fragment {
} }
if(queue == null || queue.size() == 0) { if(queue == null || queue.size() == 0) {
recyclerView.setVisibility(View.GONE); recyclerView.setVisibility(View.GONE);
layoutEmpty.setVisibility(View.VISIBLE); emptyView.setVisibility(View.VISIBLE);
} else { } else {
layoutEmpty.setVisibility(View.GONE); emptyView.setVisibility(View.GONE);
recyclerView.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.VISIBLE);
} }
@ -630,7 +631,7 @@ public class QueueFragment extends Fragment {
} }
if (queue == null) { if (queue == null) {
recyclerView.setVisibility(View.GONE); recyclerView.setVisibility(View.GONE);
layoutEmpty.setVisibility(View.GONE); emptyView.setVisibility(View.GONE);
progLoading.setVisibility(View.VISIBLE); progLoading.setVisibility(View.VISIBLE);
} }
disposable = Observable.fromCallable(DBReader::getQueue) disposable = Observable.fromCallable(DBReader::getQueue)

View File

@ -17,40 +17,9 @@
tools:itemCount="13" tools:itemCount="13"
tools:listitem="@layout/new_episodes_listitem" /> tools:listitem="@layout/new_episodes_listitem" />
<LinearLayout <include
android:id="@+id/llEmpty" android:id="@+id/emptyView"
android:layout_width="match_parent" layout="@layout/empty_view_layout"/>
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:id="@+id/emptyHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/no_all_episodes_head_label"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textSize="20sp"
android:textStyle="bold"
/>
<TextView
android:id="@+id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/no_all_episodes_label"
android:textSize="15sp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textAlignment="center"/>
</LinearLayout>
<ProgressBar <ProgressBar
android:id="@+id/progLoading" android:id="@+id/progLoading"

View File

@ -27,40 +27,10 @@
android:layout_below="@id/divider" android:layout_below="@id/divider"
android:scrollbars="vertical"/> android:scrollbars="vertical"/>
<LinearLayout <include
android:id="@+id/llEmpty" android:id="@+id/emptyView"
android:layout_width="match_parent" layout="@layout/empty_view_layout"/>
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">
<TextView
android:id="@+id/emptyQueueHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/no_items_header_label"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textSize="20sp"
android:textStyle="bold"
/>
<TextView
android:id="@+id/empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="@string/no_items_label"
android:textSize="15sp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textAlignment="center"/>
</LinearLayout>
<ProgressBar <ProgressBar
android:id="@+id/progLoading" android:id="@+id/progLoading"
android:layout_width="wrap_content" android:layout_width="wrap_content"