Use AppDetailsActivity (#2274)
This commit is contained in:
parent
b9c470f7cd
commit
4b66d556db
|
|
@ -18,6 +18,7 @@ import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
import android.graphics.drawable.LayerDrawable;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
import org.lsposed.manager.App;
|
import org.lsposed.manager.App;
|
||||||
import org.lsposed.manager.R;
|
import org.lsposed.manager.R;
|
||||||
|
|
@ -104,14 +105,17 @@ public class ShortcutUtil {
|
||||||
public static void requestPinLaunchShortcut(Runnable afterPinned) {
|
public static void requestPinLaunchShortcut(Runnable afterPinned) {
|
||||||
if (!App.isParasitic()) throw new RuntimeException();
|
if (!App.isParasitic()) throw new RuntimeException();
|
||||||
var context = App.getInstance();
|
var context = App.getInstance();
|
||||||
var info = new ShortcutInfo.Builder(context, SHORTCUT_ID)
|
var builder = new ShortcutInfo.Builder(context, SHORTCUT_ID)
|
||||||
.setShortLabel(context.getString(R.string.app_name))
|
.setShortLabel(context.getString(R.string.app_name))
|
||||||
.setIntent(getLaunchIntent(context))
|
.setIntent(getLaunchIntent(context))
|
||||||
.setActivity(new ComponentName(context.getPackageName(), "android.__dummy__"))
|
.setIcon(Icon.createWithAdaptiveBitmap(getBitmap(context, R.drawable.ic_launcher)));
|
||||||
.setIcon(Icon.createWithAdaptiveBitmap(getBitmap(context, R.drawable.ic_launcher)))
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||||
.build();
|
var activity = new ComponentName(context.getPackageName(),
|
||||||
|
"android.app.AppDetailsActivity");
|
||||||
|
builder.setActivity(activity);
|
||||||
|
}
|
||||||
var sm = context.getSystemService(ShortcutManager.class);
|
var sm = context.getSystemService(ShortcutManager.class);
|
||||||
sm.requestPinShortcut(info, registerReceiver(context, afterPinned));
|
sm.requestPinShortcut(builder.build(), registerReceiver(context, afterPinned));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isLaunchShortcutPinned() {
|
public static boolean isLaunchShortcutPinned() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue