Example usage for android.os Bundle putLong

List of usage examples for android.os Bundle putLong

Introduction

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

Prototype

public void putLong(@Nullable String key, long value) 

Source Link

Document

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

Usage

From source file:com.dwdesign.tweetings.fragment.BaseUsersListFragment.java

protected void openUserProfile(final long user_id, final String screen_name) {
    final FragmentActivity activity = getActivity();
    if (activity instanceof HomeActivity && ((HomeActivity) activity).isDualPaneMode()) {
        final HomeActivity home_activity = (HomeActivity) activity;
        if (mDetailFragment instanceof UserProfileFragment && mDetailFragment.isAdded()) {
            ((UserProfileFragment) mDetailFragment).getUserInfo(mAccountId, user_id, screen_name);
        } else {/*  ww w  .j a va 2  s . c o m*/
            mDetailFragment = new UserProfileFragment();
            final Bundle args = new Bundle();
            args.putLong(INTENT_KEY_ACCOUNT_ID, mAccountId);
            args.putLong(INTENT_KEY_USER_ID, user_id);
            args.putString(INTENT_KEY_SCREEN_NAME, screen_name);
            mDetailFragment.setArguments(args);
            home_activity.showAtPane(HomeActivity.PANE_RIGHT, mDetailFragment, true);
        }
    } else {
        final Uri.Builder builder = new Uri.Builder();
        builder.scheme(SCHEME_TWEETINGS);
        builder.authority(AUTHORITY_USER);
        builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(mAccountId));
        builder.appendQueryParameter(QUERY_PARAM_USER_ID, String.valueOf(user_id));
        builder.appendQueryParameter(QUERY_PARAM_SCREEN_NAME, screen_name);
        startActivity(new Intent(Intent.ACTION_VIEW, builder.build()));
    }
}

From source file:com.github.kanata3249.ffxieq.android.MagicSelectorActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putInt("Index", mIndex);
    outState.putLong("Current", mCurrent);
    outState.putLong("SubId", mSubId);
    outState.putLong("Filter", mFilterID);
    outState.putString("FilterByType", mFilterByType);
}

From source file:com.dwdesign.tweetings.fragment.BaseUserListsListFragment.java

@Override
public void onPullUpToRefresh() {
    final int count = mAdapter.getCount();
    if (count - 1 > 0) {
        final Bundle args = getArguments();
        if (args != null) {
            args.putLong(INTENT_KEY_MAX_ID, mAdapter.getItem(count - 1).user_id);
        }/*  w w w .j  a va 2s  . c  om*/
        if (!getLoaderManager().hasRunningLoaders()) {
            getLoaderManager().restartLoader(0, args, this);
        }
    }
}

From source file:ca.rmen.android.scrumchatter.meeting.detail.MeetingActivity.java

/**
 * Save the id of the meeting which is currently visible.
 *//*ww  w . j a v  a  2s .c o  m*/
@Override
protected void onSaveInstanceState(Bundle outState) {
    Log.v(TAG, "onSaveInstanceState, outState = " + outState);
    if (mMeetingPagerAdapter != null) {
        Meeting meeting = mMeetingPagerAdapter.getMeetingAt(mBinding.pager.getCurrentItem());
        outState.putLong(Meetings.EXTRA_MEETING_ID, meeting.getId());
    }
    super.onSaveInstanceState(outState);
}

From source file:jp.sonymusicstudio.cast.castcompanionlibrary.utils.Utils.java

/**
 * Builds and returns a {@link Bundle} which contains a select subset of data in the
 * {@link MediaInfo}. Since {@link MediaInfo} is not {@link Parcelable}, one can use this
 * container bundle to pass around from one activity to another.
 *
 * @see <code>bundleToMediaInfo()</code>
 *///from w w  w.  ja v  a  2s  .c o  m
