mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-03-07 13:07:37 +01:00
Release 1.5.1
This commit is contained in:
parent
e17c7fb01d
commit
74feb7e8f0
app
build.gradle
src/main
java/app/fedilab/fedilabtube
FedilabTube.javaLoginActivity.javaMainActivity.javaPeertubeActivity.javaPeertubeRegisterActivity.javaSepiaSearchActivity.javaShowAccountActivity.java
client
PeertubeService.javaRetrofitPeertubeAPI.javaRetrofitSepiaSearchAPI.javaSepiaSearchService.java
entities
drawer
AccountsHorizontalListAdapter.javaAccountsListAdapter.javaChannelListAdapter.javaCommentListAdapter.javaInstanceAdapter.javaOwnAccountsAdapter.javaPeertubeAdapter.javaPeertubeNotificationsListAdapter.javaPlaylistAdapter.java
fragment
DisplayNotificationsFragment.javaDisplayOverviewFragment.javaDisplaySepiaSearchFragment.javaDisplayVideosFragment.java
helper
sqlite
viewmodel
webview
res/menu
@ -11,8 +11,8 @@ android {
|
||||
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 19
|
||||
versionName "1.5.0"
|
||||
versionCode 20
|
||||
versionName "1.5.1"
|
||||
multiDexEnabled true
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
@ -39,6 +39,4 @@ public class FedilabTube extends MultiDexApplication {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -94,6 +94,11 @@ public class LoginActivity extends AppCompatActivity {
|
||||
login_passwd = findViewById(R.id.login_passwd);
|
||||
|
||||
if (Helper.isTablet(LoginActivity.this)) {
|
||||
|
||||
ViewGroup.LayoutParams layoutParamsI = login_instance_container.getLayoutParams();
|
||||
layoutParamsI.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
||||
login_instance_container.setLayoutParams(layoutParamsI);
|
||||
|
||||
TextInputLayout login_uid_container = findViewById(R.id.login_uid_container);
|
||||
ViewGroup.LayoutParams layoutParamsU = login_uid_container.getLayoutParams();
|
||||
layoutParamsU.width = (int) Helper.convertDpToPixel(300, LoginActivity.this);
|
||||
|
@ -237,6 +237,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
} catch (Error error) {
|
||||
runOnUiThread(() -> Helper.logoutCurrentUser(MainActivity.this, account));
|
||||
error.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
|
@ -158,6 +158,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
private ActivityPeertubeBinding binding;
|
||||
private List<Comment> commentsThread;
|
||||
private BroadcastReceiver mPowerKeyReceiver = null;
|
||||
private boolean isPlayInMinimized;
|
||||
|
||||
public static void hideKeyboard(Activity activity) {
|
||||
if (activity != null && activity.getWindow() != null) {
|
||||
@ -167,7 +168,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
imm.hideSoftInputFromWindow(activity.getWindow().getDecorView().getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
private boolean isPlayInMinimized;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@ -307,7 +307,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void manageVIewVideos(APIResponse apiResponse) {
|
||||
if (apiResponse == null || apiResponse.getPeertubes() == null || apiResponse.getPeertubes().size() == 0) {
|
||||
playVideo();
|
||||
@ -661,6 +660,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
if (captions == null) {
|
||||
popup.getMenu().findItem(R.id.action_captions).setEnabled(false);
|
||||
}
|
||||
if (!isMyVideo) {
|
||||
popup.getMenu().findItem(R.id.action_edit).setVisible(false);
|
||||
}
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_download) {
|
||||
@ -700,7 +702,17 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, extra_text);
|
||||
sendIntent.setType("text/plain");
|
||||
try {
|
||||
startActivity(Intent.createChooser(sendIntent, getString(R.string.share_with)));
|
||||
} catch (Exception e) {
|
||||
Toasty.error(PeertubeActivity.this, getString(R.string.toast_error), Toasty.LENGTH_LONG).show();
|
||||
}
|
||||
} else if (itemId == R.id.action_edit) {
|
||||
Intent intent = new Intent(PeertubeActivity.this, PeertubeEditUploadActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("video_id", peertube.getUuid());
|
||||
intent.putExtras(b);
|
||||
startActivity(intent);
|
||||
} else if (itemId == R.id.action_captions) {
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(PeertubeActivity.this);
|
||||
if (captions == null) {
|
||||
@ -876,12 +888,10 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
if (apiLevel >= 7) {
|
||||
try {
|
||||
getApplicationContext().unregisterReceiver(mPowerKeyReceiver);
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
mPowerKeyReceiver = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
getApplicationContext().unregisterReceiver(mPowerKeyReceiver);
|
||||
mPowerKeyReceiver = null;
|
||||
}
|
||||
@ -1003,7 +1013,6 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void initFullscreenDialog() {
|
||||
|
||||
fullScreenDialog = new Dialog(this, android.R.style.Theme_Black_NoTitleBar_Fullscreen) {
|
||||
@ -1052,13 +1061,17 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
0);
|
||||
animate.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
binding.peertubeInformationContainer.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
});
|
||||
animate.setDuration(500);
|
||||
binding.addCommentWriteReply.setText(String.format("@%s ", comment.getAccount().getAcct()));
|
||||
@ -1092,13 +1105,17 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
0);
|
||||
animate.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
public void onAnimationStart(Animation animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
binding.replyThread.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
public void onAnimationRepeat(Animation animation) {
|
||||
}
|
||||
});
|
||||
animate.setDuration(500);
|
||||
binding.replyThread.startAnimation(animate);
|
||||
@ -1244,6 +1261,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void manageVIewPlaylist(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null || apiResponse.getVideoExistPlaylist() == null) {
|
||||
return;
|
||||
|
@ -177,6 +177,9 @@ public class PeertubeRegisterActivity extends AppCompatActivity {
|
||||
String host = emailArray[1];
|
||||
instance = Helper.getPeertubeUrl(host);
|
||||
}
|
||||
if (instance != null) {
|
||||
instance = instance.toLowerCase().trim();
|
||||
}
|
||||
|
||||
AccountCreation accountCreation = new AccountCreation();
|
||||
accountCreation.setEmail(email.getText().toString().trim());
|
||||
|
@ -140,7 +140,6 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
|
||||
|
||||
Spinner sort_by = findViewById(R.id.sort_by);
|
||||
ArrayAdapter<String> adapterSortBy = new ArrayAdapter<>(SepiaSearchActivity.this,
|
||||
android.R.layout.simple_spinner_dropdown_item, getResources().getStringArray(R.array.sort_by_array));
|
||||
@ -282,7 +281,6 @@ public class SepiaSearchActivity extends AppCompatActivity {
|
||||
});
|
||||
|
||||
|
||||
|
||||
searchBar = findViewById(R.id.searchBar);
|
||||
|
||||
searchBar.setOnSearchActionListener(new MaterialSearchBar.OnSearchActionListener() {
|
||||
|
@ -42,11 +42,9 @@ import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||
import app.fedilab.fedilabtube.fragment.DisplayAccountsFragment;
|
||||
import app.fedilab.fedilabtube.fragment.DisplayChannelsFragment;
|
||||
import app.fedilab.fedilabtube.fragment.DisplayVideosFragment;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
@ -17,7 +17,6 @@ package app.fedilab.fedilabtube.client;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import app.fedilab.fedilabtube.client.data.AccountData;
|
||||
import app.fedilab.fedilabtube.client.data.BlockData;
|
||||
import app.fedilab.fedilabtube.client.data.CaptionData;
|
||||
|
@ -85,9 +85,9 @@ public class RetrofitPeertubeAPI {
|
||||
private final String finalUrl;
|
||||
private final Context _context;
|
||||
private final String instance;
|
||||
private final String count;
|
||||
private String token;
|
||||
private Set<String> selection;
|
||||
private final String count;
|
||||
|
||||
public RetrofitPeertubeAPI(Context context) {
|
||||
_context = context;
|
||||
|
@ -21,7 +21,6 @@ import java.util.Locale;
|
||||
|
||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
@ -30,7 +29,7 @@ import retrofit2.converter.gson.GsonConverterFactory;
|
||||
public class RetrofitSepiaSearchAPI {
|
||||
|
||||
|
||||
private String finalUrl;
|
||||
private final String finalUrl;
|
||||
|
||||
|
||||
public RetrofitSepiaSearchAPI() {
|
||||
@ -47,6 +46,7 @@ public class RetrofitSepiaSearchAPI {
|
||||
|
||||
/**
|
||||
* Return videos for a sepia search
|
||||
*
|
||||
* @param sepiaSearch SepiaSearch
|
||||
* @return VideoData
|
||||
*/
|
||||
|
@ -14,7 +14,6 @@ package app.fedilab.fedilabtube.client;
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.fedilabtube.client.data.ChannelData;
|
||||
|
@ -26,6 +26,17 @@ import java.util.List;
|
||||
@SuppressWarnings("unused")
|
||||
public class SepiaSearch implements Parcelable {
|
||||
|
||||
public static final Creator<SepiaSearch> CREATOR = new Creator<SepiaSearch>() {
|
||||
@Override
|
||||
public SepiaSearch createFromParcel(Parcel source) {
|
||||
return new SepiaSearch(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SepiaSearch[] newArray(int size) {
|
||||
return new SepiaSearch[size];
|
||||
}
|
||||
};
|
||||
@SerializedName("start")
|
||||
private String start;
|
||||
@SerializedName("count")
|
||||
@ -53,7 +64,27 @@ public class SepiaSearch implements Parcelable {
|
||||
@SerializedName("sort")
|
||||
private String sort;
|
||||
|
||||
public SepiaSearch() {
|
||||
}
|
||||
|
||||
protected SepiaSearch(Parcel in) {
|
||||
this.start = in.readString();
|
||||
this.count = in.readString();
|
||||
this.search = in.readString();
|
||||
this.durationMax = in.readInt();
|
||||
this.durationMin = in.readInt();
|
||||
long tmpStartDate = in.readLong();
|
||||
this.startDate = tmpStartDate == -1 ? null : new Date(tmpStartDate);
|
||||
this.boostLanguages = in.createStringArrayList();
|
||||
this.categoryOneOf = new ArrayList<>();
|
||||
in.readList(this.categoryOneOf, Integer.class.getClassLoader());
|
||||
this.licenceOneOf = new ArrayList<>();
|
||||
in.readList(this.licenceOneOf, Integer.class.getClassLoader());
|
||||
this.tagsOneOf = in.createStringArrayList();
|
||||
this.tagsAllOf = in.createStringArrayList();
|
||||
this.nsfw = in.readByte() != 0;
|
||||
this.sort = in.readString();
|
||||
}
|
||||
|
||||
public String getStart() {
|
||||
return start;
|
||||
@ -180,38 +211,4 @@ public class SepiaSearch implements Parcelable {
|
||||
dest.writeByte(this.nsfw ? (byte) 1 : (byte) 0);
|
||||
dest.writeString(this.sort);
|
||||
}
|
||||
|
||||
public SepiaSearch() {
|
||||
}
|
||||
|
||||
protected SepiaSearch(Parcel in) {
|
||||
this.start = in.readString();
|
||||
this.count = in.readString();
|
||||
this.search = in.readString();
|
||||
this.durationMax = in.readInt();
|
||||
this.durationMin = in.readInt();
|
||||
long tmpStartDate = in.readLong();
|
||||
this.startDate = tmpStartDate == -1 ? null : new Date(tmpStartDate);
|
||||
this.boostLanguages = in.createStringArrayList();
|
||||
this.categoryOneOf = new ArrayList<>();
|
||||
in.readList(this.categoryOneOf, Integer.class.getClassLoader());
|
||||
this.licenceOneOf = new ArrayList<>();
|
||||
in.readList(this.licenceOneOf, Integer.class.getClassLoader());
|
||||
this.tagsOneOf = in.createStringArrayList();
|
||||
this.tagsAllOf = in.createStringArrayList();
|
||||
this.nsfw = in.readByte() != 0;
|
||||
this.sort = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator<SepiaSearch> CREATOR = new Creator<SepiaSearch>() {
|
||||
@Override
|
||||
public SepiaSearch createFromParcel(Parcel source) {
|
||||
return new SepiaSearch(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SepiaSearch[] newArray(int size) {
|
||||
return new SepiaSearch[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -37,8 +37,8 @@ import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
||||
public class AccountsHorizontalListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private final List<ChannelData.Channel> channels;
|
||||
EventListener listener;
|
||||
private List<ChannelData.Channel> channels;
|
||||
private Context context;
|
||||
|
||||
public AccountsHorizontalListAdapter(List<ChannelData.Channel> channels, EventListener listener) {
|
||||
@ -109,11 +109,7 @@ public class AccountsHorizontalListAdapter extends RecyclerView.Adapter<Recycler
|
||||
ChannelData.Channel channel = channels.get(getAdapterPosition());
|
||||
listener.click(channel.getAcct());
|
||||
for (ChannelData.Channel acc : channels) {
|
||||
if (acc.getId().compareTo(channel.getId()) == 0) {
|
||||
acc.setSelected(true);
|
||||
} else {
|
||||
acc.setSelected(false);
|
||||
}
|
||||
acc.setSelected(acc.getId().compareTo(channel.getId()) == 0);
|
||||
}
|
||||
notifyItemRangeChanged(0, channels.size());
|
||||
}
|
||||
|
@ -47,11 +47,11 @@ import es.dmoral.toasty.Toasty;
|
||||
|
||||
public class AccountsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
public AllAccountsRemoved allAccountsRemoved;
|
||||
private final List<Account> accounts;
|
||||
private Context context;
|
||||
private final AccountsListAdapter accountsListAdapter;
|
||||
private final RetrofitPeertubeAPI.DataType type;
|
||||
public AllAccountsRemoved allAccountsRemoved;
|
||||
private Context context;
|
||||
|
||||
public AccountsListAdapter(RetrofitPeertubeAPI.DataType type, List<Account> accounts) {
|
||||
this.accounts = accounts;
|
||||
|
@ -44,11 +44,11 @@ import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
||||
public class ChannelListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private final List<Channel> channels;
|
||||
private final boolean myChannel;
|
||||
public AllChannelRemoved allChannelRemoved;
|
||||
public EditAlertDialog editAlertDialog;
|
||||
private final List<Channel> channels;
|
||||
private Context context;
|
||||
private final boolean myChannel;
|
||||
|
||||
|
||||
public ChannelListAdapter(List<Channel> channels, boolean myChannel) {
|
||||
|
@ -55,7 +55,6 @@ import java.util.regex.Pattern;
|
||||
import app.fedilab.fedilabtube.PeertubeActivity;
|
||||
import app.fedilab.fedilabtube.R;
|
||||
import app.fedilab.fedilabtube.ShowAccountActivity;
|
||||
import app.fedilab.fedilabtube.ShowChannelActivity;
|
||||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI;
|
||||
import app.fedilab.fedilabtube.client.data.CommentData.Comment;
|
||||
@ -74,11 +73,11 @@ import static app.fedilab.fedilabtube.helper.Helper.isLoggedIn;
|
||||
public class CommentListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
|
||||
public AllCommentRemoved allCommentRemoved;
|
||||
private Context context;
|
||||
private final List<Comment> comments;
|
||||
private final CommentListAdapter commentListAdapter;
|
||||
public AllCommentRemoved allCommentRemoved;
|
||||
boolean isVideoOwner;
|
||||
private Context context;
|
||||
|
||||
public CommentListAdapter(List<Comment> comments, boolean isVideoOwner) {
|
||||
this.comments = comments;
|
||||
|
@ -43,7 +43,7 @@ import static app.fedilab.fedilabtube.MainActivity.peertubeInformation;
|
||||
|
||||
public class InstanceAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private List<Instance> instances;
|
||||
private final List<Instance> instances;
|
||||
|
||||
private Context context;
|
||||
|
||||
|
@ -34,8 +34,8 @@ import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
||||
public class OwnAccountsAdapter extends ArrayAdapter<Account> {
|
||||
|
||||
private List<Account> accounts;
|
||||
private LayoutInflater layoutInflater;
|
||||
private final List<Account> accounts;
|
||||
private final LayoutInflater layoutInflater;
|
||||
|
||||
public OwnAccountsAdapter(Context context, List<Account> accounts) {
|
||||
super(context, android.R.layout.simple_list_item_1, accounts);
|
||||
|
@ -63,9 +63,9 @@ import static app.fedilab.fedilabtube.viewmodel.TimelineVM.TimelineType.SEPIA_SE
|
||||
|
||||
public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private final List<VideoData.Video> videos;
|
||||
public RelationShipListener relationShipListener;
|
||||
public PlaylistListener playlistListener;
|
||||
private List<VideoData.Video> videos;
|
||||
private Context context;
|
||||
private TimelineVM.TimelineType timelineType;
|
||||
private boolean sepiaSearch;
|
||||
@ -78,7 +78,6 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
}
|
||||
|
||||
|
||||
|
||||
public PeertubeAdapter(List<VideoData.Video> videos) {
|
||||
this.videos = videos;
|
||||
}
|
||||
@ -180,15 +179,10 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
}
|
||||
}
|
||||
}
|
||||
if (playlistListener == null || playlistListener.getPlaylist() == null || playlistListener.getPlaylist().size() == 0) {
|
||||
popup.getMenu().findItem(R.id.action_playlist).setVisible(false);
|
||||
} else {
|
||||
popup.getMenu().findItem(R.id.action_playlist).setVisible(true);
|
||||
}
|
||||
popup.getMenu().findItem(R.id.action_playlist).setVisible(playlistListener != null && playlistListener.getPlaylist() != null && playlistListener.getPlaylist().size() != 0);
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
switch (item.getItemId()) {
|
||||
|
||||
case R.id.action_follow:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_follow) {
|
||||
if (relationShipListener.getRelationShip().containsKey(video.getChannel().getAcct()) && relationShipListener.getRelationShip().get(video.getChannel().getAcct())) {
|
||||
relationShipListener.getRelationShip().put(video.getChannel().getAcct(), false);
|
||||
popup.getMenu().findItem(R.id.action_follow).setTitle(context.getString(R.string.action_follow));
|
||||
@ -214,20 +208,17 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
PostActionsVM viewModel = new ViewModelProvider((ViewModelStoreOwner) context).get(PostActionsVM.class);
|
||||
viewModel.post(FOLLOW, video.getChannel().getAcct(), null).observe((LifecycleOwner) context, apiResponse -> manageVIewPostActions(FOLLOW, apiResponse));
|
||||
}
|
||||
break;
|
||||
case R.id.action_playlist:
|
||||
} else if (itemId == R.id.action_playlist) {
|
||||
PlaylistsVM viewModelOwnerPlaylist = new ViewModelProvider((ViewModelStoreOwner) context).get(PlaylistsVM.class);
|
||||
viewModelOwnerPlaylist.manage(PlaylistsVM.action.GET_PLAYLISTS, null, null).observe((LifecycleOwner) context, apiResponse -> manageVIewPlaylists(video, apiResponse));
|
||||
break;
|
||||
case R.id.action_edit:
|
||||
} else if (itemId == R.id.action_edit) {
|
||||
Intent intent = new Intent(context, PeertubeEditUploadActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
b.putString("video_id", video.getUuid());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
break;
|
||||
case R.id.action_report:
|
||||
androidx.appcompat.app.AlertDialog.Builder dialogBuilder = new androidx.appcompat.app.AlertDialog.Builder(context);
|
||||
} else if (itemId == R.id.action_report) {
|
||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
|
||||
LayoutInflater inflater1 = ((Activity) context).getLayoutInflater();
|
||||
View dialogView = inflater1.inflate(R.layout.popup_report, new LinearLayout(context), false);
|
||||
dialogBuilder.setView(dialogView);
|
||||
@ -247,9 +238,8 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
dialog2.dismiss();
|
||||
}
|
||||
});
|
||||
androidx.appcompat.app.AlertDialog alertDialog2 = dialogBuilder.create();
|
||||
AlertDialog alertDialog2 = dialogBuilder.create();
|
||||
alertDialog2.show();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@ -385,7 +375,6 @@ public class PeertubeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
||||
}
|
||||
|
||||
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
LinearLayout main_container, bottom_container;
|
||||
ImageView peertube_profile, peertube_video_image;
|
||||
|
@ -45,8 +45,8 @@ import app.fedilab.fedilabtube.helper.Helper;
|
||||
|
||||
public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private Context context;
|
||||
private final List<Notification> notifications;
|
||||
private Context context;
|
||||
|
||||
public PeertubeNotificationsListAdapter(List<Notification> notifications) {
|
||||
this.notifications = notifications;
|
||||
|
@ -46,10 +46,10 @@ import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||
|
||||
public class PlaylistAdapter extends BaseAdapter {
|
||||
|
||||
private List<Playlist> playlists;
|
||||
private LayoutInflater layoutInflater;
|
||||
private Context context;
|
||||
private RelativeLayout textviewNoAction;
|
||||
private final List<Playlist> playlists;
|
||||
private final LayoutInflater layoutInflater;
|
||||
private final Context context;
|
||||
private final RelativeLayout textviewNoAction;
|
||||
|
||||
public PlaylistAdapter(Context context, List<Playlist> lists, RelativeLayout textviewNoAction) {
|
||||
this.playlists = lists;
|
||||
@ -123,8 +123,8 @@ public class PlaylistAdapter extends BaseAdapter {
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.playlist_menu, popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_delete:
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_delete) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(context.getString(R.string.action_lists_delete) + ": " + playlist.getDisplayName());
|
||||
builder.setMessage(context.getString(R.string.action_lists_confirm_delete));
|
||||
@ -141,12 +141,10 @@ public class PlaylistAdapter extends BaseAdapter {
|
||||
})
|
||||
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
|
||||
.show();
|
||||
break;
|
||||
case R.id.action_edit:
|
||||
} else if (itemId == R.id.action_edit) {
|
||||
if (context instanceof AllPlaylistsActivity) {
|
||||
((AllPlaylistsActivity) context).manageAlert(playlist);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
@ -38,7 +38,6 @@ import app.fedilab.fedilabtube.R;
|
||||
import app.fedilab.fedilabtube.client.APIResponse;
|
||||
import app.fedilab.fedilabtube.client.data.NotificationData.Notification;
|
||||
import app.fedilab.fedilabtube.drawer.PeertubeNotificationsListAdapter;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import app.fedilab.fedilabtube.viewmodel.NotificationsVM;
|
||||
import es.dmoral.toasty.Toasty;
|
||||
|
||||
|
@ -370,11 +370,45 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
||||
viewModelFeeds.getOverviewVideos(String.valueOf(page)).observe(DisplayOverviewFragment.this.requireActivity(), this::manageVIewVideos);
|
||||
}
|
||||
|
||||
public void manageVIewPlaylist(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null || apiResponse.getVideoExistPlaylist() == null) {
|
||||
return;
|
||||
}
|
||||
if (playlists == null) {
|
||||
playlists = new HashMap<>();
|
||||
}
|
||||
playlists.putAll(apiResponse.getVideoExistPlaylist());
|
||||
for (VideoData.Video video : peertubes) {
|
||||
video.setPlaylistExists(playlists.get(video.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void manageVIewRelationship(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null) {
|
||||
return;
|
||||
}
|
||||
if (relationship == null) {
|
||||
relationship = new HashMap<>();
|
||||
}
|
||||
relationship.putAll(apiResponse.getRelationships());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getRelationShip() {
|
||||
return relationship;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<PlaylistExist>> getPlaylist() {
|
||||
return playlists;
|
||||
}
|
||||
|
||||
static class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private int spanCount;
|
||||
private int spacing;
|
||||
private boolean includeEdge;
|
||||
private final int spanCount;
|
||||
private final int spacing;
|
||||
private final boolean includeEdge;
|
||||
|
||||
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
|
||||
this.spanCount = spanCount;
|
||||
@ -405,40 +439,4 @@ public class DisplayOverviewFragment extends Fragment implements PeertubeAdapter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void manageVIewPlaylist(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null || apiResponse.getVideoExistPlaylist() == null) {
|
||||
return;
|
||||
}
|
||||
if (playlists == null) {
|
||||
playlists = new HashMap<>();
|
||||
}
|
||||
playlists.putAll(apiResponse.getVideoExistPlaylist());
|
||||
for (VideoData.Video video : peertubes) {
|
||||
video.setPlaylistExists(playlists.get(video.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void manageVIewRelationship(APIResponse apiResponse) {
|
||||
if (apiResponse.getError() != null) {
|
||||
return;
|
||||
}
|
||||
if (relationship == null) {
|
||||
relationship = new HashMap<>();
|
||||
}
|
||||
relationship.putAll(apiResponse.getRelationships());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Boolean> getRelationShip() {
|
||||
return relationship;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<PlaylistExist>> getPlaylist() {
|
||||
return playlists;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -69,12 +69,11 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
||||
private View rootView;
|
||||
private RecyclerView lv_status;
|
||||
private SepiaSearchVM viewModelSearch;
|
||||
private SepiaSearch sepiaSearchVideo;
|
||||
|
||||
public DisplaySepiaSearchFragment() {
|
||||
}
|
||||
|
||||
private SepiaSearch sepiaSearchVideo;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
rootView = inflater.inflate(R.layout.fragment_video, container, false);
|
||||
@ -119,7 +118,6 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
||||
swipeRefreshLayout.setOnRefreshListener(this::pullToRefresh);
|
||||
|
||||
|
||||
|
||||
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||
if (mLayoutManager != null) {
|
||||
@ -160,7 +158,6 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
@ -291,12 +288,11 @@ public class DisplaySepiaSearchFragment extends Fragment implements AccountsHori
|
||||
}
|
||||
|
||||
|
||||
|
||||
static class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private int spanCount;
|
||||
private int spacing;
|
||||
private boolean includeEdge;
|
||||
private final int spanCount;
|
||||
private final int spacing;
|
||||
private final boolean includeEdge;
|
||||
|
||||
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
|
||||
this.spanCount = spanCount;
|
||||
|
@ -99,6 +99,7 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||
private String playlistId;
|
||||
private String remoteInstance;
|
||||
private boolean sepiaSearch;
|
||||
|
||||
public DisplayVideosFragment() {
|
||||
}
|
||||
|
||||
@ -245,7 +246,6 @@ public class DisplayVideosFragment extends Fragment implements AccountsHorizonta
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
@ -13,7 +13,9 @@ package app.fedilab.fedilabtube.helper;
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with TubeLab; if not,
|
||||
* see <http://www.gnu.org/licenses>. */
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@ -31,6 +33,7 @@ public class EmojiHelper {
|
||||
|
||||
/**
|
||||
* Converts emojis in input to unicode
|
||||
*
|
||||
* @param input String
|
||||
* @return String
|
||||
*/
|
||||
@ -51,7 +54,6 @@ public class EmojiHelper {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void fillMapEmoji(Context context) {
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(context.getAssets().open("emoji.csv")));
|
||||
@ -71,7 +73,8 @@ public class EmojiHelper {
|
||||
emoji.put(str[0], unicode);
|
||||
}
|
||||
br.close();
|
||||
} catch (IOException ignored) {ignored.printStackTrace();}
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,9 +36,9 @@ import app.fedilab.fedilabtube.client.data.VideoData.Video;
|
||||
*/
|
||||
public class FullScreenMediaController extends MediaController {
|
||||
|
||||
private final Context context;
|
||||
private ImageButton fullScreen;
|
||||
private Button resolution;
|
||||
private final Context context;
|
||||
private Video peertube;
|
||||
private String resolutionVal;
|
||||
|
||||
|
@ -256,6 +256,7 @@ public class Helper {
|
||||
|
||||
/**
|
||||
* Get a default instance host name depending of the device locale
|
||||
*
|
||||
* @return peertube host String
|
||||
*/
|
||||
private static String getDefaultInstance() {
|
||||
@ -265,8 +266,7 @@ public class Helper {
|
||||
lang = lang.split("-")[0];
|
||||
if (lang.split("-")[1].toLowerCase().contains("be")) {
|
||||
lang = "be";
|
||||
}
|
||||
else if(lang.split("-")[1].toLowerCase().contains("gb")){
|
||||
} else if (lang.split("-")[1].toLowerCase().contains("gb")) {
|
||||
lang = "gb";
|
||||
}
|
||||
} else {
|
||||
@ -338,6 +338,7 @@ public class Helper {
|
||||
|
||||
/**
|
||||
* Convert second to String formated date
|
||||
*
|
||||
* @param pTime timestamp
|
||||
* @return String formatted value
|
||||
*/
|
||||
@ -403,6 +404,7 @@ public class Helper {
|
||||
|
||||
/**
|
||||
* Return rounded numbers depending of the value
|
||||
*
|
||||
* @param count long
|
||||
* @return String rounded value to be displayed
|
||||
*/
|
||||
@ -475,6 +477,7 @@ public class Helper {
|
||||
|
||||
/**
|
||||
* Initialize the webview
|
||||
*
|
||||
* @param activity Current Activity
|
||||
* @param webviewId int id of the webview layout
|
||||
* @param rootView View the root view
|
||||
|
@ -33,8 +33,8 @@ import app.fedilab.fedilabtube.helper.Helper;
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public class AccountDAO {
|
||||
|
||||
public Context context;
|
||||
private final SQLiteDatabase db;
|
||||
public Context context;
|
||||
|
||||
|
||||
public AccountDAO(Context context, SQLiteDatabase db) {
|
||||
|
@ -22,6 +22,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import app.fedilab.fedilabtube.client.RetrofitSepiaSearchAPI;
|
||||
import app.fedilab.fedilabtube.client.data.VideoData;
|
||||
import app.fedilab.fedilabtube.client.entities.SepiaSearch;
|
||||
|
@ -69,13 +69,6 @@ public class TimelineVM extends AndroidViewModel {
|
||||
return apiResponseMutableLiveData;
|
||||
}
|
||||
|
||||
public LiveData<APIResponse> getVideosInChannel(String channelId, String max_id) {
|
||||
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||
loadVideosForChannel(null, channelId, max_id);
|
||||
return apiResponseMutableLiveData;
|
||||
}
|
||||
|
||||
|
||||
public LiveData<APIResponse> getVideosInChannel(String instance, String channelId, String max_id) {
|
||||
apiResponseMutableLiveData = new MutableLiveData<>();
|
||||
loadVideosForChannel(instance, channelId, max_id);
|
||||
|
@ -42,12 +42,12 @@ public class MastalabWebChromeClient extends WebChromeClient implements MediaPla
|
||||
|
||||
private ToggledFullscreenCallback toggledFullscreenCallback;
|
||||
|
||||
private CustomWebview webView;
|
||||
private View activityNonVideoView;
|
||||
private ViewGroup activityVideoView;
|
||||
private ProgressBar pbar;
|
||||
private final CustomWebview webView;
|
||||
private final View activityNonVideoView;
|
||||
private final ViewGroup activityVideoView;
|
||||
private final ProgressBar pbar;
|
||||
private boolean isVideoFullscreen;
|
||||
private Activity activity;
|
||||
private final Activity activity;
|
||||
|
||||
|
||||
public MastalabWebChromeClient(Activity activity, CustomWebview webView, FrameLayout activityNonVideoView, ViewGroup activityVideoView) {
|
||||
|
@ -32,7 +32,7 @@ import app.fedilab.fedilabtube.R;
|
||||
|
||||
public class MastalabWebViewClient extends WebViewClient {
|
||||
|
||||
private Activity activity;
|
||||
private final Activity activity;
|
||||
|
||||
|
||||
public MastalabWebViewClient(Activity activity) {
|
||||
|
@ -16,6 +16,11 @@
|
||||
android:icon="@drawable/ic_baseline_subtitles_24"
|
||||
android:title="@string/captions"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_edit"
|
||||
android:icon="@drawable/ic_baseline_edit_24"
|
||||
android:title="@string/edit"
|
||||
app:showAsAction="ifRoom" />
|
||||
<item
|
||||
android:id="@+id/action_report"
|
||||
android:icon="@drawable/ic_baseline_report_24"
|
||||
|
Loading…
x
Reference in New Issue
Block a user