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

@ -127,7 +127,7 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
loadRemotelyConversation(true); loadRemotelyConversation(true);
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
if(currentAccount != null) { if (currentAccount != null) {
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account); MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
} }
} }

View File

@ -88,7 +88,7 @@ public class HashTagActivity extends BaseActivity {
} }
private void initializeAfterBundle(Bundle bundle) { private void initializeAfterBundle(Bundle bundle) {
if( bundle != null) { if (bundle != null) {
tag = bundle.getString(Helper.ARG_SEARCH_KEYWORD, null); tag = bundle.getString(Helper.ARG_SEARCH_KEYWORD, null);
} }
if (tag == null) { if (tag == null) {

View File

@ -60,63 +60,63 @@ class InstanceHealthActivity : DialogFragment() {
private fun checkInstance() { private fun checkInstance() {
val instanceSocialVM = val instanceSocialVM =
ViewModelProvider(this@InstanceHealthActivity)[InstanceSocialVM::class.java] ViewModelProvider(this@InstanceHealthActivity)[InstanceSocialVM::class.java]
instanceSocialVM.getInstances(BaseMainActivity.currentInstance.trim { it <= ' ' }) instanceSocialVM.getInstances(BaseMainActivity.currentInstance.trim { it <= ' ' })
.observe(this@InstanceHealthActivity) { instanceSocialList: InstanceSocial? -> .observe(this@InstanceHealthActivity) { instanceSocialList: InstanceSocial? ->
val instance = instanceSocialList?.instances?.firstOrNull { instance -> val instance = instanceSocialList?.instances?.firstOrNull { instance ->
instance.name.equals( instance.name.equals(
BaseMainActivity.currentInstance.trim { it <= ' ' }, BaseMainActivity.currentInstance.trim { it <= ' ' },
ignoreCase = true ignoreCase = true
) )
}
if (instance != null) {
instance.thumbnail?.takeIf { it != "null" }?.let { thumbnail ->
Glide.with(this@InstanceHealthActivity)
.asBitmap()
.placeholder(R.drawable.default_banner)
.load(thumbnail)
.into(binding.backgroundImage)
} }
if (instance != null) { binding.name.text = instance.name
instance.thumbnail?.takeIf { it != "null" }?.let { thumbnail -> if (instance.up) {
Glide.with(this@InstanceHealthActivity) binding.up.setText(R.string.is_up)
.asBitmap() binding.up.setTextColor(
.placeholder(R.drawable.default_banner) ThemeHelper.getAttColor(
.load(thumbnail) requireContext(),
.into(binding.backgroundImage) R.attr.colorPrimary
}
binding.name.text = instance.name
if (instance.up) {
binding.up.setText(R.string.is_up)
binding.up.setTextColor(
ThemeHelper.getAttColor(
requireContext(),
R.attr.colorPrimary
)
) )
} else {
binding.up.setText(R.string.is_down)
binding.up.setTextColor(
ThemeHelper.getAttColor(
requireContext(),
R.attr.colorError
)
)
}
binding.uptime.text = getString(
R.string.instance_health_uptime,
instance.uptime * 100
)
if (instance.checked_at != null)
binding.checkedAt.text =
getString(
R.string.instance_health_checkedat,
Helper.dateToString(instance.checked_at)
)
binding.values.text = getString(
R.string.instance_health_indication,
instance.version,
Helper.withSuffix(instance.active_users.toLong()),
Helper.withSuffix(instance.statuses.toLong())
) )
} else { } else {
binding.instanceData.isVisible = false binding.up.setText(R.string.is_down)
binding.noInstance.isVisible = true binding.up.setTextColor(
ThemeHelper.getAttColor(
requireContext(),
R.attr.colorError
)
)
} }
binding.loader.isVisible = false binding.uptime.text = getString(
R.string.instance_health_uptime,
instance.uptime * 100
)
if (instance.checked_at != null)
binding.checkedAt.text =
getString(
R.string.instance_health_checkedat,
Helper.dateToString(instance.checked_at)
)
binding.values.text = getString(
R.string.instance_health_indication,
instance.version,
Helper.withSuffix(instance.active_users.toLong()),
Helper.withSuffix(instance.statuses.toLong())
)
} else {
binding.instanceData.isVisible = false
binding.noInstance.isVisible = true
} }
binding.loader.isVisible = false
}
} }
override fun onDestroyView() { override fun onDestroyView() {

View File

@ -196,7 +196,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
binding.mediaDescriptionTranslated.setText(translated); binding.mediaDescriptionTranslated.setText(translated);
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
} else { } else {
@ -206,14 +206,14 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
}); });
if (attachments.get(mediaPosition - 1).translation != null) { if (attachments.get(mediaPosition - 1).translation != null) {
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
binding.mediaDescriptionTranslated.setText(attachments.get(mediaPosition - 1).translation); binding.mediaDescriptionTranslated.setText(attachments.get(mediaPosition - 1).translation);
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
} else { } else {
binding.mediaDescription.setVisibility(View.VISIBLE); binding.mediaDescription.setVisibility(View.VISIBLE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(true); mCurrentFragment.toggleController(true);
} }
binding.mediaDescriptionTranslated.setVisibility(View.GONE); binding.mediaDescriptionTranslated.setVisibility(View.GONE);
@ -245,7 +245,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
binding.mediaDescriptionTranslated.setText(translated); binding.mediaDescriptionTranslated.setText(translated);
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
} else { } else {
@ -256,21 +256,21 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
if (!fullscreen) { if (!fullscreen) {
if (attachments.get(position).translation != null) { if (attachments.get(position).translation != null) {
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
binding.mediaDescriptionTranslated.setText(attachments.get(position).translation); binding.mediaDescriptionTranslated.setText(attachments.get(position).translation);
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
} else { } else {
binding.mediaDescription.setVisibility(View.VISIBLE); binding.mediaDescription.setVisibility(View.VISIBLE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(true); mCurrentFragment.toggleController(true);
} }
binding.mediaDescriptionTranslated.setVisibility(View.GONE); binding.mediaDescriptionTranslated.setVisibility(View.GONE);
} }
} else { } else {
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
binding.mediaDescriptionTranslated.setVisibility(View.GONE); binding.mediaDescriptionTranslated.setVisibility(View.GONE);
@ -428,14 +428,14 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
binding.mediaDescription.setText(linkify(MediaActivity.this, description), TextView.BufferType.SPANNABLE); binding.mediaDescription.setText(linkify(MediaActivity.this, description), TextView.BufferType.SPANNABLE);
if (attachments.get(binding.mediaViewpager.getCurrentItem()).translation != null) { if (attachments.get(binding.mediaViewpager.getCurrentItem()).translation != null) {
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
binding.mediaDescriptionTranslated.setText(attachments.get(binding.mediaViewpager.getCurrentItem()).translation); binding.mediaDescriptionTranslated.setText(attachments.get(binding.mediaViewpager.getCurrentItem()).translation);
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE); binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
} else { } else {
binding.mediaDescription.setVisibility(View.VISIBLE); binding.mediaDescription.setVisibility(View.VISIBLE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(true); mCurrentFragment.toggleController(true);
} }
binding.mediaDescriptionTranslated.setVisibility(View.GONE); binding.mediaDescriptionTranslated.setVisibility(View.GONE);
@ -449,7 +449,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
} }
binding.mediaDescriptionTranslated.setVisibility(View.GONE); binding.mediaDescriptionTranslated.setVisibility(View.GONE);
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
} }
@ -458,7 +458,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
binding.translate.setVisibility(View.GONE); binding.translate.setVisibility(View.GONE);
binding.mediaDescriptionTranslated.setVisibility(View.GONE); binding.mediaDescriptionTranslated.setVisibility(View.GONE);
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
} }
@ -509,7 +509,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
if (!fullscreen) { if (!fullscreen) {
showSystemUI(); showSystemUI();
binding.mediaDescription.setVisibility(View.VISIBLE); binding.mediaDescription.setVisibility(View.VISIBLE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(true); mCurrentFragment.toggleController(true);
} }
binding.translate.setVisibility(View.VISIBLE); binding.translate.setVisibility(View.VISIBLE);
@ -519,7 +519,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
} else { } else {
hideSystemUI(); hideSystemUI();
binding.mediaDescription.setVisibility(View.GONE); binding.mediaDescription.setVisibility(View.GONE);
if(mCurrentFragment != null) { if (mCurrentFragment != null) {
mCurrentFragment.toggleController(false); mCurrentFragment.toggleController(false);
} }
binding.translate.setVisibility(View.GONE); binding.translate.setVisibility(View.GONE);

View File

@ -132,7 +132,7 @@ public class SearchResultTabActivity extends BaseBarActivity {
inflater.inflate(R.menu.menu_search, menu); inflater.inflate(R.menu.menu_search, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
if(searchView == null) { if (searchView == null) {
return true; return true;
} }
if (search != null) { if (search != null) {

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));
@ -170,7 +172,7 @@ public class CachedBundle {
} }
} catch (DBException ignored) { } catch (DBException ignored) {
} }
if( bundle == null) { if (bundle == null) {
bundle = new Bundle(); bundle = new Bundle();
} }
Handler mainHandler = new Handler(Looper.getMainLooper()); Handler mainHandler = new Handler(Looper.getMainLooper());
@ -283,7 +285,7 @@ public class CachedBundle {
String dateStr = Helper.dateToString(date); String dateStr = Helper.dateToString(date);
try { try {
db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_CREATED_AT + " < ?", new String[]{dateStr}); db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_CREATED_AT + " < ?", new String[]{dateStr});
}catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -69,20 +69,20 @@ class BlurHashDecoder {
val g = (value / 19) % 19 val g = (value / 19) % 19
val b = value % 19 val b = value % 19
return floatArrayOf( return floatArrayOf(
signedPow2((r - 9) / 9.0f) * maxAc, signedPow2((r - 9) / 9.0f) * maxAc,
signedPow2((g - 9) / 9.0f) * maxAc, signedPow2((g - 9) / 9.0f) * maxAc,
signedPow2((b - 9) / 9.0f) * maxAc signedPow2((b - 9) / 9.0f) * maxAc
) )
} }
private fun signedPow2(value: Float) = value.pow(2f).withSign(value) private fun signedPow2(value: Float) = value.pow(2f).withSign(value)
private fun composeBitmap( private fun composeBitmap(
width: Int, width: Int,
height: Int, height: Int,
numCompX: Int, numCompX: Int,
numCompY: Int, numCompY: Int,
colors: Array<FloatArray> colors: Array<FloatArray>
): Bitmap { ): Bitmap {
val imageArray = IntArray(width * height) val imageArray = IntArray(width * height)
for (y in 0 until height) { for (y in 0 until height) {
@ -100,7 +100,7 @@ class BlurHashDecoder {
} }
} }
imageArray[x + width * y] = imageArray[x + width * y] =
Color.rgb(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b)) Color.rgb(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b))
} }
} }
return Bitmap.createBitmap(imageArray, width, height, Bitmap.Config.ARGB_8888) return Bitmap.createBitmap(imageArray, width, height, Bitmap.Config.ARGB_8888)
@ -116,12 +116,12 @@ class BlurHashDecoder {
} }
private val charMap = listOf( private val charMap = listOf(
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '#', '$', '%', '*', '+', ',', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '#', '$', '%', '*', '+', ',',
'-', '.', ':', ';', '=', '?', '@', '[', ']', '^', '_', '{', '|', '}', '~' '-', '.', ':', ';', '=', '?', '@', '[', ']', '^', '_', '{', '|', '}', '~'
) )
.mapIndexed { i, c -> c to i } .mapIndexed { i, c -> c to i }
.toMap() .toMap()
} }

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

