mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 00:30:03 +02:00
clean
This commit is contained in:
parent
dc72d9a8b0
commit
067fc68402
26 changed files with 114 additions and 127 deletions
|
@ -127,7 +127,7 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
|
|||
loadRemotelyConversation(true);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
if(currentAccount != null) {
|
||||
if (currentAccount != null) {
|
||||
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class HashTagActivity extends BaseActivity {
|
|||
}
|
||||
|
||||
private void initializeAfterBundle(Bundle bundle) {
|
||||
if( bundle != null) {
|
||||
if (bundle != null) {
|
||||
tag = bundle.getString(Helper.ARG_SEARCH_KEYWORD, null);
|
||||
}
|
||||
if (tag == null) {
|
||||
|
|
|
@ -60,63 +60,63 @@ class InstanceHealthActivity : DialogFragment() {
|
|||
|
||||
private fun checkInstance() {
|
||||
val instanceSocialVM =
|
||||
ViewModelProvider(this@InstanceHealthActivity)[InstanceSocialVM::class.java]
|
||||
ViewModelProvider(this@InstanceHealthActivity)[InstanceSocialVM::class.java]
|
||||
instanceSocialVM.getInstances(BaseMainActivity.currentInstance.trim { it <= ' ' })
|
||||
.observe(this@InstanceHealthActivity) { instanceSocialList: InstanceSocial? ->
|
||||
val instance = instanceSocialList?.instances?.firstOrNull { instance ->
|
||||
instance.name.equals(
|
||||
BaseMainActivity.currentInstance.trim { it <= ' ' },
|
||||
ignoreCase = true
|
||||
)
|
||||
.observe(this@InstanceHealthActivity) { instanceSocialList: InstanceSocial? ->
|
||||
val instance = instanceSocialList?.instances?.firstOrNull { instance ->
|
||||
instance.name.equals(
|
||||
BaseMainActivity.currentInstance.trim { it <= ' ' },
|
||||
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) {
|
||||
instance.thumbnail?.takeIf { it != "null" }?.let { thumbnail ->
|
||||
Glide.with(this@InstanceHealthActivity)
|
||||
.asBitmap()
|
||||
.placeholder(R.drawable.default_banner)
|
||||
.load(thumbnail)
|
||||
.into(binding.backgroundImage)
|
||||
}
|
||||
binding.name.text = instance.name
|
||||
if (instance.up) {
|
||||
binding.up.setText(R.string.is_up)
|
||||
binding.up.setTextColor(
|
||||
ThemeHelper.getAttColor(
|
||||
requireContext(),
|
||||
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 {
|
||||
binding.instanceData.isVisible = false
|
||||
binding.noInstance.isVisible = true
|
||||
binding.up.setText(R.string.is_down)
|
||||
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() {
|
||||
|
|
|
@ -196,7 +196,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|||
binding.mediaDescriptionTranslated.setText(translated);
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
} else {
|
||||
|
@ -206,14 +206,14 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|||
});
|
||||
if (attachments.get(mediaPosition - 1).translation != null) {
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
binding.mediaDescriptionTranslated.setText(attachments.get(mediaPosition - 1).translation);
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.mediaDescription.setVisibility(View.VISIBLE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(true);
|
||||
}
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
||||
|
@ -245,7 +245,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|||
binding.mediaDescriptionTranslated.setText(translated);
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
} else {
|
||||
|
@ -256,21 +256,21 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|||
if (!fullscreen) {
|
||||
if (attachments.get(position).translation != null) {
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
binding.mediaDescriptionTranslated.setText(attachments.get(position).translation);
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.mediaDescription.setVisibility(View.VISIBLE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(true);
|
||||
}
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
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);
|
||||
if (attachments.get(binding.mediaViewpager.getCurrentItem()).translation != null) {
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
binding.mediaDescriptionTranslated.setText(attachments.get(binding.mediaViewpager.getCurrentItem()).translation);
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
binding.mediaDescription.setVisibility(View.VISIBLE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(true);
|
||||
}
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
||||
|
@ -449,7 +449,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|||
}
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|||
binding.translate.setVisibility(View.GONE);
|
||||
binding.mediaDescriptionTranslated.setVisibility(View.GONE);
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|||
if (!fullscreen) {
|
||||
showSystemUI();
|
||||
binding.mediaDescription.setVisibility(View.VISIBLE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(true);
|
||||
}
|
||||
binding.translate.setVisibility(View.VISIBLE);
|
||||
|
@ -519,7 +519,7 @@ public class MediaActivity extends BaseTransparentActivity implements OnDownload
|
|||
} else {
|
||||
hideSystemUI();
|
||||
binding.mediaDescription.setVisibility(View.GONE);
|
||||
if(mCurrentFragment != null) {
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.toggleController(false);
|
||||
}
|
||||
binding.translate.setVisibility(View.GONE);
|
||||
|
|
|
@ -132,7 +132,7 @@ public class SearchResultTabActivity extends BaseBarActivity {
|
|||
inflater.inflate(R.menu.menu_search, menu);
|
||||
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
|
||||
SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
|
||||
if(searchView == null) {
|
||||
if (searchView == null) {
|
||||
return true;
|
||||
}
|
||||
if (search != null) {
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.lang.ref.WeakReference;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import app.fedilab.android.mastodon.helper.Helper;
|
||||
import app.fedilab.android.mastodon.helper.SpannableHelper;
|
||||
import de.timfreiheit.mathjax.android.MathJaxView;
|
||||
|
||||
|
|
|
@ -108,7 +108,8 @@ public class CachedBundle {
|
|||
Account account = null;
|
||||
try {
|
||||
account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
|
||||
}catch (ClassCastException ignored){}
|
||||
} catch (ClassCastException ignored) {
|
||||
}
|
||||
if (account != null) {
|
||||
bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account);
|
||||
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount));
|
||||
|
@ -127,7 +128,8 @@ public class CachedBundle {
|
|||
Status status = null;
|
||||
try {
|
||||
status = (Status) bundle.getSerializable(Helper.ARG_STATUS);
|
||||
}catch (ClassCastException ignored){}
|
||||
} catch (ClassCastException ignored) {
|
||||
}
|
||||
if (status != null) {
|
||||
bundleStatus.putSerializable(Helper.ARG_STATUS, status);
|
||||
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleStatus));
|
||||
|
@ -170,7 +172,7 @@ public class CachedBundle {
|
|||
}
|
||||
} catch (DBException ignored) {
|
||||
}
|
||||
if( bundle == null) {
|
||||
if (bundle == null) {
|
||||
bundle = new Bundle();
|
||||
}
|
||||
Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||
|
@ -283,7 +285,7 @@ public class CachedBundle {
|
|||
String dateStr = Helper.dateToString(date);
|
||||
try {
|
||||
db.delete(Sqlite.TABLE_INTENT, Sqlite.COL_CREATED_AT + " < ?", new String[]{dateStr});
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,20 +69,20 @@ class BlurHashDecoder {
|
|||
val g = (value / 19) % 19
|
||||
val b = value % 19
|
||||
return floatArrayOf(
|
||||
signedPow2((r - 9) / 9.0f) * maxAc,
|
||||
signedPow2((g - 9) / 9.0f) * maxAc,
|
||||
signedPow2((b - 9) / 9.0f) * maxAc
|
||||
signedPow2((r - 9) / 9.0f) * maxAc,
|
||||
signedPow2((g - 9) / 9.0f) * maxAc,
|
||||
signedPow2((b - 9) / 9.0f) * maxAc
|
||||
)
|
||||
}
|
||||
|
||||
private fun signedPow2(value: Float) = value.pow(2f).withSign(value)
|
||||
|
||||
private fun composeBitmap(
|
||||
width: Int,
|
||||
height: Int,
|
||||
numCompX: Int,
|
||||
numCompY: Int,
|
||||
colors: Array<FloatArray>
|
||||
width: Int,
|
||||
height: Int,
|
||||
numCompX: Int,
|
||||
numCompY: Int,
|
||||
colors: Array<FloatArray>
|
||||
): Bitmap {
|
||||
val imageArray = IntArray(width * height)
|
||||
for (y in 0 until height) {
|
||||
|
@ -100,7 +100,7 @@ class BlurHashDecoder {
|
|||
}
|
||||
}
|
||||
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)
|
||||
|
@ -116,12 +116,12 @@ class BlurHashDecoder {
|
|||
}
|
||||
|
||||
private val charMap = listOf(
|
||||
'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',
|
||||
'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', '#', '$', '%', '*', '+', ',',
|
||||
'-', '.', ':', ';', '=', '?', '@', '[', ']', '^', '_', '{', '|', '}', '~'
|
||||
'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',
|
||||
'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', '#', '$', '%', '*', '+', ',',
|
||||
'-', '.', ':', ';', '=', '?', '@', '[', ']', '^', '_', '{', '|', '}', '~'
|
||||
)
|
||||
.mapIndexed { i, c -> c to i }
|
||||
.toMap()
|
||||
.mapIndexed { i, c -> c to i }
|
||||
.toMap()
|
||||
}
|
|
@ -19,9 +19,6 @@ import android.content.SharedPreferences;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.media3.database.ExoDatabaseProvider;
|
||||
import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.datasource.DefaultDataSourceFactory;
|
||||
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.LeastRecentlyUsedCacheEvictor;
|
||||
import androidx.media3.datasource.cache.SimpleCache;
|
||||
import androidx.media3.exoplayer.upstream.DefaultBandwidthMeter;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
|
|
@ -909,7 +909,7 @@ public class Helper {
|
|||
if (args != null) fragment.setArguments(args);
|
||||
ft.add(containerViewId, fragment, tag);
|
||||
if (backStackName != null) ft.addToBackStack(backStackName);
|
||||
if(!fragmentManager.isDestroyed()) {
|
||||
if (!fragmentManager.isDestroyed()) {
|
||||
ft.commit();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -306,7 +306,7 @@ public class SpannableHelper {
|
|||
|
||||
for (Mention mention : mentions) {
|
||||
if (word.compareToIgnoreCase("@" + mention.username) == 0) {
|
||||
if(!checkRemotely) {
|
||||
if (!checkRemotely) {
|
||||
targetedMention = mention;
|
||||
} else {
|
||||
acct = mention.acct;
|
||||
|
@ -317,7 +317,7 @@ public class SpannableHelper {
|
|||
|
||||
if (targetedMention != null) {
|
||||
args.putString(Helper.ARG_USER_ID, targetedMention.id);
|
||||
} else if( acct != null){
|
||||
} else if (acct != null) {
|
||||
args.putString(Helper.ARG_MENTION, acct);
|
||||
} else {
|
||||
args.putString(Helper.ARG_MENTION, word);
|
||||
|
|
|
@ -891,8 +891,8 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
|||
tag.name = camelTag;
|
||||
if (!results.hashtags.contains(tag)) {
|
||||
|
||||
for(Tag realTag: results.hashtags) {
|
||||
if(realTag.name.equalsIgnoreCase(camelTag)) {
|
||||
for (Tag realTag : results.hashtags) {
|
||||
if (realTag.name.equalsIgnoreCase(camelTag)) {
|
||||
tag.history = realTag.history;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,6 @@ import android.widget.Toast;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.OptIn;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.LinearLayoutCompat;
|
||||
|
@ -91,7 +90,6 @@ import androidx.lifecycle.ViewModelProvider;
|
|||
import androidx.lifecycle.ViewModelStoreOwner;
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.common.Player;
|
||||
import androidx.media3.common.util.UnstableApi;
|
||||
import androidx.media3.datasource.DataSource;
|
||||
import androidx.media3.datasource.DefaultDataSource;
|
||||
import androidx.media3.exoplayer.ExoPlayer;
|
||||
|
|
|
@ -61,7 +61,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
|
||||
import com.bumptech.glide.RequestBuilder;
|
||||
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
|
|
@ -11,8 +11,6 @@ import android.widget.Filterable;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.github.mikephil.charting.data.Entry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -125,7 +123,7 @@ public class TagsSearchAdapter extends ArrayAdapter<Tag> implements Filterable {
|
|||
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.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
|
|
@ -21,8 +21,6 @@ import android.graphics.drawable.Drawable;
|
|||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -97,7 +95,7 @@ public class FragmentMedia extends Fragment {
|
|||
|
||||
@OptIn(markerClass = UnstableApi.class)
|
||||
public void toggleController(boolean display) {
|
||||
if(display) {
|
||||
if (display) {
|
||||
binding.controls.show();
|
||||
} else {
|
||||
binding.controls.hide();
|
||||
|
@ -241,9 +239,7 @@ public class FragmentMedia extends Fragment {
|
|||
);
|
||||
}
|
||||
switch (type.toLowerCase()) {
|
||||
case "video":
|
||||
case "audio":
|
||||
case "gifv":
|
||||
case "video", "audio", "gifv" -> {
|
||||
if (attachment.peertubeId != null) {
|
||||
//It's a peertube video, we are fetching data
|
||||
TimelinesVM timelinesVM = new ViewModelProvider(requireActivity()).get(TimelinesVM.class);
|
||||
|
@ -258,7 +254,7 @@ public class FragmentMedia extends Fragment {
|
|||
} else {
|
||||
loadVideo(url, type);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ public class FragmentMediaProfile extends Fragment {
|
|||
private boolean checkRemotely;
|
||||
private String accountId;
|
||||
private Bundle arguments;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
|
@ -98,7 +99,6 @@ public class FragmentMediaProfile extends Fragment {
|
|||
}
|
||||
|
||||
|
||||
|
||||
private void initializeAfterBundle(Bundle bundle) {
|
||||
|
||||
if (bundle != null) {
|
||||
|
@ -107,7 +107,7 @@ public class FragmentMediaProfile extends Fragment {
|
|||
}
|
||||
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
|
||||
}
|
||||
if(accountTimeline == null) {
|
||||
if (accountTimeline == null) {
|
||||
return;
|
||||
}
|
||||
flagLoading = false;
|
||||
|
@ -148,7 +148,6 @@ public class FragmentMediaProfile extends Fragment {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Intialize the common view for statuses on different timelines
|
||||
*
|
||||
|
|
|
@ -138,6 +138,7 @@ public class FragmentMastodonContext extends Fragment {
|
|||
private Status firstStatus;
|
||||
private boolean pullToRefresh;
|
||||
private String user_token, user_instance;
|
||||
private Bundle arguments;
|
||||
|
||||
/**
|
||||
* Return the position of the status in the ArrayList
|
||||
|
@ -158,8 +159,6 @@ public class FragmentMastodonContext extends Fragment {
|
|||
return found ? position : -1;
|
||||
}
|
||||
|
||||
private Bundle arguments;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
|
||||
|
|
|
@ -91,7 +91,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
private StatusAdapter statusAdapter;
|
||||
private Timeline.TimeLineEnum timelineType;
|
||||
private List<Status> timelineStatuses;
|
||||
private Bundle arguments;
|
||||
//Handle actions that can be done in other fragments
|
||||
private final BroadcastReceiver receive_action = new BroadcastReceiver() {
|
||||
@Override
|
||||
|
@ -184,6 +183,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
}
|
||||
}
|
||||
};
|
||||
private Bundle arguments;
|
||||
private boolean retry_for_home_done;
|
||||
private String lemmy_post_id;
|
||||
private boolean checkRemotely;
|
||||
|
@ -351,7 +351,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -393,6 +392,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeAfterBundle(Bundle bundle) {
|
||||
if (bundle != null) {
|
||||
timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);
|
||||
|
|
|
@ -48,12 +48,14 @@ public class FragmentProfileTimeline extends Fragment {
|
|||
private boolean checkRemotely;
|
||||
private boolean show_boosts = true, show_replies = true;
|
||||
private Bundle arguments;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater,
|
||||
ViewGroup container, Bundle savedInstanceState) {
|
||||
binding = FragmentProfileTimelinesBinding.inflate(inflater, container, false);
|
||||
arguments = getArguments();
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
@ -169,5 +171,4 @@ public class FragmentProfileTimeline extends Fragment {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
|
|||
case 0 -> {
|
||||
fragmentMastodonTimeline = new FragmentMastodonTimeline();
|
||||
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.putBoolean(Helper.ARG_SHOW_PINNED, true);
|
||||
|
@ -74,7 +74,7 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
|
|||
case 1 -> {
|
||||
fragmentMastodonTimeline = new FragmentMastodonTimeline();
|
||||
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.putBoolean(Helper.ARG_SHOW_PINNED, false);
|
||||
|
@ -86,7 +86,7 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
|
|||
}
|
||||
case 2 -> {
|
||||
FragmentMediaProfile fragmentMediaProfile = new FragmentMediaProfile();
|
||||
if(account != null) {
|
||||
if (account != null) {
|
||||
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
|
||||
}
|
||||
bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely);
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.util.List;
|
|||
|
||||
import app.fedilab.android.R;
|
||||
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.entities.api.Account;
|
||||
import app.fedilab.android.mastodon.client.entities.api.Accounts;
|
||||
|
@ -1078,7 +1077,7 @@ public class AccountsVM extends AndroidViewModel {
|
|||
Response<List<Account>> searchResponse = searchCall.execute();
|
||||
if (searchResponse.isSuccessful()) {
|
||||
accountList = searchResponse.body();
|
||||
if(accountList != null && accountList.size() > 0 ) {
|
||||
if (accountList != null && accountList.size() > 0) {
|
||||
new CachedBundle(getApplication().getApplicationContext()).insertAccountBundle(accountList.get(0), currentAccount);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,10 +105,9 @@ import androidx.media3.exoplayer.source.SingleSampleMediaSource;
|
|||
import androidx.media3.exoplayer.trackselection.AdaptiveTrackSelection;
|
||||
import androidx.media3.exoplayer.trackselection.DefaultTrackSelector;
|
||||
import androidx.media3.exoplayer.trackselection.TrackSelector;
|
||||
import androidx.media3.session.MediaSession;
|
||||
import androidx.media3.ui.AspectRatioFrameLayout;
|
||||
import androidx.media3.ui.PlayerControlView;
|
||||
import androidx.media3.ui.DefaultTimeBar;
|
||||
import androidx.media3.ui.PlayerControlView;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
@ -209,6 +208,7 @@ public class PeertubeActivity extends BasePeertubeActivity implements CommentLis
|
|||
private Status status;
|
||||
private int flags;
|
||||
private boolean humanInteraction;
|
||||
|
||||
public static void hideKeyboard(Activity activity) {
|
||||
if (activity != null && activity.getWindow() != null) {
|
||||
activity.getWindow().getDecorView();
|
||||
|
|
|
@ -40,7 +40,6 @@ import android.content.IntentFilter;
|
|||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
@ -513,7 +512,8 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
|
|||
Intent notificationIntent = new Intent(this, RetrieveInfoService.class);
|
||||
try {
|
||||
startService(notificationIntent);
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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_SOFTWARE;
|
||||
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.content.Context;
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import app.fedilab.android.R;
|
||||
import app.fedilab.android.databinding.TrackSelectionDialogBinding;
|
||||
|
||||
|
|
Loading…
Reference in a new issue