summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas <tschneider.ac@gmail.com>2023-01-12 17:54:31 +0100
committerThomas <tschneider.ac@gmail.com>2023-01-12 17:54:31 +0100
commitd70c285beaf058f8817dffc04b980f9c3cb93e31 (patch)
tree45582c8da9aa303d1a5ccdbceef4a3d467a8ef4b
parentaf10d647b924b9ba6cb8cbd662d0e23a26041872 (diff)
parentbb2b66ce6af70d9288becb608ae103ce22304630 (diff)
Merge branch 'develop'3.14.2
-rw-r--r--app/build.gradle4
-rw-r--r--app/src/main/AndroidManifest.xml5
-rw-r--r--app/src/main/assets/release_notes/notes.json5
-rw-r--r--app/src/main/java/app/fedilab/android/BaseMainActivity.java4
-rw-r--r--app/src/main/java/app/fedilab/android/activities/DirectoryActivity.java81
-rw-r--r--app/src/main/java/app/fedilab/android/activities/ProfileActivity.java32
-rw-r--r--app/src/main/java/app/fedilab/android/client/endpoints/MastodonAccountsService.java19
-rw-r--r--app/src/main/java/app/fedilab/android/client/entities/api/FamiliarFollowers.java28
-rw-r--r--app/src/main/java/app/fedilab/android/client/entities/app/Timeline.java2
-rw-r--r--app/src/main/java/app/fedilab/android/helper/Helper.java4
-rw-r--r--app/src/main/java/app/fedilab/android/helper/MastodonHelper.java49
-rw-r--r--app/src/main/java/app/fedilab/android/helper/MediaHelper.java11
-rw-r--r--app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java2
-rw-r--r--app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java135
-rw-r--r--app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonAccount.java20
-rw-r--r--app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java4
-rw-r--r--app/src/main/java/app/fedilab/android/viewmodel/mastodon/AccountsVM.java67
-rw-r--r--app/src/main/res/drawable/ic_baseline_android_24.xml10
-rw-r--r--app/src/main/res/drawable/ic_baseline_perm_contact_calendar_24.xml10
-rw-r--r--app/src/main/res/layout/activity_directory.xml31
-rw-r--r--app/src/main/res/layout/activity_profile.xml40
-rw-r--r--app/src/main/res/layout/drawer_status.xml40
-rw-r--r--app/src/main/res/layout/popup_release_notes.xml13
-rw-r--r--app/src/main/res/menu/activity_main_drawer.xml5
-rw-r--r--app/src/main/res/menu/menu_directory.xml23
-rw-r--r--app/src/main/res/values-cs/strings.xml3
-rw-r--r--app/src/main/res/values-pt/strings.xml4
-rw-r--r--app/src/main/res/values/strings.xml3
-rw-r--r--src/fdroid/fastlane/metadata/android/en/changelogs/464.txt12
29 files changed, 561 insertions, 105 deletions
diff --git a/app/build.gradle b/app/build.gradle
index e39b62ae5..eaabe38d4 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,8 +13,8 @@ android {
defaultConfig {
minSdk 21
targetSdk 33
- versionCode 463
- versionName "3.14.1"
+ versionCode 464
+ versionName "3.14.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions "default"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6543017c5..61a0d0a4a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -250,6 +250,11 @@
android:label="@string/Suggestions"
android:theme="@style/AppThemeBar" />
<activity
+ android:name=".activities.DirectoryActivity"
+ android:configChanges="keyboardHidden|orientation|screenSize"
+ android:label="@string/Directory"
+ android:theme="@style/AppThemeBar" />
+ <activity
android:name=".activities.PartnerShipActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/action_about"
diff --git a/app/src/main/assets/release_notes/notes.json b/app/src/main/assets/release_notes/notes.json
index 53210353f..c4bd320ab 100644
--- a/app/src/main/assets/release_notes/notes.json
+++ b/app/src/main/assets/release_notes/notes.json
@@ -1,5 +1,10 @@
[
{
+ "version": "3.14.2",
+ "code": "464",
+ "note": "Added:\n- Display familiar followers on profiles\n- Display and filter Instance directory\n\nChanged:\n- Bot and reply icon indicators more visible\n- Single media are hidden with link previews\n\nFixed:\n- Fix a crash with Art timelines\n- Friendica: media cannot be downloaded/shared\n- Fix a crash with pinned timelines"
+ },
+ {
"version": "3.14.1",
"code": "463",
"note": "Added:\n- Search bar: display suggestions when starting by \"@\" or \"#\"\n\nChanged:\n- Preload media in timelines to avoid jumps\n- Search: Automatically switch to account tab if no results for tags\n\nFixed:\n- Fix jumps with the fetch more feature\n- Fix videos cannot be saved\n- Tags cannot be pinned when there are no custom tabs\n- PixelFed view: NSFW not honored\n- Fix crashes"
diff --git a/app/src/main/java/app/fedilab/android/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/BaseMainActivity.java
index ff7cffd95..693e72e43 100644
--- a/app/src/main/java/app/fedilab/android/BaseMainActivity.java
+++ b/app/src/main/java/app/fedilab/android/BaseMainActivity.java
@@ -109,6 +109,7 @@ import app.fedilab.android.activities.BaseActivity;
import app.fedilab.android.activities.CacheActivity;
import app.fedilab.android.activities.ComposeActivity;
import app.fedilab.android.activities.ContextActivity;
+import app.fedilab.android.activities.DirectoryActivity;
import app.fedilab.android.activities.DraftActivity;
import app.fedilab.android.activities.FilterActivity;
import app.fedilab.android.activities.FollowRequestActivity;
@@ -409,6 +410,9 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
} else if (id == R.id.nav_suggestions) {
Intent intent = new Intent(this, SuggestionActivity.class);
startActivity(intent);
+ } else if (id == R.id.nav_directory) {
+ Intent intent = new Intent(this, DirectoryActivity.class);
+ startActivity(intent);
} else if (id == R.id.nav_cache) {
Intent intent = new Intent(BaseMainActivity.this, CacheActivity.class);
startActivity(intent);
diff --git a/app/src/main/java/app/fedilab/android/activities/DirectoryActivity.java b/app/src/main/java/app/fedilab/android/activities/DirectoryActivity.java
new file mode 100644
index 000000000..1b68d213f
--- /dev/null
+++ b/app/src/main/java/app/fedilab/android/activities/DirectoryActivity.java
@@ -0,0 +1,81 @@
+package app.fedilab.android.activities;
+/* Copyright 2022 Thomas Schneider
+ *
+ * This file is a part of Fedilab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Fedilab; if not,
+ * see <http://www.gnu.org/licenses>. */
+
+import static app.fedilab.android.client.entities.app.Timeline.TimeLineEnum.ACCOUNT_DIRECTORY;
+
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+
+import org.jetbrains.annotations.NotNull;
+
+import app.fedilab.android.R;
+import app.fedilab.android.databinding.ActivityDirectoryBinding;
+import app.fedilab.android.helper.Helper;
+import app.fedilab.android.ui.fragment.timeline.FragmentMastodonAccount;
+
+
+public class DirectoryActivity extends BaseBarActivity {
+
+ private static boolean local = false;
+ private static String order = "active";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ ActivityDirectoryBinding binding = ActivityDirectoryBinding.inflate(getLayoutInflater());
+ setContentView(binding.getRoot());
+ if (getSupportActionBar() != null) {
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ }
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(Helper.ARG_DIRECTORY_LOCAL, local);
+ bundle.putString(Helper.ARG_DIRECTORY_ORDER, order);
+ bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, ACCOUNT_DIRECTORY);
+ Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_directory, new FragmentMastodonAccount(), bundle, null, null);
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.menu_directory, menu);
+ if (order.equals("active")) {
+ menu.findItem(R.id.order_active).setChecked(true);
+ } else {
+ menu.findItem(R.id.order_new).setChecked(true);
+ }
+ menu.findItem(R.id.action_local).setChecked(local);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(@NotNull MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ finish();
+ return true;
+ } else if (item.getItemId() == R.id.action_local) {
+ item.setChecked(!item.isChecked());
+ local = item.isChecked();
+ } else if (item.getItemId() == R.id.order_active) {
+ order = "active";
+ } else if (item.getItemId() == R.id.order_new) {
+ order = "new";
+ }
+ recreate();
+ return super.onOptionsItemSelected(item);
+ }
+
+}
diff --git a/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java b/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java
index 1ab57d6d8..27e59b80d 100644
--- a/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java
@@ -34,6 +34,7 @@ import android.text.method.LinkMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.text.style.UnderlineSpan;
import android.util.TypedValue;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -76,6 +77,7 @@ import app.fedilab.android.BaseMainActivity;
import app.fedilab.android.R;
import app.fedilab.android.client.entities.api.Account;
import app.fedilab.android.client.entities.api.Attachment;
+import app.fedilab.android.client.entities.api.FamiliarFollowers;
import app.fedilab.android.client.entities.api.Field;
import app.fedilab.android.client.entities.api.IdentityProof;
import app.fedilab.android.client.entities.api.MastodonList;
@@ -86,6 +88,7 @@ import app.fedilab.android.client.entities.app.RemoteInstance;
import app.fedilab.android.client.entities.app.Timeline;
import app.fedilab.android.client.entities.app.WellKnownNodeinfo;
import app.fedilab.android.databinding.ActivityProfileBinding;
+import app.fedilab.android.databinding.NotificationsRelatedAccountsBinding;
import app.fedilab.android.exception.DBException;
import app.fedilab.android.helper.CrossActionHelper;
import app.fedilab.android.helper.Helper;
@@ -106,6 +109,7 @@ public class ProfileActivity extends BaseActivity {
private RelationShip relationship;
+ private FamiliarFollowers familiarFollowers;
private Account account;
private ScheduledExecutorService scheduledExecutorService;
private action doAction;
@@ -255,6 +259,13 @@ public class ProfileActivity extends BaseActivity {
updateAccount();
}
});
+ accountsVM.getFamiliarFollowers(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, accountListToCheck).observe(ProfileActivity.this, familiarFollowersList -> {
+ if (familiarFollowersList != null && familiarFollowersList.size() > 0) {
+ this.familiarFollowers = familiarFollowersList.get(0);
+ updateAccount();
+ }
+ });
+
//Retrieve identity proofs
accountsVM.getIdentityProofs(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, account.id).observe(ProfileActivity.this, identityProofs -> {
this.identityProofList = identityProofs;
@@ -567,6 +578,27 @@ public class ProfileActivity extends BaseActivity {
}
}
+ if (familiarFollowers != null && familiarFollowers.accounts != null && familiarFollowers.accounts.size() > 0) {
+ binding.relatedAccounts.removeAllViews();
+ for (Account account : familiarFollowers.accounts) {
+ NotificationsRelatedAccountsBinding notificationsRelatedAccountsBinding = NotificationsRelatedAccountsBinding.inflate(LayoutInflater.from(ProfileActivity.this));
+ MastodonHelper.loadProfileMediaMastodonRound(ProfileActivity.this, notificationsRelatedAccountsBinding.profilePicture, account);
+ notificationsRelatedAccountsBinding.acc.setText(account.username);
+ notificationsRelatedAccountsBinding.relatedAccountContainer.setOnClickListener(v -> {
+ Intent intent = new Intent(ProfileActivity.this, ProfileActivity.class);
+ Bundle b = new Bundle();
+ b.putSerializable(Helper.ARG_ACCOUNT, account);
+ intent.putExtras(b);
+ ActivityOptionsCompat options = ActivityOptionsCompat
+ .makeSceneTransitionAnimation(ProfileActivity.this, notificationsRelatedAccountsBinding.profilePicture, getString(R.string.activity_porfile_pp));
+ // start the new activity
+ startActivity(intent, options.toBundle());
+ });
+ binding.relatedAccounts.addView(notificationsRelatedAccountsBinding.getRoot());
+ }
+ binding.familiarFollowers.setVisibility(View.VISIBLE);
+ }
+
binding.accountFollow.setEnabled(true);
//Visibility depending of the relationship
if (relationship != null) {
diff --git a/app/src/main/java/app/fedilab/android/client/endpoints/MastodonAccountsService.java b/app/src/main/java/app/fedilab/android/client/endpoints/MastodonAccountsService.java
index 398c43dcc..b7cba8995 100644
--- a/app/src/main/java/app/fedilab/android/client/endpoints/MastodonAccountsService.java
+++ b/app/src/main/java/app/fedilab/android/client/endpoints/MastodonAccountsService.java
@@ -18,6 +18,7 @@ package app.fedilab.android.client.endpoints;
import java.util.List;
import app.fedilab.android.client.entities.api.Account;
+import app.fedilab.android.client.entities.api.FamiliarFollowers;
import app.fedilab.android.client.entities.api.FeaturedTag;
import app.fedilab.android.client.entities.api.IdentityProof;
import app.fedilab.android.client.entities.api.MastodonList;
@@ -253,6 +254,13 @@ public interface MastodonAccountsService {
@Query("id[]") List<String> ids
);
+ //Get familiar followers
+ @GET("accounts/familiar_followers ")
+ Call<List<FamiliarFollowers>> getFamiliarFollowers(
+ @Header("Authorization") String token,
+ @Query("id[]") List<String> ids
+ );
+
//Get search
@GET("accounts/search")
Call<List<Account>> searchAccounts(
@@ -409,4 +417,15 @@ public interface MastodonAccountsService {
@Header("Authorization") String token,
@Path("account_id") String account_id
);
+
+
+ //Get user suggestions
+ @GET("directory")
+ Call<List<Account>> getDirectory(
+ @Header("Authorization") String token,
+ @Query("offset") Integer offset,
+ @Query("limit") Integer limit,
+ @Query("order") String order,
+ @Query("local") Boolean local
+ );
}
diff --git a/app/src/main/java/app/fedilab/android/client/entities/api/FamiliarFollowers.java b/app/src/main/java/app/fedilab/android/client/entities/api/FamiliarFollowers.java
new file mode 100644
index 000000000..1d753c55e
--- /dev/null
+++ b/app/src/main/java/app/fedilab/android/client/entities/api/FamiliarFollowers.java
@@ -0,0 +1,28 @@
+package app.fedilab.android.client.entities.api;
+/* Copyright 2022 Thomas Schneider
+ *
+ * This file is a part of Fedilab
+ *
+ * This program is free software; you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
+ * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+ * Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Fedilab; if not,
+ * see <http://www.gnu.org/licenses>. */
+
+import com.google.gson.annotations.SerializedName;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class FamiliarFollowers implements Serializable {
+
+ @SerializedName("id")
+ public String id;
+ @SerializedName("accounts")
+ public List<Account> accounts;
+}
diff --git a/app/src/main/java/app/fedilab/android/client/entities/app/Timeline.java b/app/src/main/java/app/fedilab/android/client/entities/app/Timeline.java
index e3c5fa665..c4196055c 100644
--- a/app/src/main/java/app/fedilab/android/client/entities/app/Timeline.java
+++ b/app/src/main/java/app/fedilab/android/client/entities/app/Timeline.java
@@ -382,6 +382,8 @@ public class Timeline {
TREND_MESSAGE("TREND_MESSAGE"),
@SerializedName("ACCOUNT_SUGGESTION")
ACCOUNT_SUGGESTION("ACCOUNT_SUGGESTION"),
+ @SerializedName("ACCOUNT_DIRECTORY")
+ ACCOUNT_DIRECTORY("ACCOUNT_DIRECTORY"),
@SerializedName("PUBLIC_TREND_MESSAGE")
TREND_MESSAGE_PUBLIC("TREND_MESSAGE_PUBLIC"),
@SerializedName("STATUS_HISTORY")
diff --git a/app/src/main/java/app/fedilab/android/helper/Helper.java b/app/src/main/java/app/fedilab/android/helper/Helper.java
index 2d31e6059..e443b7869 100644
--- a/app/src/main/java/app/fedilab/android/helper/Helper.java
+++ b/app/src/main/java/app/fedilab/android/helper/Helper.java
@@ -253,6 +253,8 @@ public class Helper {
public static final String ARG_WORK_ID = "ARG_WORK_ID";
public static final String ARG_LIST_ID = "ARG_LIST_ID";
public static final String ARG_SEARCH_KEYWORD = "ARG_SEARCH_KEYWORD";
+ public static final String ARG_DIRECTORY_ORDER = "ARG_DIRECTORY_ORDER";
+ public static final String ARG_DIRECTORY_LOCAL = "ARG_DIRECTORY_LOCAL";
public static final String ARG_SEARCH_TYPE = "ARG_SEARCH_TYPE";
public static final String ARG_SEARCH_KEYWORD_CACHE = "ARG_SEARCH_KEYWORD_CACHE";
public static final String ARG_VIEW_MODEL_KEY = "ARG_VIEW_MODEL_KEY";
@@ -1809,7 +1811,7 @@ public class Helper {
binding.aboutSupport.setVisibility(View.GONE);
binding.aboutSupportPaypal.setVisibility(View.GONE);
}
- binding.accountFollow.setImageResource(R.drawable.ic_baseline_person_add_24);
+ binding.accountFollow.setIconResource(R.drawable.ic_baseline_person_add_24);
binding.aboutSupport.setOnClickListener(v -> {
Intent intentLiberapay = new Intent(Intent.ACTION_VIEW);
intentLiberapay.setData(Uri.parse("https://liberapay.com/tom79"));
diff --git a/app/src/main/java/app/fedilab/android/helper/MastodonHelper.java b/app/src/main/java/app/fedilab/android/helper/MastodonHelper.java
index b86a9ecd7..8212dc74b 100644
--- a/app/src/main/java/app/fedilab/android/helper/MastodonHelper.java
+++ b/app/src/main/java/app/fedilab/android/helper/MastodonHelper.java
@@ -40,6 +40,9 @@ import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.resource.bitmap.CenterCrop;
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
+import com.bumptech.glide.request.RequestOptions;
import com.google.gson.annotations.SerializedName;
import java.text.SimpleDateFormat;
@@ -268,6 +271,52 @@ public class MastodonHelper {
}
}
+ public static void loadProfileMediaMastodonRound(Activity activity, ImageView view, Account account) {
+ Context context = view.getContext();
+ SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
+ boolean disableGif = sharedpreferences.getBoolean(context.getString(R.string.SET_DISABLE_GIF), false);
+ @DrawableRes int placeholder = R.drawable.ic_person;
+ if (Helper.isValidContextForGlide(activity != null ? activity : context)) {
+ if (account == null) {
+ Glide.with(activity != null ? activity : context)
+ .asDrawable()
+ .load(placeholder)
+ .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(16)))
+ .thumbnail(0.1f)
+ .placeholder(placeholder)
+ .into(view);
+ return;
+ }
+ String targetedUrl = disableGif ? account.avatar_static : account.avatar;
+ if (targetedUrl != null) {
+ if (disableGif || (!targetedUrl.endsWith(".gif"))) {
+ Glide.with(activity != null ? activity : context)
+ .asDrawable()
+ .load(targetedUrl)
+ .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
+ .thumbnail(0.1f)
+ .placeholder(placeholder)
+ .into(view);
+ } else {
+ Glide.with(activity != null ? activity : context)
+ .asGif()
+ .load(targetedUrl)
+ .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
+ .thumbnail(0.1f)
+ .placeholder(placeholder)
+ .into(view);
+ }
+ } else {
+ Glide.with(activity != null ? activity : context)
+ .asDrawable()
+ .load(placeholder)
+ .apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10)))
+ .thumbnail(0.1f)
+ .into(view);
+ }
+ }
+ }
+
/**
* Convert a date in String -> format yyyy-MM-dd HH:mm:ss
*
diff --git a/app/src/main/java/app/fedilab/android/helper/MediaHelper.java b/app/src/main/java/app/fedilab/android/helper/MediaHelper.java
index b6f65f7c7..1a60e74af 100644
--- a/app/src/main/java/app/fedilab/android/helper/MediaHelper.java
+++ b/app/src/main/java/app/fedilab/android/helper/MediaHelper.java
@@ -100,7 +100,10 @@ public class MediaHelper {
}
try {
String mime = getMimeType(url);
- final String fileName = URLUtil.guessFileName(url, null, null);
+ String fileName = URLUtil.guessFileName(url, null, null);
+ if (fileName.endsWith(".bin")) {
+ fileName = fileName.replace(".bin", ".mp4");
+ }
request.allowScanningByMediaScanner();
if (mime.toLowerCase().startsWith("video")) {
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, context.getString(R.string.app_name) + "/" + fileName);
@@ -134,9 +137,11 @@ public class MediaHelper {
.into(new CustomTarget<File>() {
@Override
public void onResourceReady(@NotNull File file, Transition<? super File> transition) {
- final String fileName = URLUtil.guessFileName(url, null, null);
-
+ String fileName = URLUtil.guessFileName(url, null, null);
+ if (fileName.endsWith(".bin")) {
+ fileName = fileName.replace(".bin", ".jpg");
+ }
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File targeted_folder = new File(path, context.getString(R.string.app_name));
if (!targeted_folder.exists()) {
diff --git a/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java b/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java
index 7a39946da..4f92c1e84 100644
--- a/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java
+++ b/app/src/main/java/app/fedilab/android/helper/PinnedTimelineHelper.java
@@ -464,7 +464,7 @@ public class PinnedTimelineHelper {
break;
case NITTER:
item.setIcon(R.drawable.nitter);
- if (pinnedTimeline.remoteInstance.displayName.trim().length() > 0) {
+ if (pinnedTimeline.remoteInstance.displayName != null && pinnedTimeline.remoteInstance.displayName.trim().length() > 0) {
item.setTitle(pinnedTimeline.remoteInstance.displayName);
} else {
item.setTitle(pinnedTimeline.remoteInstance.host);
diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java
index baa1a162c..ca686c881 100644
--- a/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java
+++ b/app/src/main/java/app/fedilab/android/ui/drawer/StatusAdapter.java
@@ -163,6 +163,8 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
public static final int STATUS_FILTERED = 3;
public static final int STATUS_FILTERED_HIDE = 4;
public static final int STATUS_PIXELFED = 5;
+ private static float measuredWidth = -1;
+ private static float measuredWidthArt = -1;
private final List<Status> statusList;
private final boolean minified;
private final Timeline.TimeLineEnum timelineType;
@@ -171,10 +173,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
public FetchMoreCallBack fetchMoreCallBack;
private Context context;
private boolean visiblePixelfed;
-
private RecyclerView mRecyclerView;
- private static float measuredWidth = -1;
- private static float measuredWidthArt = -1;
public StatusAdapter(List<Status> statuses, Timeline.TimeLineEnum timelineType, boolean minified, boolean canBeFederated, boolean checkRemotely) {
this.statusList = statuses;
@@ -1288,7 +1287,9 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
LayoutInflater inflater = ((Activity) context).getLayoutInflater();
//--- MEDIA ATTACHMENT ---
- if (statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0) {
+ boolean cardDisplayed = (statusToDeal.card != null && (display_card || statusToDeal.isFocused) && statusToDeal.quote_id == null);
+ if (statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0 && (!cardDisplayed || statusToDeal.media_attachments.size() > 1)) {
+
holder.binding.attachmentsList.removeAllViews();
holder.binding.mediaContainer.removeAllViews();
if ((loadMediaType.equals("ASK") || (loadMediaType.equals("WIFI") && !TimelineHelper.isOnWIFI(context))) && !statusToDeal.canLoadMedia) {
@@ -2246,53 +2247,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
- @NonNull
- @Override
- public List<Attachment> getPreloadItems(int position) {
- List<Attachment> attachments = new ArrayList<>();
- if (position == 0 && statusList.size() > 0) {
- for (Status status : statusList.subList(0, 1)) {
- Status statusToDeal = status.reblog != null ? status.reblog : status;
- if (statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0) {
- attachments.addAll(statusToDeal.media_attachments);
- }
- }
- } else if (position > 0 && position < (statusList.size() - 1)) {
- for (Status status : statusList.subList(position - 1, position + 1)) {
- Status statusToDeal = status.reblog != null ? status.reblog : status;
- if (statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0) {
- attachments.addAll(statusToDeal.media_attachments);
- }
- }
- } else {
- for (Status status : statusList.subList(position, position)) {
- Status statusToDeal = status.reblog != null ? status.reblog : status;
- if (statusToDeal.media_attachments != null && statusToDeal.media_attachments.size() > 0) {
- attachments.addAll(statusToDeal.media_attachments);
- }
- }
- }
- return attachments;
- }
-
- @Nullable
- @Override
- public RequestBuilder<Drawable> getPreloadRequestBuilder(@NonNull Attachment attachment) {
- float focusX = 0.f;
- float focusY = 0.f;
- if (attachment.meta != null && attachment.meta.focus != null) {
- focusX = attachment.meta.focus.x;
- focusY = attachment.meta.focus.y;
- }
- int mediaH = 0;
- int mediaW = 0;
- if (attachment.meta != null && attachment.meta.small != null) {
- mediaH = attachment.meta.small.height;
- mediaW = attachment.meta.small.width;
- }
- return prepareRequestBuilder(context, attachment, mediaW, mediaH, focusX, focusY, attachment.sensitive, timelineType == Timeline.TimeLineEnum.ART).load(attachment);
- }
-
/**
* Send a broadcast to other open fragments that content a timeline
*
@@ -2317,21 +2271,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
LocalBroadcastManager.getInstance(context).sendBroadcast(intentBC);
}
- /* private static boolean mediaObfuscated(Status status) {
- //Media is not sensitive and doesn't have a spoiler text
- if (!status.isMediaObfuscated) {
- return false;
- }
- if (!status.sensitive && (status.spoiler_text == null || status.spoiler_text.trim().isEmpty())) {
- return false;
- }
- if (status.isMediaObfuscated && status.spoiler_text != null && !status.spoiler_text.trim().isEmpty()) {
- return true;
- } else {
- return status.sensitive;
- }
- }*/
-
public static void applyColor(Context context, StatusViewHolder holder) {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
int currentNightMode = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
@@ -2418,6 +2357,68 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder