Release 3.0.7
This commit is contained in:
parent
7a5cb3a3d5
commit
dc1155d7c2
|
@ -9,8 +9,8 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 31
|
targetSdk 31
|
||||||
versionCode 396
|
versionCode 397
|
||||||
versionName "3.0.6"
|
versionName "3.0.7"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
flavorDimensions "default"
|
flavorDimensions "default"
|
||||||
|
|
|
@ -772,7 +772,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
||||||
currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct;
|
currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct;
|
||||||
}
|
}
|
||||||
headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name);
|
headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name);
|
||||||
Helper.loadPP(headerMainBinding.accountProfilePicture, currentAccount);
|
Helper.loadPP(headerMainBinding.accountProfilePicture, currentAccount, false);
|
||||||
MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER);
|
MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER);
|
||||||
/*
|
/*
|
||||||
* Some general data are loaded when the app starts such;
|
* Some general data are loaded when the app starts such;
|
||||||
|
|
|
@ -87,8 +87,10 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.bumptech.glide.RequestBuilder;
|
||||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
|
||||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
|
||||||
|
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||||
import com.bumptech.glide.request.RequestOptions;
|
import com.bumptech.glide.request.RequestOptions;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
|
@ -1043,6 +1045,7 @@ public class Helper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a profile picture for the account
|
* Load a profile picture for the account
|
||||||
*
|
*
|
||||||
|
@ -1050,25 +1053,39 @@ public class Helper {
|
||||||
* @param account - {@link Account}
|
* @param account - {@link Account}
|
||||||
*/
|
*/
|
||||||
public static void loadPP(ImageView view, BaseAccount account) {
|
public static void loadPP(ImageView view, BaseAccount account) {
|
||||||
|
loadPP(view, account, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load a profile picture for the account
|
||||||
|
*
|
||||||
|
* @param view ImageView - the view where the image will be loaded
|
||||||
|
* @param account - {@link Account}
|
||||||
|
*/
|
||||||
|
public static void loadPP(ImageView view, BaseAccount account, boolean crop) {
|
||||||
Context context = view.getContext();
|
Context context = view.getContext();
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false);
|
boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false);
|
||||||
String targetedUrl = disableGif ? account.mastodon_account.avatar_static : account.mastodon_account.avatar;
|
String targetedUrl = disableGif ? account.mastodon_account.avatar_static : account.mastodon_account.avatar;
|
||||||
if (targetedUrl != null) {
|
if (targetedUrl != null) {
|
||||||
if (disableGif || (!targetedUrl.endsWith(".gif"))) {
|
if (disableGif || (!targetedUrl.endsWith(".gif"))) {
|
||||||
Glide.with(view.getContext())
|
RequestBuilder<Drawable> requestBuilder = Glide.with(view.getContext())
|
||||||
.asDrawable()
|
.asDrawable()
|
||||||
.load(targetedUrl)
|
.load(targetedUrl)
|
||||||
.thumbnail(0.1f)
|
.thumbnail(0.1f);
|
||||||
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
|
if (crop) {
|
||||||
.into(view);
|
requestBuilder = requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)));
|
||||||
|
}
|
||||||
|
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view);
|
||||||
} else {
|
} else {
|
||||||
Glide.with(view.getContext())
|
RequestBuilder<GifDrawable> requestBuilder = Glide.with(view.getContext())
|
||||||
.asGif()
|
.asGif()
|
||||||
.load(targetedUrl)
|
.load(targetedUrl)
|
||||||
.thumbnail(0.1f)
|
.thumbnail(0.1f);
|
||||||
.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
|
if (crop) {
|
||||||
.into(view);
|
requestBuilder = requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)));
|
||||||
|
}
|
||||||
|
requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Glide.with(view.getContext())
|
Glide.with(view.getContext())
|
||||||
|
|
|
@ -45,8 +45,8 @@
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:contentDescription="@string/profile_picture"
|
android:contentDescription="@string/profile_picture"
|
||||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||||
tools:src="@tools:sample/avatars"
|
android:scaleType="fitCenter"
|
||||||
android:scaleType="fitCenter" />
|
tools:src="@tools:sample/avatars" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:id="@+id/change_account"
|
android:id="@+id/change_account"
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
- Fix some bugs reported.
|
Loading…
Reference in New Issue