diff --git a/app/src/main/java/com/odysee/app/ui/channel/ChannelContentFragment.java b/app/src/main/java/com/odysee/app/ui/channel/ChannelContentFragment.java index 52f4bbe4..e268940d 100644 --- a/app/src/main/java/com/odysee/app/ui/channel/ChannelContentFragment.java +++ b/app/src/main/java/com/odysee/app/ui/channel/ChannelContentFragment.java @@ -305,6 +305,9 @@ private void fetchClaimSearchContent(boolean reset) { Activity a = getActivity(); if (a != null) { + scheduledLivestreamsLayout.findViewById(R.id.livestreams_progressbar).setVisibility(View.VISIBLE); + scheduledLivestreamsLayout.setVisibility(View.VISIBLE); + Collection> callables = new ArrayList<>(2); callables.add(() -> new Page(findActiveStream(), true /* ignored */)); callables.add(() -> Lbry.claimSearch(claimSearchOptions, Lbry.API_CONNECTION_STRING)); @@ -350,6 +353,8 @@ public void onClaimClicked(Claim claim, int position) { scheduledClaimsListAdapter.addItems(finalScheduledClaims); } + scheduledLivestreamsLayout.findViewById(R.id.livestreams_progressbar).setVisibility(View.GONE); + if (scheduledStreamsList != null && scheduledStreamsList.getAdapter() == null) { scheduledStreamsList.setAdapter(scheduledClaimsListAdapter); } diff --git a/app/src/main/java/com/odysee/app/ui/findcontent/AllContentFragment.java b/app/src/main/java/com/odysee/app/ui/findcontent/AllContentFragment.java index 55c674c9..42299913 100644 --- a/app/src/main/java/com/odysee/app/ui/findcontent/AllContentFragment.java +++ b/app/src/main/java/com/odysee/app/ui/findcontent/AllContentFragment.java @@ -471,7 +471,7 @@ private Map buildContentOptions() { canShowMatureContent = sp.getBoolean(MainActivity.PREFERENCE_KEY_SHOW_MATURE_CONTENT, false); } - List channelIdsForCategory = null; + List channelIdsForCategory; List excludedChannelIdsForCategory = Arrays.asList(dynamicCategories.get(currentCategoryId).getExcludedChannelIds()); if (currentChannelIdList != null) { @@ -526,6 +526,8 @@ public void fetchClaimSearchContent(boolean reset) { contentClaimSearchLoading = true; Helper.setViewVisibility(noContentView, View.GONE); Map claimSearchOptions = buildContentOptions(); + claimSearchOptions.put("has_source", true); + // TODO Use a Search callable instead of this AsyncTask contentClaimSearchTask = new ClaimSearchTask(claimSearchOptions, Lbry.API_CONNECTION_STRING, getLoadingView(), new ClaimSearchResultHandler() { @Override public void onSuccess(List claims, boolean hasReachedEnd) { @@ -587,6 +589,8 @@ private void fetchActiveLivestreams() { activeClaimsListAdapter.clearItems(); } + activeLivestreamsLayout.findViewById(R.id.livestreams_progressbar).setVisibility(View.VISIBLE); + Thread t = new Thread(new Runnable() { @Override public void run() { @@ -626,6 +630,8 @@ public void onClaimClicked(Claim claim, int position) { livestreamingClaimsFetched = true; + activeLivestreamsLayout.findViewById(R.id.livestreams_progressbar).setVisibility(View.GONE); + if (livestreamsList != null && livestreamsList.getAdapter() == null) { livestreamsList.setAdapter(activeClaimsListAdapter); } @@ -650,6 +656,13 @@ private List findActiveLivestreams() { List subscribedActiveClaims = new ArrayList<>(); if (a != null) { try { + a.runOnUiThread(new Runnable() { + @Override + public void run() { + Helper.setViewVisibility(activeLivestreamsLayout, View.VISIBLE); + } + }); + Map activeJsonData; Callable> callable; Future> futureActive; @@ -658,12 +671,12 @@ private List findActiveLivestreams() { List channelIds = Arrays.asList(currentChannelIdList); callable = new ChannelLiveStatus(channelIds, false, true); - futureActive = ((OdyseeApp) a.getApplication()).getExecutor().submit(callable); } else { callable = new GetAllLivestreams(); - futureActive = ((OdyseeApp) a.getApplication()).getExecutor().submit(callable); } + futureActive = ((OdyseeApp) a.getApplication()).getExecutor().submit(callable); + activeJsonData = futureActive.get(); if (activeJsonData != null && activeJsonData.size() > 0) { @@ -709,6 +722,13 @@ private List findActiveLivestreams() { throw new RuntimeException(e); } } + } else { + a.runOnUiThread(new Runnable() { + @Override + public void run() { + Helper.setViewVisibility(activeLivestreamsLayout, View.GONE); + } + }); } } catch (InterruptedException | ExecutionException e) { Throwable cause = e.getCause(); diff --git a/app/src/main/res/layout/fragment_all_content.xml b/app/src/main/res/layout/fragment_all_content.xml index b1916352..6ba72c26 100644 --- a/app/src/main/res/layout/fragment_all_content.xml +++ b/app/src/main/res/layout/fragment_all_content.xml @@ -44,7 +44,8 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" - android:layout_marginStart="16dp" + android:layout_marginBottom="16dp" + android:layout_marginStart="12dp" android:orientation="vertical" tools:visibility="visible" android:visibility="gone"> @@ -73,6 +74,16 @@ android:background="?attr/selectableItemBackground" android:src="@drawable/ic_expand"/> + + + +