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:
@@ -25,6 +25,7 @@ import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
@@ -76,6 +77,7 @@ public class EntityHeaderController {
|
||||
// Required for hearing aid devices.
|
||||
private CharSequence mSecondSummary;
|
||||
private String mPackageName;
|
||||
private String mPackageNameReal;
|
||||
private Intent mAppNotifPrefIntent;
|
||||
@UserIdInt
|
||||
private int mUid = UserHandle.USER_NULL;
|
||||
@@ -134,6 +136,7 @@ public class EntityHeaderController {
|
||||
*/
|
||||
public EntityHeaderController setIcon(ApplicationsState.AppEntry appEntry) {
|
||||
mIcon = Utils.getBadgedIcon(mAppContext, appEntry.info);
|
||||
mPackageNameReal = appEntry.info.packageName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -233,6 +236,18 @@ public class EntityHeaderController {
|
||||
if (iconView != null) {
|
||||
iconView.setImageDrawable(mIcon);
|
||||
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_summary, mSummary);
|
||||
|
||||
Reference in New Issue
Block a user