This commit is contained in:
Thomas 2024-01-23 16:02:28 +01:00
parent dc72d9a8b0
commit 067fc68402
26 changed files with 114 additions and 127 deletions

View file

@ -28,7 +28,6 @@ import java.lang.ref.WeakReference;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.SpannableHelper; import app.fedilab.android.mastodon.helper.SpannableHelper;
import de.timfreiheit.mathjax.android.MathJaxView; import de.timfreiheit.mathjax.android.MathJaxView;

View file

@ -108,7 +108,8 @@ public class CachedBundle {
Account account = null; Account account = null;
try { try {
account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT); account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
}catch (ClassCastException ignored){} } catch (ClassCastException ignored) {
}
if (account != null) { if (account != null) {
bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account); bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account);
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount)); valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount));
@ -127,7 +128,8 @@ public class CachedBundle {
Status status = null; Status status = null;
try { try {
status = (Status) bundle.getSerializable(Helper.ARG_STATUS); status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
}catch (ClassCastException ignored){} } catch (ClassCastException ignored) {
}
if (status != null) { if (status != null) {
bundleStatus.putSerializable(Helper.ARG_STATUS, status); bundleStatus.putSerializable(Helper.ARG_STATUS, status);
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleStatus)); valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleStatus));

View file

@ -19,9 +19,6 @@ import android.content.SharedPreferences;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.media3.database.ExoDatabaseProvider; import androidx.media3.database.ExoDatabaseProvider;
import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter;
import androidx.preference.PreferenceManager;
import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DefaultDataSourceFactory; import androidx.media3.datasource.DefaultDataSourceFactory;
import androidx.media3.datasource.DefaultHttpDataSource; import androidx.media3.datasource.DefaultHttpDataSource;
@ -30,6 +27,8 @@ import androidx.media3.datasource.cache.CacheDataSink;
import androidx.media3.datasource.cache.CacheDataSource; import androidx.media3.datasource.cache.CacheDataSource;
import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor; import androidx.media3.datasource.cache.LeastRecentlyUsedCacheEvictor;
import androidx.media3.datasource.cache.SimpleCache; import androidx.media3.datasource.cache.SimpleCache;
import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter;
import androidx.preference.PreferenceManager;
import java.io.File; import java.io.File;

View file

@ -76,7 +76,6 @@ import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.OptIn;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.LinearLayoutCompat; import androidx.appcompat.widget.LinearLayoutCompat;
@ -91,7 +90,6 @@ import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStoreOwner; import androidx.lifecycle.ViewModelStoreOwner;
import androidx.media3.common.MediaItem; import androidx.media3.common.MediaItem;
import androidx.media3.common.Player; import androidx.media3.common.Player;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DefaultDataSource; import androidx.media3.datasource.DefaultDataSource;
import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.ExoPlayer;

View file

@ -61,7 +61,6 @@ import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.RequestBuilder; import com.bumptech.glide.RequestBuilder;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;

View file

@ -11,8 +11,6 @@ import android.widget.Filterable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.github.mikephil.charting.data.Entry;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View file

@ -21,8 +21,6 @@ import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -241,9 +239,7 @@ public class FragmentMedia extends Fragment {
); );
} }
switch (type.toLowerCase()) { switch (type.toLowerCase()) {
case "video": case "video", "audio", "gifv" -> {
case "audio":
case "gifv":
if (attachment.peertubeId != null) { if (attachment.peertubeId != null) {
//It's a peertube video, we are fetching data //It's a peertube video, we are fetching data
TimelinesVM timelinesVM = new ViewModelProvider(requireActivity()).get(TimelinesVM.class); TimelinesVM timelinesVM = new ViewModelProvider(requireActivity()).get(TimelinesVM.class);
@ -258,7 +254,7 @@ public class FragmentMedia extends Fragment {
} else { } else {
loadVideo(url, type); loadVideo(url, type);
} }
break; }
} }
} }

View file

