Example usage for android.content Intent getBundleExtra

List of usage examples for android.content Intent getBundleExtra

Introduction

In this page you can find the example usage for android.content Intent getBundleExtra.

Prototype

public Bundle getBundleExtra(String name) 

Source Link

Document

Retrieve extended data from the intent.

Usage

From source file:de.dreier.mytargets.views.selector.SelectorBase.java

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == Activity.RESULT_OK && requestCode == this.requestCode) {
        Bundle intentData = data.getBundleExtra(ItemSelectActivity.INTENT);
        if (index == -1 || (intentData != null && intentData.getInt(INDEX) == index)) {
            final Parcelable parcelable = data.getParcelableExtra(ITEM);
            setItem(Parcels.unwrap(parcelable));
        }//from w w  w .j  a va 2s  .co  m
    }
}

From source file:net.zionsoft.obadiah.model.notification.PushNotificationHandler.java

@Override
protected void onHandleIntent(Intent intent) {
    App.get(this).getInjectionComponent().inject(this);

    final Bundle extras = intent.getBundleExtra(KEY_EXTRAS);
    final String messageType = extras.getString("type");
    final String messageAttrs = extras.getString("attrs");

    final NotificationCompat.Builder builder = buildBasicNotificationBuilder(this, messageType);
    final int notificationId;
    if (MESSAGE_TYPE_VERSE.equals(messageType)) {
        notificationId = NOTIFICATION_ID_VERSE;
        if (!prepareForVerse(builder, messageType, messageAttrs)) {
            return;
        }/*  w w  w  .j a va  2  s  .  com*/
    } else if (MESSAGE_TYPE_NEW_TRANSLATION.equals(messageType)) {
        notificationId = NOTIFICATION_ID_NEW_TRANSLATION;
        if (!prepareForNewTranslation(this, builder, messageType, messageAttrs)) {
            return;
        }
    } else {
        Analytics.trackNotificationEvent("unknown_message_type", messageType);
        return;
    }

    final NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(notificationId, builder.build());

    Analytics.trackNotificationEvent("notification_shown", messageType);
}

From source file:com.linkedin.android.shaky.Shaky.java

private Result unpackResult(Intent intent) {
    Result result = new Result(intent.getBundleExtra(FeedbackActivity.USER_DATA));
    result.setScreenshotUri((Uri) intent.getParcelableExtra(FeedbackActivity.SCREENSHOT_URI));
    result.setTitle(intent.getStringExtra(FeedbackActivity.TITLE));
    result.setMessage(intent.getStringExtra(FeedbackActivity.MESSAGE));

    // add file provider data to all attachments
    ArrayList<Uri> fileProviderAttachments = new ArrayList<>();
    for (Uri attachment : result.getAttachments()) {
        fileProviderAttachments.add(Utils.getProviderUri(activity, attachment));
    }/*from   www  . j  a v  a  2  s  . c  o m*/
    result.setAttachments(fileProviderAttachments);

    return result;
}

From source file:com.facebook.internal.BoltsMeasurementEventListener.java

@Override
public void onReceive(Context context, Intent intent) {
    AppEventsLogger appEventsLogger = AppEventsLogger.newLogger(context);
    String eventName = BOLTS_MEASUREMENT_EVENT_PREFIX + intent.getStringExtra(MEASUREMENT_EVENT_NAME_KEY);
    Bundle eventArgs = intent.getBundleExtra(MEASUREMENT_EVENT_ARGS_KEY);
    Bundle logData = new Bundle();
    for (String key : eventArgs.keySet()) {
        String safeKey = key.replaceAll("[^0-9a-zA-Z _-]", "-").replaceAll("^[ -]*", "").replaceAll("[ -]*$",
                "");
        logData.putString(safeKey, (String) eventArgs.get(key));
    }//from w ww . java  2 s  .c  om
    appEventsLogger.logEvent(eventName, logData);
}

From source file:com.paymaya.sdk.android.checkout.PayMayaCheckoutActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.paymaya_checkout_activity);

    Intent intent = getIntent();
    Preconditions.checkNotNull(intent, "Missing intent.");

    Bundle bundle = intent.getBundleExtra(EXTRAS_CHECKOUT_BUNDLE);
    Preconditions.checkNotNull(bundle, "Missing bundle.");

    mCheckout = bundle.getParcelable(EXTRAS_CHECKOUT);
    Preconditions.checkNotNull(mCheckout, "Missing checkout object.");

    mClientKey = intent.getStringExtra(EXTRAS_CLIENT_KEY);
    Preconditions.checkNotNull(mClientKey, "Missing client key.");

    initialize();//w w  w .j a  v a 2s.c o  m
    requestCreateCheckout();
}

From source file:test.hugo.ui.ImgShowActivity.java

