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.tweetlanes.android.core.view.DirectMessageFeedFragment.java

public static DirectMessageFeedFragment newInstance(int laneIndex, final TwitterContentHandleBase handleBase,
        final String screenName, final String userName, final String laneIdentifier, final Long otherUserId,
        final String currentAccountKey, final String cachedMessages) {

    DirectMessageFeedFragment fragment = new DirectMessageFeedFragment();

    fragment.mContentHandle = TwitterManager.get().getContentHandle(handleBase, screenName, laneIdentifier,
            currentAccountKey);/*from  www.ja v a  2s  .c  om*/

    fragment.configureBaseLaneFragment(laneIndex, fragment.mContentHandle.getTypeAsString(),
            new ConfigureBundleListener() {

                @Override
                public void addValues(Bundle args) {
                    // TODO: serializing is a slow way of doing this...
                    args.putSerializable("handleBase", handleBase);
                    args.putString("screenName", screenName);
                    args.putString("userName", userName);
                    args.putString("laneIdentifier", laneIdentifier);
                    if (otherUserId != null) {
                        args.putLong("otherUserId", otherUserId);
                    }
                    if (cachedMessages != null) {
                        args.putString("cachedMessages", cachedMessages);
                    }
                }

            });

    return fragment;
}

From source file:ca.ualberta.cmput301w14t08.geochan.fragments.ThreadListFragment.java

/**
 * Initializes our fragment with various variables, displays the threads,
 * sets up a onItemClickListener so the user is sent to the appropriate
 * thread when they click on it, then sorts the threads according to the
 * method the user has chosen.//from  w  ww  . j  a  v a 2  s  .  com
 */
@Override
public void onStart() {
    super.onStart();
    if (locationListener == null) {
        locationListener = new LocationListenerService(getActivity());
    }
    if (prefManager == null) {
        prefManager = PreferencesManager.getInstance();
    }
    if (cacheManager == null) {
        cacheManager = CacheManager.getInstance();
    }
    threadListView = (PullToRefreshListView) getActivity().findViewById(R.id.thread_list);
    // On start, get the threadList from the cache
    ArrayList<ThreadComment> list = cacheManager.deserializeThreadList();
    ThreadList.setThreads(list);
    adapter = new ThreadListAdapter(getActivity(), ThreadList.getThreads());
    threadListView.setEmptyView(getActivity().findViewById(R.id.empty_list_view));
    threadListView.setAdapter(adapter);

    threadListView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        /*
         * On click, launch the fragment responsible for thread viewing
         */
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Fragment fragment = new ThreadViewFragment();
            Bundle bundle = new Bundle();
            bundle.putParcelable("thread", ThreadList.getThreads().get((int) id));
            bundle.putLong("id", id);
            fragment.setArguments(bundle);
            getFragmentManager().beginTransaction()
                    .replace(R.id.fragment_container, fragment, "thread_view_fragment")
                    .addToBackStack("thread_view_fragment").commit();
            getFragmentManager().executePendingTransactions();
        }
    });

    int sort = prefManager.getThreadSort();
    SortUtil.sortThreads(sort, ThreadList.getThreads());
    //setSortCheck(sort);
    adapter.notifyDataSetChanged();

    threadListView.setOnRefreshListener(new OnRefreshListener() {

        @Override
        public void onRefresh() {
            if (!connectHelper.isConnected()) {
                Toaster.toastShort("No network connection.");
                threadListView.onRefreshComplete();
            } else {
                reload();
            }
        }
    });

    // Toggle PullToRefresh programatically on start
    if (!refresh && connectHelper.isConnected()) {
        threadListView.setRefreshing();
        ThreadManager.startGetThreadComments(this);
        refresh = true;
    }

    updateReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            if (isVisible() && connectHelper.getWasNotConnected() == true) {
                connectHelper.setWasNotConnected(false);
                UpdateDialogFragment fragment = new UpdateDialogFragment();
                fragment.show(getFragmentManager(), "updateDialogFrag");
            }
        }

    };

    getActivity().getApplicationContext().registerReceiver(updateReceiver,
            new IntentFilter(ConnectivityBroadcastReceiver.UPDATE_FROM_SERVER_INTENT));
}

