Android Open Source - Alfred4Android Shortcut Helper






From Project

Back to project page Alfred4Android.

License

The source code is released under:

Apache License

If you think the Android project Alfred4Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.toraleap.collimator.util;
//from   www. ja  v a2 s.c  om
import android.content.Context;
import android.content.Intent;
import android.content.Intent.ShortcutIconResource;

/**
 * ????????????????????????
 * @author    uestc.Mobius <mobius@toraleap.com>
 * @version  2010.1104
 */
public final class ShortcutHelper {
  
  private static final String ACTION_INSTALL_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT";
  private static final String EXTRA_SHORTCUT_DUPLICATE = "duplicate";
  
  private Context mContext;
  private String mName;
  private Intent mIntent;
  private ShortcutIconResource mIconResource;
  
  /**
   * ???????? Intent ??????????????????
   * @param context  ?????????
   * @param intent  ??????? Intent ????
   */
  public ShortcutHelper(Context context, Intent intent) {
    mContext = context;
    mIntent = intent;
  }
  
  /**
   * ?????????????????
   * @param name  ????????????
   * @return ??????????
   */
  public ShortcutHelper setName(String name) {
    mName = name;
    return this;
  }
  
  /**
   * ????????????????????
   * @param iconResource  ?????????
   * @return  ??????????
   */
  public ShortcutHelper setIconResource(ShortcutIconResource iconResource) {
    mIconResource = iconResource;
    return this;
  }
  
  /**
   * ?????????????????
   * @param duplicate    ????????????????????
   */
  public void install(boolean duplicate) {
    Intent installIntent = new Intent(ACTION_INSTALL_SHORTCUT);    
      installIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, mName);    
      installIntent.putExtra(EXTRA_SHORTCUT_DUPLICATE, duplicate);
      installIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, mIntent);    
      installIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, mIconResource);
      mContext.sendBroadcast(installIntent);    
  }
}




Java Source Code List

android.media.MediaMetadataRetriever.java
com.toraleap.collimator.AppSearchActivity.java
com.toraleap.collimator.GlobalContext.java
com.toraleap.collimator.HelpActivity.java
com.toraleap.collimator.PrefsActivity.java
com.toraleap.collimator.SearchActivity.java
com.toraleap.collimator.ShortcutActivity.java
com.toraleap.collimator.bll.FileScannerService.java
com.toraleap.collimator.bll.TagGenerator.java
com.toraleap.collimator.dal.DBColumns.java
com.toraleap.collimator.dal.DBHelper.java
com.toraleap.collimator.dal.DBOperation.java
com.toraleap.collimator.data.Expression.java
com.toraleap.collimator.data.IndexData.java
com.toraleap.collimator.data.IndexLoader.java
com.toraleap.collimator.data.Index.java
com.toraleap.collimator.data.Match.java
com.toraleap.collimator.data.Matcher.java
com.toraleap.collimator.data.Sorter.java
com.toraleap.collimator.ext.GlobalProvider.java
com.toraleap.collimator.ext.Playlist.java
com.toraleap.collimator.model.BaseTag.java
com.toraleap.collimator.ui.FloatingDialog.java
com.toraleap.collimator.ui.MatchAdapter.java
com.toraleap.collimator.util.DigestUtil.java
com.toraleap.collimator.util.FileInfo.java
com.toraleap.collimator.util.MimeTypeMap.java
com.toraleap.collimator.util.RecursiveFileObserver.java
com.toraleap.collimator.util.ShortcutHelper.java
com.toraleap.collimator.util.SoftCache.java
com.toraleap.collimator.util.ThumbnailUtil.java
com.toraleap.collimator.util.Unicode2Alpha.java