Example usage for android.os Bundle putInt

List of usage examples for android.os Bundle putInt

Introduction

In this page you can find the example usage for android.os Bundle putInt.

Prototype

public void putInt(@Nullable String key, int value) 

Source Link

Document

Inserts an int value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:org.dvbviewer.controller.ui.fragments.TimerDetails.java

@Override
public void onSaveInstanceState(Bundle arg0) {
    super.onSaveInstanceState(arg0);
    arg0.putLong(EXTRA_ID, timer.getId());
    arg0.putString(EXTRA_TITLE, timer.getTitle());
    arg0.putString(EXTRA_CHANNEL_NAME, timer.getChannelName());
    arg0.putLong(EXTRA_CHANNEL_ID, timer.getChannelId());
    arg0.putLong(EXTRA_START, timer.getStart().getTime());
    arg0.putLong(EXTRA_END, timer.getEnd().getTime());
    arg0.putInt(EXTRA_ACTION, timer.getTimerAction());
}

From source file:com.gelakinetic.mtgfam.fragments.TradeFragment.java

/**
 * Remove any showing dialogs, and show the requested one.
 *
 * @param id                The ID of the dialog to show.
 * @param sideForDialog     If this is for a specific card, this is the side of the trade the
 *                          card lives in.
 * @param positionForDialog If this is for a specific card, this is the position of the card in
 *                          the list./*from   w  ww . j a  v  a2s . c om*/
 */
public void showDialog(final int id, final int sideForDialog, final int positionForDialog)
        throws IllegalStateException {

    /* DialogFragment.show() will take care of adding the fragment in a transaction. We also
       want to remove any currently showing dialog, so make our own transaction and take care
       of that here. */

    /* If the fragment isn't visible (maybe being loaded by the pager), don't show dialogs */
    if (!this.isVisible()) {
        return;
    }

    removeDialog(getFragmentManager());

    if (id == TradeDialogFragment.DIALOG_SORT) {
        SortOrderDialogFragment newFragment = new SortOrderDialogFragment();
        Bundle args = new Bundle();
        args.putString(SortOrderDialogFragment.SAVED_SORT_ORDER,
                PreferenceAdapter.getTradeSortOrder(getContext()));
        newFragment.setArguments(args);
        newFragment.show(getFragmentManager(), FamiliarActivity.DIALOG_TAG);
    } else {
        /* Create and show the dialog. */
        TradeDialogFragment newFragment = new TradeDialogFragment();
        Bundle arguments = new Bundle();
        arguments.putInt(FamiliarDialogFragment.ID_KEY, id);
        arguments.putInt(TradeDialogFragment.ID_SIDE, sideForDialog);
        arguments.putInt(TradeDialogFragment.ID_POSITION, positionForDialog);
        newFragment.setArguments(arguments);
        newFragment.show(getFragmentManager(), FamiliarActivity.DIALOG_TAG);
    }

}

From source file:com.hackensack.umc.activity.ProfileSelfieActivityCustomeCam.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.proceed_btn:
        ProfileInsuranceInfoFragment profileInsuranceInfoFragment = new ProfileInsuranceInfoFragment();
        FragmentManager fragmentManager = getSupportFragmentManager();
        android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.add(R.id.fragmentIcContainer, profileInsuranceInfoFragment, "IsuranceFragment");
        fragmentTransaction.addToBackStack(null);
        fragmentTransaction.commit();/*from   ww  w  .  j  av  a 2 s. com*/
        break;
    case R.id.manual_btn:
        Intent intent = new Intent(ProfileSelfieActivityCustomeCam.this, RegistrationDetailsActivity.class);
        Bundle b = new Bundle();
        b.putInt(Constant.REGISTRATION_MODE, Constant.MANUAL);
        intent.putExtra(Constant.BUNDLE, b);
        startActivity(intent);
        break;
    case R.id.selfie_img:
        imageUri = CameraFunctionality.dispatchTakePictureIntent(ProfileSelfieActivityCustomeCam.this, 1, 5);
        break;

    }

}

From source file:com.openerp.MainActivity.java

private void loadFragment(DrawerItem item) {

    Fragment fragment = (Fragment) item.getFragmentInstace();
    ;//from  w  ww. j  a v a2 s. c om
    if (item.getTagColor() != null && !fragment.getArguments().containsKey("tag_color")) {
        Bundle tagcolor = fragment.getArguments();
        tagcolor.putInt("tag_color", Color.parseColor(item.getTagColor()));
        fragment.setArguments(tagcolor);
    }
    loadFragment(fragment);
}

From source file:org.anhonesteffort.flock.SubscriptionGoogleFragment.java

