Fix crash when drawing icon on older devices
CHANGELOG.md
8 | 8 | ||
9 | 9 | * Do not highlight dictionaries that have not been downloaded, even if there is | |
10 | 10 | a new version. | |
11 | + | * Fix a crash on older devices that was caused by incorrect handling of dictionary | |
12 | + | icons. | |
11 | 13 | ||
12 | 14 | Changes In 0.2.2.1 | |
13 | 15 | ------------------ |
app/src/main/java/eu/lepiller/nani/DictionaryDownloadActivity.java
6 | 6 | import android.os.Build; | |
7 | 7 | ||
8 | 8 | import androidx.core.app.NotificationCompat; | |
9 | - | import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; | |
10 | 9 | import androidx.appcompat.app.AppCompatActivity; | |
11 | 10 | import android.os.Bundle; | |
12 | 11 | import android.util.Log; | |
… | |||
156 | 155 | if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { | |
157 | 156 | drawable = getResources().getDrawable(drawableResId, getTheme()); | |
158 | 157 | } else { | |
159 | - | drawable = VectorDrawableCompat.create(getResources(), drawableResId, getTheme()); | |
158 | + | drawable = getResources().getDrawable(drawableResId); | |
160 | 159 | } | |
161 | 160 | download_button.setImageDrawable(drawable); | |
162 | 161 | } |
app/src/main/java/eu/lepiller/nani/dictionary/Dictionary.java
5 | 5 | import android.os.Build; | |
6 | 6 | import android.util.Pair; | |
7 | 7 | ||
8 | - | import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; | |
9 | - | ||
10 | 8 | import java.io.File; | |
11 | 9 | import java.io.FileInputStream; | |
12 | 10 | import java.io.FileNotFoundException; | |
… | |||
78 | 76 | if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.M) { | |
79 | 77 | drawable = context.getResources().getDrawable(drawableResId, context.getTheme()); | |
80 | 78 | } else { | |
81 | - | drawable = VectorDrawableCompat.create(context.getResources(), drawableResId, context.getTheme()); | |
79 | + | drawable = context.getResources().getDrawable(drawableResId); | |
82 | 80 | } | |
83 | 81 | return drawable; | |
84 | 82 | } |