mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-06-26 07:00:10 +03:00
Merge branch 'fix_528' into develop
This commit is contained in:
commit
8db458704c
9 changed files with 38 additions and 36 deletions
|
@ -141,7 +141,7 @@ dependencies {
|
||||||
implementation("com.vanniktech:android-image-cropper:4.3.3")
|
implementation("com.vanniktech:android-image-cropper:4.3.3")
|
||||||
annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"
|
annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"
|
||||||
implementation 'jp.wasabeef:glide-transformations:4.3.0'
|
implementation 'jp.wasabeef:glide-transformations:4.3.0'
|
||||||
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.23.0'
|
implementation 'com.github.penfeizhou.android.animation:glide-plugin:3.0.4'
|
||||||
implementation 'androidx.media3:media3-exoplayer-hls:1.2.1'
|
implementation 'androidx.media3:media3-exoplayer-hls:1.2.1'
|
||||||
implementation "androidx.media3:media3-exoplayer:1.2.1"
|
implementation "androidx.media3:media3-exoplayer:1.2.1"
|
||||||
implementation "androidx.media3:media3-exoplayer-dash:1.2.1"
|
implementation "androidx.media3:media3-exoplayer-dash:1.2.1"
|
||||||
|
|
|
@ -230,6 +230,7 @@
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize" />
|
android:configChanges="keyboardHidden|orientation|screenSize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".mastodon.activities.MediaActivity"
|
android:name=".mastodon.activities.MediaActivity"
|
||||||
|
android:hardwareAccelerated="false"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
android:theme="@style/Transparent" />
|
android:theme="@style/Transparent" />
|
||||||
|
|
||||||
|
|
|
@ -82,9 +82,6 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import androidmads.library.qrgenearator.QRGContents;
|
import androidmads.library.qrgenearator.QRGContents;
|
||||||
import androidmads.library.qrgenearator.QRGEncoder;
|
import androidmads.library.qrgenearator.QRGEncoder;
|
||||||
|
@ -103,6 +100,7 @@ import app.fedilab.android.mastodon.client.entities.api.Field;
|
||||||
import app.fedilab.android.mastodon.client.entities.api.IdentityProof;
|
import app.fedilab.android.mastodon.client.entities.api.IdentityProof;
|
||||||
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
|
import app.fedilab.android.mastodon.client.entities.api.MastodonList;
|
||||||
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
|
import app.fedilab.android.mastodon.client.entities.api.RelationShip;
|
||||||
|
import app.fedilab.android.mastodon.client.entities.api.Status;
|
||||||
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
|
import app.fedilab.android.mastodon.client.entities.app.CachedBundle;
|
||||||
import app.fedilab.android.mastodon.client.entities.app.Languages;
|
import app.fedilab.android.mastodon.client.entities.app.Languages;
|
||||||
import app.fedilab.android.mastodon.client.entities.app.Pinned;
|
import app.fedilab.android.mastodon.client.entities.app.Pinned;
|
||||||
|
@ -132,7 +130,6 @@ public class ProfileActivity extends BaseActivity {
|
||||||
private RelationShip relationship;
|
private RelationShip relationship;
|
||||||
private FamiliarFollowers familiarFollowers;
|
private FamiliarFollowers familiarFollowers;
|
||||||
private Account account;
|
private Account account;
|
||||||
private ScheduledExecutorService scheduledExecutorService;
|
|
||||||
private action doAction;
|
private action doAction;
|
||||||
private AccountsVM accountsVM;
|
private AccountsVM accountsVM;
|
||||||
private RecyclerView identityProofsRecycler;
|
private RecyclerView identityProofsRecycler;
|
||||||
|
@ -357,14 +354,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
this.identityProofList = identityProofs;
|
this.identityProofList = identityProofs;
|
||||||
updateAccount();
|
updateAccount();
|
||||||
});
|
});
|
||||||
//Animate emojis
|
|
||||||
if (account.emojis != null && !account.emojis.isEmpty()) {
|
|
||||||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(getString(R.string.SET_DISABLE_ANIMATED_EMOJI), false);
|
|
||||||
if (!disableAnimatedEmoji) {
|
|
||||||
scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
|
|
||||||
scheduledExecutorService.scheduleAtFixedRate(() -> binding.accountDn.invalidate(), 0, 130, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
binding.accountTabLayout.clearOnTabSelectedListeners();
|
binding.accountTabLayout.clearOnTabSelectedListeners();
|
||||||
binding.accountTabLayout.removeAllTabs();
|
binding.accountTabLayout.removeAllTabs();
|
||||||
//Tablayout for timelines/following/followers
|
//Tablayout for timelines/following/followers
|
||||||
|
@ -550,8 +540,15 @@ public class ProfileActivity extends BaseActivity {
|
||||||
});
|
});
|
||||||
binding.accountNote.setText(
|
binding.accountNote.setText(
|
||||||
account.getSpanNote(ProfileActivity.this,
|
account.getSpanNote(ProfileActivity.this,
|
||||||
new WeakReference<>(binding.accountNote)),
|
new WeakReference<>(binding.accountNote), () -> {
|
||||||
|
//TODO: replace this hack
|
||||||
|
binding.accountNote.setText(
|
||||||
|
account.getSpanNote(ProfileActivity.this,
|
||||||
|
new WeakReference<>(binding.accountNote)), TextView.BufferType.SPANNABLE);
|
||||||
|
|
||||||
|
}),
|
||||||
TextView.BufferType.SPANNABLE);
|
TextView.BufferType.SPANNABLE);
|
||||||
|
|
||||||
binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance());
|
binding.accountNote.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
|
||||||
|
|
||||||
|
@ -1370,10 +1367,6 @@ public class ProfileActivity extends BaseActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
if (scheduledExecutorService != null) {
|
|
||||||
scheduledExecutorService.shutdownNow();
|
|
||||||
scheduledExecutorService = null;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
unregisterReceiver(broadcast_data);
|
unregisterReceiver(broadcast_data);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
|
|
|
@ -112,6 +112,9 @@ public class Account implements Serializable {
|
||||||
public synchronized Spannable getSpanNote(Context context, WeakReference<View> viewWeakReference) {
|
public synchronized Spannable getSpanNote(Context context, WeakReference<View> viewWeakReference) {
|
||||||
return SpannableHelper.convert(context, note, null, this, null, viewWeakReference, null, true, false);
|
return SpannableHelper.convert(context, note, null, this, null, viewWeakReference, null, true, false);
|
||||||
}
|
}
|
||||||
|
public synchronized Spannable getSpanNote(Context context, WeakReference<View> viewWeakReference, Status.Callback callback) {
|
||||||
|
return SpannableHelper.convert(context, note, null, this, null, viewWeakReference, callback, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(@Nullable Object obj) {
|
public boolean equals(@Nullable Object obj) {
|
||||||
|
|
|
@ -918,7 +918,7 @@ public class Helper {
|
||||||
ft.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);
|
ft.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit);
|
||||||
Fragment _fragment = fragmentManager.findFragmentByTag(tag);
|
Fragment _fragment = fragmentManager.findFragmentByTag(tag);
|
||||||
if (_fragment != null && _fragment.isAdded()) {
|
if (_fragment != null && _fragment.isAdded()) {
|
||||||
ft.show(_fragment).commit();
|
ft.show(_fragment).commitAllowingStateLoss();
|
||||||
fragment = _fragment;
|
fragment = _fragment;
|
||||||
} else {
|
} else {
|
||||||
if (args != null) fragment.setArguments(args);
|
if (args != null) fragment.setArguments(args);
|
||||||
|
@ -930,7 +930,7 @@ public class Helper {
|
||||||
}catch (Exception ignored){}
|
}catch (Exception ignored){}
|
||||||
}
|
}
|
||||||
if (!fragmentManager.isDestroyed()) {
|
if (!fragmentManager.isDestroyed()) {
|
||||||
ft.commit();
|
ft.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fragmentManager.executePendingTransactions();
|
fragmentManager.executePendingTransactions();
|
||||||
|
@ -2159,6 +2159,22 @@ public class Helper {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static OkHttpClient myPostOkHttpClient(Context context) {
|
||||||
|
return new OkHttpClient.Builder()
|
||||||
|
.addInterceptor(chain -> {
|
||||||
|
Request originalRequest = chain.request();
|
||||||
|
Request requestWithUserAgent = originalRequest.newBuilder()
|
||||||
|
.header("User-Agent", context.getString(R.string.app_name) + "/" + BuildConfig.VERSION_NAME + "/" + BuildConfig.VERSION_CODE)
|
||||||
|
.build();
|
||||||
|
return chain.proceed(requestWithUserAgent);
|
||||||
|
})
|
||||||
|
.readTimeout(120, TimeUnit.SECONDS)
|
||||||
|
.connectTimeout(120, TimeUnit.SECONDS)
|
||||||
|
.callTimeout(120, TimeUnit.SECONDS)
|
||||||
|
.proxy(Helper.getProxy(context))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
public static String parseHtml(String html) {
|
public static String parseHtml(String html) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY).toString();
|
return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY).toString();
|
||||||
|
|
|
@ -47,9 +47,7 @@ import com.google.gson.Gson;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.IDN;
|
import java.net.IDN;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
import app.fedilab.android.BaseMainActivity;
|
import app.fedilab.android.BaseMainActivity;
|
||||||
|
@ -72,7 +70,6 @@ import app.fedilab.android.mastodon.helper.Helper;
|
||||||
import app.fedilab.android.mastodon.ui.drawer.StatusAdapter;
|
import app.fedilab.android.mastodon.ui.drawer.StatusAdapter;
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.MultipartBody;
|
import okhttp3.MultipartBody;
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
|
@ -94,19 +91,11 @@ public class ComposeWorker extends Worker {
|
||||||
context.getSystemService(NOTIFICATION_SERVICE);
|
context.getSystemService(NOTIFICATION_SERVICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static OkHttpClient getOkHttpClient(Context context) {
|
|
||||||
return new OkHttpClient.Builder()
|
|
||||||
.readTimeout(120, TimeUnit.SECONDS)
|
|
||||||
.connectTimeout(120, TimeUnit.SECONDS)
|
|
||||||
.proxy(Helper.getProxy(context.getApplicationContext()))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static MastodonStatusesService init(Context context, String instance) {
|
private static MastodonStatusesService init(Context context, String instance) {
|
||||||
Retrofit retrofit = new Retrofit.Builder()
|
Retrofit retrofit = new Retrofit.Builder()
|
||||||
.baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
|
.baseUrl("https://" + (instance != null ? IDN.toASCII(instance, IDN.ALLOW_UNASSIGNED) : null) + "/api/v1/")
|
||||||
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
|
.addConverterFactory(GsonConverterFactory.create(Helper.getDateBuilder()))
|
||||||
.client(getOkHttpClient(context))
|
.client(Helper.myPostOkHttpClient(context))
|
||||||
.build();
|
.build();
|
||||||
return retrofit.create(MastodonStatusesService.class);
|
return retrofit.create(MastodonStatusesService.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -598,7 +598,9 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
if (proceedToSplit) {
|
if (proceedToSplit) {
|
||||||
int max_car = MastodonHelper.getInstanceMaxChars(context);
|
int max_car = MastodonHelper.getInstanceMaxChars(context);
|
||||||
ArrayList<String> splitText = ComposeHelper.splitToots(contentString, max_car);
|
ArrayList<String> splitText = ComposeHelper.splitToots(contentString, max_car);
|
||||||
contentString = splitText.get(0);
|
if(!splitText.isEmpty()) {
|
||||||
|
contentString = splitText.get(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int currentLength = MastodonHelper.countLength(holder);
|
int currentLength = MastodonHelper.countLength(holder);
|
||||||
if (promptDraftListener != null) {
|
if (promptDraftListener != null) {
|
||||||
|
|
|
@ -59,7 +59,6 @@ import android.os.Looper;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/media_fragment_container"
|
android:id="@+id/media_fragment_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:background="@color/black">
|
|
||||||
<!-- Main Loader -->
|
<!-- Main Loader -->
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/loader"
|
android:id="@+id/loader"
|
||||||
|
|
Loading…
Reference in a new issue