Fix some issues

This commit is contained in:
tom79 2020-04-05 19:26:08 +02:00
parent a5e3fe75ef
commit cb98031766
7 changed files with 55 additions and 100 deletions

View File

@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 355
versionName "2.33.0"
versionCode 356
versionName "2.33.1"
multiDexEnabled true
renderscriptTargetApi 28 as int
renderscriptSupportModeEnabled true
@ -125,7 +125,7 @@ dependencies {
implementation "ch.acra:acra-notification:5.5.0"
implementation 'com.github.stom79:Android-WYSIWYG-Editor:3.2.1'
implementation 'com.github.duanhong169:colorpicker:1.1.6'
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.0.0'
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.2.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'com.github.smarteist:autoimageslider:1.3.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'

View File

@ -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
- Crash due to a library update
- Missing animate profile pictures

View File

@ -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);

View File

@ -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;

View File

@ -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());
}
});

View File

@ -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)

View File

@ -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>