当前位置: 首页>>代码示例>>Java>>正文


Java BitmapUtils类代码示例

本文整理汇总了Java中com.lody.virtual.helper.utils.BitmapUtils的典型用法代码示例。如果您正苦于以下问题:Java BitmapUtils类的具体用法?Java BitmapUtils怎么用?Java BitmapUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BitmapUtils类属于com.lody.virtual.helper.utils包,在下文中一共展示了BitmapUtils类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleInstallShortcutIntent

import com.lody.virtual.helper.utils.BitmapUtils; //导入依赖的package包/类
private Intent handleInstallShortcutIntent(Intent intent) {
    Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
    if (shortcut != null) {
        ComponentName component = shortcut.resolveActivity(VirtualCore.getPM());
        if (component != null) {
            String pkg = component.getPackageName();
            Intent newShortcutIntent = new Intent();
            newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
            newShortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
            newShortcutIntent.putExtra("_VA_|_intent_", shortcut);
            newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0));
            newShortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());
            intent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT);
            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent);

            Intent.ShortcutIconResource icon = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
            if (icon != null && !TextUtils.equals(icon.packageName, getHostPkg())) {
                try {
                    Resources resources = VirtualCore.get().getResources(pkg);
                    if (resources != null) {
                        int resId = resources.getIdentifier(icon.resourceName, "drawable", pkg);
                        if (resId > 0) {
                            Drawable iconDrawable = resources.getDrawable(resId);
                            Bitmap newIcon = BitmapUtils.drawableToBitmap(iconDrawable);
                            if (newIcon != null) {
                                intent.removeExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
                                intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, newIcon);
                            }
                        }
                    }
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return intent;
}
 
开发者ID:codehz,项目名称:container,代码行数:39,代码来源:BroadcastIntent.java

示例2: handleInstallShortcutIntent

import com.lody.virtual.helper.utils.BitmapUtils; //导入依赖的package包/类
private Intent handleInstallShortcutIntent(Intent intent) {
    Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
    if (shortcut != null) {
        ComponentName component = shortcut.resolveActivity(VirtualCore.getPM());
        if (component != null) {
            String pkg = component.getPackageName();
            Intent newShortcutIntent = new Intent();
            newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
            newShortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
            newShortcutIntent.putExtra("_VA_|_intent_", shortcut);
            newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0));
            newShortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());
            intent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT);
            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent);

            Intent.ShortcutIconResource icon = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
            if (icon != null && !TextUtils.equals(icon.packageName, getHostPkg())) {
                try {
                    Resources resources = VirtualCore.get().getResources(pkg);
                    int resId = resources.getIdentifier(icon.resourceName, "drawable", pkg);
                    if (resId > 0) {
                        //noinspection deprecation
                        Drawable iconDrawable = resources.getDrawable(resId);
                        Bitmap newIcon = BitmapUtils.drawableToBitmap(iconDrawable);
                        if (newIcon != null) {
                            intent.removeExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
                            intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, newIcon);
                        }
                    }
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return intent;
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:38,代码来源:MethodProxies.java

示例3: handleInstallShortcutIntent

import com.lody.virtual.helper.utils.BitmapUtils; //导入依赖的package包/类
private Intent handleInstallShortcutIntent(Intent intent) {
    Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
    if (shortcut != null) {
        ComponentName component = shortcut.resolveActivity(VirtualCore.getPM());
        if (component != null) {
            String pkg = component.getPackageName();
            Intent newShortcutIntent = new Intent();
            newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
            newShortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
            newShortcutIntent.putExtra("_VA_|_intent_", shortcut);
            newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0));
            newShortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());
            intent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT);
            intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent);

            Intent.ShortcutIconResource icon = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
            if (icon != null && !TextUtils.equals(icon.packageName, getHostPkg())) {
                try {
                    Resources resources = VirtualCore.get().getResources(pkg);
                    if (resources != null) {
                        int resId = resources.getIdentifier(icon.resourceName, "drawable", pkg);
                        if (resId > 0) {
                            //noinspection deprecation
                            Drawable iconDrawable = resources.getDrawable(resId);
                            Bitmap newIcon = BitmapUtils.drawableToBitmap(iconDrawable);
                            if (newIcon != null) {
                                intent.removeExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
                                intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, newIcon);
                            }
                        }
                    }
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            }
        }
    }
    return intent;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:40,代码来源:MethodProxies.java

示例4: createShortcut