private void extractViewInfoFromBundle(Intent intent) {
    Bundle extras = intent.getBundleExtra("loc");
    initPosition = extras.getInt(INITPOSITION);
    mLocation_left = extras.getInt(PROPNAME_SCREENLOCATION_LEFT);
    mLocation_top = extras.getInt(PROPNAME_SCREENLOCATION_TOP);
    mInit_width = extras.getInt(PROPNAME_WIDTH);
    mInit_height = extras.getInt(PROPNAME_HEIGHT);
    imgUrl = new String[] {
            "http://cdn.oss.gaokaopai.com//mobile/face/post/2017/06/29/2017062981591498705792498_and.jpg",
            "http://cdn.oss.gaokaopai.com//mobile/face/post/2016/04/21/2016042117460047498x.jpg",
            "http://cdn.oss.gaokaopai.com//mobile/face/post/2017/06/28/2017062818012299966x.jpg",
            "http://cdn.oss.gaokaopai.com//mobile/face/post/2017/06/29/2017062918891498706928153_and.webp",
            "http://cdn.oss.gaokaopai.com//mobile/face/post/2017/05/13/2017051310140545224x.jpg",
            "http://cdn.oss.gaokaopai.com//mobile/face/post/2017/05/13/2017051310140490168x.jpg" };
    pairs = new Pair[6];
}

From source file:com.hscardref.android.view.MainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {

    if (requestCode == WIN_MODEL_REQUEST_CODE) {
        if (resultCode == RESULT_OK) {
            Bundle mBundle = intent.getBundleExtra("CardCompositeFilter");
            CardCompositeFilter cardCompositeFilter = (CardCompositeFilter) mBundle
                    .get("com.hscardref.generic.domain.CardCompositeFilter");
            NodeSelectorFragment nodeSelectorFragment = (NodeSelectorFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.nodeselector);

            if (nodeSelectorFragment != null) {
                nodeSelectorFragment.setRefresh(false);
                // Call a method in the NodeSelectorFragment to search card
                // info
                nodeSelectorFragment.applyCardFilter(-2, 0, cardCompositeFilter);
            }/*  w  w  w .j  a v a 2  s .  c  o  m*/

            WorkareaFragment workareaFragment = (WorkareaFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.workarea);
            if (cardCompositeFilter.getAbilities().size() > 0 || cardCompositeFilter.getRaces().size() > 0
                    || cardCompositeFilter.getTypes().size() > 0) {
                workareaFragment.setFilterDialogStatus(false);
            } else {
                workareaFragment.setFilterDialogStatus(true);
            }
        }
    }
}

From source file:org.barbon.mangaget.fragments.MangaSearchResults.java

public void performSearch(Intent intent) {
    Scraper scraper = Scraper.getInstance(getActivity());
    String query = intent.getStringExtra(SearchManager.QUERY);
    Bundle extra = intent.getBundleExtra(SearchManager.APP_DATA);
    Scraper.SearchCriteria criteria = new Scraper.SearchCriteria();

    criteria.title = query;//from   w  w w . ja  v a 2 s  .c o  m
    if (extra != null)
        criteria.includeTags = extra.getStringArrayList("include_tags");

    setListAdapter(new SearchAdapter(getActivity(), scraper, criteria));
}

From source file:com.glacialsoftware.googolplex.GoogolplexDisplayActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    String theme = PreferenceManager.getDefaultSharedPreferences(this).getString("theme_select", "Light");
    if (theme.equals("Light")) {
        setTheme(R.style.lightTheme);/*from  w  w w .  ja  v  a  2s .  c  o  m*/
        currentTheme = theme;
    } else {
        setTheme(R.style.darkTheme);
        currentTheme = theme;
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_googolplex_display);
    //created=true;

    if (savedInstanceState == null) {
        Intent intent = getIntent();
        savedInstanceState = intent.getBundleExtra("com.glacialsoftware.googolplex.manualSavedInstanceState");
    }

    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("tilt_lock", false)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    }

    firstVisiblePosition = 0;
    overlayShowing = false;
    preferencesShowing = false;
    int overlayPosition = 0;
    if (savedInstanceState != null) {
        firstVisiblePosition = savedInstanceState.getInt("firstVisiblePosition");
        overlayShowing = savedInstanceState.getBoolean("overlayShowing");
        overlayPosition = savedInstanceState.getInt("overlayPosition");
        preferencesShowing = savedInstanceState.getBoolean("preferencesShowing");
    }

    googolplexDisplayFragment = new GoogolplexDisplayFragment(overlayShowing, overlayPosition);
    digitOverlayFragment = new DigitOverlayFragment();
    googolplexPreferenceFragment = new GoogolplexPreferenceFragment();
    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    fragmentTransaction.add(R.id.googolplex_display_frame, googolplexDisplayFragment);
    fragmentTransaction.add(R.id.googolplex_display_frame, digitOverlayFragment);
    fragmentTransaction.add(R.id.googolplex_display_frame, googolplexPreferenceFragment);
    fragmentTransaction.hide(digitOverlayFragment);
    fragmentTransaction.hide(googolplexPreferenceFragment);
    fragmentTransaction.commit();
}

From source file:com.kyakujin.android.tagnotepad.ui.NoteActivity.java

/**
 * ?//from   w ww .jav a2  s . c om
 *
 * @param intent the intent
 */
private void handleIntent(Intent intent) {
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY);
        String tagname = null;
        final Bundle bundle = intent.getBundleExtra(SearchManager.APP_DATA);
        if (bundle != null) {
            // ????????????????
            // ??"Tag_A"????????????
            // ???????
            // "Tag_A"?where????
            tagname = bundle.getString(Config.SELECTED_TAGNAME);
        }

        doSearch(query, tagname);
    }
}