private void handleRequestPurchaseIntent(final String productType, final String productSku) {
    if (asyncTask != null)
        return;//from www  .ja  v a2s . c  o  m

    asyncTask = new AsyncTask<Void, Void, Bundle>() {

        @Override
        protected void onPreExecute() {
            Log.d(TAG, "handleRequestPurchaseIntent");
            subscriptionActivity.setProgressBarIndeterminateVisibility(true);
            subscriptionActivity.setProgressBarVisibility(true);
        }

        @Override
        protected Bundle doInBackground(Void... params) {
            Bundle result = new Bundle();

            if (subscriptionActivity.billingService == null) {
                Log.e(TAG, "billing service is null");
                result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR);
                return result;
            }

            String developerPayload = Base64
                    .encodeBytes(subscriptionActivity.davAccount.getUserId().toUpperCase().getBytes());

            try {

                Bundle intentBundle = subscriptionActivity.billingService.getBuyIntent(3,
                        SubscriptionGoogleFragment.class.getPackage().getName(), productSku, productType,
                        developerPayload);

                if (intentBundle.getParcelable("BUY_INTENT") != null) {
                    result.putParcelable("BUY_INTENT", intentBundle.getParcelable("BUY_INTENT"));
                    result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_SUCCESS);

                    return result;
                }
                Log.e(TAG, "buy intent is null");

            } catch (RemoteException e) {
                Log.e(TAG, "caught remote exception while getting buy intent", e);
            }

            result.putInt(ErrorToaster.KEY_STATUS_CODE, ErrorToaster.CODE_GOOGLE_PLAY_ERROR);

            return result;
        }

        @Override
        protected void onPostExecute(Bundle result) {
            asyncTask = null;
            subscriptionActivity.setProgressBarIndeterminateVisibility(false);
            subscriptionActivity.setProgressBarVisibility(false);

            if (result.getInt(ErrorToaster.KEY_STATUS_CODE) == ErrorToaster.CODE_SUCCESS)
                handleStartPurchaseIntent((PendingIntent) result.getParcelable("BUY_INTENT"));
            else
                ErrorToaster.handleDisplayToastBundledError(subscriptionActivity, result);
        }
    }.execute();
}

From source file:net.homelinux.penecoptero.android.citybikes.app.MainActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    ////Log.i("openBicing", "SaveInstanceState!");
    outState.putInt("homeRadius", hOverlay.getRadius());
    outState.putBoolean("view_all", view_all);
    outState.putInt("zoom", mapView.getZoomLevel());
}

From source file:com.myinstagram.afinski.myinstgrmviewer.ui.ImageGridFragment.java

@TargetApi(VERSION_CODES.JELLY_BEAN)
@Override/*ww  w.  j a v a2 s. co m*/
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

    //        final Intent i = new Intent(getActivity(), ImageDetailActivity.class);
    //        i.putExtra(ImageDetailActivity.EXTRA_IMAGE, (int) id);
    //        if (Utils.hasJellyBean()) {
    //            // makeThumbnailScaleUpAnimation() looks kind of ugly here as the loading spinner may
    //            // show plus the thumbnail image in GridView is cropped. so using
    //            // makeScaleUpAnimation() instead.
    //            ActivityOptions options =
    //                    ActivityOptions.makeScaleUpAnimation(v, 0, 0, v.getWidth(), v.getHeight());
    //            getActivity().startActivity(i, options.toBundle());
    //        } else {
    //            startActivity(i);
    //        }
    ImageDetailFragment pictureDialog = new ImageDetailFragment();
    Bundle args = new Bundle();
    String standard_resolution = ((PictureInstagram) mAdapter.getItem(position)).getUrl_standard_resolution();
    args.putString(IMAGE_DATA_EXTRA, standard_resolution);
    args.putInt("Width",
            ((PictureInstagram) mAdapter.getItem(position)).getSize_standard_resolution().getImageWidth());
    args.putInt("Height",
            ((PictureInstagram) mAdapter.getItem(position)).getSize_standard_resolution().getImageHeight());
    pictureDialog.setArguments(args);
    pictureDialog.setTargetFragment(this, 0);
    pictureDialog.show(getChildFragmentManager(), "PictureInstagram");

}

From source file:de.sourcestream.movieDB.controller.SearchList.java

/**
 * Called to ask the fragment to save its current dynamic state,
 * so it can later be reconstructed in a new instance of its process is restarted.
 *
 * @param outState Bundle in which to place your saved state.
 *//*from   www  .  j av  a  2  s .c o  m*/
@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    // Used to avoid bug where we add item in the back stack
    // and if we change orientation twice the item from the back stack has null values
    if (save != null)
        outState.putBundle("save", save);
    else {
        Bundle send = new Bundle();
        send.putInt("totalPages", totalPages);
        send.putString("title", getTitle());
        if (backState == 1) {
            send.putInt("backState", 1);
            send.putParcelableArrayList("listData", searchList);
            // used to restore the scroll listener variables
            send.putInt("currentPage", endlessScrollListener.getCurrentPage());
            send.putInt("oldCount", endlessScrollListener.getOldCount());
            send.putBoolean("loading", endlessScrollListener.getLoading());
            // Save scroll position
            if (listView != null) {
                Parcelable listState = listView.onSaveInstanceState();
                send.putParcelable("listViewScroll", listState);
            }
        } else {
            send.putInt("backState", 0);
            send.putString("query", query);
        }
        outState.putBundle("save", send);
    }
}

From source file:net.naonedbus.fragment.CustomListFragment.java

@Override
public void onSaveInstanceState(final Bundle outState) {
    if (isAdded()) {
        final View v = getListView().getChildAt(0);
        final int top = (v == null) ? 0 : v.getTop();
        outState.putInt(STATE_POSITION, getListView().getFirstVisiblePosition());
        outState.putInt(STATE_TOP, top);
    }/*from  www. j a v  a2  s .  co m*/
    super.onSaveInstanceState(outState);
}