Fix some bugs when playing

This commit is contained in:
Thomas 2020-11-28 14:54:47 +01:00
parent 4b25b61680
commit 964b0f2690
5 changed files with 86 additions and 77 deletions

View File

@ -222,7 +222,7 @@
<string name="peertube_video_from_subscription"><![CDATA[<b>%1$s</b> a publié une nouvelle vidéo : <b>%2$s</b>]]></string> <string name="peertube_video_from_subscription"><![CDATA[<b>%1$s</b> a publié une nouvelle vidéo : <b>%2$s</b>]]></string>
<string name="peertube_video_blacklist"><![CDATA[Votre vidéo <b>%1$s</b> a été blacklisté]]></string> <string name="peertube_video_blacklist"><![CDATA[Votre vidéo <b>%1$s</b> a été blacklisté]]></string>
<string name="peertube_video_unblacklist"><![CDATA[Votre vidéo <b>%1$s</b> nest plus blacklisté]]></string> <string name="peertube_video_unblacklist"><![CDATA[Votre vidéo <b>%1$s</b> nest plus blacklisté]]></string>
<string name="peertube_video_report_success"><![CDATA[Votre rapport d'abus <b>%1$s</b> a été accepté]]></string> <string name="peertube_video_report_success"><![CDATA[Votre rapport dabus <b>%1$s</b> a été accepté]]></string>
<string name="peertube_video_abuse"><![CDATA[Nouveau signalement pour la vidéo : <b>%1$s</b>]]></string> <string name="peertube_video_abuse"><![CDATA[Nouveau signalement pour la vidéo : <b>%1$s</b>]]></string>
<string name="add_public_comment">Ajouter un commentaire public</string> <string name="add_public_comment">Ajouter un commentaire public</string>
<string name="send_comment">Envoyer un commentaire</string> <string name="send_comment">Envoyer un commentaire</string>

View File

@ -24,7 +24,6 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.util.Log;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -195,7 +194,6 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Log.v(Helper.TAG, "onCreate: " + savedInstanceState);
binding = ActivityMainBinding.inflate(getLayoutInflater()); binding = ActivityMainBinding.inflate(getLayoutInflater());
View view = binding.getRoot(); View view = binding.getRoot();
setContentView(view); setContentView(view);
@ -240,7 +238,6 @@ public class MainActivity extends AppCompatActivity {
mostLikedFragment.setArguments(bundle); mostLikedFragment.setArguments(bundle);
overviewFragment = new DisplayOverviewFragment(); overviewFragment = new DisplayOverviewFragment();
Log.v(Helper.TAG, "Helper.isLoggedIn(MainActivity.this): " + Helper.isLoggedIn(MainActivity.this));
if (!Helper.isLoggedIn(MainActivity.this)) { if (!Helper.isLoggedIn(MainActivity.this)) {
PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager()); PagerAdapter mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
binding.viewpager.setAdapter(mPagerAdapter); binding.viewpager.setAdapter(mPagerAdapter);
@ -632,7 +629,6 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onNewIntent(Intent intent) { protected void onNewIntent(Intent intent) {
Log.v(Helper.TAG, "onNewIntent: " + intent);
super.onNewIntent(intent); super.onNewIntent(intent);
if (intent == null) if (intent == null)
return; return;

View File

@ -193,6 +193,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
private String currentResolution; private String currentResolution;
private String currentCaption; private String currentCaption;
private boolean isRemote; private boolean isRemote;
private boolean willPlayFromIntent;
public static void hideKeyboard(Activity activity) { public static void hideKeyboard(Activity activity) {
if (activity != null && activity.getWindow() != null) { if (activity != null && activity.getWindow() != null) {
@ -301,7 +302,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
peertube = b.getParcelable("video"); peertube = b.getParcelable("video");
} }
manageIntentUrl(intent); willPlayFromIntent = manageIntentUrl(intent);
binding.peertubeDescriptionMore.setOnClickListener(v -> { binding.peertubeDescriptionMore.setOnClickListener(v -> {
if (show_more_content != null && peertube != null) { if (show_more_content != null && peertube != null) {
@ -411,12 +412,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} }
} }
}); });
if (peertube != null && sepiaSearch && peertube.getEmbedUrl() != null && Helper.isLoggedIn(PeertubeActivity.this)) { if (!willPlayFromIntent && peertube != null && sepiaSearch && peertube.getEmbedUrl() != null && Helper.isLoggedIn(PeertubeActivity.this)) {
SearchVM viewModelSearch = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class); SearchVM viewModelSearch = new ViewModelProvider(PeertubeActivity.this).get(SearchVM.class);
viewModelSearch.getVideos("0", peertube.getEmbedUrl()).observe(PeertubeActivity.this, this::manageVIewVideos); viewModelSearch.getVideos("0", peertube.getUuid()).observe(PeertubeActivity.this, this::manageVIewVideos);
} else { } else {
playVideo(); playVideo();
} }
registBroadcastReceiver(); registBroadcastReceiver();
if (autoFullscreen && autoPlay) { if (autoFullscreen && autoPlay) {
openFullscreenDialog(); openFullscreenDialog();
@ -446,7 +448,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} else { } else {
binding.videoSensitive.setVisibility(View.INVISIBLE); binding.videoSensitive.setVisibility(View.INVISIBLE);
} }
if (peertube.getUserHistory() != null) { if (player != null && peertube.getUserHistory() != null) {
player.seekTo(peertube.getUserHistory().getCurrentTime() * 1000); player.seekTo(peertube.getUserHistory().getCurrentTime() * 1000);
} }
sepiaSearch = false; sepiaSearch = false;
@ -529,10 +531,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} }
playVideo(); playVideo();
} }
manageIntentUrl(intent); willPlayFromIntent = manageIntentUrl(intent);
} }
private void manageIntentUrl(Intent intent) { private boolean manageIntentUrl(Intent intent) {
if (intent.getData() != null) { //Comes from a link if (intent.getData() != null) { //Comes from a link
String url = intent.getData().toString(); String url = intent.getData().toString();
Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})(\\?start=(\\d+[hH])?(\\d+[mM])?(\\d+[sS])?)?$"); Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})(\\?start=(\\d+[hH])?(\\d+[mM])?(\\d+[sS])?)?$");
@ -572,6 +574,17 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} }
TimelineVM viewModelTimeline = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class); TimelineVM viewModelTimeline = new ViewModelProvider(PeertubeActivity.this).get(TimelineVM.class);
viewModelTimeline.getVideo(peertubeInstance, peertube.getUuid(), false).observe(PeertubeActivity.this, this::manageVIewVideo); viewModelTimeline.getVideo(peertubeInstance, peertube.getUuid(), false).observe(PeertubeActivity.this, this::manageVIewVideo);
if (player != null) {
player.release();
}
if (comments != null && comments.size() > 0) {
int number = comments.size();
comments.clear();
commentListAdapter.notifyItemRangeRemoved(0, number);
}
fetchComments();
isRemote = true;
return true;
} else { } else {
Helper.forwardToAnotherApp(PeertubeActivity.this, intent); Helper.forwardToAnotherApp(PeertubeActivity.this, intent);
finish(); finish();
@ -581,6 +594,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
finish(); finish();
} }
} }
return false;
} }
private void playVideo() { private void playVideo() {
@ -735,7 +749,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} }
} }
@SuppressLint("ClickableViewAccessibility")
public void manageVIewVideo(APIResponse apiResponse) { public void manageVIewVideo(APIResponse apiResponse) {
if (!isRemote && apiResponse != null && apiResponse.getPeertubes() != null && apiResponse.getPeertubes().get(0).getErrorCode() == 1 && apiResponse.getPeertubes().get(0).getOriginUrl() != null) { if (!isRemote && apiResponse != null && apiResponse.getPeertubes() != null && apiResponse.getPeertubes().get(0).getErrorCode() == 1 && apiResponse.getPeertubes().get(0).getOriginUrl() != null) {
String url = apiResponse.getPeertubes().get(0).getOriginUrl(); String url = apiResponse.getPeertubes().get(0).getOriginUrl();
@ -758,7 +772,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
totalSeconds += 60 * minInt; totalSeconds += 60 * minInt;
} }
if (sec != null) { if (sec != null) {
secInt = Integer.parseInt(sec.replace("s", "")); secInt = Integer.parseInt(sec.replace("strue", ""));
totalSeconds += secInt; totalSeconds += secInt;
} }
@ -899,26 +913,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
alertDialog.show(); alertDialog.show();
}); });
if (peertube.isCommentsEnabled()) { fetchComments();
if (Helper.isLoggedIn(PeertubeActivity.this)) {
binding.postCommentButton.setVisibility(View.VISIBLE);
} else {
binding.postCommentButton.setVisibility(View.GONE);
}
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
commentViewModel.getThread(sepiaSearch ? peertubeInstance : null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment);
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
binding.writeCommentContainer.setVisibility(View.VISIBLE);
}
binding.peertubeComments.setVisibility(View.VISIBLE);
} else {
binding.postCommentButton.setVisibility(View.GONE);
binding.peertubeComments.setVisibility(View.GONE);
binding.writeCommentContainer.setVisibility(View.GONE);
binding.noActionText.setText(getString(R.string.comment_no_allowed_peertube));
binding.noAction.setVisibility(View.VISIBLE);
binding.writeCommentContainer.setVisibility(View.GONE);
}
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
setTitle(peertube.getName()); setTitle(peertube.getName());
@ -1161,6 +1156,30 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
} }
} }
private void fetchComments() {
if (peertube.isCommentsEnabled()) {
if (Helper.isLoggedIn(PeertubeActivity.this)) {
binding.postCommentButton.setVisibility(View.VISIBLE);
} else {
binding.postCommentButton.setVisibility(View.GONE);
}
CommentVM commentViewModel = new ViewModelProvider(PeertubeActivity.this).get(CommentVM.class);
commentViewModel.getThread(sepiaSearch ? peertubeInstance : null, videoUuid, max_id).observe(PeertubeActivity.this, this::manageVIewComment);
if (Helper.isLoggedIn(PeertubeActivity.this) && !sepiaSearch) {
binding.writeCommentContainer.setVisibility(View.VISIBLE);
}
binding.peertubeComments.setVisibility(View.VISIBLE);
binding.noAction.setVisibility(View.GONE);
} else {
binding.postCommentButton.setVisibility(View.GONE);
binding.peertubeComments.setVisibility(View.GONE);
binding.writeCommentContainer.setVisibility(View.GONE);
binding.noActionText.setText(getString(R.string.comment_no_allowed_peertube));
binding.noAction.setVisibility(View.VISIBLE);
binding.writeCommentContainer.setVisibility(View.GONE);
}
}
private void startStream(String videoURL, String streamingPlaylistsURLS, boolean autoPlay, long position, Uri subtitles, String lang, boolean promptNSFW) { private void startStream(String videoURL, String streamingPlaylistsURLS, boolean autoPlay, long position, Uri subtitles, String lang, boolean promptNSFW) {
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);

View File

@ -932,6 +932,7 @@ public class RetrofitPeertubeAPI {
APIResponse apiResponse = new APIResponse(); APIResponse apiResponse = new APIResponse();
try { try {
Response<VideoData> response = searchVideosCall.execute(); Response<VideoData> response = searchVideosCall.execute();
if (response.isSuccessful() && response.body() != null) { if (response.isSuccessful() && response.body() != null) {
apiResponse.setPeertubes(response.body().data); apiResponse.setPeertubes(response.body().data);
} else { } else {

View File

@ -22,17 +22,15 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager; import android.view.inputmethod.InputMethodManager;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -44,6 +42,7 @@ import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.client.data.ChannelData; import app.fedilab.fedilabtube.client.data.ChannelData;
import app.fedilab.fedilabtube.client.data.VideoData; import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.SepiaSearch; import app.fedilab.fedilabtube.client.entities.SepiaSearch;
import app.fedilab.fedilabtube.databinding.FragmentVideoBinding;
import app.fedilab.fedilabtube.drawer.AccountsHorizontalListAdapter; import app.fedilab.fedilabtube.drawer.AccountsHorizontalListAdapter;
import app.fedilab.fedilabtube.drawer.PeertubeAdapter; import app.fedilab.fedilabtube.drawer.PeertubeAdapter;
import app.fedilab.fedilabtube.helper.Helper; import app.fedilab.fedilabtube.helper.Helper;
@ -62,23 +61,24 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
private Context context; private Context context;
private PeertubeAdapter peertubeAdapater; private PeertubeAdapter peertubeAdapater;
private List<VideoData.Video> peertubes; private List<VideoData.Video> peertubes;
private RelativeLayout mainLoader, nextElementLoader, textviewNoAction;
private boolean firstLoad; private boolean firstLoad;
private SwipeRefreshLayout swipeRefreshLayout;
private SharedPreferences sharedpreferences; private SharedPreferences sharedpreferences;
private TextView textviewNoActionText;
private View rootView;
private RecyclerView lv_status;
private SepiaSearchVM viewModelSearch; private SepiaSearchVM viewModelSearch;
private SepiaSearch sepiaSearchVideo; private SepiaSearch sepiaSearchVideo;
private FragmentVideoBinding binding;
public DisplaySepiaSearchFragment() { public DisplaySepiaSearchFragment() {
} }
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_video, container, false); binding = FragmentVideoBinding.inflate(inflater, container, false);
return binding.getRoot();
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
peertubes = new ArrayList<>(); peertubes = new ArrayList<>();
context = getContext(); context = getContext();
@ -86,40 +86,35 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
if (bundle != null) { if (bundle != null) {
sepiaSearchVideo = bundle.getParcelable("sepiaSearchVideo"); sepiaSearchVideo = bundle.getParcelable("sepiaSearchVideo");
} }
lv_status = rootView.findViewById(R.id.lv_status);
flag_loading = true; flag_loading = true;
firstLoad = true; firstLoad = true;
assert context != null; assert context != null;
sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
swipeRefreshLayout = rootView.findViewById(R.id.swipeContainer);
mainLoader = rootView.findViewById(R.id.loader);
nextElementLoader = rootView.findViewById(R.id.loading_next_status); binding.loader.setVisibility(View.VISIBLE);
textviewNoAction = rootView.findViewById(R.id.no_action); binding.loadingNextVideos.setVisibility(View.GONE);
textviewNoActionText = rootView.findViewById(R.id.no_action_text);
mainLoader.setVisibility(View.VISIBLE);
nextElementLoader.setVisibility(View.GONE);
peertubeAdapater = new PeertubeAdapter(this.peertubes, SEPIA_SEARCH, true); peertubeAdapater = new PeertubeAdapter(this.peertubes, SEPIA_SEARCH, true);
lv_status.setAdapter(peertubeAdapater); binding.lvVideos.setAdapter(peertubeAdapater);
if (!Helper.isTablet(context)) { if (!Helper.isTablet(context)) {
mLayoutManager = new LinearLayoutManager(context); mLayoutManager = new LinearLayoutManager(context);
lv_status.setLayoutManager(mLayoutManager); binding.lvVideos.setLayoutManager(mLayoutManager);
} else { } else {
gLayoutManager = new GridLayoutManager(context, 2); gLayoutManager = new GridLayoutManager(context, 2);
int spanCount = (int) Helper.convertDpToPixel(2, context); int spanCount = (int) Helper.convertDpToPixel(2, context);
int spacing = (int) Helper.convertDpToPixel(5, context); int spacing = (int) Helper.convertDpToPixel(5, context);
lv_status.addItemDecoration(new GridSpacingItemDecoration(spanCount, spacing, true)); binding.lvVideos.addItemDecoration(new GridSpacingItemDecoration(spanCount, spacing, true));
lv_status.setLayoutManager(gLayoutManager); binding.lvVideos.setLayoutManager(gLayoutManager);
} }
viewModelSearch = new ViewModelProvider(DisplaySepiaSearchFragment.this).get(SepiaSearchVM.class); viewModelSearch = new ViewModelProvider(DisplaySepiaSearchFragment.this).get(SepiaSearchVM.class);
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh); binding.swipeContainer.setOnRefreshListener(this::pullToRefresh);
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { binding.lvVideos.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
if (mLayoutManager != null) { if (mLayoutManager != null) {
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
@ -130,10 +125,10 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
if (!flag_loading) { if (!flag_loading) {
flag_loading = true; flag_loading = true;
loadTimeline(); loadTimeline();
nextElementLoader.setVisibility(View.VISIBLE); binding.loadingNextVideos.setVisibility(View.VISIBLE);
} }
} else { } else {
nextElementLoader.setVisibility(View.GONE); binding.loadingNextVideos.setVisibility(View.GONE);
} }
} }
} else if (gLayoutManager != null) { } else if (gLayoutManager != null) {
@ -145,27 +140,26 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
if (!flag_loading) { if (!flag_loading) {
flag_loading = true; flag_loading = true;
loadTimeline(); loadTimeline();
nextElementLoader.setVisibility(View.VISIBLE); binding.loadingNextVideos.setVisibility(View.VISIBLE);
} }
} else { } else {
nextElementLoader.setVisibility(View.GONE); binding.loadingNextVideos.setVisibility(View.GONE);
} }
} }
} }
} }
}); });
loadTimeline(); loadTimeline();
return rootView;
} }
@Override @Override
public void onPause() { public void onPause() {
super.onPause(); super.onPause();
if (swipeRefreshLayout != null) { if (binding.swipeContainer != null) {
swipeRefreshLayout.setEnabled(false); binding.swipeContainer.setEnabled(false);
swipeRefreshLayout.setRefreshing(false); binding.swipeContainer.setRefreshing(false);
swipeRefreshLayout.clearAnimation(); binding.swipeContainer.clearAnimation();
} }
if (getActivity() != null) { if (getActivity() != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
@ -202,12 +196,12 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
private void manageVIewVideos(VideoData videoData) { private void manageVIewVideos(VideoData videoData) {
//hide loaders //hide loaders
mainLoader.setVisibility(View.GONE); binding.loader.setVisibility(View.GONE);
nextElementLoader.setVisibility(View.GONE); binding.loadingNextVideos.setVisibility(View.GONE);
//handle other API error //handle other API error
if (videoData == null || videoData.data == null) { if (videoData == null || videoData.data == null) {
Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show(); Toasty.error(context, context.getString(R.string.toast_error), Toast.LENGTH_LONG).show();
swipeRefreshLayout.setRefreshing(false); binding.swipeContainer.setRefreshing(false);
flag_loading = false; flag_loading = false;
return; return;
} }
@ -228,16 +222,16 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
//If no item were inserted previously the adapter is created //If no item were inserted previously the adapter is created
if (previousPosition == 0) { if (previousPosition == 0) {
peertubeAdapater = new PeertubeAdapter(this.peertubes, SEPIA_SEARCH, true); peertubeAdapater = new PeertubeAdapter(this.peertubes, SEPIA_SEARCH, true);
lv_status.setAdapter(peertubeAdapater); binding.lvVideos.setAdapter(peertubeAdapater);
} else } else
peertubeAdapater.notifyItemRangeInserted(previousPosition, videoData.data.size()); peertubeAdapater.notifyItemRangeInserted(previousPosition, videoData.data.size());
//remove handlers //remove handlers
swipeRefreshLayout.setRefreshing(false); binding.swipeContainer.setRefreshing(false);
textviewNoAction.setVisibility(View.GONE); binding.noAction.setVisibility(View.GONE);
if (firstLoad && (videoData.data == null || videoData.data.size() == 0)) { if (firstLoad && (videoData.data == null || videoData.data.size() == 0)) {
textviewNoActionText.setText(R.string.no_video_to_display); binding.noActionText.setText(R.string.no_video_to_display);
textviewNoAction.setVisibility(View.VISIBLE); binding.noAction.setVisibility(View.VISIBLE);
} }
flag_loading = false; flag_loading = false;
firstLoad = false; firstLoad = false;
@ -245,20 +239,19 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
@Override @Override
public void onDestroyView() { public void onDestroyView() {
if (lv_status != null) { if (binding.lvVideos != null) {
try { try {
lv_status.setAdapter(null); binding.lvVideos.setAdapter(null);
} catch (Exception ignored) { } catch (Exception ignored) {
} }
} }
super.onDestroyView(); super.onDestroyView();
rootView = null;
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
swipeRefreshLayout.setEnabled(true); binding.swipeContainer.setEnabled(true);
} }