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.nononsenseapps.feeder.model.RssSyncAdapter.java

/**
 * Perform a sync for this account. SyncAdapter-specific parameters may
 * be specified in extras, which is guaranteed to not be null. Invocations
 * of this method are guaranteed to be serialized.
 *
 * @param account//from  ww w.j  a va2 s. c  o  m
 *         the account that should be synced
 * @param extras
 *         SyncAdapter-specific parameters
 * @param authority
 *         the authority of this sync request
 * @param provider
 *         a ContentProviderClient that points to the
 *         ContentProvider for this
 *         authority
 * @param syncResult
 *         SyncAdapter-specific parameters
 */
@Override
public void onPerformSync(final Account account, final Bundle extras, final String authority,
        final ContentProviderClient provider, final SyncResult syncResult) {
    // By default, if a sync is performed, we can wait at least an hour
    // to the next one. Unit is seconds
    syncResult.delayUntil = 60L * 60L;

    final Intent bcast = new Intent(SYNC_BROADCAST).putExtra(SYNC_BROADCAST_IS_ACTIVE, true);

    // Broadcast start of sync
    LocalBroadcastManager.getInstance(getContext()).sendBroadcast(bcast);

    RssLocalSync.syncFeeds(getContext(), extras.getLong(FeedSQL.COL_ID, -1),
            extras.getString(FeedSQL.COL_TAG, ""));

    // Broadcast end of sync
    LocalBroadcastManager.getInstance(getContext())
            .sendBroadcast(bcast.putExtra(SYNC_BROADCAST_IS_ACTIVE, false));
}

From source file:at.ac.tuwien.detlef.fragments.EpisodeListFragment.java

@Override
public void onActivityCreated(Bundle savedState) {
    super.onActivityCreated(savedState);
    registerForContextMenu(getListView());

    /* Restore selected podcast. */

    if (savedState != null) {
        long id = savedState.getLong(BUNDLE_SELECTED_PODCAST, ID_NONE);
        if (id != ID_NONE) {
            PodcastDAO dao = Singletons.i().getPodcastDAO();
            filteredByPodcast = dao.getPodcastById(id);
            filterByPodcast();//from   w w w. ja va  2s . co m
        }
    }
    /* restore sort order */
    restoreSortOrder();
}

From source file:com.popdeem.sdk.uikit.fragment.PDUIInboxMessageFragment.java

