private IntentParameterHandler createTestee(final String key, final Serializable value) {
   final Intent intent = new Intent();
   intent.putExtra(key, value);
   final Activity activity = new Activity();
   activity.setIntent(intent);
   return new IntentParameterHandler(activity);
 }
Example #2
0
 @Override
 @ReceiveIntent("startActivity,1")
 // :: error: (intent.getintent.notfound)
 public void setIntent(
     @IntentMap({
           @Extra(
               key = "k5",
               source = {ACCESS_FINE_LOCATION},
               sink = {})
         })
         Intent newIntent) {
   super.setIntent(newIntent);
 }
Example #3
0
 /**
  * Checks to see if the activity's intent ({@link android.app.Activity#getIntent()}) is an NFC
  * intent that the app recognizes. If it is, then parse the NFC message and set the activity's
  * intent (using {@link android.app.Activity#setIntent(android.content.Intent)}) to something the
  * app can recognize (i.e. a normal {@link android.content.Intent#ACTION_VIEW} intent).
  */
 @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
 public static void tryUpdateIntentFromBeam(Activity activity) {
   if (UIUtils.hasICS()) {
     Intent originalIntent = activity.getIntent();
     if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(originalIntent.getAction())) {
       Parcelable[] rawMsgs =
           originalIntent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
       NdefMessage msg = (NdefMessage) rawMsgs[0];
       // Record 0 contains the MIME type, record 1 is the AAR, if present.
       // In iosched, AARs are not present.
       NdefRecord mimeRecord = msg.getRecords()[0];
       if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals(new String(mimeRecord.getType()))) {
         // Re-set the activity's intent to one that represents session details.
         Intent sessionDetailIntent =
             new Intent(Intent.ACTION_VIEW, Uri.parse(new String(mimeRecord.getPayload())));
         activity.setIntent(sessionDetailIntent);
       }
     }
   }
 }
Example #4
0
 @Override
 public void handleAction(CharSequence name) {
   activity.setIntent(new Intent(TAG));
 }
 @Override
 @ReceiveIntent("startActivity,1")
 public void setIntent(@IntentMap() Intent newIntent) {
   super.setIntent(newIntent);
 }