@ -65,6 +65,7 @@ public class FragmentMediaProfile extends Fragment {
private boolean checkRemotely; private boolean checkRemotely;
private String accountId; private String accountId;
private Bundle arguments; private Bundle arguments;
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -98,7 +99,6 @@ public class FragmentMediaProfile extends Fragment {
} }
private void initializeAfterBundle(Bundle bundle) { private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) { if (bundle != null) {
@ -148,7 +148,6 @@ public class FragmentMediaProfile extends Fragment {
} }
/** /**
* Intialize the common view for statuses on different timelines * Intialize the common view for statuses on different timelines
* *

View file

@ -138,6 +138,7 @@ public class FragmentMastodonContext extends Fragment {
private Status firstStatus; private Status firstStatus;
private boolean pullToRefresh; private boolean pullToRefresh;
private String user_token, user_instance; private String user_token, user_instance;
private Bundle arguments;
/** /**
* Return the position of the status in the ArrayList * Return the position of the status in the ArrayList
@ -158,8 +159,6 @@ public class FragmentMastodonContext extends Fragment {
return found ? position : -1; return found ? position : -1;
} }
private Bundle arguments;
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {

View file

@ -91,7 +91,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
private StatusAdapter statusAdapter; private StatusAdapter statusAdapter;
private Timeline.TimeLineEnum timelineType; private Timeline.TimeLineEnum timelineType;
private List<Status> timelineStatuses; private List<Status> timelineStatuses;
private Bundle arguments;
//Handle actions that can be done in other fragments //Handle actions that can be done in other fragments
private final BroadcastReceiver receive_action = new BroadcastReceiver() { private final BroadcastReceiver receive_action = new BroadcastReceiver() {
@Override @Override
@ -184,6 +183,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} }
} }
}; };
private Bundle arguments;
private boolean retry_for_home_done; private boolean retry_for_home_done;
private String lemmy_post_id; private String lemmy_post_id;
private boolean checkRemotely; private boolean checkRemotely;
@ -351,7 +351,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} }
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -393,6 +392,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} }
} }
} }
private void initializeAfterBundle(Bundle bundle) { private void initializeAfterBundle(Bundle bundle) {
if (bundle != null) { if (bundle != null) {
timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE); timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);

View file

@ -48,12 +48,14 @@ public class FragmentProfileTimeline extends Fragment {
private boolean checkRemotely; private boolean checkRemotely;
private boolean show_boosts = true, show_replies = true; private boolean show_boosts = true, show_replies = true;
private Bundle arguments; private Bundle arguments;
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
binding = FragmentProfileTimelinesBinding.inflate(inflater, container, false); binding = FragmentProfileTimelinesBinding.inflate(inflater, container, false);
arguments = getArguments(); arguments = getArguments();
return binding.getRoot(); return binding.getRoot();
} }
@Override @Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
@ -169,5 +171,4 @@ public class FragmentProfileTimeline extends Fragment {
} }
} }

View file

@ -32,7 +32,6 @@ import java.util.List;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity; import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.mastodon.activities.ProfileActivity;
import app.fedilab.android.mastodon.client.endpoints.MastodonAccountsService; import app.fedilab.android.mastodon.client.endpoints.MastodonAccountsService;
import app.fedilab.android.mastodon.client.entities.api.Account; import app.fedilab.android.mastodon.client.entities.api.Account;
import app.fedilab.android.mastodon.client.entities.api.Accounts; import app.fedilab.android.mastodon.client.entities.api.Accounts;

View file

@ -105,10 +105,9 @@ import androidx.media3.exoplayer.source.SingleSampleMediaSource;
import androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection; import androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection;
import androidx.media3.exoplayer.trackselection.DefaultTrackSelector; import androidx.media3.exoplayer.trackselection.DefaultTrackSelector;
import androidx.media3.exoplayer.trackselection.TrackSelector; import androidx.media3.exoplayer.trackselection.TrackSelector;
import androidx.media3.session.MediaSession;
import androidx.media3.ui.AspectRatioFrameLayout; import androidx.media3.ui.AspectRatioFrameLayout;
import androidx.media3.ui.PlayerControlView;
import androidx.media3.ui.DefaultTimeBar; import androidx.media3.ui.DefaultTimeBar;
import androidx.media3.ui.PlayerControlView;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -209,6 +208,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
private Status status; private Status status;
private int flags; private int flags;
private boolean humanInteraction; private boolean humanInteraction;
public static void hideKeyboard(Activity activity) { public static void hideKeyboard(Activity activity) {
if (activity != null && activity.getWindow() != null) { if (activity != null && activity.getWindow() != null) {
activity.getWindow().getDecorView(); activity.getWindow().getDecorView();

View file

@ -40,7 +40,6 @@ import android.content.IntentFilter;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
@ -513,7 +512,8 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
Intent notificationIntent = new Intent(this, RetrieveInfoService.class); Intent notificationIntent = new Intent(this, RetrieveInfoService.class);
try { try {
startService(notificationIntent); startService(notificationIntent);
} catch (Exception ignored) {} } catch (Exception ignored) {
}
} }
@Override @Override

View file

@ -18,7 +18,6 @@ import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN; import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN;
import static app.fedilab.android.peertube.helper.Helper.peertubeInformation;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;

View file

@ -31,7 +31,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import app.fedilab.android.R; import app.fedilab.android.R;
import app.fedilab.android.databinding.TrackSelectionDialogBinding; import app.fedilab.android.databinding.TrackSelectionDialogBinding;