summaryrefslogtreecommitdiffstats
path: root/app/src
diff options
context:
space:
mode:
authortom79 <tschneider.ac@gmail.com>2020-04-05 19:26:08 +0200
committertom79 <tschneider.ac@gmail.com>2020-04-05 19:26:08 +0200
commitcb98031766337b6073134075ae36be3b33abe1e3 (patch)
tree61e0acf2d2e530045e0e517d1f39d1ba9ff0b1a7 /app/src
parenta5e3fe75efcdc401a809afe5989033888004c4a0 (diff)
Fix some issues
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/assets/changelogs/356.txt15
-rw-r--r--app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java2
-rw-r--r--app/src/main/java/app/fedilab/android/activities/EditProfileActivity.java4
-rw-r--r--app/src/main/java/app/fedilab/android/drawers/CustomEmojiAdapter.java35
-rw-r--r--app/src/main/java/app/fedilab/android/helper/Helper.java91
-rw-r--r--app/src/main/res/drawable-v24/block_quote_background.xml2
6 files changed, 52 insertions, 97 deletions
diff --git a/app/src/main/assets/changelogs/356.txt b/app/src/main/assets/changelogs/356.txt
index 573d2e8a4..9ca9acb92 100644
--- a/app/src/main/assets/changelogs/356.txt
+++ b/app/src/main/assets/changelogs/356.txt
@@ -1,14 +1,3 @@
-Added:
-- Allow to edit searches
-
-Changed:
-- Move the favourite item in menu
-
Fixed:
-- Filters not working
-- Crash when sharing http URLs
-- Missing ogg image when sharing
-- Extra space with quick replies
-- Crash when doing searches
-- Fix crash when clicking on conversations
-- Fix crash when editing profile \ No newline at end of file
+- Crash due to a library update
+- Missing animate profile pictures \ No newline at end of file
diff --git a/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java
index 66b6a5aec..bad14d1b3 100644
--- a/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/BaseMainActivity.java
@@ -905,7 +905,7 @@ public abstract class BaseMainActivity extends BaseActivity
toggle.setDrawerIndicatorEnabled(false);
ImageView iconbar = toolbar.findViewById(R.id.iconbar);
iconbar.setOnClickListener(v -> drawer.openDrawer(GravityCompat.START));
- Helper.loadPictureIcon(BaseMainActivity.this, account, iconbar);
+ Helper.loadGiF(BaseMainActivity.this, account, iconbar);
headerLayout = navigationView.getHeaderView(0);
final ImageView menuMore = headerLayout.findViewById(R.id.header_option_menu);
diff --git a/app/src/main/java/app/fedilab/android/activities/EditProfileActivity.java b/app/src/main/java/app/fedilab/android/activities/EditProfileActivity.java
index fca734a29..9928925b1 100644
--- a/app/src/main/java/app/fedilab/android/activities/EditProfileActivity.java
+++ b/app/src/main/java/app/fedilab/android/activities/EditProfileActivity.java
@@ -358,12 +358,12 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
set_profile_save.setOnClickListener(v -> {
- if (set_profile_name != null && set_profile_name.getText() != null && !set_profile_name.getText().toString().contentEquals(set_profile_name.getHint()))
+ if (set_profile_name != null && set_profile_name.getHint() != null && set_profile_name.getText() != null && !set_profile_name.getText().toString().contentEquals(set_profile_name.getHint()))
profile_username = set_profile_name.getText().toString().trim();
else
profile_username = null;
- if (set_profile_description != null && set_profile_description.getText() != null && !set_profile_description.getText().toString().contentEquals(set_profile_description.getHint()))
+ if (set_profile_description != null && set_profile_description.getHint() != null && set_profile_description.getText() != null && !set_profile_description.getText().toString().contentEquals(set_profile_description.getHint()))
profile_note = set_profile_description.getText().toString().trim();
else
profile_note = null;
diff --git a/app/src/main/java/app/fedilab/android/drawers/CustomEmojiAdapter.java b/app/src/main/java/app/fedilab/android/drawers/CustomEmojiAdapter.java
index 9546d989e..65391f2c2 100644
--- a/app/src/main/java/app/fedilab/android/drawers/CustomEmojiAdapter.java
+++ b/app/src/main/java/app/fedilab/android/drawers/CustomEmojiAdapter.java
@@ -30,12 +30,6 @@ import androidx.annotation.Nullable;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
-import com.github.penfeizhou.animation.apng.APNGDrawable;
-import com.github.penfeizhou.animation.apng.decode.APNGParser;
-import com.github.penfeizhou.animation.gif.GifDrawable;
-import com.github.penfeizhou.animation.gif.decode.GifParser;
-
-import java.io.File;
import java.util.List;
import app.fedilab.android.R;
@@ -86,32 +80,15 @@ public class CustomEmojiAdapter extends BaseAdapter {
//if (!emoji.isDrawableFound()) {
emoji.setDrawableFound(true);
+ SharedPreferences sharedpreferences = parent.getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
+ boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
Glide.with(parent.getContext())
- .asFile()
- .load(emoji.getUrl())
+ .load(!disableAnimatedEmoji?emoji.getUrl():emoji.getStatic_url())
.thumbnail(0.1f)
- .into(new SimpleTarget<File>() {
+ .into(new SimpleTarget<Drawable>() {
@Override
- public void onResourceReady(@NonNull File resourceFile, @Nullable Transition<? super File> transition) {
- Drawable resource;
- SharedPreferences sharedpreferences = parent.getContext().getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
- boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
- if (!disableAnimatedEmoji) {
- if (GifParser.isGif(resourceFile.getAbsolutePath())) {
- resource = GifDrawable.fromFile(resourceFile.getAbsolutePath());
- emoji.setDrawable(resource);
- } else if (APNGParser.isAPNG(resourceFile.getAbsolutePath())) {
- resource = APNGDrawable.fromFile(resourceFile.getAbsolutePath());
- emoji.setDrawable(resource);
- } else {
- resource = Drawable.createFromPath(resourceFile.getAbsolutePath());
- emoji.setDrawable(resource);
-
- }
- } else {
- resource = Drawable.createFromPath(resourceFile.getAbsolutePath());
- emoji.setDrawable(resource);
- }
+ public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition) {
+ emoji.setDrawable(resource);
imageView.setImageDrawable(emoji.getDrawable());
}
});
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 c5feef62c..969b19879 100644
--- a/app/src/main/java/app/fedilab/android/helper/Helper.java
+++ b/app/src/main/java/app/fedilab/android/helper/Helper.java
@@ -1544,6 +1544,7 @@ public class Helper {
navigationView.inflateMenu(R.menu.menu_accounts);
Menu mainMenu = navigationView.getMenu();
SubMenu currentSubmenu = null;
+ boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false);
if (accounts != null)
for (final Account account : accounts) {
@@ -1562,12 +1563,11 @@ public class Helper {
}
if (!url.equals("null"))
Glide.with(navigationView.getContext())
- .asBitmap()
- .load(url)
- .into(new SimpleTarget<Bitmap>() {
+ .load(!disableGif?account.getAvatar():account.getAvatar_static())
+ .into(new SimpleTarget<Drawable>() {
@Override
- public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
- item.setIcon(new BitmapDrawable(activity.getResources(), resource));
+ public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
+ item.setIcon(resource);
item.getIcon().setColorFilter(0xFFFFFFFF, PorterDuff.Mode.MULTIPLY);
}
});
@@ -1909,16 +1909,6 @@ public class Helper {
return result;
}
- /**
- * Load the profile picture at the place of hamburger icon
- *
- * @param activity Activity The current activity
- * @param account Account for the profile picture
- */
- public static void loadPictureIcon(final Activity activity, Account account, final ImageView imageView) {
- loadGiF(activity, account.getAvatar(), imageView);
- }
-
public static SpannableString makeMentionsClick(final Context context, List<Mention> mentions) {
String cw_mention = "";
@@ -1993,6 +1983,7 @@ public class Helper {
final List<Account> accounts = new AccountDAO(activity, db).getAllAccount();
if (activity.isFinishing())
return;
+ boolean disableGif = sharedpreferences.getBoolean(SET_DISABLE_GIF, false);
if (accounts != null && accounts.size() > 1) {
FloatingActionButton.LayoutParams layoutparmansAcc = new FloatingActionButton.LayoutParams((int) Helper.convertDpToPixel(37, activity), (int) Helper.convertDpToPixel(37, activity));
@@ -2006,13 +1997,13 @@ public class Helper {
if (currrentUserId != null && (!currrentUserId.equals(accountChoice.getId()) || !getLiveInstance(activity).equals(accountChoice.getInstance()))) {
icon = new ImageView(activity);
ImageView finalIcon = icon;
- Glide.with(activity.getApplicationContext())
- .asBitmap()
+ Glide.with(activity)
+ .asDrawable()
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(270)))
- .listener(new RequestListener<Bitmap>() {
+ .listener(new RequestListener<Drawable>() {
@Override
- public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
+ public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
return false;
}
@@ -2025,11 +2016,11 @@ public class Helper {
return false;
}
})
- .load(accountChoice.getAvatar())
- .into(new SimpleTarget<Bitmap>() {
+ .load(!disableGif?accountChoice.getAvatar():accountChoice.getAvatar_static())
+ .into(new SimpleTarget<Drawable>() {
@Override
- public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
- finalIcon.setImageBitmap(resource);
+ public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
+ finalIcon.setImageDrawable(resource);
}
});
MenuFloating.Builder actionButtonAccBuild = new MenuFloating.Builder(activity);
@@ -2061,13 +2052,13 @@ public class Helper {
accountChoice.setAvatar("https://" + accountChoice.getInstance() + accountChoice.getAvatar());
ImageView itemIconAcc = new ImageView(activity);
Glide.with(activity.getApplicationContext())
- .asBitmap()
+ .asDrawable()
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(270)))
- .load(accountChoice.getAvatar())
- .listener(new RequestListener<Bitmap>() {
+ .load(!disableGif?accountChoice.getAvatar():accountChoice.getAvatar_static())
+ .listener(new RequestListener<Drawable>() {
@Override
- public boolean onResourceReady(Bitmap resource, Object model, Target<Bitmap> target, DataSource dataSource, boolean isFirstResource) {
+ public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
return false;
}
@@ -2080,10 +2071,10 @@ public class Helper {
return false;
}
})
- .into(new SimpleTarget<Bitmap>() {
+ .into(new SimpleTarget<Drawable>() {
@Override
- public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
- itemIconAcc.setImageBitmap(resource);
+ public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
+ itemIconAcc.setImageDrawable(resource);
}
});
@@ -2197,8 +2188,8 @@ public class Helper {
Account.makeAccountNameEmoji(activity, ((BaseMainActivity) activity), account);
username.setText(String.format("@%s", account.getUsername() + "@" + account.getInstance()));
displayedName.setText(account.getdisplayNameSpan(), TextView.BufferType.SPANNABLE);
- loadGiF(activity, account.getAvatar(), profilePicture);
- String urlHeader = account.getHeader();
+ loadGiF(activity, account, profilePicture);
+ String urlHeader = !disableGif?account.getHeader():account.getHeader_static();
if (urlHeader.startsWith("/")) {
urlHeader = Helper.getLiveInstanceWithProtocol(activity) + account.getHeader();
}
@@ -2208,13 +2199,13 @@ public class Helper {
if (!urlHeader.contains("missing.png")) {
ImageView backgroundImage = headerLayout.findViewById(R.id.back_ground_image);
Glide.with(activity.getApplicationContext())
- .asBitmap()
+ .asDrawable()
.load(urlHeader)
- .into(new SimpleTarget<Bitmap>() {
+ .into(new SimpleTarget<Drawable>() {
@Override
- public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
+ public void onResourceReady(@NonNull Drawable resource, Transition<? super Drawable> transition) {
- backgroundImage.setImageBitmap(resource);
+ backgroundImage.setImageDrawable(resource);
if (theme == THEME_LIGHT) {
backgroundImage.setImageAlpha(80);
} else {
@@ -2226,20 +2217,17 @@ public class Helper {
}
}
profilePicture.setOnClickListener(null);
- profilePicture.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (account != null) {
- Intent intent = new Intent(activity, ShowAccountActivity.class);
- Bundle b = new Bundle();
- if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
- b.putBoolean("peertubeaccount", true);
- b.putString("accountId", account.getAcct());
- } else
- b.putString("accountId", account.getId());
- intent.putExtras(b);
- activity.startActivity(intent);
- }
+ profilePicture.setOnClickListener(v -> {
+ if (account != null) {
+ Intent intent = new Intent(activity, ShowAccountActivity.class);
+ Bundle b = new Bundle();
+ if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
+ b.putBoolean("peertubeaccount", true);
+ b.putString("accountId", account.getAcct());
+ } else
+ b.putString("accountId", account.getId());
+ intent.putExtras(b);
+ activity.startActivity(intent);
}
});
}
@@ -3302,7 +3290,8 @@ public class Helper {
return;
}
try {
- if( account.getAvatar_static().compareTo(account.getAvatar()) == 0 ) {
+ assert url != null;
+ if( disableGif || (!url.endsWith(".gif") && account.getAvatar_static().compareTo(account.getAvatar()) == 0 )) {
Glide.with(imageView.getContext())
.asDrawable()
.load(url)
diff --git a/app/src/main/res/drawable-v24/block_quote_background.xml b/app/src/main/res/drawable-v24/block_quote_background.xml
index 8c6cf929a..e88be82f3 100644
--- a/app/src/main/res/drawable-v24/block_quote_background.xml
+++ b/app/src/main/res/drawable-v24/block_quote_background.xml
@@ -2,7 +2,7 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
- <solid android:color="@color/cyanea_accent" />
+ <solid android:color="?colorAccent" />
<size android:width="5dp" />
</shape>
</item>