import com.lody.virtual.helper.utils.BitmapUtils; //导入依赖的package包/类
public boolean createShortcut(int userId, String packageName, Intent splash, OnEmitShortcutListener listener) {
    InstalledAppInfo setting = getInstalledAppInfo(packageName, 0);
    if (setting == null) {
        return false;
    }
    ApplicationInfo appInfo = setting.getApplicationInfo(userId);
    PackageManager pm = context.getPackageManager();
    String name;
    Bitmap icon;
    try {
        CharSequence sequence = appInfo.loadLabel(pm);
        name = sequence.toString();
        icon = BitmapUtils.drawableToBitmap(appInfo.loadIcon(pm));
    } catch (Throwable e) {
        return false;
    }
    if (listener != null) {
        String newName = listener.getName(name);
        if (newName != null) {
            name = newName;
        }
        Bitmap newIcon = listener.getIcon(icon);
        if (newIcon != null) {
            icon = newIcon;
        }
    }
    Intent targetIntent = getLaunchIntent(packageName, userId);
    if (targetIntent == null) {
        return false;
    }
    Intent shortcutIntent = new Intent();
    shortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
    shortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
    if (splash != null) {
        shortcutIntent.putExtra("_VA_|_splash_", splash.toUri(0));
    }
    shortcutIntent.putExtra("_VA_|_intent_", targetIntent);
    shortcutIntent.putExtra("_VA_|_uri_", targetIntent.toUri(0));
    shortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    context.sendBroadcast(addIntent);
    return true;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:49,代码来源:VirtualCore.java

示例5: createShortcut

import com.lody.virtual.helper.utils.BitmapUtils; //导入依赖的package包/类
public boolean createShortcut(int userId, String packageName, Intent splash, OnEmitShortcutListener listener) {
    InstalledAppInfo setting = getInstalledAppInfo(packageName, 0);
    if (setting == null) {
        return false;
    }
    ApplicationInfo appInfo = setting.getApplicationInfo(userId);
    PackageManager pm = context.getPackageManager();
    String name;
    Bitmap icon;
    try {
        CharSequence sequence = appInfo.loadLabel(pm);
        name = sequence.toString();
        icon = BitmapUtils.drawableToBitmap(appInfo.loadIcon(pm));
    } catch (Throwable e) {
        return false;
    }
    if (listener != null) {
        String newName = listener.getName(name);
        if (newName != null) {
            name = newName;
        }
        Bitmap newIcon = listener.getIcon(icon);
        if (newIcon != null) {
            icon = newIcon;
        }
    }
    Intent targetIntent = getLaunchIntent(packageName, userId);
    if (targetIntent == null) {
        return false;
    }
    Intent shortcutIntent = new Intent();
    shortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
    shortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
    if (splash != null) {
        shortcutIntent.putExtra("_VA_|_splash_", splash.toUri(0));
    }
    shortcutIntent.putExtra("_VA_|_intent_", targetIntent);
    shortcutIntent.putExtra("_VA_|_uri_", targetIntent.toUri(0));
    shortcutIntent.putExtra("_VA_|_user_id_", userId);

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    context.sendBroadcast(addIntent);
    return true;
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:49,代码来源:VirtualCore.java

示例6: createShortcut

import com.lody.virtual.helper.utils.BitmapUtils; //导入依赖的package包/类
public boolean createShortcut(int userId, String packageName, Intent splash, OnEmitShortcutListener listener) {
    AppSetting setting = findApp(packageName);
    if (setting == null) {
        return false;
    }
    ApplicationInfo appInfo = setting.getApplicationInfo(userId);
    PackageManager pm = context.getPackageManager();
    String name;
    Bitmap icon;
    try {
        CharSequence sequence = appInfo.loadLabel(pm);
        name = sequence.toString();
        icon = BitmapUtils.drawableToBitmap(appInfo.loadIcon(pm));
    } catch (Throwable e) {
        return false;
    }
    if (listener != null) {
        String newName = listener.getName(name);
        if (newName != null) {
            name = newName;
        }
        Bitmap newIcon = listener.getIcon(icon);
        if (newIcon != null) {
            icon = newIcon;
        }
    }
    Intent targetIntent = getLaunchIntent(packageName, userId);
    if (targetIntent == null) {
        return false;
    }
    Intent shortcutIntent = new Intent();
    shortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
    shortcutIntent.addCategory(Intent.CATEGORY_DEFAULT);
    if (splash != null) {
        shortcutIntent.putExtra("_VA_|_splash_", splash.toUri(0));
    }
    shortcutIntent.putExtra("_VA_|_intent_", targetIntent);
    shortcutIntent.putExtra("_VA_|_uri_", targetIntent.toUri(0));
    shortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, icon);
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    context.sendBroadcast(addIntent);
    return true;
}
 
开发者ID:codehz,项目名称:container,代码行数:49,代码来源:VirtualCore.java


注:本文中的com.lody.virtual.helper.utils.BitmapUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。