Java Code Examples for android.content.Intent.hashCode()

The following are Jave code examples for showing how to use hashCode() of the android.content.Intent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ActivityBuilder   File: RefManager.java   View Source Code Vote up 6 votes
/**
 * 如果 oldIntent 绑定了 RefMap,那么将其解绑并重新绑定到 newIntent
 */
public void rebindRefMap(Intent oldIntent, Intent newIntent) {
  if (hasRefMap(oldIntent)) {
    Map<String, Object> refMap = getRefMap(oldIntent);

    sGlobalRefMap.remove(getKeyOfMap(oldIntent));
    oldIntent.removeExtra(KEY_OF_MAP);

    int keyOfMap = newIntent.hashCode();
    newIntent.putExtra(KEY_OF_MAP, keyOfMap);
    sGlobalRefMap.put(keyOfMap, refMap);
  }
}
 
Example 2
Project: ActivityBuilder   File: RefManager.java   View Source Code Vote up 6 votes
/**
 * 用于 setResult 的 Intent
 */
public @NonNull Map<String, Object> getOrCreateRefMap(Intent intent) {
  Map<String, Object> refMap = getRefMap(intent);
  if (refMap == null) {
    refMap = new HashMap<>();
    int keyOfMap = intent.hashCode();
    intent.putExtra(KEY_OF_MAP, keyOfMap);
    sGlobalRefMap.put(keyOfMap, refMap);
  }
  return refMap;
}
 
Example 3
Project: FlickLauncher   File: UserEventDispatcher.java   View Source Code Vote up 6 votes
protected LauncherEvent createLauncherEvent(View v, Intent intent) {
    LauncherEvent event = LoggerUtils.initLauncherEvent(
            Action.TOUCH, v, Target.CONTAINER);
    event.action.touch = Action.TAP;

    // Fill in grid(x,y), pageIndex of the child and container type of the parent
    // TODO: make this percolate up the view hierarchy if needed.
    int idx = 0;
    LaunchSourceProvider provider = getLaunchProviderRecursive(v);
    if (v == null || !(v.getTag() instanceof ItemInfo) || provider == null) {
        return null;
    }
    ItemInfo itemInfo = (ItemInfo) v.getTag();
    provider.fillInLaunchSourceData(v, itemInfo, event.srcTarget[idx], event.srcTarget[idx + 1]);

    event.srcTarget[idx].intentHash = intent.hashCode();
    ComponentName cn = intent.getComponent();
    if (cn != null) {
        event.srcTarget[idx].packageNameHash = cn.getPackageName().hashCode();
        event.srcTarget[idx].componentHash = cn.hashCode();
        if (mPredictedApps != null) {
            event.srcTarget[idx].predictedRank = mPredictedApps.indexOf(
                    new ComponentKey(cn, itemInfo.user));
        }
    }
    return event;
}
 
Example 4
Project: SimpleUILauncher   File: UserEventDispatcher.java   View Source Code Vote up 6 votes
protected LauncherEvent createLauncherEvent(View v, Intent intent) {
    LauncherEvent event = LoggerUtils.initLauncherEvent(
            Action.TOUCH, v, Target.CONTAINER);
    event.action.touch = Action.TAP;

    // Fill in grid(x,y), pageIndex of the child and container type of the parent
    // TODO: make this percolate up the view hierarchy if needed.
    int idx = 0;
    LaunchSourceProvider provider = getLaunchProviderRecursive(v);
    if (v == null || !(v.getTag() instanceof ItemInfo) || provider == null) {
        return null;
    }
    ItemInfo itemInfo = (ItemInfo) v.getTag();
    provider.fillInLaunchSourceData(v, itemInfo, event.srcTarget[idx], event.srcTarget[idx + 1]);

    event.srcTarget[idx].intentHash = intent.hashCode();
    ComponentName cn = intent.getComponent();
    if (cn != null) {
        event.srcTarget[idx].packageNameHash = cn.getPackageName().hashCode();
        event.srcTarget[idx].componentHash = cn.hashCode();
        if (mPredictedApps != null) {
            event.srcTarget[idx].predictedRank = mPredictedApps.indexOf(
                    new ComponentKey(cn, itemInfo.user));
        }
    }
    return event;
}