@ -909,7 +909,7 @@ public class Helper {
if (args != null) fragment.setArguments(args); if (args != null) fragment.setArguments(args);
ft.add(containerViewId, fragment, tag); ft.add(containerViewId, fragment, tag);
if (backStackName != null) ft.addToBackStack(backStackName); if (backStackName != null) ft.addToBackStack(backStackName);
if(!fragmentManager.isDestroyed()) { if (!fragmentManager.isDestroyed()) {
ft.commit(); ft.commit();
} }
} }

View File

@ -306,7 +306,7 @@ public class SpannableHelper {
for (Mention mention : mentions) { for (Mention mention : mentions) {
if (word.compareToIgnoreCase("@" + mention.username) == 0) { if (word.compareToIgnoreCase("@" + mention.username) == 0) {
if(!checkRemotely) { if (!checkRemotely) {
targetedMention = mention; targetedMention = mention;
} else { } else {
acct = mention.acct; acct = mention.acct;
@ -317,7 +317,7 @@ public class SpannableHelper {
if (targetedMention != null) { if (targetedMention != null) {
args.putString(Helper.ARG_USER_ID, targetedMention.id); args.putString(Helper.ARG_USER_ID, targetedMention.id);
} else if( acct != null){ } else if (acct != null) {
args.putString(Helper.ARG_MENTION, acct); args.putString(Helper.ARG_MENTION, acct);
} else { } else {
args.putString(Helper.ARG_MENTION, word); args.putString(Helper.ARG_MENTION, word);

View File

@ -891,8 +891,8 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
tag.name = camelTag; tag.name = camelTag;
if (!results.hashtags.contains(tag)) { if (!results.hashtags.contains(tag)) {
for(Tag realTag: results.hashtags) { for (Tag realTag : results.hashtags) {
if(realTag.name.equalsIgnoreCase(camelTag)) { if (realTag.name.equalsIgnoreCase(camelTag)) {
tag.history = realTag.history; tag.history = realTag.history;
break; break;
} }

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;
@ -125,7 +123,7 @@ public class TagsSearchAdapter extends ArrayAdapter<Tag> implements Filterable {
stat += Integer.parseInt(history.accounts); stat += Integer.parseInt(history.accounts);
} }
} }
if(stat > 0 ) { if (stat > 0) {
holder.binding.tagCount.setText("(" + context.getString(R.string.talking_about, stat) + ")"); holder.binding.tagCount.setText("(" + context.getString(R.string.talking_about, stat) + ")");
holder.binding.tagCount.setVisibility(View.VISIBLE); holder.binding.tagCount.setVisibility(View.VISIBLE);
} else { } else {

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;
@ -97,7 +95,7 @@ public class FragmentMedia extends Fragment {
@OptIn(markerClass = UnstableApi.class) @OptIn(markerClass = UnstableApi.class)
public void toggleController(boolean display) { public void toggleController(boolean display) {
if(display) { if (display) {
binding.controls.show(); binding.controls.show();
} else { } else {
binding.controls.hide(); binding.controls.hide();
@ -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) {
@ -107,7 +107,7 @@ public class FragmentMediaProfile extends Fragment {
} }
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false); checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
} }
if(accountTimeline == null) { if (accountTimeline == null) {
return; return;
} }
flagLoading = false; flagLoading = false;
@ -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

@ -61,7 +61,7 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
case 0 -> { case 0 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline(); fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
if(account != null) { if (account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id); bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
} }
bundle.putBoolean(Helper.ARG_SHOW_PINNED, true); bundle.putBoolean(Helper.ARG_SHOW_PINNED, true);
@ -74,7 +74,7 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
case 1 -> { case 1 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline(); fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
if(account != null) { if (account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id); bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
} }
bundle.putBoolean(Helper.ARG_SHOW_PINNED, false); bundle.putBoolean(Helper.ARG_SHOW_PINNED, false);
@ -86,7 +86,7 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
} }
case 2 -> { case 2 -> {
FragmentMediaProfile fragmentMediaProfile = new FragmentMediaProfile(); FragmentMediaProfile fragmentMediaProfile = new FragmentMediaProfile();
if(account != null) { if (account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id); bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
} }
bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely); bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely);

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;
@ -1078,7 +1077,7 @@ public class AccountsVM extends AndroidViewModel {
Response<List<Account>> searchResponse = searchCall.execute(); Response<List<Account>> searchResponse = searchCall.execute();
if (searchResponse.isSuccessful()) { if (searchResponse.isSuccessful()) {
accountList = searchResponse.body(); accountList = searchResponse.body();
if(accountList != null && accountList.size() > 0 ) { if (accountList != null && accountList.size() > 0) {
new CachedBundle(getApplication().getApplicationContext()).insertAccountBundle(accountList.get(0), currentAccount); new CachedBundle(getApplication().getApplicationContext()).insertAccountBundle(accountList.get(0), currentAccount);
} }
} }

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;