Open app when clicking on icon in App Info

Based on Xposed module Shortcut in App Info:
http://repo.xposed.info/module/com.mohammadag.shortcutinappinfo

Credit: Adam77Root
There is no vibration as in the module as I didn't find it necessary

@mydongistiny: Ported to Pie
Change-Id: I9c09a17bd0fd3a205ebb9cde366ce9d2335c6a84
Signed-off-by: mydongistiny <jaysonedson@gmail.com>
Signed-off-by: blinoff82 <blinov.in@gmail.com>
Signed-off-by: SagarMakhar <sagarmakhar@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
This commit is contained in:
deadman96385
2015-10-21 00:51:42 +03:00
committed by Joey
parent b1e4fb94ef
commit c389f11521

View File

@@ -25,6 +25,7 @@ import android.app.settings.SettingsEnums;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.UserHandle; import android.os.UserHandle;
import android.text.TextUtils; import android.text.TextUtils;
@@ -76,6 +77,7 @@ public class EntityHeaderController {
// Required for hearing aid devices. // Required for hearing aid devices.
private CharSequence mSecondSummary; private CharSequence mSecondSummary;
private String mPackageName; private String mPackageName;
private String mPackageNameReal;
private Intent mAppNotifPrefIntent; private Intent mAppNotifPrefIntent;
@UserIdInt @UserIdInt
private int mUid = UserHandle.USER_NULL; private int mUid = UserHandle.USER_NULL;
@@ -134,6 +136,7 @@ public class EntityHeaderController {
*/ */
public EntityHeaderController setIcon(ApplicationsState.AppEntry appEntry) { public EntityHeaderController setIcon(ApplicationsState.AppEntry appEntry) {
mIcon = Utils.getBadgedIcon(mAppContext, appEntry.info); mIcon = Utils.getBadgedIcon(mAppContext, appEntry.info);
mPackageNameReal = appEntry.info.packageName;
return this; return this;
} }
@@ -233,6 +236,18 @@ public class EntityHeaderController {
if (iconView != null) { if (iconView != null) {
iconView.setImageDrawable(mIcon); iconView.setImageDrawable(mIcon);
iconView.setContentDescription(mIconContentDescription); iconView.setContentDescription(mIconContentDescription);
if (mPackageNameReal != null) {
iconView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PackageManager pm = v.getContext().getPackageManager();
Intent intent = pm.getLaunchIntentForPackage(mPackageNameReal);
if (intent == null)
return;
v.getContext().startActivity(intent);
}
});
}
} }
setText(R.id.entity_header_title, mLabel); setText(R.id.entity_header_title, mLabel);
setText(R.id.entity_header_summary, mSummary); setText(R.id.entity_header_summary, mSummary);