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.mtramin.awarenessplayground.MainActivity.java

private void subscribeToBackgroundFenceWithData() {
    long now = System.currentTimeMillis();
    long in5seconds = now + 5000;
    long in10seconds = now + 10000;

    Bundle bundle = new Bundle();
    bundle.putLong("start", now);

    disposables.add(BackgroundFence.query(this).subscribe(fenceStateMap -> {
        if (!fenceStateMap.getFenceKeys().contains(ExampleFenceReceiver.TIME)) {
            AwarenessFence fence = TimeFence.inInterval(in5seconds, in10seconds);
            BackgroundFence.registerWithData(this, ExampleFenceReceiver.TIME, fence, bundle);
        }//from w  ww.j a v  a2  s.c o m
    }, throwable -> logError(throwable, "query")));
}

From source file:com.lkunic.libs.apptoolbox.twopane.fragments.ItemDetailFragment.java

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

    // Save the item id so that it can be loaded when the fragment is recreated
    outState.putLong(ARG_ITEM_ID, mItemId);
}

From source file:com.perfilyev.vkmessengerlite.MessagingService.java

private NotificationCompat.Action createReplyAction(long peerId, PendingIntent mainPendingIntent) {
    String replyLabel = getString(R.string.reply_label);

    Bundle extras = new Bundle();
    extras.putLong(MessagingService.EXTRA_PEER_ID, peerId);

    RemoteInput remoteInput = new RemoteInput.Builder(MessagingService.EXTRA_REPLY).addExtras(extras)
            .setLabel(replyLabel).build();
    PendingIntent replyActionPendingIntent;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        Intent intent = new Intent(this, MessagingService.class);
        intent.setAction(MessagingService.ACTION_REPLY);
        replyActionPendingIntent = PendingIntent.getService(this, 0, intent, 0);
    } else {//from  w  ww  .j a  va2s.  c o m
        // TODO: 22.10.2016 add fallback to activity
        replyActionPendingIntent = mainPendingIntent;
    }

    return new NotificationCompat.Action.Builder(R.drawable.ic_reply, replyLabel, replyActionPendingIntent)
            .addRemoteInput(remoteInput).setAllowGeneratedReplies(true).build();
}

From source file:com.google.android.demos.jamendo.widget.Loadable.java

public void refresh() {
    Bundle args = new Bundle();
    args.putInt(ARG_NUMBER, mCount);//from w w w . j ava  2 s .  c o  m
    args.putLong(ARG_MAX_AGE, 0L);
    mLoaderManager.restartLoader(mLoaderId, args, this);
}

From source file:com.enadein.carlogbook.ui.TypeReportFragment.java

private Bundle getRangeParams() {
    Bundle params = new Bundle();
    params.putLong(DataLoader.FROM, from);
    params.putLong(DataLoader.TO, to);/*from  w ww. j  a  v  a2 s .  c o  m*/
    return params;
}

From source file:com.google.android.demos.jamendo.widget.Loadable.java

public void retry() {
    Bundle args = new Bundle();
    args.putInt(ARG_NUMBER, mTargetCount);
    args.putLong(ARG_MAX_AGE, 0L);
    mLoaderManager.restartLoader(mLoaderId, args, this);
}

From source file:com.rowland.movies.ui.activities.MainActivity.java

@Override
public void onMovieSelected(long movieId, int selectedPosition) {
    // Store this position
    mSelectedPosition = selectedPosition;
    // Store remote movie id
    mMovieId = movieId;//from   ww  w .  ja  v a 2  s.c om
    // Check for two-pane
    if (mIsTwoPane) {
        // Create a Bundle object
        Bundle args = new Bundle();
        // Set the arguments
        args.putLong(DetailFragment.MOVIE_KEY, movieId);
        // Show the DetailFragment
        showDetailFragment(args);
    } else {
        // Create an Intent object
        Intent intent = new Intent(this, DetailActivity.class);
        // Set extras - pass MOVIE_KEY
        intent.putExtra(DetailFragment.MOVIE_KEY, movieId);
        // Start the DetailActivity
        startActivity(intent);
    }
}