From source file:es.uniovi.imovil.fcrtrainer.BaseExerciseFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(STATE_IS_PLAYING, mIsPlaying);
    outState.putLong(STATE_CONSUMED_TIME_MS, mDurationMs - getRemainingTimeMs());
    outState.putLong(STATE_DURATION_TIME_MS, mDurationMs);
    outState.putInt(STATE_SCORE, mScore);
}

From source file:com.abcvoipsip.ui.account.AccountsEditListFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putLong(CURRENT_CHOICE, curCheckPosition);
}

From source file:com.akop.bach.fragment.playstation.GamesFragment.java

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

    if (mAccount != null) {
        outState.putParcelable("account", mAccount);
        outState.putLong("currentId", mTitleId);
    }/*www  . j ava2s .  co  m*/
}

From source file:com.grokkingandroid.sampleapp.samples.data.contentprovider.lentitems.LentItemFormFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putBoolean(KEY_ACTIVITY_FOR_RESULT_STARTED, mWasActivityForResultStarted);
    if (mPhotoUri != null) {
        outState.putString(KEY_PHOTO_URI, mPhotoUri.toString());
    }//  w  w w  .  j  a  v  a  2s  .  co m
    outState.putLong(KEY_ITEM_ID, mItemId);
}

From source file:li.barter.fragments.AbstractBarterLiFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putLong(Keys.LAST_SCREEN_TIME, Utils.getCurrentEpochTime());
}

From source file:edu.stanford.mobisocial.dungbeetle.ui.wizard.ChangePictureActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_feed_home);

    checked = new boolean[filterTypes.length];

    for (int x = 0; x < filterTypes.length; x++) {
        checked[x] = true;/* w  w w  . j a v  a2 s.co  m*/
    }

    findViewById(R.id.btn_broadcast).setVisibility(View.GONE);
    mContactId = getIntent().getLongExtra("contact_id", -1);
    if (mContactId == -1) {
        Uri data = getIntent().getData();
        if (data != null) {
            try {
                mContactId = Long.parseLong(data.getLastPathSegment());
            } catch (NumberFormatException e) {
            }
        }
    }

    Bundle args = new Bundle();
    args.putLong("contact_id", mContactId);
    Fragment profileFragment = new ViewProfileFragment();
    profileFragment.setArguments(args);

    doTitleBar(this, "My Profile");
    mLabels.add("View");
    mLabels.add("Edit");
    mFragments.add(profileFragment);
    mFragments.add(new EditProfileFragment());

    Uri privateUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/feeds/private");
    mLabels.add("Notes");
    Fragment feedView = new FeedViewFragment();
    args = new Bundle(args);
    args.putParcelable(FeedViewFragment.ARG_FEED_URI, privateUri);
    feedView.setArguments(args);
    //mFragments.add(feedView);

    PagerAdapter adapter = new ViewFragmentAdapter(getSupportFragmentManager(), mFragments);
    mViewPager = (ViewPager) findViewById(R.id.feed_pager);
    mViewPager.setAdapter(adapter);
    mViewPager.setOnPageChangeListener(this);

    ViewGroup group = (ViewGroup) findViewById(R.id.tab_frame);
    int i = 0;
    for (String s : mLabels) {
        Button button = new Button(this);
        button.setText(s);
        button.setTextSize(18f);

        button.setLayoutParams(CommonLayouts.FULL_HEIGHT);
        button.setTag(i++);
        button.setOnClickListener(mViewSelected);

        group.addView(button);
        mButtons.add(button);
    }

    // Listen for future changes
    Uri feedUri;
    if (mContactId == Contact.MY_ID) {
        feedUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/feeds/me");
    } else {
        feedUri = Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/contacts");
    }
    mProfileContentObserver = new ProfileContentObserver(mHandler);
    getContentResolver().registerContentObserver(feedUri, true, mProfileContentObserver);

    onPageSelected(0);

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Click on the avatar to take a profile picture of yourself.").setCancelable(false)
            .setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {

                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.cl.slack.gesture.GestureBuilderActivity.java

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

    if (mCurrentRenameGesture != null) {
        outState.putLong(GESTURES_INFO_ID, mCurrentRenameGesture.gesture.getID());
    }//from   w  w w  .java 2s .c  o  m
}

From source file:com.nextgis.mobile.fragment.AttributesFragment.java

@Override
public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    outState.putLong(KEY_ITEM_ID, mItemId);
    outState.putInt(KEY_ITEM_POSITION, mItemPosition);
}