@Nullable
@Override/*from w w  w.j  a  va 2  s.  com*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_pd_inbox_message, container, false);

    Bundle args = getArguments();

    TextView textView = (TextView) view.findViewById(R.id.pd_inbox_message_title_text_view);
    textView.setText(args.getString("title", ""));

    textView = (TextView) view.findViewById(R.id.pd_inbox_message_body_text_view);
    textView.setText(args.getString("body", ""));

    textView = (TextView) view.findViewById(R.id.pd_inbox_message_sender_text_view);
    textView.setText(args.getString("sender", ""));

    textView = (TextView) view.findViewById(R.id.pd_inbox_message_date_text_view);
    long date = args.getLong("date", -1);
    if (date == -1) {
        textView.setText("");
    } else {
        textView.setText(PDUIUtils.convertUnixTimeToDate(date, PDUIUtils.PD_DATE_FORMAT));
    }

    PDUIBezelImageView imageView = (PDUIBezelImageView) view.findViewById(R.id.pd_inbox_message_image_view);
    String imageUrl = args.getString("image", "");
    if (imageUrl.isEmpty() || imageUrl.contains("default")) {
        Glide.with(getActivity()).load(R.drawable.pd_ui_star_icon).dontAnimate().into(imageView);
    } else {
        Glide.with(getActivity()).load(imageUrl).placeholder(R.drawable.pd_ui_star_icon).dontAnimate()
                .error(R.drawable.pd_ui_star_icon).into(imageView);
    }

    return view;
}

From source file:com.xengar.android.englishverbs.ui.DetailsActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_details);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/*from   w  ww .j  a  v  a  2  s. c o m*/
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    Bundle bundle = getIntent().getExtras();
    demo = bundle.getBoolean(DEMO_MODE, false);
    verbID = bundle.getLong(VERB_ID, -1);
    String title = bundle.getString(VERB_NAME);
    getSupportActionBar().setTitle(title);

    // Invalidate the options menu, so the "Edit" menu option can be hidden.
    invalidateOptionsMenu();

    //Text
    infinitive = (TextView) findViewById(R.id.infinitive);
    simplePast = (TextView) findViewById(R.id.simple_past);
    pastParticiple = (TextView) findViewById(R.id.past_participle);
    pInfinitive = (TextView) findViewById(R.id.phonetic_infinitive);
    pSimplePast = (TextView) findViewById(R.id.phonetic_simple_past);
    pPastParticiple = (TextView) findViewById(R.id.phonetic_past_participle);
    definition = (TextView) findViewById(R.id.definition);
    translation = (TextView) findViewById(R.id.translation);
    sample1 = (TextView) findViewById(R.id.sample1);
    sample2 = (TextView) findViewById(R.id.sample2);
    sample3 = (TextView) findViewById(R.id.sample3);

    // define click listeners
    LinearLayout header = (LinearLayout) findViewById(R.id.play_infinitive);
    header.setOnClickListener(this);
    header = (LinearLayout) findViewById(R.id.play_simple_past);
    header.setOnClickListener(this);
    header = (LinearLayout) findViewById(R.id.play_past_participle);
    header.setOnClickListener(this);

    // initialize Speaker
    tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
        @Override
        public void onInit(int status) {
            if (status == TextToSpeech.SUCCESS) {
                int result = tts.setLanguage(Locale.US);
                if (result == TextToSpeech.LANG_MISSING_DATA || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                    if (LOG) {
                        Log.e("TTS", "This Language is not supported");
                    }
                }
            } else {
                if (LOG) {
                    Log.e("TTS", "Initilization Failed!");
                }
            }
        }
    });

    // Initialize a loader to read the verb data from the database and display it
    getLoaderManager().initLoader(EXISTING_VERB_LOADER, null, this);
    showFavoriteButtons();

    // Obtain the FirebaseAnalytics instance.
    mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
    ActivityUtils.firebaseAnalyticsLogEventSelectContent(mFirebaseAnalytics, PAGE_VERB_DETAILS,
            PAGE_VERB_DETAILS, TYPE_PAGE);

    // create AdMob banner
    listener = new LogAdListener(mFirebaseAnalytics, DETAILS_ACTIVITY);
    mAdView = ActivityUtils.createAdMobBanner(this, listener);

    if (demo) {
        defineDemoMode();
    }
}

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

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

    mCp = new CachePolicy();
    mCp.resizeHeight = 96;//from ww  w .j  a  va2s .  c om

    if (mAccount == null) {
        Bundle args = getArguments();

        mAccount = (PsnAccount) args.getParcelable("account");
        mTitleId = args.getLong("titleId", -1);
    }

    if (state != null) {
        mAccount = (PsnAccount) state.getParcelable("account");
        mTitleId = state.getLong("titleId");
    }

    setHasOptionsMenu(true);
}

From source file:edu.mit.media.funf.funfohmage.MainPipeline.java

@Override
public void onDataReceived(Bundle data) {
    String dataJson = getBundleSerializer().serialize(data);
    String probeName = data.getString(Probe.PROBE);
    long timestamp = data.getLong(Probe.TIMESTAMP, 0L);
    Bundle b = new Bundle();
    b.putString(NameValueDatabaseService.DATABASE_NAME_KEY, getPipelineName());
    b.putLong(NameValueDatabaseService.TIMESTAMP_KEY, timestamp);
    b.putString(NameValueDatabaseService.NAME_KEY, probeName);
    b.putString(NameValueDatabaseService.VALUE_KEY, dataJson);

    //Funf Ohmage
    //Log.w("dony","ts:"+timestamp);
    Log.w("dony", "name:" + probeName);
    //Log.w("dony","data:"+dataJson);

    if (probeName.endsWith("LocationProbe"))
        locationProbe_data = dataJson;//from w  ww . ja v  a  2s  .  c  om
    else if (probeName.endsWith("WifiProbe"))
        wifiProbe_data = dataJson;
    else if (probeName.endsWith("AccelerometerSensorProbe"))
        accelerometerSensorProbe_data = dataJson;
    else
        Log.w("dony", "Received:" + probeName);

    if (locationProbe_data != null && wifiProbe_data != null && accelerometerSensorProbe_data != null) {
        Log.w("dony", "ts: All data received");
        uploadRequest(accelerometerSensorProbe_data, locationProbe_data, wifiProbe_data);
        Log.v("dony", "location:" + locationProbe_data);
        Log.v("dony", "wifi:" + wifiProbe_data);
        Log.v("dony", "acc:" + accelerometerSensorProbe_data);
        locationProbe_data = null;
        wifiProbe_data = null;
        accelerometerSensorProbe_data = null;
    }

    //Intent i = new Intent(this, getDatabaseServiceClass());
    //i.setAction(DatabaseService.ACTION_RECORD);
    //i.putExtras(b);
    //startService(i);
}

From source file:com.akop.bach.fragment.xboxlive.AchievementsFragment.java

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

    if (mAccount == null) {
        Bundle args = getArguments();

        mAccount = (XboxLiveAccount) args.getParcelable("account");
        mTitleId = args.getLong("titleId", -1);
    }/* w  w  w. jav a2  s.co  m*/

    if (state != null) {
        mAccount = (XboxLiveAccount) state.getParcelable("account");
        mTitleId = state.getLong("titleId");
    }

    setHasOptionsMenu(true);
}

From source file:de.spiritcroc.ownlog.ui.fragment.LogItemEditFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);/*w  w w  .  j  a v  a 2 s. c o m*/

    if (savedInstanceState != null) {
        mEditItemId = savedInstanceState.getLong(Constants.EXTRA_LOG_ITEM_ID, -1);
        mAddItem = savedInstanceState.getBoolean(KEY_ADD_ITEM, mEditItemId == -1);
        mTemporaryExistence = savedInstanceState.getBoolean(KEY_TEMPORARY_EXISTENCE, false);
    } else if (getArguments() == null) {
        mAddItem = true;
    } else {
        mEditItemId = getArguments().getLong(Constants.EXTRA_LOG_ITEM_ID, -1);
        mAddItem = mEditItemId == -1;
    }

    // We will be using the the keyboard more in this screen. Don't do any awkward content
    // moving around; just resize the content to fit into the visible window.
    getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}

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

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    // initial//from  w w w. j a  v a  2s  .c  o m
    this.selectedId = Constants.EMPTY_INT;
    this.isSelectDefault = false;
    this.selectedPos = 0;
    if (getArguments() != null)
        this.isFav = getArguments().getBoolean(Constants.PARAM_IS_FAV);

    if (savedInstanceState != null) {
        this.selectedPos = savedInstanceState.getInt(Constants.PARAM_CAT_POS_TAG, this.selectedPos);
        this.selectedId = savedInstanceState.getLong(Constants.PARAM_CAT_ID_TAG, this.selectedId);
        this.isFav = savedInstanceState.getBoolean(Constants.PARAM_IS_FAV, this.isFav);
    }

    int landThreshold = (int) getResources().getDimension(R.dimen.is_land);
    if (landThreshold > 0)
        isDual = true;
    customList();
    // Process
    populateList();
    handleMasterStatus(savedInstanceState);

}

From source file:com.example.nitish.welcomapp.activitypt.ElementListFragment.java

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

    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
    prefs.registerOnSharedPreferenceChangeListener(this);

    if (savedInstanceState != null) {
        mSort = savedInstanceState.getInt(KEY_SORT, mSort);
        mSortReverse = savedInstanceState.getBoolean(KEY_SORT_REVERSE, mSortReverse);
        mFilter = savedInstanceState.getString(KEY_FILTER);
        mActivatedItem = savedInstanceState.getLong(KEY_ACTIVATED_ITEM, mActivatedItem);
    }/*from w ww  .  j a  v a 2s  .  com*/

    mAdapter = new ElementListAdapter(getContext());
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            super.onChanged();
            setActivatedPosition(mAdapter.getItemPosition(mActivatedItem));
        }
    });
    mAdapter.getFilter().filter(mFilter);
    mAdapter.setSort(mSort, mSortReverse);
    setListAdapter(mAdapter);

    setupFilter();
    setupSort();
}