Example usage for android.os Bundle getLong

List of usage examples for android.os Bundle getLong

Introduction

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

Prototype

public long getLong(String key, long defaultValue) 

Source Link

Document

Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

Usage

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

@Override
public Loader<SynchronizedStateSavedList<ParcelableStatus, Long>> newLoaderInstance(final Bundle args) {
    long account_id = -1, max_id = -1, since_id = -1, user_id = -1;
    String screen_name = null;/*ww  w.j  a v a 2 s.c om*/
    boolean is_home_tab = false;
    if (args != null) {
        account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1);
        max_id = args.getLong(INTENT_KEY_MAX_ID, -1);
        since_id = args.getLong(INTENT_KEY_SINCE_ID, -1);
        user_id = args.getLong(INTENT_KEY_USER_ID, -1);
        screen_name = args.getString(INTENT_KEY_SCREEN_NAME);
        is_home_tab = args.getBoolean(INTENT_KEY_IS_HOME_TAB);
    }
    return new UserTimelineLoader(getActivity(), account_id, user_id, screen_name, max_id, since_id, getData(),
            getClass().getSimpleName(), is_home_tab);
}

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

@Override
public Loader<List<ParcelableUser>> newLoaderInstance() {
    final Bundle args = getArguments();
    int list_id = -1;
    long account_id = -1, user_id = -1;
    String screen_name = null, list_name = null;
    if (args != null) {
        list_id = args.getInt(INTENT_KEY_LIST_ID, -1);
        account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1);
        user_id = args.getLong(INTENT_KEY_USER_ID, -1);
        screen_name = args.getString(INTENT_KEY_SCREEN_NAME);
        list_name = args.getString(INTENT_KEY_LIST_NAME);
    }/*w  w w . j ava2 s .com*/
    return new UserListSubscribersLoader(getActivity(), account_id, list_id, user_id, screen_name, list_name,
            mCursor, getData());
}

From source file:com.fullmeadalchemist.mustwatch.ui.batch.detail.BatchDetailFragment.java

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    initClickListeners();//from   w ww.j  a  va 2  s  . co m

    Bundle bundle = this.getArguments();
    if (bundle != null) {

        long batchId = bundle.getLong(BATCH_ID, Long.MIN_VALUE);
        Timber.i("Got Batch ID %d from the NavigationController. Acting as a Batch Editor.", batchId);

        if (batchId != Long.MIN_VALUE) {
            if (viewModel.batch != null) {
                Timber.v("Reusing viewmodel data");
                dataBinding.setBatch(viewModel.batch);
                updateBatchUiInfo();
                updateIngredientUiInfo();
            } else {

                viewModel.getBatch(batchId).observe(this, batch -> {
                    if (batch != null) {
                        dataBinding.setBatch(batch);
                        viewModel.batch = batch;
                        updateBatchUiInfo();

                        viewModel.getBatchIngredients(batchId).observe(this, batchIngredients -> {
                            if (batchIngredients != null) {
                                Timber.v("Loaded %s Batch ingredients", batchIngredients.size());
                                viewModel.batch.ingredients = batchIngredients;
                                updateIngredientUiInfo();
                                updateBatchUiInfo();
                            } else {
                                Timber.w(
                                        "Received nothing from the RecipeRepository when trying to get ingredients for Batch %s",
                                        batchId);
                            }
                            Timber.i("Loaded Batch with ID %d:\n%s", batch.id, batch);
                        });

                    } else {
                        Timber.w("Received a null Batch from the RecipeDetailViewModel.");
                    }
                });
                viewModel.getLogsForBatch(batchId).observe(this, batches -> {
                    // update UI
                    logsAdapter.dataSet = batches;
                    logsAdapter.notifyDataSetChanged();
                });
            }
        }
    } else {
        Timber.i("No Batch ID was received. Redirecting to the Batch Creation form.");
        navigationController.navigateToAddBatch();
    }

    logsRecyclerView = getActivity().findViewById(R.id.logs_list);
    logsRecyclerView.setHasFixedSize(true);

    LinearLayoutManager llm = new LinearLayoutManager(getContext());
    llm.setOrientation(LinearLayoutManager.VERTICAL);

    logsRecyclerView.setLayoutManager(llm);
    logsRecyclerView.setAdapter(logsAdapter);
}

