1
0
mirror of https://framagit.org/tom79/fedilab-tube synced 2025-06-05 21:09:11 +02:00

5 Commits

Author SHA1 Message Date
f2fddfb16c typo 2020-12-13 15:41:26 +01:00
05300682c1 Fixes 2020-12-13 15:41:00 +01:00
a3714a4ecf Fix issue #143 2020-12-13 11:48:56 +01:00
500584b9ef Fix some issues 2020-12-13 09:32:33 +01:00
33ac822957 fix issue #142 2020-12-13 08:53:22 +01:00
8 changed files with 75 additions and 35 deletions

View File

@ -9,8 +9,8 @@ android {
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 30 versionCode 31
versionName "1.10.0" versionName "1.10.1"
multiDexEnabled true multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@ -0,0 +1,13 @@
Fixes some issues on 1.10.0 (Crashes when adding a playlist + bad behavior when subscribing to remote accounts)
Added:
- Chromecast support (default disabled)
- Detect start time in URLs
Fixed:
- Typo
- Comment feature when logged out
- Full-screen breaks
- Crashes with the download button on live streams
- Jumps with full-screen and vertical videos
- Abuse report notifications clickable

View File

@ -0,0 +1,16 @@
Fixes some issues on 1.10.0 (Crashes when adding a playlist + bad behavior when subscribing to remote accounts)
Added:
- Chromecast support (default disabled)
- Detect start time in URLs
Changed:
- Instance picker supports URLs
Fixed:
- Typo
- Comment feature when logged out
- Full-screen breaks
- Crashes with the download button on live streams
- Jumps with full-screen and vertical videos
- Abuse report notifications clickable
- Remote channel subscriptions need twice clicks

View File

@ -197,7 +197,7 @@ public class AllPlaylistsActivity extends AppCompatActivity implements PlaylistA
intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes); intent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes);
startActivityForResult(intent, PICK_AVATAR); startActivityForResult(intent, PICK_AVATAR);
}); });
Helper.loadGiF(AllPlaylistsActivity.this, playlistParam.getThumbnailPath(), bindingDialog.profilePicture); Helper.loadGiF(AllPlaylistsActivity.this, playlistParam != null ? playlistParam.getThumbnailPath() : null, bindingDialog.profilePicture);
alertDialog.setOnShowListener(dialogInterface -> { alertDialog.setOnShowListener(dialogInterface -> {
Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); Button button = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);

View File

@ -416,7 +416,6 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
setTitleCustom(R.string.title_discover); setTitleCustom(R.string.title_discover);
if (Helper.isLoggedIn(MainActivity.this)) { if (Helper.isLoggedIn(MainActivity.this)) {
navView.inflateMenu(R.menu.bottom_nav_menu_connected); navView.inflateMenu(R.menu.bottom_nav_menu_connected);
refreshToken(); refreshToken();
@ -566,25 +565,7 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
oauthParams.setAccess_token(account.getToken()); oauthParams.setAccess_token(account.getToken());
try { try {
Token token = new RetrofitPeertubeAPI(MainActivity.this).manageToken(oauthParams); Token token = new RetrofitPeertubeAPI(MainActivity.this).manageToken(oauthParams);
if (token == null && Helper.instanceOnline(instance)) { if (token == null) {
runOnUiThread(() -> {
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_bld.setTitle(R.string.refresh_token_failed);
alt_bld.setMessage(R.string.refresh_token_failed_message);
alt_bld.setNegativeButton(R.string.action_logout, (dialog, id) -> {
dialog.dismiss();
Helper.logoutCurrentUser(MainActivity.this, finalAccount);
});
alt_bld.setPositiveButton(R.string._retry, (dialog, id) -> {
dialog.dismiss();
refreshToken();
});
AlertDialog alert = alt_bld.create();
alert.show();
});
return;
} else if (token == null) {
return; return;
} }
runOnUiThread(() -> { runOnUiThread(() -> {
@ -622,7 +603,22 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen
} }
instanceConfig = new RetrofitPeertubeAPI(MainActivity.this).getConfigInstance(); instanceConfig = new RetrofitPeertubeAPI(MainActivity.this).getConfigInstance();
} catch (Error error) { } catch (Error error) {
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, finalAccount)); runOnUiThread(() -> {
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_bld.setTitle(R.string.refresh_token_failed);
alt_bld.setMessage(R.string.refresh_token_failed_message);
alt_bld.setNegativeButton(R.string.action_logout, (dialog, id) -> {
dialog.dismiss();
Helper.logoutCurrentUser(MainActivity.this, finalAccount);
});
alt_bld.setPositiveButton(R.string._retry, (dialog, id) -> {
dialog.dismiss();
refreshToken();
});
AlertDialog alert = alt_bld.create();
alert.show();
});
error.printStackTrace(); error.printStackTrace();
} }
} }

View File

@ -55,6 +55,8 @@ import app.fedilab.fedilabtube.R;
import app.fedilab.fedilabtube.ShowChannelActivity; import app.fedilab.fedilabtube.ShowChannelActivity;
import app.fedilab.fedilabtube.client.APIResponse; import app.fedilab.fedilabtube.client.APIResponse;
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI; import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
import app.fedilab.fedilabtube.client.data.AccountData;
import app.fedilab.fedilabtube.client.data.ChannelData;
import app.fedilab.fedilabtube.client.data.PlaylistData; import app.fedilab.fedilabtube.client.data.PlaylistData;
import app.fedilab.fedilabtube.client.data.VideoData; import app.fedilab.fedilabtube.client.data.VideoData;
import app.fedilab.fedilabtube.client.entities.PlaylistExist; import app.fedilab.fedilabtube.client.entities.PlaylistExist;
@ -82,12 +84,15 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
private Context context; private Context context;
private TimelineVM.TimelineType timelineType; private TimelineVM.TimelineType timelineType;
private boolean sepiaSearch; private boolean sepiaSearch;
private ChannelData.Channel forChannel;
private AccountData.Account forAccount;
public PeertubeAdapter(List<VideoData.Video> videos, TimelineVM.TimelineType timelineType, boolean sepiaSearch, ChannelData.Channel forChannel, AccountData.Account forAccount) {
public PeertubeAdapter(List<VideoData.Video> videos, TimelineVM.TimelineType timelineType, boolean sepiaSearch) {
this.videos = videos; this.videos = videos;
this.timelineType = timelineType; this.timelineType = timelineType;
this.sepiaSearch = sepiaSearch || timelineType == SEPIA_SEARCH; this.sepiaSearch = sepiaSearch || timelineType == SEPIA_SEARCH;
this.forChannel = forChannel;
this.forAccount = forAccount;
} }
@ -127,11 +132,17 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
ownVideos = Helper.isVideoOwner(context, video); ownVideos = Helper.isVideoOwner(context, video);
} }
String instance = null; String instance = null;
if (sepiaSearch) { if (sepiaSearch) {
instance = video.getAccount().getHost(); instance = video.getAccount().getHost();
} else if (forChannel != null) {
instance = forChannel.getHost();
} else if (forAccount != null) {
instance = forAccount.getHost();
} }
holder.binding.peertubeAccountName.setText(video.getChannel().getAcct()); holder.binding.peertubeAccountName.setText(video.getChannel().getAcct());
Helper.loadGiF(context, instance, video.getChannel().getAvatar() != null ? video.getChannel().getAvatar().getPath() : null, holder.binding.peertubeProfile); Helper.loadGiF(context, instance, video.getChannel().getAvatar() != null ? video.getChannel().getAvatar().getPath() : null, holder.binding.peertubeProfile);
@ -172,8 +183,8 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
Intent intent = new Intent(context, ShowChannelActivity.class); Intent intent = new Intent(context, ShowChannelActivity.class);
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putParcelable("channel", video.getChannel()); b.putParcelable("channel", video.getChannel());
b.putBoolean("sepia_search", sepiaSearch); b.putBoolean("sepia_search", sepiaSearch || forChannel != null);
if (sepiaSearch) { if (sepiaSearch || forChannel != null) {
b.putString("peertube_instance", video.getAccount().getHost()); b.putString("peertube_instance", video.getAccount().getHost());
} }
intent.putExtras(b); intent.putExtras(b);

