Commit e0a5273b authored by Amit Kumar's avatar Amit Kumar
Browse files

Fix icon resolution and masking

parent a582c823
...@@ -22,34 +22,29 @@ public class AppUtil { ...@@ -22,34 +22,29 @@ public class AppUtil {
/** /**
* Uses the PackageManager to find all launchable apps. * Uses the PackageManager to find all launchable apps.
* @param context
* @return
*/ */
public static List<AppItem> loadLaunchableApps(Context context) { public static List<AppItem> loadLaunchableApps(Context context, int iconWidth) {
PackageManager packageManager = context.getPackageManager(); PackageManager packageManager = context.getPackageManager();
List<ApplicationInfo> apps = packageManager.getInstalledApplications(0); List<ApplicationInfo> apps = packageManager.getInstalledApplications(0);
List<AppItem> launchableApps = new ArrayList<>(); List<AppItem> launchableApps = new ArrayList<>();
for(ApplicationInfo app: apps) { for (ApplicationInfo app : apps) {
String packageName = app.packageName; String packageName = app.packageName;
Intent intent = packageManager.getLaunchIntentForPackage(packageName); Intent intent = packageManager.getLaunchIntentForPackage(packageName);
if(intent != null) { if (intent != null) {
String componentName = intent.getComponent().toString(); String componentName = intent.getComponent().toString();
boolean iconFromIconPack = true; boolean iconFromIconPack = true;
Drawable appIcon; Drawable appIcon = null;
// Load icon from icon pack if present // Load icon from icon pack if present
if(IconPackUtil.iconPackPresent) { if (IconPackUtil.iconPackPresent) {
appIcon = IconPackUtil.getIconFromIconPack(context, componentName); appIcon = IconPackUtil.getIconFromIconPack(context, componentName);
if(appIcon == null) { }
appIcon = app.loadIcon(packageManager); if (appIcon == null) {
iconFromIconPack = false;
appIcon = GraphicsUtil.scaleImage(context, appIcon, 1f);
appIcon = GraphicsUtil.maskImage(context, appIcon);
}
} else {
appIcon = app.loadIcon(packageManager); appIcon = app.loadIcon(packageManager);
iconFromIconPack = false; iconFromIconPack = false;
appIcon = GraphicsUtil.scaleImage(context, appIcon, 1f, iconWidth);
appIcon = GraphicsUtil.maskImage(context, appIcon);
} }
AppItem launchableApp = new AppItem( AppItem launchableApp = new AppItem(
...@@ -77,10 +72,6 @@ public class AppUtil { ...@@ -77,10 +72,6 @@ public class AppUtil {
/** /**
* Currently picks four apps for the dock (Phone, SMS, Browser, Camera) * Currently picks four apps for the dock (Phone, SMS, Browser, Camera)
*
* @param context
* @param launchableApps
* @return
*/ */
public static List<AppItem> getPinnedApps(Context context, List<AppItem> launchableApps) { public static List<AppItem> getPinnedApps(Context context, List<AppItem> launchableApps) {
PackageManager pm = context.getPackageManager(); PackageManager pm = context.getPackageManager();
...@@ -92,10 +83,10 @@ public class AppUtil { ...@@ -92,10 +83,10 @@ public class AppUtil {
}; };
List<AppItem> pinnedApps = new ArrayList<>(); List<AppItem> pinnedApps = new ArrayList<>();
for(Intent intent:intents) { for (Intent intent : intents) {
String packageName = getPackageNameForIntent(intent, pm); String packageName = getPackageNameForIntent(intent, pm);
for(AppItem app:launchableApps) { for (AppItem app : launchableApps) {
if(app.getPackageName().equals(packageName)) { if (app.getPackageName().equals(packageName)) {
pinnedApps.add(app); pinnedApps.add(app);
break; break;
} }
...@@ -108,7 +99,7 @@ public class AppUtil { ...@@ -108,7 +99,7 @@ public class AppUtil {
private static String getPackageNameForIntent(Intent intent, PackageManager pm) { private static String getPackageNameForIntent(Intent intent, PackageManager pm) {
List<ResolveInfo> activities = pm.queryIntentActivities(intent, List<ResolveInfo> activities = pm.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY); PackageManager.MATCH_DEFAULT_ONLY);
if(activities.size() == 0) return null; if (activities.size() == 0) return null;
return activities.get(0).activityInfo.packageName; return activities.get(0).activityInfo.packageName;
} }
...@@ -120,28 +111,26 @@ public class AppUtil { ...@@ -120,28 +111,26 @@ public class AppUtil {
/** /**
* Create an AppItem object given just a package name * Create an AppItem object given just a package name
* @param context
* @param packageName
* @return
*/ */
public static AppItem createAppItem(Context context, String packageName) { public static AppItem createAppItem(Context context, String packageName, int iconWidth) {
try { try {
PackageManager packageManager = context.getPackageManager(); PackageManager packageManager = context.getPackageManager();
ApplicationInfo appInfo = packageManager.getApplicationInfo(packageName, 0); ApplicationInfo appInfo = packageManager.getApplicationInfo(packageName, 0);
Intent intent = packageManager.getLaunchIntentForPackage(packageName); Intent intent = packageManager.getLaunchIntentForPackage(packageName);
if(intent == null) if (intent == null) {
return null; return null;
}
String componentName = intent.getComponent().toString(); String componentName = intent.getComponent().toString();
Drawable appIcon; Drawable appIcon;
boolean iconFromIconPack = true; boolean iconFromIconPack = true;
if(IconPackUtil.iconPackPresent) { if (IconPackUtil.iconPackPresent) {
appIcon = IconPackUtil.getIconFromIconPack(context, componentName); appIcon = IconPackUtil.getIconFromIconPack(context, componentName);
if(appIcon == null) { if (appIcon == null) {
appIcon = appInfo.loadIcon(packageManager); appIcon = appInfo.loadIcon(packageManager);
iconFromIconPack = false; iconFromIconPack = false;
appIcon = GraphicsUtil.scaleImage(context, appIcon, 1f); appIcon = GraphicsUtil.scaleImage(context, appIcon, 1f, iconWidth);
appIcon = GraphicsUtil.maskImage(context, appIcon); appIcon = GraphicsUtil.maskImage(context, appIcon);
} }
} else { } else {
......
...@@ -22,6 +22,7 @@ import android.os.Bundle; ...@@ -22,6 +22,7 @@ import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.util.TypedValue;
import android.view.Display; import android.view.Display;
import android.view.DragEvent; import android.view.DragEvent;
import android.view.Gravity; import android.view.Gravity;
...@@ -227,7 +228,7 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -227,7 +228,7 @@ public class DesktopActivity extends AppCompatActivity {
} }
} }
AppItem appItem = AppUtil.createAppItem(this, packageName); AppItem appItem = AppUtil.createAppItem(this, packageName, iconWidth);
if (appItem != null) { if (appItem != null) {
View view = prepareApp(appItem); View view = prepareApp(appItem);
int current = getCurrentAppsPageNumber(); int current = getCurrentAppsPageNumber();
...@@ -256,7 +257,7 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -256,7 +257,7 @@ public class DesktopActivity extends AppCompatActivity {
// Cache icons before loading apps // Cache icons before loading apps
IconPackUtil.cacheIconsFromIconPack(this); IconPackUtil.cacheIconsFromIconPack(this);
launchableApps = AppUtil.loadLaunchableApps(getApplicationContext()); launchableApps = AppUtil.loadLaunchableApps(getApplicationContext(), iconWidth);
pinnedApps = AppUtil.getPinnedApps(this, launchableApps); pinnedApps = AppUtil.getPinnedApps(this, launchableApps);
launchableApps.removeAll(pinnedApps); launchableApps.removeAll(pinnedApps);
...@@ -293,9 +294,9 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -293,9 +294,9 @@ public class DesktopActivity extends AppCompatActivity {
double screenInches = Math.sqrt(x + y); double screenInches = Math.sqrt(x + y);
Log.d("debug", "Screen inches : " + screenInches); Log.d("debug", "Screen inches : " + screenInches);
if (screenInches <= 4.7) { if (screenInches <= 4.5) {
nRows = 4; nRows = 4;
} else if (screenInches <= 5.4) { } else if (screenInches <= 5.2) {
nRows = 5; nRows = 5;
} else { } else {
nRows = 6; nRows = 6;
...@@ -316,7 +317,8 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -316,7 +317,8 @@ public class DesktopActivity extends AppCompatActivity {
hotBackground = getResources().getDrawable(R.drawable.rounded_corners_icon_hot, null); hotBackground = getResources().getDrawable(R.drawable.rounded_corners_icon_hot, null);
defaultBackground = getResources().getDrawable(R.drawable.rounded_corners_icon, null); defaultBackground = getResources().getDrawable(R.drawable.rounded_corners_icon, null);
scrollCorner = getResources().getDimensionPixelSize(R.dimen.scrollCorner); scrollCorner = getResources().getDimensionPixelSize(R.dimen.scrollCorner) * mPagerWidth
/ 480;
wobbleAnimation = AnimationUtils.loadAnimation(this, R.anim.wobble); wobbleAnimation = AnimationUtils.loadAnimation(this, R.anim.wobble);
wobbleReverseAnimation = AnimationUtils.loadAnimation(this, R.anim.wobble_reverse); wobbleReverseAnimation = AnimationUtils.loadAnimation(this, R.anim.wobble_reverse);
transparentBackground = getResources().getDrawable(R.drawable.transparent, null); transparentBackground = getResources().getDrawable(R.drawable.transparent, null);
...@@ -751,7 +753,7 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -751,7 +753,7 @@ public class DesktopActivity extends AppCompatActivity {
} }
} }
folderItem.setIcon(GraphicsUtil.generateFolderIcon(this, folderItem)); folderItem.setIcon(GraphicsUtil.generateFolderIcon(this, folderItem, iconWidth));
//output = prepareApp(folderItem); //output = prepareApp(folderItem);
return folderItem; return folderItem;
} else { } else {
...@@ -799,6 +801,11 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -799,6 +801,11 @@ public class DesktopActivity extends AppCompatActivity {
final Intent intent = app.getIntent(); final Intent intent = app.getIntent();
icon.setImageDrawable(app.getIcon()); icon.setImageDrawable(app.getIcon());
label.setText(app.getLabel()); label.setText(app.getLabel());
if (nRows < 6) {
label.setTextSize(12);
} else {
label.setTextSize(14);
}
List<Object> tags = new ArrayList<>(); List<Object> tags = new ArrayList<>();
tags.add(icon); tags.add(icon);
tags.add(label); tags.add(label);
...@@ -1245,13 +1252,9 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -1245,13 +1252,9 @@ public class DesktopActivity extends AppCompatActivity {
activeFolder.getSubApps().remove(app); activeFolder.getSubApps().remove(app);
assert app != null; assert app != null;
app.setBelongsToFolder(false); app.setBelongsToFolder(false);
Log.i(TAG, "removeAppFromFolder: Size:" + activeFolder.getSubApps().size());
if (activeFolder.getSubApps().size() == 1) { if (activeFolder.getSubApps().size() == 0) {
AppItem item = activeFolder.getSubApps().get(0); View view = prepareApp(app);
activeFolder.getSubApps().remove(item);
item.setBelongsToFolder(false);
View view = prepareApp(item);
if (folderFromDock) { if (folderFromDock) {
addToDock(view, dock.indexOfChild(activeFolderView)); addToDock(view, dock.indexOfChild(activeFolderView));
} else { } else {
...@@ -1261,16 +1264,32 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -1261,16 +1264,32 @@ public class DesktopActivity extends AppCompatActivity {
((ViewGroup) activeFolderView.getParent()).removeView(activeFolderView); ((ViewGroup) activeFolderView.getParent()).removeView(activeFolderView);
} else { } else {
updateIcon(activeFolderView, activeFolder, if (activeFolder.getSubApps().size() == 1) {
GraphicsUtil.generateFolderIcon(this, activeFolder)); AppItem item = activeFolder.getSubApps().get(0);
activeFolder.getSubApps().remove(item);
item.setBelongsToFolder(false);
View view = prepareApp(item);
if (folderFromDock) {
addToDock(view, dock.indexOfChild(activeFolderView));
} else {
GridLayout gridLayout = pages.get(getCurrentAppsPageNumber());
addAppToPage(gridLayout, view, gridLayout.indexOfChild(activeFolderView));
}
((ViewGroup) activeFolderView.getParent()).removeView(activeFolderView);
} else {
updateIcon(activeFolderView, activeFolder,
GraphicsUtil.generateFolderIcon(this, activeFolder, iconWidth));
}
if (movingApp.getParent() != null) {
((ViewGroup) movingApp.getParent()).removeView(movingApp);
}
int current = getCurrentAppsPageNumber();
addAppToPage(pages.get(current), movingApp);
} }
hideFolderWindowContainer(); hideFolderWindowContainer();
if (movingApp.getParent() != null) {
((ViewGroup) movingApp.getParent()).removeView(movingApp);
}
movingApp.setVisibility(View.VISIBLE); movingApp.setVisibility(View.VISIBLE);
int current = getCurrentAppsPageNumber();
addAppToPage(pages.get(current), movingApp);
} }
} }
...@@ -1329,7 +1348,7 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -1329,7 +1348,7 @@ public class DesktopActivity extends AppCompatActivity {
AppItem app1 = (AppItem) ((List<Object>) collidingApp.getTag()).get(2); AppItem app1 = (AppItem) ((List<Object>) collidingApp.getTag()).get(2);
AppItem app2 = (AppItem) ((List<Object>) movingApp.getTag()).get(2); AppItem app2 = (AppItem) ((List<Object>) movingApp.getTag()).get(2);
Drawable folderIcon = GraphicsUtil.generateFolderIcon(this, Drawable folderIcon = GraphicsUtil.generateFolderIcon(this, iconWidth,
app1.getIcon(), app2.getIcon()); app1.getIcon(), app2.getIcon());
AppItem folder; AppItem folder;
...@@ -1357,7 +1376,7 @@ public class DesktopActivity extends AppCompatActivity { ...@@ -1357,7 +1376,7 @@ public class DesktopActivity extends AppCompatActivity {
} else { } else {
app2.setBelongsToFolder(true); app2.setBelongsToFolder(true);
app1.getSubApps().add(app2); app1.getSubApps().add(app2);
updateIcon(collidingApp, app1, GraphicsUtil.generateFolderIcon(this, app1)); updateIcon(collidingApp, app1, GraphicsUtil.generateFolderIcon(this, app1, iconWidth));
} }
......
...@@ -2,7 +2,6 @@ package org.indin.blisslaunchero; ...@@ -2,7 +2,6 @@ package org.indin.blisslaunchero;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
...@@ -13,6 +12,7 @@ import android.renderscript.Allocation; ...@@ -13,6 +12,7 @@ import android.renderscript.Allocation;
import android.renderscript.Element; import android.renderscript.Element;
import android.renderscript.RenderScript; import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur; import android.renderscript.ScriptIntrinsicBlur;
import android.support.v4.content.ContextCompat;
import android.util.Log; import android.util.Log;
public class GraphicsUtil { public class GraphicsUtil {
...@@ -41,16 +41,14 @@ public class GraphicsUtil { ...@@ -41,16 +41,14 @@ public class GraphicsUtil {
/** /**
* Takes 1 or more drawables and merges them to form a single Drawable. * Takes 1 or more drawables and merges them to form a single Drawable.
* However, if more than 4 drawables are provided, only the first 4 are used. * However, if more than 4 drawables are provided, only the first 4 are used.
* @param context
* @param sources
* @return
*/ */
public static Drawable generateFolderIcon(Context context, Drawable ...sources) { public static Drawable generateFolderIcon(Context context, int iconWidth, Drawable... sources) {
for(Drawable d:sources) for (Drawable d : sources) {
if(!(d instanceof BitmapDrawable)) { if (!(d instanceof BitmapDrawable)) {
Log.d(TAG, "Unknown type of icon found"); Log.d(TAG, "Unknown type of icon found");
return context.getResources().getDrawable(R.mipmap.ic_folder, null); return context.getResources().getDrawable(R.mipmap.ic_folder, null);
} }
}
int width = sources[0].getIntrinsicWidth(); int width = sources[0].getIntrinsicWidth();
int height = width; // Square icons int height = width; // Square icons
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
...@@ -64,26 +62,26 @@ public class GraphicsUtil { ...@@ -64,26 +62,26 @@ public class GraphicsUtil {
int yIncrement = bitmap.getHeight() / 10; int yIncrement = bitmap.getHeight() / 10;
int count = 0; int count = 0;
int total = 0; int total = 0;
for(Drawable d:sources) { for (Drawable d : sources) {
BitmapDrawable bd = (BitmapDrawable)d; BitmapDrawable bd = (BitmapDrawable) d;
bd.setBounds(x, y, (int)(x+width/2.5f), (int)(y+height/2.5f)); bd.setBounds(x, y, (int) (x + width / 2.5f), (int) (y + height / 2.5f));
bd.draw(canvas); bd.draw(canvas);
x += (int)(width/2.5f + xIncrement); x += (int) (width / 2.5f + xIncrement);
count++; count++;
total++; total++;
if(count == 2) { if (count == 2) {
count = 0; count = 0;
y += (int)(height/2.5f + yIncrement); y += (int) (height / 2.5f + yIncrement);
x = xOrigin; x = xOrigin;
} }
if(total > 3) { if (total > 3) {
break; break;
} }
} }
Drawable output = new BitmapDrawable(context.getResources(), bitmap); Drawable output = new BitmapDrawable(context.getResources(), bitmap);
if(IconPackUtil.iconPackPresent) { if (IconPackUtil.iconPackPresent) {
output = GraphicsUtil.scaleImage(context, output, 0.90f); output = GraphicsUtil.scaleImage(context, output, 1f, iconWidth);
output = GraphicsUtil.maskImage(context, output); output = GraphicsUtil.maskImage(context, output);
} }
return output; return output;
...@@ -92,30 +90,24 @@ public class GraphicsUtil { ...@@ -92,30 +90,24 @@ public class GraphicsUtil {
/** /**
* A utility method that simplifies calls to the generateFolderIcon() method that * A utility method that simplifies calls to the generateFolderIcon() method that
* expects an array of Drawables. * expects an array of Drawables.
* @param context
* @param app
* @return
*/ */
public static Drawable generateFolderIcon(Context context, AppItem app) { public static Drawable generateFolderIcon(Context context, AppItem app, int iconWidth) {
Drawable[] drawables = new Drawable[app.getSubApps().size()]; Drawable[] drawables = new Drawable[app.getSubApps().size()];
for(int i=0;i<app.getSubApps().size();i++) { for (int i = 0; i < app.getSubApps().size(); i++) {
drawables[i] = app.getSubApps().get(i).getIcon(); drawables[i] = app.getSubApps().get(i).getIcon();
} }
return generateFolderIcon(context, drawables); return generateFolderIcon(context, iconWidth, drawables);
} }
/** /**
* Scales icons to match the icon pack * Scales icons to match the icon pack
* @param context
* @param image
* @param scaleFactor
* @return
*/ */
public static Drawable scaleImage(Context context, Drawable image, float scaleFactor) { public static Drawable scaleImage(Context context, Drawable image, float scaleFactor,
int iconWidth) {
if ((image == null) || !(image instanceof BitmapDrawable)) { if ((image == null) || !(image instanceof BitmapDrawable)) {
return image; return image;
} }
Bitmap b = ((BitmapDrawable)image).getBitmap(); Bitmap b = ((BitmapDrawable) image).getBitmap();
int sizeX = Math.round(image.getIntrinsicWidth() * scaleFactor); int sizeX = Math.round(image.getIntrinsicWidth() * scaleFactor);
int sizeY = Math.round(image.getIntrinsicHeight() * scaleFactor); int sizeY = Math.round(image.getIntrinsicHeight() * scaleFactor);
Bitmap bitmapResized = Bitmap.createScaledBitmap(b, sizeX, sizeY, false); Bitmap bitmapResized = Bitmap.createScaledBitmap(b, sizeX, sizeY, false);
...@@ -127,18 +119,27 @@ public class GraphicsUtil { ...@@ -127,18 +119,27 @@ public class GraphicsUtil {
if ((image == null) || !(image instanceof BitmapDrawable)) { if ((image == null) || !(image instanceof BitmapDrawable)) {
return image; return image;
} }
double scale = 0.64; double scale = 0.85;
Bitmap original = Bitmap.createScaledBitmap(((BitmapDrawable)image).getBitmap(), Drawable maskDrawable;
(int)(image.getIntrinsicWidth() * scale), if(IconPackUtil.getIconMask() != null){
(int)(image.getIntrinsicWidth() * scale), true); maskDrawable = IconPackUtil.getIconMask();
Bitmap mask = ((BitmapDrawable)IconPackUtil.getIconMask()).getBitmap(); }else
Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(), Bitmap.Config.ARGB_8888); maskDrawable = ContextCompat.getDrawable(context, R.drawable.iconmask);
Bitmap mask = ((BitmapDrawable) maskDrawable).getBitmap();
Bitmap original = Bitmap.createScaledBitmap(((BitmapDrawable) image).getBitmap(),
(int) (mask.getWidth() * scale),
(int) (mask.getHeight() * scale), true);
Bitmap result = Bitmap.createBitmap(mask.getWidth(), mask.getHeight(),
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result); Canvas canvas = new Canvas(result);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
canvas.drawBitmap(original, (canvas.getWidth() - original.getWidth())/2, (canvas.getHeight() - original.getHeight())/2, null); canvas.drawBitmap(original, (canvas.getWidth() - original.getWidth()) / 2,
(canvas.getHeight() - original.getHeight()) / 2, null);
canvas.drawBitmap(mask, 0, 0, paint); canvas.drawBitmap(mask, 0, 0, paint);
paint.setXfermode(null); paint.setXfermode(null);
return new BitmapDrawable(context.getResources(), result); return new BitmapDrawable(context.getResources(), result);
} }
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ import android.graphics.Bitmap; ...@@ -7,6 +7,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
...@@ -85,12 +86,19 @@ public class IconPackUtil { ...@@ -85,12 +86,19 @@ public class IconPackUtil {
iconMapper.put(componentName, drawableId); iconMapper.put(componentName, drawableId);
} }
} }
iconBackground1 = iconPackResources.getDrawable( iconBackground1 = iconPackResources.getDrawable(
iconPackResources.getIdentifier("iconback_d", "drawable", ICON_PACK_PACKAGE), iconPackResources.getIdentifier("iconback_d", "drawable", ICON_PACK_PACKAGE),
null); null);
if(iconBackground1 == null){
iconBackground1 = ContextCompat.getDrawable(context, R.drawable.iconback_d);