Loading app/src/main/java/app/fedilab/android/BaseMainActivity.java +2 −2 Original line number Diff line number Diff line Loading @@ -654,13 +654,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt regex_public = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_PUBLIC) + currentUserID + currentInstance, null); show_art_nsfw = sharedpreferences.getBoolean(getString(R.string.SET_ART_WITH_NSFW) + currentUserID + currentInstance, false); binding.profilePicture.setOnClickListener(v -> binding.drawerLayout.openDrawer(GravityCompat.START)); Helper.loadPP(binding.profilePicture, currentAccount); Helper.loadPP(BaseMainActivity.this, binding.profilePicture, currentAccount); headerMainBinding.accountAcc.setText(String.format("%s@%s", currentAccount.mastodon_account.username, currentAccount.instance)); if (currentAccount.mastodon_account.display_name == null || currentAccount.mastodon_account.display_name.isEmpty()) { currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct; } headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name); Helper.loadPP(headerMainBinding.accountProfilePicture, currentAccount, false); Helper.loadPP(BaseMainActivity.this, headerMainBinding.accountProfilePicture, currentAccount, false); MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER); /* * Some general data are loaded when the app starts such; Loading app/src/main/java/app/fedilab/android/activities/ProfileActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -870,7 +870,7 @@ public class ProfileActivity extends BaseActivity { i++; } builderSingle.setMultiChoiceItems(listsArray, presentArray, (dialog, which, isChecked) -> { if (!relationship.following) { if (relationship == null || !relationship.following) { accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false) .observe(ProfileActivity.this, newRelationShip -> { relationship = newRelationShip; Loading app/src/main/java/app/fedilab/android/helper/Helper.java +10 −11 Original line number Diff line number Diff line Loading @@ -1132,8 +1132,8 @@ public class Helper { * @param view ImageView - the view where the image will be loaded * @param account - {@link Account} */ public static void loadPP(ImageView view, BaseAccount account) { loadPP(view, account, false); public static void loadPP(Activity activity, ImageView view, BaseAccount account) { loadPP(activity, view, account, false); } /** Loading @@ -1142,15 +1142,14 @@ public class Helper { * @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(); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false); public static void loadPP(Activity activity, ImageView view, BaseAccount account, boolean crop) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity); boolean disableGif = sharedpreferences.getBoolean(activity.getString(R.string.SET_DISABLE_GIF), false); String targetedUrl = disableGif ? account.mastodon_account.avatar_static : account.mastodon_account.avatar; if (targetedUrl != null && Helper.isValidContextForGlide(context)) { if (targetedUrl != null && Helper.isValidContextForGlide(activity)) { if (disableGif || (!targetedUrl.endsWith(".gif"))) { try { RequestBuilder<Drawable> requestBuilder = Glide.with(context) RequestBuilder<Drawable> requestBuilder = Glide.with(activity) .asDrawable() .load(targetedUrl) .thumbnail(0.1f); Loading @@ -1161,7 +1160,7 @@ public class Helper { } catch (Exception ignored) { } } else { RequestBuilder<GifDrawable> requestBuilder = Glide.with(context) RequestBuilder<GifDrawable> requestBuilder = Glide.with(activity) .asGif() .load(targetedUrl) .thumbnail(0.1f); Loading @@ -1170,8 +1169,8 @@ public class Helper { } requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view); } } else if (Helper.isValidContextForGlide(context)) { Glide.with(context) } else if (Helper.isValidContextForGlide(activity)) { Glide.with(activity) .asDrawable() .load(R.drawable.ic_person) .thumbnail(0.1f) Loading app/src/main/java/app/fedilab/android/ui/drawer/ReorderTabAdapter.java +4 −2 Original line number Diff line number Diff line Loading @@ -170,9 +170,11 @@ public class ReorderTabAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol holder.binding.delete.setOnClickListener(v -> { if (item.type == Timeline.TimeLineEnum.TAG || item.type == Timeline.TimeLineEnum.REMOTE || item.type == Timeline.TimeLineEnum.LIST) { mUndoListener.onUndo(item, position); if (position < pinned.pinnedTimelines.size()) { pinned.pinnedTimelines.remove(position); notifyItemRemoved(position); } } }); } Loading app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java +1 −2 Original line number Diff line number Diff line Loading @@ -622,8 +622,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati for (Notification notificationsAlreadyPresent : notificationList) { //We compare the date of each status and we only add status having a date greater than the another, it is inserted at this position //Pinned messages are ignored because their date can be older //if (Helper.compareTo(notificationReceived.id, notificationsAlreadyPresent.id) > 0) { if (notificationReceived.created_at.after(notificationsAlreadyPresent.created_at)) { if (Helper.compareTo(notificationReceived.id, notificationsAlreadyPresent.id) > 0) { if (!notificationList.contains(notificationReceived)) { notificationList.add(position, notificationReceived); notificationAdapter.notifyItemInserted(position); Loading Loading
app/src/main/java/app/fedilab/android/BaseMainActivity.java +2 −2 Original line number Diff line number Diff line Loading @@ -654,13 +654,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt regex_public = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_PUBLIC) + currentUserID + currentInstance, null); show_art_nsfw = sharedpreferences.getBoolean(getString(R.string.SET_ART_WITH_NSFW) + currentUserID + currentInstance, false); binding.profilePicture.setOnClickListener(v -> binding.drawerLayout.openDrawer(GravityCompat.START)); Helper.loadPP(binding.profilePicture, currentAccount); Helper.loadPP(BaseMainActivity.this, binding.profilePicture, currentAccount); headerMainBinding.accountAcc.setText(String.format("%s@%s", currentAccount.mastodon_account.username, currentAccount.instance)); if (currentAccount.mastodon_account.display_name == null || currentAccount.mastodon_account.display_name.isEmpty()) { currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct; } headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name); Helper.loadPP(headerMainBinding.accountProfilePicture, currentAccount, false); Helper.loadPP(BaseMainActivity.this, headerMainBinding.accountProfilePicture, currentAccount, false); MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER); /* * Some general data are loaded when the app starts such; Loading
app/src/main/java/app/fedilab/android/activities/ProfileActivity.java +1 −1 Original line number Diff line number Diff line Loading @@ -870,7 +870,7 @@ public class ProfileActivity extends BaseActivity { i++; } builderSingle.setMultiChoiceItems(listsArray, presentArray, (dialog, which, isChecked) -> { if (!relationship.following) { if (relationship == null || !relationship.following) { accountsVM.follow(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id, true, false) .observe(ProfileActivity.this, newRelationShip -> { relationship = newRelationShip; Loading
app/src/main/java/app/fedilab/android/helper/Helper.java +10 −11 Original line number Diff line number Diff line Loading @@ -1132,8 +1132,8 @@ public class Helper { * @param view ImageView - the view where the image will be loaded * @param account - {@link Account} */ public static void loadPP(ImageView view, BaseAccount account) { loadPP(view, account, false); public static void loadPP(Activity activity, ImageView view, BaseAccount account) { loadPP(activity, view, account, false); } /** Loading @@ -1142,15 +1142,14 @@ public class Helper { * @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(); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false); public static void loadPP(Activity activity, ImageView view, BaseAccount account, boolean crop) { SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(activity); boolean disableGif = sharedpreferences.getBoolean(activity.getString(R.string.SET_DISABLE_GIF), false); String targetedUrl = disableGif ? account.mastodon_account.avatar_static : account.mastodon_account.avatar; if (targetedUrl != null && Helper.isValidContextForGlide(context)) { if (targetedUrl != null && Helper.isValidContextForGlide(activity)) { if (disableGif || (!targetedUrl.endsWith(".gif"))) { try { RequestBuilder<Drawable> requestBuilder = Glide.with(context) RequestBuilder<Drawable> requestBuilder = Glide.with(activity) .asDrawable() .load(targetedUrl) .thumbnail(0.1f); Loading @@ -1161,7 +1160,7 @@ public class Helper { } catch (Exception ignored) { } } else { RequestBuilder<GifDrawable> requestBuilder = Glide.with(context) RequestBuilder<GifDrawable> requestBuilder = Glide.with(activity) .asGif() .load(targetedUrl) .thumbnail(0.1f); Loading @@ -1170,8 +1169,8 @@ public class Helper { } requestBuilder.apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(view); } } else if (Helper.isValidContextForGlide(context)) { Glide.with(context) } else if (Helper.isValidContextForGlide(activity)) { Glide.with(activity) .asDrawable() .load(R.drawable.ic_person) .thumbnail(0.1f) Loading
app/src/main/java/app/fedilab/android/ui/drawer/ReorderTabAdapter.java +4 −2 Original line number Diff line number Diff line Loading @@ -170,9 +170,11 @@ public class ReorderTabAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol holder.binding.delete.setOnClickListener(v -> { if (item.type == Timeline.TimeLineEnum.TAG || item.type == Timeline.TimeLineEnum.REMOTE || item.type == Timeline.TimeLineEnum.LIST) { mUndoListener.onUndo(item, position); if (position < pinned.pinnedTimelines.size()) { pinned.pinnedTimelines.remove(position); notifyItemRemoved(position); } } }); } Loading
app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java +1 −2 Original line number Diff line number Diff line Loading @@ -622,8 +622,7 @@ public class FragmentMastodonNotification extends Fragment implements Notificati for (Notification notificationsAlreadyPresent : notificationList) { //We compare the date of each status and we only add status having a date greater than the another, it is inserted at this position //Pinned messages are ignored because their date can be older //if (Helper.compareTo(notificationReceived.id, notificationsAlreadyPresent.id) > 0) { if (notificationReceived.created_at.after(notificationsAlreadyPresent.created_at)) { if (Helper.compareTo(notificationReceived.id, notificationsAlreadyPresent.id) > 0) { if (!notificationList.contains(notificationReceived)) { notificationList.add(position, notificationReceived); notificationAdapter.notifyItemInserted(position); Loading