Permalink
Browse files

Toast icon switch [1/2]

PureNexus Edits:
*turned off by default

Change-Id: Id55bdaa9fa1560d7ce1258bab87d45a85cee3180
  • Loading branch information...
LorDClockaN authored and xlxfoxxlx committed Jun 26, 2016
1 parent 4a1554d commit 8747c6a102d7f4c615002e9f30478ad32c2c6dbb
Showing with 21 additions and 11 deletions.
  1. +6 −0 core/java/android/provider/Settings.java
  2. +15 −11 core/java/android/widget/Toast.java
@@ -4161,6 +4161,12 @@ public boolean validate(String value) {
*/
public static final String QS_SETTINGS_EXPANDED_TOGGLE = "qs_settings_expanded_toggle";
/**
* Toast icon Switch
* @hide
*/
public static final String TOAST_ICON = "toast_icon";
/**
* Whether to show or hide the edit icon
* @hide
@@ -32,6 +32,7 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -436,18 +437,21 @@ public void handleShow(IBinder windowToken) {
}
ImageView appIcon = (ImageView) mView.findViewById(android.R.id.icon);
if (appIcon != null) {
ActivityManager am =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (!am.isPackageInForeground(packageName)) {
PackageManager pm = context.getPackageManager();
Drawable icon = null;
try {
icon = pm.getApplicationIcon(packageName);
} catch (PackageManager.NameNotFoundException e) {
// nothing to do
if ((Settings.System.getInt(context.getContentResolver(),
Settings.System.TOAST_ICON, 0) == 1)) {
if (appIcon != null) {
ActivityManager am =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
if (!am.isPackageInForeground(packageName)) {
PackageManager pm = context.getPackageManager();
Drawable icon = null;
try {
icon = pm.getApplicationIcon(packageName);
} catch (PackageManager.NameNotFoundException e) {
// nothing to do
}
appIcon.setImageDrawable(icon);
}
appIcon.setImageDrawable(icon);
}
}
mWM = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);

0 comments on commit 8747c6a

Please sign in to comment.