View File

@ -96,7 +96,7 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
binding.loader.setVisibility(View.VISIBLE); binding.loader.setVisibility(View.VISIBLE);
binding.loadingNextVideos.setVisibility(View.GONE); binding.loadingNextVideos.setVisibility(View.GONE);
peertubeAdapater = new PeertubeAdapter(this.peertubes, SEPIA_SEARCH, true); peertubeAdapater = new PeertubeAdapter(this.peertubes, SEPIA_SEARCH, true, null, null);
binding.lvVideos.setAdapter(peertubeAdapater); binding.lvVideos.setAdapter(peertubeAdapater);
@ -221,7 +221,7 @@ 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, null, null);
binding.lvVideos.setAdapter(peertubeAdapater); binding.lvVideos.setAdapter(peertubeAdapater);
} else } else
peertubeAdapater.notifyItemRangeInserted(previousPosition, videoData.data.size()); peertubeAdapater.notifyItemRangeInserted(previousPosition, videoData.data.size());

View File

@ -70,7 +70,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
private LinearLayoutManager mLayoutManager; private LinearLayoutManager mLayoutManager;
private GridLayoutManager gLayoutManager; private GridLayoutManager gLayoutManager;
private boolean flag_loading; private boolean flag_loading, flag_loading_account;
private Context context; private Context context;
private PeertubeAdapter peertubeAdapater; private PeertubeAdapter peertubeAdapater;
private AccountsHorizontalListAdapter accountsHorizontalListAdapter; private AccountsHorizontalListAdapter accountsHorizontalListAdapter;
@ -136,13 +136,14 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
//forChannel = type == TimelineVM.TimelineType.ACCOUNT_VIDEOS ? channelId : null; //forChannel = type == TimelineVM.TimelineType.ACCOUNT_VIDEOS ? channelId : null;
max_id_accounts = null; max_id_accounts = null;
flag_loading = true; flag_loading = true;
flag_loading_account = false;
firstLoad = true; firstLoad = true;
check_ScrollingUp = false; check_ScrollingUp = false;
binding.loader.setVisibility(View.VISIBLE); binding.loader.setVisibility(View.VISIBLE);
binding.loadingNextVideos.setVisibility(View.GONE); binding.loadingNextVideos.setVisibility(View.GONE);
peertubeAdapater = new PeertubeAdapter(this.peertubes, type, sepiaSearch); peertubeAdapater = new PeertubeAdapter(this.peertubes, type, sepiaSearch, forChannel, account);
peertubeAdapater.playlistListener = this; peertubeAdapater.playlistListener = this;
peertubeAdapater.relationShipListener = this; peertubeAdapater.relationShipListener = this;
binding.lvVideos.setAdapter(peertubeAdapater); binding.lvVideos.setAdapter(peertubeAdapater);
@ -152,6 +153,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
= new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
binding.lvAccounts.setLayoutManager(layoutManager); binding.lvAccounts.setLayoutManager(layoutManager);
binding.lvAccounts.setAdapter(accountsHorizontalListAdapter); binding.lvAccounts.setAdapter(accountsHorizontalListAdapter);
if (!Helper.isTablet(context)) { if (!Helper.isTablet(context)) {
mLayoutManager = new LinearLayoutManager(context); mLayoutManager = new LinearLayoutManager(context);
binding.lvVideos.setLayoutManager(mLayoutManager); binding.lvVideos.setLayoutManager(mLayoutManager);
@ -170,10 +172,11 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
binding.lvAccounts.addOnScrollListener(new RecyclerView.OnScrollListener() { binding.lvAccounts.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
int firstVisibleItem = layoutManager.findFirstVisibleItemPosition(); int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
if (dy > 0) { if (dx > 0) {
int visibleItemCount = layoutManager.getChildCount(); int visibleItemCount = layoutManager.getChildCount();
int totalItemCount = layoutManager.getItemCount(); int totalItemCount = layoutManager.getItemCount();
if (firstVisibleItem + visibleItemCount == totalItemCount && context != null) { if (firstVisibleItem + visibleItemCount == totalItemCount && context != null && !flag_loading_account) {
flag_loading_account = true;
viewModelAccounts.getAccounts(RetrofitPeertubeAPI.DataType.SUBSCRIBER, max_id_accounts).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageViewAccounts(apiResponse)); viewModelAccounts.getAccounts(RetrofitPeertubeAPI.DataType.SUBSCRIBER, max_id_accounts).observe(DisplayVideosFragment.this.requireActivity(), apiResponse -> manageViewAccounts(apiResponse));
} }
} }
@ -294,6 +297,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
private void manageViewAccounts(APIResponse apiResponse) { private void manageViewAccounts(APIResponse apiResponse) {
flag_loading_account = false;
if (apiResponse != null && apiResponse.getChannels() != null && apiResponse.getChannels().size() > 0) { if (apiResponse != null && apiResponse.getChannels() != null && apiResponse.getChannels().size() > 0) {
if (binding.topAccountContainer.getVisibility() == View.GONE) { if (binding.topAccountContainer.getVisibility() == View.GONE) {
binding.topAccountContainer.setVisibility(View.VISIBLE); binding.topAccountContainer.setVisibility(View.VISIBLE);
@ -356,7 +360,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
//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, type, sepiaSearch); peertubeAdapater = new PeertubeAdapter(this.peertubes, type, sepiaSearch, forChannel, account);
peertubeAdapater.playlistListener = DisplayVideosFragment.this; peertubeAdapater.playlistListener = DisplayVideosFragment.this;
peertubeAdapater.relationShipListener = DisplayVideosFragment.this; peertubeAdapater.relationShipListener = DisplayVideosFragment.this;
binding.lvVideos.setAdapter(peertubeAdapater); binding.lvVideos.setAdapter(peertubeAdapater);