public static Bundle mediaInfoToBundle(MediaInfo info) {
    if (info == null) {
        return null;
    }

    MediaMetadata md = info.getMetadata();
    Bundle wrapper = new Bundle();

    wrapper.putString(MediaMetadata.KEY_TITLE, md.getString(MediaMetadata.KEY_TITLE));
    wrapper.putString(MediaMetadata.KEY_SUBTITLE, md.getString(MediaMetadata.KEY_SUBTITLE));
    wrapper.putString(MediaMetadata.KEY_ALBUM_TITLE, md.getString(MediaMetadata.KEY_ALBUM_TITLE));
    wrapper.putString(MediaMetadata.KEY_ALBUM_ARTIST, md.getString(MediaMetadata.KEY_ALBUM_ARTIST));
    wrapper.putString(MediaMetadata.KEY_COMPOSER, md.getString(MediaMetadata.KEY_COMPOSER));
    wrapper.putString(MediaMetadata.KEY_SERIES_TITLE, md.getString(MediaMetadata.KEY_SERIES_TITLE));
    wrapper.putString(MediaMetadata.KEY_SEASON_NUMBER, md.getString(MediaMetadata.KEY_SEASON_NUMBER));
    wrapper.putString(MediaMetadata.KEY_EPISODE_NUMBER, md.getString(MediaMetadata.KEY_EPISODE_NUMBER));

    Calendar releaseCalender = md.getDate(MediaMetadata.KEY_RELEASE_DATE);
    if (releaseCalender != null) {
        long releaseMillis = releaseCalender.getTimeInMillis();
        wrapper.putLong(MediaMetadata.KEY_RELEASE_DATE, releaseMillis);
    }

    wrapper.putInt(KEY_MEDIA_TYPE, info.getMetadata().getMediaType());
    wrapper.putString(KEY_URL, info.getContentId());
    wrapper.putString(MediaMetadata.KEY_STUDIO, md.getString(MediaMetadata.KEY_STUDIO));
    wrapper.putString(KEY_CONTENT_TYPE, info.getContentType());
    wrapper.putInt(KEY_STREAM_TYPE, info.getStreamType());
    wrapper.putLong(KEY_STREAM_DURATION, info.getStreamDuration());

    if (!md.getImages().isEmpty()) {
        ArrayList<String> urls = new ArrayList<>();
        for (WebImage img : md.getImages()) {
            urls.add(img.getUrl().toString());
        }
        wrapper.putStringArrayList(KEY_IMAGES, urls);
    }

    JSONObject customData = info.getCustomData();
    if (customData != null) {
        wrapper.putString(KEY_CUSTOM_DATA, customData.toString());
    }
    if (info.getMediaTracks() != null && !info.getMediaTracks().isEmpty()) {
        try {
            JSONArray jsonArray = new JSONArray();
            for (MediaTrack mt : info.getMediaTracks()) {
                JSONObject jsonObject = new JSONObject();
                jsonObject.put(KEY_TRACK_NAME, mt.getName());
                jsonObject.put(KEY_TRACK_CONTENT_ID, mt.getContentId());
                jsonObject.put(KEY_TRACK_ID, mt.getId());
                jsonObject.put(KEY_TRACK_LANGUAGE, mt.getLanguage());
                jsonObject.put(KEY_TRACK_TYPE, mt.getType());
                if (mt.getSubtype() != MediaTrack.SUBTYPE_UNKNOWN) {
                    jsonObject.put(KEY_TRACK_SUBTYPE, mt.getSubtype());
                }
                if (mt.getCustomData() != null) {
                    jsonObject.put(KEY_TRACK_CUSTOM_DATA, mt.getCustomData().toString());
                }
                jsonArray.put(jsonObject);
            }
            wrapper.putString(KEY_TRACKS_DATA, jsonArray.toString());
        } catch (JSONException e) {
            LOGE(TAG, "mediaInfoToBundle(): Failed to convert Tracks data to json", e);
        }
    }

    return wrapper;
}

From source file:com.iaraby.template.view.fragment.ListFrag.java

@Override
public void onSaveInstanceState(Bundle outState) {
    outState.putBoolean(Constants.PARAM_IS_FAV, this.isFav);
    outState.putInt(Constants.PARAM_CAT_POS_TAG, this.selectedPos);
    outState.putLong(Constants.PARAM_CAT_ID_TAG, this.selectedId);
    super.onSaveInstanceState(outState);
}

From source file:com.github.kanata3249.ffxieq.android.FoodSelectorActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    outState.putLong("Current", mCurrent);
    outState.putLong("Filter", mFilterID);
    outState.putString("FilterByType", mFilterByType);
}

From source file:com.android.calendar.DayFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    long time = getSelectedTimeInMillis();
    if (time != -1) {
        outState.putLong(BUNDLE_KEY_RESTORE_TIME, time);
    }/*from  w w  w .  j a v  a 2s.  com*/
}

From source file:com.brq.wallet.activity.export.BackupToPdfActivity.java

@Override
protected void onSaveInstanceState(Bundle outState) {
    outState.putLong("backupTime", _backupTime);
    outState.putString("password", _password);
    outState.putBoolean("isPdfGenerated", _isPdfGenerated);
    super.onSaveInstanceState(outState);
}

From source file:com.github.jobs.ui.activity.EditTemplateActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    if (savedInstanceState != null) {
        mCurrentTab = savedInstanceState.getInt(KEY_CURRENT_TAB);
        mEditModeEnabled = savedInstanceState.getBoolean(KEY_EDIT_MODE);
    }/* ww  w  .  j av  a  2  s. c  o m*/

    mTemplateId = getIntent().getLongExtra(EditTemplateActivity.EXTRA_TEMPLATE_ID, -1);
    boolean enableEditMode = mEditModeEnabled || mTemplateId == -1;
    if (enableEditMode) {
        enableEditMode();
    }

    Bundle args = new Bundle();
    args.putLong(EditTemplateFragment.ARG_TEMPLATE_ID, mTemplateId);
    args.putBoolean(EditTemplateFragment.ARG_EDIT_MODE, enableEditMode);
    setupBaseFragment(R.id.base_container, EditTemplateFragment.class, args);
}