From source file:de.vanita5.twittnuker.fragment.support.BaseUserListsListFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mTwitterWrapper = getTwitterWrapper();
    mMultiSelectManager = getMultiSelectManager();
    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    final Bundle args = getArguments();
    if (args != null) {
        mAccountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
        mUserId = args.getLong(EXTRA_USER_ID, -1);
        mScreenName = args.getString(EXTRA_SCREEN_NAME);
    }/*from  w w  w  .  j a  va2 s  .co  m*/
    mAdapter = new ParcelableUserListsAdapter(getActivity());
    mListView = getListView();
    mListView.setDivider(null);
    mListView.setSelector(android.R.color.transparent);
    mListView.setFastScrollEnabled(mPreferences.getBoolean(KEY_FAST_SCROLL_THUMB, false));
    // final long account_id = args.getLong(EXTRA_ACCOUNT_ID, -1);
    // if (mAccountId != account_id) {
    //    mAdapter.clear();
    //    mData.clear();
    // }
    // mAccountId = account_id;
    setListAdapter(mAdapter);
    mAdapter.setMenuButtonClickListener(this);
    getLoaderManager().initLoader(0, getArguments(), this);
    setListShown(false);
    setRefreshMode(RefreshMode.NONE);
}

From source file:com.rappsantiago.weighttracker.progress.AddEditProgressFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle args = getArguments();
    if (null != args) {
        mExistingProgressId = args.getLong(KEY_PROGRESS_ID, -1L);
    }/*w  w w.  j  a  v  a  2  s  . c  o m*/
}

From source file:com.example.crudcontent.fragment.EditCityFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // City id can not be changed, so always fetch from arguments
    Bundle args = getArguments();
    if (args != null) {
        cityId = args.getLong(ARG_CITY_ID, CityContract.NO_CITY_ID);
    }//from w  ww  . jav  a 2s .  c o  m
}

From source file:de.vanita5.twittnuker.fragment.support.BaseUsersListFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    mAdapter = new ParcelableUsersAdapter(getActivity());
    mAdapter.setMenuButtonClickListener(this);
    mMultiSelectManager = getMultiSelectManager();
    mListView = getListView();/*from w  w  w.  ja  v  a 2s  .  c  o m*/
    mListView.setFastScrollEnabled(mPreferences.getBoolean(KEY_FAST_SCROLL_THUMB, false));
    final Bundle args = getArguments() != null ? getArguments() : new Bundle();
    final long accountId = args.getLong(EXTRA_ACCOUNT_ID, -1);
    if (mAccountId != accountId) {
        mAdapter.clear();
        mData.clear();
    }
    mAccountId = accountId;
    if (!mPreferences.getBoolean(KEY_PLAIN_LIST_STYLE, false)) {
        mListView.setDivider(null);
    }
    mListView.setSelector(android.R.color.transparent);
    mListView.setOnItemLongClickListener(this);
    setListAdapter(mAdapter);
    getLoaderManager().initLoader(0, getArguments(), this);
    setListShown(false);
}

From source file:com.kunze.androidlocaltodo.TaskActivityFragment.java

private void Log(String message) {
    Bundle args = getArguments();
    long id = args.getLong(TaskActivity.TASK_ID, 0);
    Log.v("TaskActivityFragment", message + " (" + Long.toString(id) + ")");
}

From source file:de.aw.monma.mainscreen.ActivityMainScreen.java

@Override
public boolean onMenuItemClick(MenuItem item) {
    Bundle extras = item.getIntent().getExtras();
    long id = extras.getLong(ID, NOID);
    switch (item.getItemId()) {
    case R.id.context_menu_item_deleteReport:
        DBDefinition reportTbd = DBDefinition.ReportBasisdaten;
        String selection = _id + " = " + id;
        DBHelper db = DBHelper.getInstance();
        db.delete(reportTbd, selection, null);
        return true;
    case R.id.context_menu_item_editReport:
        DialogReportDaten d = DialogReportDaten.newInstance(id);
        d.show(getSupportFragmentManager(), d.getTAG());
        return true;
    }/*from  w  ww .ja  v  a 2s  .co m*/
    return false;
}

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

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mApplication = getApplication();// w ww  .  jav  a2  s  . com
    mPreferences = getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    mAdapter = new UsersAdapter(getActivity());
    mListView = getListView();
    final Bundle args = getArguments() != null ? getArguments() : new Bundle();
    final long account_id = args.getLong(INTENT_KEY_ACCOUNT_ID, -1);
    if (mAccountId != account_id) {
        mAdapter.clear();
        mData.clear();
    }
    mAccountId = account_id;
    mListView.setOnItemClickListener(this);
    mListView.setOnItemLongClickListener(this);
    mListView.setOnScrollListener(this);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        mListView.setCacheColorHint(0);
    }
    setMode(Mode.BOTH);
    setListAdapter(mAdapter);
    getLoaderManager().initLoader(0, getArguments(), this);
    setListShown(false);
}