Set AKKOMA instance as PLEROMA

maths
Thomas 2 years ago
parent 5bc122cb5e
commit 7dc57d27a4

@ -92,8 +92,8 @@ dependencies {
implementation 'com.vanniktech:emoji-one:0.6.0'
implementation 'com.github.GrenderG:Toasty:1.5.2'
implementation 'org.framagit.tom79:SparkButton:1.0.13'
implementation "com.github.bumptech.glide:glide:4.12.0"
implementation "com.github.bumptech.glide:okhttp3-integration:4.12.0"
implementation "com.github.bumptech.glide:glide:4.14.2"
implementation "com.github.bumptech.glide:okhttp3-integration:4.14.2"
implementation "org.jsoup:jsoup:1.15.1"
@ -102,12 +102,11 @@ dependencies {
implementation project(path: ':ratethisapp')
implementation 'com.burhanrashid52:photoeditor:1.5.1'
implementation project(path: ':cropper')
annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"
implementation 'jp.wasabeef:glide-transformations:4.3.0'
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.22.0'
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.24.0'
implementation 'com.google.android.exoplayer:exoplayer:2.18.1'
implementation "androidx.viewpager2:viewpager2:1.0.0"
implementation 'com.github.piasy:rxandroidaudio:1.7.0'

@ -661,7 +661,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
}
headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name);
Helper.loadPP(BaseMainActivity.this, headerMainBinding.accountProfilePicture, currentAccount, false);
MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER);
MastodonHelper.loadProfileMediaMastodon(BaseMainActivity.this, headerMainBinding.backgroundImage, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER);
/*
* Some general data are loaded when the app starts such;
* - Pinned timelines (in app feature)

@ -89,7 +89,7 @@ public class EditProfileActivity extends BaseActivity {
@SuppressWarnings("deprecation")
private void initializeView() {
//Hydrate values
MastodonHelper.loadProfileMediaMastodon(binding.bannerPp, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER);
MastodonHelper.loadProfileMediaMastodon(EditProfileActivity.this, binding.bannerPp, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER);
MastodonHelper.loadPPMastodon(binding.accountPp, currentAccount.mastodon_account);
binding.displayName.setText(currentAccount.mastodon_account.display_name);
binding.acct.setText(String.format(Locale.getDefault(), "%s@%s", currentAccount.mastodon_account.acct, BaseMainActivity.currentInstance));

@ -291,7 +291,7 @@ public class ProfileActivity extends BaseActivity {
}
);
//Load header
MastodonHelper.loadProfileMediaMastodon(binding.bannerPp, account, MastodonHelper.MediaAccountType.HEADER);
MastodonHelper.loadProfileMediaMastodon(ProfileActivity.this, binding.bannerPp, account, MastodonHelper.MediaAccountType.HEADER);
//Redraws icon for locked accounts
final float scale = getResources().getDisplayMetrics().density;
if (account.locked) {

@ -272,7 +272,7 @@ public class AdminAccountActivity extends BaseActivity {
}
);
//Load header
MastodonHelper.loadProfileMediaMastodon(binding.bannerPp, adminAccount.account, MastodonHelper.MediaAccountType.HEADER);
MastodonHelper.loadProfileMediaMastodon(AdminAccountActivity.this, binding.bannerPp, adminAccount.account, MastodonHelper.MediaAccountType.HEADER);
//Redraws icon for locked accounts
final float scale = getResources().getDisplayMetrics().density;
if (adminAccount.account.locked) {

@ -291,7 +291,7 @@ public class AdminReportActivity extends BaseActivity {
}
);
//Load header
MastodonHelper.loadProfileMediaMastodon(binding.bannerPp, account, MastodonHelper.MediaAccountType.HEADER);
MastodonHelper.loadProfileMediaMastodon(AdminReportActivity.this, binding.bannerPp, account, MastodonHelper.MediaAccountType.HEADER);
//Redraws icon for locked accounts
final float scale = getResources().getDisplayMetrics().density;
if (account.locked) {

@ -40,6 +40,7 @@ public class Field implements Serializable {
//Some extra spannable element - They will be filled automatically when fetching the account
private transient ForegroundColorSpan value_span;
private transient ForegroundColorSpan name_span;
public synchronized Spannable getValueSpan(Context context, Account account, WeakReference<View> viewWeakReference) {
@ -53,6 +54,16 @@ public class Field implements Serializable {
return spannable;
}
public synchronized Spannable getLabelSpan(Context context, Account account, WeakReference<View> viewWeakReference) {
Spannable spannable = SpannableHelper.convert(context, name, null, account, null, true, viewWeakReference);
if (name_span != null && spannable != null) {
spannable.setSpan(name_span, 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return spannable;
}
public static class FieldParams implements Serializable {
@SerializedName("name")
public String name;

@ -419,6 +419,7 @@ public class Account extends BaseAccount implements Serializable {
case "PIXELFED":
api = API.PIXELFED;
break;
case "AKKOMA":
case "PLEROMA":
api = API.PLEROMA;
break;

@ -222,13 +222,17 @@ public class MastodonHelper {
}
public static void loadProfileMediaMastodon(ImageView view, Account account, MediaAccountType type) {
loadProfileMediaMastodon(null, view, account, type);
}
public static void loadProfileMediaMastodon(Activity activity, ImageView view, Account account, MediaAccountType type) {
Context context = view.getContext();
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false);
@DrawableRes int placeholder = type == MediaAccountType.AVATAR ? R.drawable.ic_person : R.drawable.default_banner;
if (Helper.isValidContextForGlide(view.getContext())) {
if (Helper.isValidContextForGlide(activity != null ? activity : context)) {
if (account == null) {
Glide.with(view.getContext())
Glide.with(activity != null ? activity : context)
.asDrawable()
.load(placeholder)
.thumbnail(0.1f)
@ -239,14 +243,14 @@ public class MastodonHelper {
String targetedUrl = disableGif ? (type == MediaAccountType.AVATAR ? account.avatar_static : account.header_static) : (type == MediaAccountType.AVATAR ? account.avatar : account.header);
if (targetedUrl != null) {
if (disableGif || (!targetedUrl.endsWith(".gif"))) {
Glide.with(view.getContext())
Glide.with(activity != null ? activity : context)
.asDrawable()
.load(targetedUrl)
.thumbnail(0.1f)
.placeholder(placeholder)
.into(view);
} else {
Glide.with(view.getContext())
Glide.with(activity != null ? activity : context)
.asGif()
.load(targetedUrl)
.thumbnail(0.1f)
@ -254,7 +258,7 @@ public class MastodonHelper {
.into(view);
}
} else {
Glide.with(view.getContext())
Glide.with(activity != null ? activity : context)
.asDrawable()
.load(placeholder)
.thumbnail(0.1f)

@ -77,7 +77,7 @@ public class FieldAdapter extends RecyclerView.Adapter<FieldAdapter.FieldViewHol
holder.binding.value.setMovementMethod(LinkMovementMethod.getInstance());
holder.binding.label.setText(
field.getValueSpan(context, account,
field.getLabelSpan(context, account,
new WeakReference<>(holder.binding.label)),
TextView.BufferType.SPANNABLE);
holder.binding.label.setMovementMethod(LinkMovementMethod.getInstance());

@ -160,6 +160,7 @@ public class FragmentLoginMain extends Fragment {
case "PIXELFED":
apiLogin = Account.API.PIXELFED;
break;
case "AKKOMA":
case "PLEROMA":
apiLogin = Account.API.PLEROMA;
break;

Loading…
Cancel
Save