From source file:com.rowland.moviesquire.ui.activities.MainActivity.java

@Override
public void onMovieSelected(long movieId, int selectedPosition) {
    // Store this position
    mSelectedPosition = selectedPosition;
    // Store remote movie id
    mMovieId = movieId;//  w w  w  .  j a va2s.  co m
    // Check for two-pane
    if (mIsTwoPane) {
        // Create a Bundle object
        Bundle args = new Bundle();
        // Set the arguments
        args.putLong(DetailFragment.MOVIE_KEY, movieId);
        // Show the DetailFragment
        showDetailFragment(args);
    } else {
        // Create an Intent object
        Intent intent = new Intent(this, DetailActivity.class);
        // Set extras - pass MOVIE_KEY
        intent.putExtra(DetailFragment.MOVIE_KEY, movieId);
        // Set extras - pass MOVIE_KEY
        intent.putExtra(DetailFragment.MOVIE_POSITION_KEY, selectedPosition);
        // Start the DetailActivity
        startActivity(intent);
    }
}

From source file:com.github.jvanhie.discogsscrobbler.NowPlayingActivity.java

private void setPager() {
    if (mPanes != 3) {
        //first initialization
        if (mPager == null) {
            mPager = (ViewPager) findViewById(R.id.now_playing_pager);
            if (mPanes == 2) {
                if (mRecentlyPlayedFragment == null)
                    mRecentlyPlayedFragment = new RecentlyPlayedFragment();
                getSupportFragmentManager().beginTransaction()
                        .replace(R.id.recently_played_container, mRecentlyPlayedFragment).commit();
            }/*from w ww .  jav a2 s. c o  m*/
        }
        //update the pager
        mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
        mPager.setAdapter(mPagerAdapter);
        if (mReleaseId != 0) {
            mPager.setCurrentItem(1);
        }
    } else {
        //3 pane goodness, no pagers needed
        if (mReleaseId != 0) {
            mDetailFragment = new ReleaseDetailFragment();
            Bundle arguments = new Bundle();
            arguments.putLong(ReleaseDetailFragment.ARG_ITEM_ID, mReleaseId);
            mDetailFragment.setArguments(arguments);
            getSupportFragmentManager().beginTransaction().replace(R.id.detail_container, mDetailFragment)
                    .commit();
            findViewById(R.id.detail_container).setVisibility(View.VISIBLE);
        }
        if (mNowPlayingFragment == null) {
            mNowPlayingFragment = new NowPlayingFragment();
            if (mRecentlyPlayedFragment == null) {
                mRecentlyPlayedFragment = new RecentlyPlayedFragment();
            }
            getSupportFragmentManager().beginTransaction()
                    .replace(R.id.now_playing_container, mNowPlayingFragment)
                    .replace(R.id.recently_played_container, mRecentlyPlayedFragment).commit();
        }

    }
}

From source file:com.andreykaraman.multinote.ui.list.AltNoteActivity.java

public void onArticleSelected(int position, long id) {
    // The user selected the headline of an article from the
    // HeadlinesFragment

    // Capture the article fragment from the activity layout
    AltEditNoteFragment articleFrag = (AltEditNoteFragment) getFragmentManager()
            .findFragmentById(R.id.fragment_new_note);

    if (articleFrag != null) {
        // If article frag is available, we're in two-pane layout...

        // Call a method in the ArticleFragment to update its content
        articleFrag.updateArticleView(position);

    } else {//w w  w  . j ava2s .com
        // If the frag is not available, we're in the one-pane layout and
        // must swap frags...

        // Create fragment and give it an argument for the selected article
        AltEditNoteFragment newFragment = new AltEditNoteFragment();
        Bundle args = new Bundle();
        args.putLong(AltEditNoteFragment.ARG_ID, id);

        newFragment.setArguments(args);
        FragmentTransaction transaction = getFragmentManager().beginTransaction();

        // Replace whatever is in the fragment_container view with this
        // fragment,
        // and add the transaction to the back stack so the user can
        // navigate back
        transaction.replace(R.id.fragment_container, newFragment);
        transaction.addToBackStack(null);

        // Commit the transaction
        transaction.commit();
    }
}