mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Fix crash on API 19 in Achievements screen. (#2673)
This commit is contained in:
parent
09a93d1d3b
commit
d1ae88ca8b
1 changed files with 3 additions and 6 deletions
|
|
@ -5,11 +5,9 @@ import android.annotation.SuppressLint;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import androidx.core.content.FileProvider;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import android.util.DisplayMetrics;
|
||||
|
|
@ -33,6 +31,7 @@ import java.util.Objects;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
|
@ -132,7 +131,6 @@ public class AchievementsActivity extends NavigationBaseActivity {
|
|||
imageView.getLayoutParams();
|
||||
params.height = (int) (height * BADGE_IMAGE_HEIGHT_RATIO);
|
||||
params.width = (int) (width * BADGE_IMAGE_WIDTH_RATIO);
|
||||
imageView.setImageResource(R.drawable.badge);
|
||||
imageView.requestLayout();
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
|
@ -351,9 +349,8 @@ public class AchievementsActivity extends NavigationBaseActivity {
|
|||
String levelUpInfoString = getString(R.string.level);
|
||||
levelUpInfoString += " " + Integer.toString(levelInfo.getLevelNumber());
|
||||
levelNumber.setText(levelUpInfoString);
|
||||
final ContextThemeWrapper wrapper = new ContextThemeWrapper(this, levelInfo.getLevelStyle());
|
||||
Drawable drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.badge, wrapper.getTheme());
|
||||
imageView.setImageDrawable(drawable);
|
||||
imageView.setImageDrawable(VectorDrawableCompat.create(getResources(), R.drawable.badge,
|
||||
new ContextThemeWrapper(this, levelInfo.getLevelStyle()).getTheme()));
|
||||
badgeText.setText(Integer.toString(levelInfo.getLevelNumber()));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue