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) 

Source Link

Document

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

Usage

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

/**
 * Initializes several of the member variables used
 * by PostFragment.//from   w w w.j  a  v a2  s . c  o m
 * @param savedInstanceState The previously saved state of the fragment.
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    locationListenerService = new LocationListenerService(getActivity());
    locationListenerService.startListening();
    Bundle args = getArguments();
    if (args.getLong("id") != -1) {
        commentToReplyTo = (Comment) args.getParcelable("cmt");
        boolean fromFavs = args.getBoolean("fromFavs");
        if (fromFavs) {
            FavouritesLog log = FavouritesLog.getInstance(getActivity());
            thread = log.getThreads().get((int) args.getLong("id"));
        } else {
            thread = ThreadList.getThreads().get((int) args.getLong("id"));
        }
    }
}

From source file:de.dreier.mytargets.features.bows.EditBowFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = super.onCreateView(inflater, container, savedInstanceState);

    contentBinding = FragmentEditBowBinding.inflate(inflater, binding.content, true);
    contentBinding.addButton.setOnClickListener(v -> onAddSightSetting());
    contentBinding.moreFields.setOnClickListener(v -> contentBinding.setShowAll(true));

    EBowType bowType = EBowType.valueOf(getArguments().getString(BOW_TYPE, EBowType.RECURVE_BOW.name()));

    if (savedInstanceState == null) {
        Bundle bundle = getArguments();
        if (bundle != null && bundle.containsKey(BOW_ID)) {
            // Load data from database
            bow = Bow.get(bundle.getLong(BOW_ID));
        } else {//from w  w  w .  j  a  v a  2 s. co  m
            // Set to default values
            bow = new Bow();
            bow.name = getString(R.string.my_bow);
            bow.type = bowType;
            bow.getSightMarks().add(new SightMark());
        }
        setImageFiles(bow.getImages());
    }
    ToolbarUtils.setTitle(this, bow.name);
    contentBinding.setBow(bow);

    loadImage(imageFile);
    adapter = new SightMarksAdapter(this, bow.getSightMarks());
    contentBinding.sightMarks.setAdapter(adapter);
    contentBinding.sightMarks.setNestedScrollingEnabled(false);
    return rootView;
}

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

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

From source file:com.ultramegasoft.flavordex2.fragment.ViewEntryFragment.java

@Nullable
@Override//from w w w  .j a  v  a2 s . c om
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    final Context context = getContext();
    if (context == null) {
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    mTabHost = (FragmentTabHost) inflater.inflate(R.layout.tab_layout, container, false);
    mTabHost.setup(getContext(), getChildFragmentManager(), R.id.content);

    final Bundle tabArgs = new Bundle();
    tabArgs.putLong(ARG_ENTRY_ID, mEntryId);

    final Bundle args = getArguments();
    tabArgs.putLong(ARG_ENTRY_CAT_ID, args != null ? args.getLong(ARG_ENTRY_CAT_ID) : 0);

    Drawable icon;
    TabHost.TabSpec tab;

    icon = ActivityCompat.getDrawable(context, R.drawable.ic_description);
    tab = mTabHost.newTabSpec("info_" + mEntryId).setIndicator(null, icon);
    mTabHost.addTab(tab, getEntryInfoClass(), tabArgs);

    icon = ActivityCompat.getDrawable(context, R.drawable.ic_radar);
    tab = mTabHost.newTabSpec("flavors_" + mEntryId).setIndicator(null, icon);
    mTabHost.addTab(tab, ViewFlavorsFragment.class, tabArgs);

    icon = ActivityCompat.getDrawable(context, R.drawable.ic_photo);
    tab = mTabHost.newTabSpec("photos_" + mEntryId).setIndicator(null, icon);
    mTabHost.addTab(tab, ViewPhotosFragment.class, tabArgs);

    return mTabHost;
}

From source file:com.firebase.ui.auth.ui.phone.SubmitConfirmationCodeFragment.java

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

    if (savedInstanceState != null) {
        Long t = savedInstanceState.getLong(EXTRA_MILLIS_UNTIL_FINISHED);
        if (t != null) {
            mCountdownTimer.update(t);//w  w  w . j  av a  2  s. c  om
        }
    }

    if (!(getActivity() instanceof PhoneVerificationActivity)) {
        throw new IllegalStateException("Activity must implement PhoneVerificationHandler");
    }
    mVerifier = (PhoneVerificationActivity) getActivity();
}

From source file:com.bydavy.card.receipts.fragments.ReceiptEditFragment.java

public long getReceiptId() {
    final Bundle args = getArguments();
    if (args != null) {
        return args.getLong(ARG_RECEIPT_ID);
    }//w w w.  j  ava  2 s.  c  o m
    return 0;
}

From source file:de.aw.monma.actions.FragmentWPList.java

@Override
public boolean onMenuItemClick(MenuItem item) {
    boolean consumed = false;
    AWFragment f = null;/*from  www .  j a  v a 2 s . c o  m*/
    Bundle extras = item.getIntent().getExtras();
    Long wpid = extras.getLong(WPID);
    String wpname = extras.getString(WPNAME);
    int mAccountID = extras.getInt(ACCOUNTID);
    switch (item.getItemId()) {
    case R.id.context_menu_item_wpKursAktualisieren:
        WPKurs kurs = new WPKurs();
        kurs.put(column_wpid, wpid);
        kurs.setWPName(wpname);
        DialogKursaktualisierung dialog = DialogKursaktualisierung.newInstance(kurs);
        dialog.show(getFragmentManager(), dialog.TAG);
        consumed = true;
        break;
    case R.id.context_menu_item_wpPaketeansehen:
        f = FragmentWPPaketListe.newInstance(mAccountID, wpid, new Bundle());
        wpname = extras.getString(WPNAME);
        setTitle(getString(R.string.Pakete) + " " + wpname);
        f.setArguments(extras);
        consumed = true;
        break;
    case R.id.context_menu_item_wpKurseBearbeiten:
        f = new FragmentWertpapierKurseListe();
        f.setArguments(extras);
        setTitle(R.string.tvKursFuerWertpapier);
        consumed = true;
        break;
    case R.id.context_menu_item_wpUmsaetze:
        f = FragmentWertpapierBuchungenListe.newInstance(mAccountID, wpid, wpname);
        consumed = true;
        break;
    case R.id.context_menu_item_wpErtraegeDetails:
        Intent intent = item.getIntent();
        intent.setClass(getActivity(), ActivityActions.class);
        intent.putExtra(ACTION, (Parcelable) Action.ShowWPDetails);
        startActivity(intent);
        consumed = true;
        break;
    default:
    }
    if (f != null) {
        replaceFragment(f);
    }
    return consumed;
}

From source file:com.todoroo.astrid.timers.TimerControlSet.java

@Nullable
@Override/*w  w  w.  j  a  v a  2  s  .  c o m*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);
    if (savedInstanceState != null) {
        timerStarted = savedInstanceState.getLong(EXTRA_STARTED);
        elapsedSeconds = savedInstanceState.getInt(EXTRA_ELAPSED);
        estimatedSeconds = savedInstanceState.getInt(EXTRA_ESTIMATED);
    }

    dialogView = inflater.inflate(R.layout.control_set_timers_dialog, null);
    estimated = new TimeDurationControlSet(context, dialogView, R.id.estimatedDuration, theme);
    elapsed = new TimeDurationControlSet(context, dialogView, R.id.elapsedDuration, theme);
    estimated.setTimeDuration(estimatedSeconds);
    elapsed.setTimeDuration(elapsedSeconds);
    refresh();
    return view;
}

From source file:com.lambdasoup.quickfit.ui.SchedulesFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    Timber.d("onCreateLoader with args %s on schedules fragment %d", args, this.hashCode());
    switch (id) {
    case LOADER_SCHEDULES:
        return new SchedulesLoader(getContext(), args.getLong(ARG_WORKOUT_ID));
    }//  www .  j a va2s.c  o m
    throw new IllegalArgumentException("Not a loader id: " + id);
}

From source file:com.xargsgrep.portknocker.activity.EditHostActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.host_edit);//from ww  w .j a  v a2  s .  c  om

    databaseManager = new DatabaseManager(this);

    Bundle extras = getIntent().getExtras();
    hostId = (BundleUtils.contains(extras, KEY_HOST_ID)) ? extras.getLong(KEY_HOST_ID) : null;
    Host host = (hostId == null) ? null : databaseManager.getHost(hostId);

    if (host != null)
        getSupportActionBar().setSubtitle(host.getLabel());
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    addTab(getString(R.string.host_tab_name));
    addTab(getString(R.string.ports_tab_name));
    addTab(getString(R.string.misc_tab_name));

    if (savedInstanceState != null) {
        getSupportActionBar().setSelectedNavigationItem(savedInstanceState.getInt(KEY_SELECTED_TAB_INDEX));
        if (savedInstanceState.getBoolean(KEY_SHOW_CANCEL_DIALOG))
            showCancelDialog();
    }
}