diff --git a/app/src/acad/res/values/strings.xml b/app/src/acad/res/values/strings.xml index c3612d1..a55fb56 100644 --- a/app/src/acad/res/values/strings.xml +++ b/app/src/acad/res/values/strings.xml @@ -299,6 +299,7 @@ Faible Voulez-vous vous désabonner de ce compte ? + Aucune liste de lecture ! Titre de la vidéo Rejoignez Peertube J\'ai au moins 16 ans et je suis d\'accord avec les %1$s de cette instance diff --git a/app/src/full/res/values/strings.xml b/app/src/full/res/values/strings.xml index d34fdfa..ec5dc08 100644 --- a/app/src/full/res/values/strings.xml +++ b/app/src/full/res/values/strings.xml @@ -292,6 +292,7 @@ Open the attached file with TubeLab Playlists + No playlists Display name You don\'t have any playlists. Tap on the \"+\" icon to add a new playlist You must provide a display name! diff --git a/app/src/main/java/app/fedilab/fedilabtube/AllLocalPlaylistsActivity.java b/app/src/main/java/app/fedilab/fedilabtube/AllLocalPlaylistsActivity.java index 09fd662..775edc5 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/AllLocalPlaylistsActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/AllLocalPlaylistsActivity.java @@ -19,7 +19,7 @@ import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.RelativeLayout; -import android.widget.Toast; +import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.lifecycle.ViewModelProvider; @@ -35,7 +35,6 @@ import app.fedilab.fedilabtube.client.data.PlaylistData.Playlist; import app.fedilab.fedilabtube.client.data.VideoPlaylistData; import app.fedilab.fedilabtube.drawer.PlaylistAdapter; import app.fedilab.fedilabtube.viewmodel.PlaylistsVM; -import es.dmoral.toasty.Toasty; public class AllLocalPlaylistsActivity extends AppCompatActivity implements PlaylistAdapter.AllPlaylistRemoved { @@ -69,10 +68,12 @@ public class AllLocalPlaylistsActivity extends AppCompatActivity implements Play FloatingActionButton add_new = findViewById(R.id.add_new); add_new.setVisibility(View.GONE); - + TextView no_action_text = findViewById(R.id.no_action_text); + no_action_text.setText(R.string.no_playlist); playlists = new ArrayList<>(); RecyclerView lv_playlist = findViewById(R.id.lv_playlist); playlistAdapter = new PlaylistAdapter(playlists, true); + playlistAdapter.allPlaylistRemoved = this; lv_playlist.setAdapter(playlistAdapter); LinearLayoutManager mLayoutManager = new LinearLayoutManager(AllLocalPlaylistsActivity.this); lv_playlist.setLayoutManager(mLayoutManager); @@ -97,7 +98,7 @@ public class AllLocalPlaylistsActivity extends AppCompatActivity implements Play public void manageVIewPlaylists(List videoPlaylistExports) { mainLoader.setVisibility(View.GONE); if (videoPlaylistExports == null) { - Toasty.error(AllLocalPlaylistsActivity.this, getString(R.string.toast_error), Toast.LENGTH_LONG).show(); + textviewNoAction.setVisibility(View.VISIBLE); return; } if (videoPlaylistExports.size() > 0) { diff --git a/app/src/main/java/app/fedilab/fedilabtube/AllPlaylistsActivity.java b/app/src/main/java/app/fedilab/fedilabtube/AllPlaylistsActivity.java index 493cefe..3fb4710 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/AllPlaylistsActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/AllPlaylistsActivity.java @@ -112,6 +112,7 @@ public class AllPlaylistsActivity extends AppCompatActivity implements PlaylistA playlists = new ArrayList<>(); RecyclerView lv_playlist = findViewById(R.id.lv_playlist); playlistAdapter = new PlaylistAdapter(playlists, false); + playlistAdapter.allPlaylistRemoved = this; lv_playlist.setAdapter(playlistAdapter); LinearLayoutManager mLayoutManager = new LinearLayoutManager(AllPlaylistsActivity.this); lv_playlist.setLayoutManager(mLayoutManager); diff --git a/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayVideosFragment.java b/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayVideosFragment.java index 14e7599..20c2d81 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayVideosFragment.java +++ b/app/src/main/java/app/fedilab/fedilabtube/fragment/DisplayVideosFragment.java @@ -65,6 +65,8 @@ import app.fedilab.fedilabtube.viewmodel.SearchVM; import app.fedilab.fedilabtube.viewmodel.TimelineVM; import es.dmoral.toasty.Toasty; +import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.VIDEOS_IN_LOCAL_PLAYLIST; + public class DisplayVideosFragment extends Fragment implements AccountsHorizontalListAdapter.EventListener, PeertubeAdapter.RelationShipListener, PeertubeAdapter.PlaylistListener { @@ -187,57 +189,59 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta }); - lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { - public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { - if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) { - if (dy > 0) { - if (check_ScrollingUp) { - top_account_container.setVisibility(View.GONE); - final Handler handler = new Handler(); - handler.postDelayed(() -> check_ScrollingUp = false, 300); + if (type != VIDEOS_IN_LOCAL_PLAYLIST) { + lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() { + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) { + if (dy > 0) { + if (check_ScrollingUp) { + top_account_container.setVisibility(View.GONE); + final Handler handler = new Handler(); + handler.postDelayed(() -> check_ScrollingUp = false, 300); + } + } else { + if (!check_ScrollingUp) { + top_account_container.setVisibility(View.VISIBLE); + final Handler handler = new Handler(); + handler.postDelayed(() -> check_ScrollingUp = true, 300); + } } - } else { - if (!check_ScrollingUp) { - top_account_container.setVisibility(View.VISIBLE); - final Handler handler = new Handler(); - handler.postDelayed(() -> check_ScrollingUp = true, 300); + } + if (mLayoutManager != null) { + int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); + if (dy > 0) { + int visibleItemCount = mLayoutManager.getChildCount(); + int totalItemCount = mLayoutManager.getItemCount(); + if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) { + if (!flag_loading) { + flag_loading = true; + loadTimeline(max_id); + nextElementLoader.setVisibility(View.VISIBLE); + } + } else { + nextElementLoader.setVisibility(View.GONE); + } + } + } else if (gLayoutManager != null) { + int firstVisibleItem = gLayoutManager.findFirstVisibleItemPosition(); + if (dy > 0) { + int visibleItemCount = gLayoutManager.getChildCount(); + int totalItemCount = gLayoutManager.getItemCount(); + if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) { + if (!flag_loading) { + flag_loading = true; + loadTimeline(max_id); + nextElementLoader.setVisibility(View.VISIBLE); + } + } else { + nextElementLoader.setVisibility(View.GONE); + } } } } - if (mLayoutManager != null) { - int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition(); - if (dy > 0) { - int visibleItemCount = mLayoutManager.getChildCount(); - int totalItemCount = mLayoutManager.getItemCount(); - if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) { - if (!flag_loading) { - flag_loading = true; - loadTimeline(max_id); - nextElementLoader.setVisibility(View.VISIBLE); - } - } else { - nextElementLoader.setVisibility(View.GONE); - } - } - } else if (gLayoutManager != null) { - int firstVisibleItem = gLayoutManager.findFirstVisibleItemPosition(); - if (dy > 0) { - int visibleItemCount = gLayoutManager.getChildCount(); - int totalItemCount = gLayoutManager.getItemCount(); - if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) { - if (!flag_loading) { - flag_loading = true; - loadTimeline(max_id); - nextElementLoader.setVisibility(View.VISIBLE); - } - } else { - nextElementLoader.setVisibility(View.GONE); - } - } - } - } - }); + }); + } if (type == TimelineVM.TimelineType.SUBSCRIBTIONS) { AccountsVM viewModel = new ViewModelProvider(this).get(AccountsVM.class); viewModel.getAccounts(RetrofitPeertubeAPI.DataType.SUBSCRIBER, max_id).observe(DisplayVideosFragment.this.requireActivity(), this::manageViewAccounts); @@ -506,7 +510,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta viewModelFeeds.getVideosInChannel(sepiaSearch ? remoteInstance : null, channelId, max_id).observe(this.requireActivity(), this::manageVIewVideos); } else if (type == TimelineVM.TimelineType.VIDEOS_IN_PLAYLIST) { viewModelFeeds.loadVideosInPlaylist(playlistId, max_id).observe(this.requireActivity(), this::manageVIewVideos); - } else if (type == TimelineVM.TimelineType.VIDEOS_IN_LOCAL_PLAYLIST) { + } else if (type == VIDEOS_IN_LOCAL_PLAYLIST) { viewModelFeeds.loadVideosInLocalPlaylist(playlistId).observe(this.requireActivity(), this::manageVIewVideos); } else if (type == TimelineVM.TimelineType.HISTORY) { viewModelFeeds.getVideoHistory(max_id, startDate, endDate).observe(this.requireActivity(), this::manageVIewVideos);