Finish support for third-party wallpaper pickers
Clicking on the pickers didn't do anything before. Change-Id: I103caafbe8d44d27d1797436ce479fb769c4c0f4
This commit is contained in:
1 parent
2b931429db
commit
a805e1a297
3 files changed
+47
-32
No files matched your search
@@ -16,9 +16,10 @@
|
||||
|
||||
package com.android.launcher3;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BlurMaskFilter;
|
||||
@@ -28,19 +29,17 @@ import android.graphics.ColorMatrixColorFilter;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PaintFlagsDrawFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.PaintDrawable;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
|
||||
/**
|
||||
* Various utilities shared amongst the Launcher's classes.
|
||||
*/
|
||||
@@ -298,4 +297,18 @@ final class Utilities {
|
||||
sIconWidth = sIconHeight = widthPx;
|
||||
sIconTextureWidth = sIconTextureHeight = widthPx;
|
||||
}
|
||||
|
||||
public static void startActivityForResultSafely(
|
||||
Activity activity, Intent intent, int requestCode) {
|
||||
try {
|
||||
activity.startActivityForResult(intent, requestCode);
|
||||
} catch (ActivityNotFoundException e) {
|
||||
Toast.makeText(activity, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
|
||||
} catch (SecurityException e) {
|
||||
Toast.makeText(activity, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
|
||||
Log.e(TAG, "Launcher does not have the permission to launch " + intent +
|
||||
". Make sure to create a MAIN intent-filter for the corresponding activity " +
|
||||
"or use the exported attribute for this activity.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user