项目:LaunchEnr
文件:LauncherIcons.java
/**
* Returns a bitmap suitable for the all apps view. If the package or the resource do not
* exist,it returns null.
*/
public static Bitmap createIconBitmap(ShortcutIconResource iconRes,Context context) {
PackageManager packageManager = context.getPackageManager();
// the resource
try {
Resources resources = packageManager.getResourcesForApplication(iconRes.packageName);
if (resources != null) {
final int id = resources.getIdentifier(iconRes.resourceName,null,null);
return createIconBitmap(resources.getDrawableForDensity(
id,LauncherAppState.getIDP(context).fillResIconDpi,context.getTheme()),context);
}
} catch (Exception e) {
// Icon not found.
}
return null;
}
项目:LaunchEnr
文件:LoaderCursor.java
/**
* Loads the icon from the cursor and updates the {@param info} if the icon is an app resource.
*/
private Bitmap loadIcon(ShortcutInfo info) {
Bitmap icon = null;
if (itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
String packageName = getString(iconPackageIndex);
String resourceName = getString(iconResourceIndex);
if (!TextUtils.isEmpty(packageName) || !TextUtils.isEmpty(resourceName)) {
info.iconResource = new ShortcutIconResource();
info.iconResource.packageName = packageName;
info.iconResource.resourceName = resourceName;
icon = LauncherIcons.createIconBitmap(info.iconResource,mContext);
}
}
if (icon == null) {
// Failed to load from resource,try loading from DB.
byte[] data = getBlob(iconIndex);
try {
icon = LauncherIcons.createIconBitmap(
BitmapFactory.decodeByteArray(data,data.length),mContext);
} catch (Exception e) {
return null;
}
}
return icon;
}
项目:letv
文件:a.java
public static void a(Context context,String str,String str2,int i) {
Uri parse = Uri.parse(str2);
if (parse == null) {
new StringBuilder(z[34]).append(str2);
z.b();
return;
}
Parcelable intent = new Intent(z[23],parse);
intent.setFlags(335544320);
Parcelable fromContext = ShortcutIconResource.fromContext(context,i);
Intent intent2 = new Intent(z[30]);
intent2.putExtra(z[33],false);
intent2.putExtra(z[35],str);
intent2.putExtra(z[32],intent);
intent2.putExtra(z[31],fromContext);
context.sendbroadcast(intent2);
}
项目:FlickLauncher
文件:CursorIconInfo.java
/**
* Loads the icon from the cursor and updates the {@param info} if the icon is an app resource.
*/
public Bitmap loadIcon(Cursor c,ShortcutInfo info) {
Bitmap icon = null;
String packageName = c.getString(iconPackageIndex);
String resourceName = c.getString(iconResourceIndex);
if (!TextUtils.isEmpty(packageName) || !TextUtils.isEmpty(resourceName)) {
info.iconResource = new ShortcutIconResource();
info.iconResource.packageName = packageName;
info.iconResource.resourceName = resourceName;
icon = Utilities.createIconBitmap(packageName,resourceName,mContext);
}
if (icon == null) {
// Failed to load from resource,try loading from DB.
icon = loadIcon(c);
}
return icon;
}
项目:financisto1-holo
文件:PreferencesActivity.java
private Intent createShortcutIntent(String activity,String shortcutName,ShortcutIconResource shortcutIcon,String action) {
Intent shortcutIntent = new Intent();
shortcutIntent.setComponent(new ComponentName(this.getPackageName(),activity));
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,shortcutName);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,shortcutIcon);
intent.setAction(action);
return intent;
}
项目:SimpleUILauncher
文件:CursorIconInfo.java
/**
* Loads the icon from the cursor and updates the {@param info} if the icon is an app resource.
*/
public Bitmap loadIcon(Cursor c,try loading from DB.
icon = loadIcon(c);
}
return icon;
}
项目:apps-for-android
文件:ShortcutEditorDialog.java
/**
* Loads the editor state from a shortcut intent.
*
* @param intent The shortcut intent to load the editor from
*/
private void loadIntent(Intent intent) {
// Show the icon
Bitmap iconBitmap = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
if (iconBitmap != null) {
mIconView.setimageBitmap(iconBitmap);
} else {
ShortcutIconResource iconRes = intent.getParcelableExtra(
Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
if (iconRes != null) {
int res = getContext().getResources().getIdentifier(iconRes.resourceName,iconRes.packageName);
mIconView.setimageResource(res);
} else {
mIconView.setVisibility(View.INVISIBLE);
}
}
// Fill in the name field for editing
mNameView.addTextChangedListener(this);
mNameView.setText(intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
// Ensure the intent has the proper flags
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
项目:SimplOS
文件:CursorIconInfo.java
public Bitmap loadIcon(Cursor c,ShortcutInfo info,Context context) {
Bitmap icon = null;
int iconType = c.getInt(iconTypeIndex);
switch (iconType) {
case LauncherSettings.Favorites.ICON_TYPE_RESOURCE:
String packageName = c.getString(iconPackageIndex);
String resourceName = c.getString(iconResourceIndex);
if (!TextUtils.isEmpty(packageName) || !TextUtils.isEmpty(resourceName)) {
info.iconResource = new ShortcutIconResource();
info.iconResource.packageName = packageName;
info.iconResource.resourceName = resourceName;
icon = Utilities.createIconBitmap(packageName,context);
}
if (icon == null) {
// Failed to load from resource,try loading from DB.
icon = Utilities.createIconBitmap(c,iconIndex,context);
}
break;
case LauncherSettings.Favorites.ICON_TYPE_BITMAP:
icon = Utilities.createIconBitmap(c,context);
info.customIcon = icon != null;
break;
}
return icon;
}
项目:AndroidStudyDemo
文件:ShortCutUtil.java
/**
* 为程序创建桌面快捷方式
*
* @param activity Activity
*/
public static void addShortcut(Activity activity) {
Intent shortcut = new Intent(
"com.android.launcher.action.INSTALL_SHORTCUT");
// 快捷方式的名称
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,activity.getString(R.string.app_name));
shortcut.putExtra("duplicate",false); // 不允许重复创建
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.setClassName(activity,activity.getClass().getName());
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
// 快捷方式的图标
ShortcutIconResource iconRes = ShortcutIconResource.fromContext(
activity,R.drawable.ic_launcher);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconRes);
activity.sendbroadcast(shortcut);
}
项目:Trebuchet
文件:CursorIconInfo.java
public Bitmap loadIcon(Cursor c,context);
info.customIcon = icon != null;
break;
}
return icon;
}
项目:flowzr-android-black
文件:PreferencesActivity.java
private Intent createShortcutIntent(String activity,String fragmentClassName,activity));
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcutIntent.putExtra(MyFragmentAPI.EDIT_ENTITY_REQUEST,true);
shortcutIntent.putExtra(MyFragmentAPI.ENTITY_CLASS_EXTRA,fragmentClassName);
shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,true);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIcon);
intent.setAction(action);
return intent;
}
项目:FLauncher
文件:CursorIconInfo.java
public Bitmap loadIcon(Cursor c,context);
info.customIcon = icon != null;
break;
}
return icon;
}
项目:cleanmaster
文件:MainActivity.java
private void createShortcut()
{
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
String name = getResources().getString(R.string.app_name);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,name);
//不允许重复创建
shortcut.putExtra("duplicate",false);
Intent shortcutIntent = new Intent();
ComponentName componentName = new ComponentName(getPackageName(),"com.bitants.cleanmaster.MainActivity");
shortcutIntent.setComponent(componentName);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
ShortcutIconResource iconRes=null;
iconRes = Intent.ShortcutIconResource.fromContext(this,R.drawable.oh);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconRes);
sendbroadcast(shortcut);
Log.i("AAA","sendbroadcast : INSTALL_SHORTCUT");
}
项目:AnyCut
文件:ShortcutEditorDialog.java
/**
* Loads the editor state from a shortcut intent.
*
* @param intent The shortcut intent to load the editor from
*/
private void loadIntent(Intent intent) {
// Show the icon
Bitmap iconBitmap = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
if (iconBitmap != null) {
mIconView.setimageBitmap(iconBitmap);
} else {
ShortcutIconResource iconRes = intent.getParcelableExtra(
Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
if (iconRes != null) {
int res = getContext().getResources().getIdentifier(iconRes.resourceName,iconRes.packageName);
mIconView.setimageResource(res);
} else {
mIconView.setVisibility(View.INVISIBLE);
}
}
// Fill in the name field for editing
mNameView.addTextChangedListener(this);
mNameView.setText(intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME));
// Ensure the intent has the proper flags
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
}
/**
* 创建桌面快捷方式
*
* @param resId
* 应用图标 <uses-permission
* android:name="com.android.launcher.permission.INSTALL_SHORTCUT"
* />
*/
public void createShortcut(int resId) {
Intent shortcut = new Intent(
"com.android.launcher.action.INSTALL_SHORTCUT");
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,context.getString(R.string.app_name));
shortcut.putExtra("duplicate",false);
ComponentName comp = new ComponentName(context.getPackageName(),"."
+ ((Activity) context).getLocalClassName());
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,new Intent(
Intent.ACTION_MAIN).setComponent(comp));
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(
context,resId);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconRes);
context.sendbroadcast(shortcut);
}
项目:AppMarket
文件:AtyWelcome.java
public void createShortCut(Activity app,String componetName,String appName,int icon) {
SharedPreferences sp = app.getSharedPreferences("CreateShortcut",0);
// 这种创建方法可以在程序卸载的时候,快捷方式自动 删除!
ComponentName comp = new ComponentName(app.getApplicationContext(),componetName);
Intent shortcutIntent = new Intent(
new Intent(Intent.ACTION_MAIN).setComponent(comp));
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,appName);
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(
app,R.drawable.ic_launcher);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconRes);
// 不创建重复快捷方式
intent.putExtra("duplicate",false);
// 添加快捷方式
intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
app.sendbroadcast(intent);
sp.edit().putString("create","yes").commit();
}
项目:AppMarket
文件:AtyWelcome.java
/**
* create shortcut in home screen
*/
private void addShortcut() {
Intent shortcut = new Intent(
"com.android.launcher.action.INSTALL_SHORTCUT");
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,getString(R.string.app_name));
shortcut.putExtra("duplicate",false);
// 指定当前的Activity为快捷方式启动的对象: 如 com.everest.video.VideoPlayer
// 这里必须为Intent设置一个action,可以任意(但安装和卸载时该参数必须一致)
Intent respondIntent = new Intent(this,this.getClass());
respondIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,respondIntent);
// 快捷方式的图标
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(
this,iconRes);
sendbroadcast(shortcut);
}
项目:like_googleplus_layout
文件:MainActivity.java
private void createDesktop()
{
// 安装的Intent
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
// 快捷名称
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,"编程之家");
// 快捷图标是允许重复
shortcut.putExtra("duplicate",false);
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.setClassName(getPackageName(),getPackageName() + ".StartActivity");
shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
// 快捷图标
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this,iconRes);
// 发送广播
sendbroadcast(shortcut);
// Toast.makeText(mActivity,"发送到桌面",Toast.LENGTH_SHORT).show();
}
项目:AdDetector
文件:FloatFolder.java
private void setUpShortCut() {
Intent shortcut = new Intent(
"com.android.launcher.action.INSTALL_SHORTCUT");
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,"baiduad");
shortcut.putExtra("duplicate",true);
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.putExtra("tName","baiduad");
shortcutIntent.setClassName("com.baidu.adfolder","com.baidu.adfolder.FloatFolder");
shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(
this,iconRes);
sendbroadcast(shortcut);
Editor editor = sharedPreferences.edit();
editor.putBoolean(PREFERENCE_KEY_SHORTCUT_EXISTS,true);
editor.commit();
}
private void addShortcut(){
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
//��ݷ�ʽ������
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,getString(R.string.app_name));
shortcut.putExtra("duplicate",false); //�������ظ�����
//ָ����ǰ��ActivityΪ��ݷ�ʽ�����Ķ���: �� com.everest.video.VideoPlayer
//ע��: ComponentName�ĵڶ�������������ϵ��(.)�������ݷ�ʽ��������Ӧ����
ComponentName comp = new ComponentName(this.getPackageName(),"."+this.getLocalClassName());
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,new Intent(getApplicationContext(),SplashActivity.class));
//��ݷ�ʽ��ͼ��
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(this,R.drawable.tools);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconRes);
sendbroadcast(shortcut);
isShowIconRef = getSharedPreferences(
"isShowIcon"+versionName,0);
Editor isShowIconRef_e = isShowIconRef.edit();
isShowIconRef_e.putBoolean("isShowIcon"+versionName,true);
isShowIconRef_e.commit();
ToastManager.showToastView(SplashActivity.this,"�Ѵ�����ݷ�ʽ");
}
项目:AndroidLinkup
文件:ShortcutUtil.java
/**
* 为程序创建桌面快捷方式
*/
public void addShortcut() {
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
// 快捷方式的名称
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,ctx.getString(R.string.app_name));
// 不允许重复创建
shortcut.putExtra("duplicate",false);
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.setClass(ctx,WelcomeActivity.class);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
// 快捷方式的图标
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(ctx,iconRes);
ctx.sendbroadcast(shortcut);
}
项目:zhangshangwuda
文件:CreateOneKeyWifi.java
private void addShortcut() {
Intent shortcut = new Intent(
"com.android.launcher.action.INSTALL_SHORTCUT");
// 快捷方式的名称
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,getString(R.string.Wifi_onekey));
shortcut.putExtra("duplicate",false); // 不允许重复创建
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.setClassName(this,OneKeyWifi.class.getName());
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
// 快捷方式的图标
ShortcutIconResource iconRes = Intent.ShortcutIconResource.fromContext(
this,R.drawable.wifi_onekey_icon);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconRes);
sendbroadcast(shortcut);
}
项目:Diandi1.20
文件:ActivityUtil.java
/**
* 创建快捷方式
*/
public static void addShortCut(Context context) {
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
// 设置属性
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,context.getString(R.string.app_name));
ShortcutIconResource resource = ShortcutIconResource.fromContext(context,R.drawable.icc_launcher);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,resource);
// 是否允许重复创建
shortcut.putExtra("duplicate",false);
Intent intent = new Intent(Intent.ACTION_MAIN);// 标识Activity为一个程序的开始
intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.setClass(context,SplashActivity.class);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,intent);
context.sendbroadcast(shortcut);
}
项目:fruit.launcher
文件:Launcher.java
private void pickShortcut() {
Bundle bundle = new Bundle();
ArrayList<String> shortcutNames = new ArrayList<String>();
shortcutNames.add(getString(R.string.group_applications));
bundle.putStringArrayList(Intent.EXTRA_SHORTCUT_NAME,shortcutNames);
ArrayList<ShortcutIconResource> shortcutIcons = new ArrayList<ShortcutIconResource>();
shortcutIcons.add(ShortcutIconResource.fromContext(Launcher.this,R.drawable.ic_launcher_application));
bundle.putParcelableArrayList(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,shortcutIcons);
Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
pickIntent.putExtra(Intent.EXTRA_INTENT,new Intent(
Intent.ACTION_CREATE_SHORTCUT));
pickIntent.putExtra(Intent.EXTRA_TITLE,getText(R.string.title_select_shortcut));
pickIntent.putExtras(bundle);
startActivityForResult(pickIntent,REQUEST_PICK_SHORTCUT);
}
项目:smsnenado
文件:MainActivity.java
private void addShortcut() {
Intent shortcutIntent = new Intent(getApplicationContext(),MainActivity.class);
shortcutIntent.setAction(Intent.ACTION_MAIN);
Intent addIntent = new Intent();
addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME,getText(R.string.app_name));
addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext(getApplicationContext(),R.drawable.ic_launcher));
addIntent.putExtra("duplicate",false);
addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
getApplicationContext().sendbroadcast(addIntent);
}
项目:CineTime
文件:ShortcutActivity.java
@Override
protected void onListItemClick(ListView l,View v,int position,long id) {
// The meat of our shortcut
Intent shortcutIntent = new Intent(this,MoviesActivity.class);
shortcutIntent.putExtra("code",theaters.get(position).code);
shortcutIntent.putExtra("theater",theaters.get(position).title);
ShortcutIconResource iconResource = Intent.ShortcutIconResource.fromContext(this,R.drawable.ic_launcher);
// The result we are passing back from this activity
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,theaters.get(position).title);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconResource);
setResult(RESULT_OK,intent);
finish();
}
项目:GitHub
文件:HostListActivity.java
@Override
public void onClick(View v) {
// launch off to console details
Uri uri = host.getUri();
Intent contents = new Intent(Intent.ACTION_VIEW,uri);
contents.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (makingShortcut) {
// create shortcut if requested
ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(
HostListActivity.this,R.drawable.icon);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,contents);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,host.getNickname());
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,icon);
setResult(RESULT_OK,intent);
finish();
} else {
// otherwise just launch activity to show this host
contents.setClass(HostListActivity.this,ConsoleActivity.class);
HostListActivity.this.startActivity(contents);
}
}
项目:letv
文件:UIs.java
public static void createShortCut(Context context) {
if (context != null && PreferencesManager.getInstance().getShortcut()) {
PreferencesManager.getInstance().setShortcut(false);
if (!hasShortcut()) {
Intent shortcutintent = new Intent(ApkConstant.ACTION_INSTALL_SHORTCUT);
shortcutintent.putExtra("duplicate",false);
shortcutintent.putExtra("android.intent.extra.shortcut.NAME",context.getString(2131099758));
shortcutintent.putExtra("android.intent.extra.shortcut.ICON_RESOURCE",ShortcutIconResource.fromContext(context.getApplicationContext(),2130838438));
shortcutintent.putExtra("android.intent.extra.shortcut.INTENT",new Intent(context.getApplicationContext(),SplashActivity.class));
context.sendbroadcast(shortcutintent);
}
}
}
项目:FMTech
文件:iid.java
public final void a(jpg paramjpg)
{
if (paramjpg.a())
{
iic localiic = this.a;
localiic.h.putExtra("from_shortcut",true);
localiic.h.setPackage(localiic.b.getPackageName());
Intent localIntent1 = localiic.h;
String str1 = localiic.g;
Parcelable localParcelable = localiic.i;
Intent localIntent2 = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
localIntent2.putExtra("android.intent.extra.shortcut.INTENT",localIntent1);
localIntent2.putExtra("android.intent.extra.shortcut.NAME",str1);
if (localParcelable != null)
{
if (!(localParcelable instanceof Intent.ShortcutIconResource)) {
break label136;
}
localIntent2.putExtra("android.intent.extra.shortcut.ICON_RESOURCE",localParcelable);
}
for (;;)
{
localIntent2.putExtra("duplicate",true);
localiic.b.sendbroadcast(localIntent2);
localiic.b(efj.NK);
return;
label136:
if (!(localParcelable instanceof Bitmap)) {
break;
}
localIntent2.putExtra("android.intent.extra.shortcut.ICON",localParcelable);
}
String str2 = String.valueOf(localParcelable);
throw new IllegalArgumentException(23 + String.valueOf(str2).length() + "UnkNown icon resource: " + str2);
}
this.a.b(efj.NL);
}
项目:bVnc
文件:ConnectionListActivity.java
@Override
protected void onListItemClick(ListView l,long id) {
ConnectionBean connection = new ConnectionBean(this);
if (connection.Gen_read(database.getReadableDatabase(),id))
{
// create shortcut if requested
ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(this,R.drawable.icon);
Intent intent = new Intent();
Intent launchIntent = new Intent(this,RemoteCanvasActivity.class);
Uri.Builder builder = new Uri.Builder();
builder.authority(Constants.CONNECTION + ":" + connection.get_Id());
builder.scheme("vnc");
launchIntent.setData(builder.build());
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,launchIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,connection.getNickname());
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,intent);
}
else
setResult(RESULT_CANCELED);
finish();
}
项目:SendLog
文件:CreateShortcutActivity.java
private Intent createShortcutIntent() {
// if name and destination are set then handle it
// otherwise ignore it
if (mNameView.length() > 0 && mDestView.length() > 0) {
// create the destination intent
final Intent intent = new Intent(this,SendLog.class);
final CharSequence dest = mDestView.getText();
final int format = mFormatSpinner.getSelectedItemPosition();
// Todo Could change format to be String,but that's not backward-compatible
final int senderPos = mSenderSpinner.getSelectedItemPosition();
final ResolveInfo ri = mSenderAdapter.ri.get(senderPos);
intent.setType(format + SendLog.FORMAT_SEParaTOR + ri.activityInfo.name + SendLog.FORMAT_SEParaTOR + dest.toString());
// create the shortcut
final Intent shortcut = new Intent();
shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,intent);
shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,ShortcutIconResource.fromContext(this,R.drawable.icon));
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,mNameView.getText().toString());
return shortcut;
} else {
return null;
}
}
项目:SecondScreen
文件:QuickLaunchActivity.java
private void quickLaunchProfile(String filename) {
// The meat of our shortcut
Intent shortcutIntent = new Intent (this,QuickLaunchActivity.class);
shortcutIntent.setAction(Intent.ACTION_MAIN);
shortcutIntent.putExtra(U.NAME,filename);
shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
ShortcutIconResource iconResource = Intent.ShortcutIconResource.fromContext(this,R.mipmap.ic_launcher);
// The result we are passing back from this activity
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconResource);
if(filename.equals("turn_off"))
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,getResources().getStringArray(R.array.pref_notification_action_list)[0]);
else {
try {
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,U.getProfileTitle(this,filename));
} catch (IOException e) {
U.showToast(this,R.string.error_loading_list);
}
}
setResult(RESULT_OK,intent);
finish(); // Must call finish for result to be returned immediately
}
项目:androidVNC
文件:ConnectionListActivity.java
@Override
protected void onListItemClick(ListView l,long id) {
ConnectionBean connection = new ConnectionBean();
if (connection.Gen_read(database.getReadableDatabase(),id))
{
// create shortcut if requested
ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(this,R.drawable.icon);
Intent intent = new Intent();
Intent launchIntent = new Intent(this,VncCanvasActivity.class);
Uri.Builder builder = new Uri.Builder();
builder.authority(VncConstants.CONNECTION + ":" + connection.get_Id());
builder.scheme("vnc");
launchIntent.setData(builder.build());
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,launchIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,connection.getNickname());
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,icon);
setResult(RESULT_OK,intent);
}
else
setResult(RESULT_CANCELED);
finish();
}
项目:zhangshangwuda
文件:CreateOneKeyWifi.java
void createShortCut() {
Intent shortcutIntent = new Intent(Intent.ACTION_MAIN);
shortcutIntent.setClass(this,OneKeyWifi.class);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,getString(R.string.Wifi_onekey));
Parcelable shortIcon = Intent.ShortcutIconResource.fromContext(this,R.drawable.wifi_onekey_icon);
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,shortIcon);
setResult(RESULT_OK,intent);
}
项目:fruit.launcher
文件:LauncherModel.java
private static void loadLiveFolderIcon(Context context,Cursor c,int iconTypeIndex,int iconPackageIndex,int iconResourceIndex,LiveFolderInfo liveFolderInfo) {
int iconType = c.getInt(iconTypeIndex);
switch (iconType) {
case BaseLauncherColumns.ICON_TYPE_RESOURCE:
String packageName = c.getString(iconPackageIndex);
String resourceName = c.getString(iconResourceIndex);
PackageManager packageManager = context.getPackageManager();
try {
Resources resources = packageManager
.getResourcesForApplication(packageName);
final int id = resources
.getIdentifier(resourceName,null);
liveFolderInfo.icon = Utilities.createIconBitmap(
resources.getDrawable(id),context);
} catch (Exception e) {
liveFolderInfo.icon = Utilities.createIconBitmap(
context.getResources().getDrawable(
R.drawable.ic_launcher_folder),context);
}
liveFolderInfo.iconResource = new Intent.ShortcutIconResource();
liveFolderInfo.iconResource.packageName = packageName;
liveFolderInfo.iconResource.resourceName = resourceName;
break;
default:
liveFolderInfo.icon = Utilities.createIconBitmap(context
.getResources().getDrawable(R.drawable.ic_launcher_folder),context);
}
}
项目:bikey
文件:ShortcutActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent result = new Intent();
Intent shortcutIntent = new Intent(this,RideListActivity.class);
shortcutIntent.setAction(RideListActivity.ACTION_QUICK_START);
result.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
result.putExtra(Intent.EXTRA_SHORTCUT_NAME,getString(R.string.ride_list_btnQuickStart));
ShortcutIconResource iconResource = Intent.ShortcutIconResource.fromContext(this,R.drawable.ic_launcher_quick_start);
result.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,iconResource);
setResult(RESULT_OK,result);
finish();
}
项目:servestream
文件:ShortcutActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shortcut);
getSupportActionBar();
ListView list = getListView();
list.setonItemClickListener(new OnItemClickListener() {
public synchronized void onItemClick(AdapterView<?> parent,View view,long id) {
UriBean uriBean = (UriBean) parent.getAdapter().getItem(position);
Intent contents = new Intent(Intent.ACTION_VIEW);
contents.setType("net.sourceforge.servestream/" + uriBean.getUri());
contents.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// create shortcut if requested
ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(ShortcutActivity.this,R.drawable.ic_launcher);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,contents);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,uriBean.getNickname());
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,icon);
setResult(RESULT_OK,intent);
finish();
}
});
StreamDatabase streamdb = new StreamDatabase(this);
List<UriBean> uris = new ArrayList<UriBean>();
uris = streamdb.getUris();
Urllistadapter adapter = new Urllistadapter(this,uris);
list.setAdapter(adapter);
streamdb.close();
}
项目:NotificationStopwatch
文件:CreateShortcutActivity.java
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(this,R.drawable.ic_launcher);
Intent intent = new Intent();
Intent launchIntent = new Intent(this,ServiceStartActivity.class);
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,launchIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,getString(R.string.shortcut_label));
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,icon);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
setResult(RESULT_OK,intent);
finish();
}
@Override
protected ShortcutIconResource getIconResource() {
return ShortcutIconResource.fromContext(mContext,R.drawable.shortcut_notif_clear);
}
@Override
protected ShortcutIconResource getIconResource() {
return ShortcutIconResource.fromContext(mContext,R.drawable.shortcut_app_launcher);
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。