зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1268019 - Return default icon for download files that do not have intent for handling.;r=VladBaicu
Depends on D34386 Differential Revision: https://phabricator.services.mozilla.com/D34387 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
569b5f037a
Коммит
5dd2ee009a
|
@ -37,6 +37,7 @@ import org.mozilla.gecko.util.ProxySelector;
|
||||||
import org.mozilla.gecko.util.StrictModeContext;
|
import org.mozilla.gecko.util.StrictModeContext;
|
||||||
import org.mozilla.gecko.util.ThreadUtils;
|
import org.mozilla.gecko.util.ThreadUtils;
|
||||||
import org.mozilla.geckoview.BuildConfig;
|
import org.mozilla.geckoview.BuildConfig;
|
||||||
|
import org.mozilla.geckoview.R;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
|
@ -74,6 +75,7 @@ import android.os.PowerManager;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v4.content.res.ResourcesCompat;
|
||||||
import android.support.v4.util.SimpleArrayMap;
|
import android.support.v4.util.SimpleArrayMap;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -1428,11 +1430,11 @@ public class GeckoAppShell {
|
||||||
PackageManager pm = getApplicationContext().getPackageManager();
|
PackageManager pm = getApplicationContext().getPackageManager();
|
||||||
Drawable icon = getDrawableForExtension(pm, resolvedExt);
|
Drawable icon = getDrawableForExtension(pm, resolvedExt);
|
||||||
if (icon == null) {
|
if (icon == null) {
|
||||||
// Use a generic icon
|
// Use a generic icon.
|
||||||
icon = pm.getDefaultActivityIcon();
|
icon = ResourcesCompat.getDrawable(getApplicationContext().getResources(), R.drawable.ic_generic_file, getApplicationContext().getTheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
Bitmap bitmap = ((BitmapDrawable)icon).getBitmap();
|
Bitmap bitmap = BitmapUtils.getBitmapFromDrawable(icon);
|
||||||
if (bitmap.getWidth() != resolvedIconSize || bitmap.getHeight() != resolvedIconSize) {
|
if (bitmap.getWidth() != resolvedIconSize || bitmap.getHeight() != resolvedIconSize) {
|
||||||
bitmap = Bitmap.createScaledBitmap(bitmap, resolvedIconSize, resolvedIconSize, true);
|
bitmap = Bitmap.createScaledBitmap(bitmap, resolvedIconSize, resolvedIconSize, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<vector android:height="24dp" android:viewportHeight="40"
|
||||||
|
android:viewportWidth="40" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M6.5,37.5l0,-35l18.293,0l8.707,8.707l0,26.293z"/>
|
||||||
|
<path android:fillColor="#788B9C" android:pathData="M24.586,3L33,11.414V37H7V3H24.586M25,2H6v36h28V11L25,2L25,2z"/>
|
||||||
|
<path android:fillColor="#FFFFFF" android:pathData="M24.5,11.5l0,-9l0.293,0l8.707,8.707l0,0.293z"/>
|
||||||
|
<path android:fillColor="#788B9C" android:pathData="M25,3.414L32.586,11H25V3.414M25,2h-1v10h10v-1L25,2L25,2z"/>
|
||||||
|
</vector>
|
Загрузка…
Ссылка в новой задаче