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:com.ichi2.anki.DeckPicker.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    mContextMenuDid = savedInstanceState.getLong("mContextMenuDid");
}

From source file:cm.aptoide.pt.ApkInfo.java

@SuppressLint("NewApi")
private void loadElements(long id) {
    viewComments = (ViewGroup) findViewById(R.id.commentContainer);
    viewComments.removeAllViews();/*www. j av  a2 s  .  c o  m*/
    viewLikes = (ViewGroup) findViewById(R.id.likesLayout);
    loading = LayoutInflater.from(context).inflate(R.layout.loadingfootercomments, null);
    viewComments.addView(loading, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    installString = getString(R.string.install);
    viewLikesButton = (ViewGroup) findViewById(R.id.ratings);
    ((TextView) viewLikes.findViewById(R.id.likes)).setText(context.getString(R.string.loading_likes));
    ((TextView) viewLikes.findViewById(R.id.dislikes)).setText("");

    findViewById(R.id.downloading_icon).setVisibility(View.GONE);
    findViewById(R.id.downloading_name).setVisibility(View.GONE);
    findViewById(R.id.download_progress).setVisibility(View.GONE);
    ProgressBar progress = (ProgressBar) findViewById(R.id.downloading_progress);
    progress.setIndeterminate(true);
    Bundle b = new Bundle();
    b.putLong("_id", id);

    //      findViewById(R.id.inst_version).setVisibility(View.VISIBLE);
    getSupportLoaderManager().restartLoader(20, b, new LoaderCallbacks<ViewApk>() {

        @Override
        public Loader<ViewApk> onCreateLoader(int arg0, final Bundle arg1) {
            pd.show();
            pd.setMessage(getString(R.string.please_wait));
            pd.setCancelable(false);
            return new ViewApkLoader(ApkInfo.this) {

                @Override
                public ViewApk loadInBackground() {
                    return db.getApk(arg1.getLong("_id"), category);
                }
            };

        }

        @Override
        public void onLoadFinished(Loader<ViewApk> arg0, ViewApk arg1) {
            //                AdView adView = (AdView)findViewById(R.id.adView);
            //                adView.loadAd(new AdRequest());

            mAdView = (MoPubView) findViewById(R.id.adview);
            mAdView.setAdUnitId(ApplicationAptoide.ADUNITID); // Enter your Ad Unit ID from www.mopub.com
            mAdView.loadAd();
            pd.dismiss();
            viewApk = arg1;
            new Thread(new Runnable() {
                @Override
                public void run() {
                    loadDescription();
                }
            }).start();

            mainObbUrl = viewApk.getMainObbUrl();
            mainObbMd5 = viewApk.getMainObbMd5();
            mainObbName = viewApk.getMainObbFileName();
            mainObbSize = viewApk.getMainObbFileSize();

            patchObbUrl = viewApk.getPatchObbUrl();
            patchObbMd5 = viewApk.getPatchObbMd5();
            patchObbName = viewApk.getPatchObbFileName();
            patchObbSize = viewApk.getPatchObbFileSize();

            if (viewApk.getLikes() != -1) {
                setLikes(viewApk.getLikes() + "", viewApk.getDislikes() + "");
            }

            if (viewApk.getComments().size() > 0) {
                setComments(viewApk.getComments());
                loading.setVisibility(View.GONE);
            }

            loadScreenshots();

            //viewApk.getWebservicePath

            int installedVercode = db.getInstalledAppVercode(viewApk.getApkid());

            if (installedVercode <= viewApk.getVercode() && installedVercode != 0) {
                findViewById(R.id.inst_version).setVisibility(View.VISIBLE);
                ((TextView) findViewById(R.id.inst_version)).setText(getString(R.string.installed_version)
                        + ": " + db.getInstalledAppVername(viewApk.getApkid()));
                if (installedVercode < viewApk.getVercode() && !getIntent().hasExtra("installed")) {
                    installString = getString(R.string.update);
                } else if (getIntent().hasExtra("installed")) {
                    installString = getString(R.string.open);
                }
                ((Button) findViewById(R.id.btinstall)).setText(installString);

            } else if (installedVercode > viewApk.getVercode()) {
                if (getIntent().hasExtra("installed")) {
                    installString = getString(R.string.open);
                } else {
                    installString = getString(R.string.install);

                }
                ((Button) findViewById(R.id.btinstall)).setText(installString);

                findViewById(R.id.inst_version).setVisibility(View.GONE);
            }

            if (installedVercode == viewApk.getVercode()) {
                if (getIntent().hasExtra("installed")) {
                    installString = getString(R.string.open);
                } else {
                    installString = getString(R.string.install);
                }
                ((Button) findViewById(R.id.btinstall)).setText(installString);
                findViewById(R.id.inst_version).setVisibility(View.GONE);
            }

            repo_string = viewApk.getRepoName();
            checkDownloadStatus();
            webservicespath = viewApk.getWebservicesPath();

            try {
                ((RatingBar) findViewById(R.id.ratingbar)).setRating(Float.parseFloat(viewApk.getRating()));
                ((RatingBar) findViewById(R.id.ratingbar)).setIsIndicator(true);
            } catch (Exception e) {
                ((RatingBar) findViewById(R.id.ratingbar)).setRating(0);
                ((RatingBar) findViewById(R.id.ratingbar)).setIsIndicator(true);
            }
            ((TextView) findViewById(R.id.app_store)).setText(getString(R.string.store) + ": " + repo_string);
            ((TextView) findViewById(R.id.versionInfo)).setText(getString(R.string.clear_dwn_title) + ": "
                    + viewApk.getDownloads() + " " + getString(R.string.size) + ": "
                    + withSuffix((Long.parseLong(viewApk.getSize()) * 1024 + mainObbSize + patchObbSize)));
            ((TextView) findViewById(R.id.version_label))
                    .setText(getString(R.string.version) + " " + viewApk.getVername());
            ((TextView) findViewById(R.id.app_name)).setText(viewApk.getName());
            //            ImageLoader imageLoader = ImageLoader.getInstance(context);
            //            imageLoader.DisplayImage(viewApk.getIcon(),(ImageView) findViewById(R.id.app_icon), context, (viewApk.getApkid()+"|"+viewApk.getVercode()));
            DisplayImageOptions options = new DisplayImageOptions.Builder()
                    .displayer(new FadeInBitmapDisplayer(1000))
                    .showStubImage(android.R.drawable.sym_def_app_icon).resetViewBeforeLoading().cacheInMemory()
                    .cacheOnDisc().build();
            ImageLoader.getInstance().displayImage(viewApk.getIcon(), (ImageView) findViewById(R.id.app_icon),
                    options, null, (viewApk.getApkid() + "|" + viewApk.getVercode()));

            new GetApkInfo().execute();

            /*Comments comments = new Comments(context,webservicespath);
            comments.getComments(repo_string, viewApk.getApkid(),viewApk.getVername(),(LinearLayout) findViewById(R.id.commentContainer), false);*/
            likes = new Likes(context, webservicespath);
            /*likes.getLikes(repo_string, viewApk.getApkid(), viewApk.getVername(),(ViewGroup) findViewById(R.id.likesLayout),(ViewGroup) findViewById(R.id.ratings));*/

            ItemBasedApks items = new ItemBasedApks(context, viewApk);
            items.getItems((LinearLayout) findViewById(R.id.itembasedapks_container),
                    (LinearLayout) findViewById(R.id.itembasedapks_maincontainer),
                    (TextView) findViewById(R.id.itembasedapks_label));

            if (!spinnerInstanciated) {
                loadApkVersions();
            }
            setClickListeners();

            //Malware badges
            loadMalwareBadges();
            if (Build.VERSION.SDK_INT >= 11) {
                invalidateOptionsMenu();
            }

            //                if(!getIntent().hasExtra("installed")){
            //                    new checkPaymentTask().execute();
            //                }

        }

        private void loadMalwareBadges() {
            new Thread(new Runnable() {

                @Override
                public void run() {
                    try {
                        loadMalware(viewApk.getMalwareStatus());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }).start();

        }

        @Override
        public void onLoaderReset(Loader<ViewApk> arg0) {

        }
    });

    //

    //

    //      Button serch_mrkt = (Button)findViewById(R.id.btmarket);
    //      serch_mrkt.setOnClickListener(new OnClickListener() {
    //
    //         public void onClick(View v) {

    //         }
    //
    //      });

    //

    //
    //

}

From source file:com.vegnab.vegnab.MainVNActivity.java

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
    if (LDebug.ON)
        Log.d(LOG_TAG, "In 'onRestoreInstanceState'");
    mSubplotTypeId = savedInstanceState.getLong(ARG_SUBPLOT_TYPE_ID);
    mVisitId = savedInstanceState.getLong(ARG_VISIT_ID);
    mConnectionRequested = savedInstanceState.getBoolean(ARG_CONNECTION_REQUESTED);
    mExistingPhCodes = (HashMap<String, Long>) savedInstanceState.getSerializable(ARG_PH_EXISTING_SET);
    mNewPurcRecId = savedInstanceState.getLong(ARG_PURCH_REC_ID);

}

From source file:com.hippo.ehviewer.ui.scene.GalleryDetailScene.java

private void handleArgs(Bundle args) {
    if (args == null) {
        return;/*from   www  . j ava  2s .c  o m*/
    }

    String action = args.getString(KEY_ACTION);
    mAction = action;
    if (ACTION_GALLERY_INFO.equals(action)) {
        mGalleryInfo = args.getParcelable(KEY_GALLERY_INFO);
        // Add history
        if (null != mGalleryInfo) {
            EhDB.putHistoryInfo(mGalleryInfo);
        }
    } else if (ACTION_GID_TOKEN.equals(action)) {
        mGid = args.getLong(KEY_GID);
        mToken = args.getString(KEY_TOKEN);
    }
}

From source file:study.tdcc.act.MainCalendar.java

/**
 * ????//from   w ww  . j a  va2s  .  co  m
 */
private void getScreenTransitionData() {
    Log.d("DEBUG", "MainCalendar getScreenTransitionData Start");
    //?????
    Bundle bExtras = getIntent().getExtras();
    if (bExtras != null) {
        stdObj.setStrCalendarYearMonth(bExtras.getString("calym"));
        stdObj.setStrCalendarYearMonthDay(bExtras.getString("calymd"));
        stdObj.setStrUserInterfaceId(bExtras.getString("uiid"));
        stdObj.setLgKeyId(bExtras.getLong("keyid"));
    }
    Log.d("DEBUG", "MainCalendar getScreenTransitionData End");
}

From source file:com.ginstr.android.service.opencellid.upload.data.MeasurementsUploaderService.java

/**
 * checks intent configuration parameters
 * @param extras/*from w  ww .  j  a v  a2s  .c om*/
 */
private void getExtraParameters(Bundle extras) {
    if (extras != null) {
        writeToLog("configurationReceiver.onReceive() extras : " + extras.keySet());

        if (extras != null) {
            appId = extras.getString(UploadConstants.PREF_APPID_KEY);

            if (extras.containsKey(UploadConstants.PREF_API_KEY))
                apiKey = extras.getString(UploadConstants.PREF_API_KEY);

            if (extras.containsKey(UploadConstants.PREF_OPENCELL_UPLOAD_URL_KEY))
                openCellUrl = extras.getString(UploadConstants.PREF_OPENCELL_UPLOAD_URL_KEY);

            if (extras.containsKey(UploadConstants.PREF_OPENCELL_NETWORK_UPLOAD_URL_KEY))
                networksUrl = extras.getString(UploadConstants.PREF_OPENCELL_NETWORK_UPLOAD_URL_KEY);

            testEnvironment = extras.getBoolean(UploadConstants.PREF_TEST_ENVIRONMENT_KEY,
                    UploadConstants.PREF_TEST_ENVIRONMENT);

            if (openCellUrl == null) {
                if (testEnvironment) {
                    openCellUrl = UploadConstants.OPEN_CELL_TEST_UPLOAD_URL;
                } else {
                    openCellUrl = UploadConstants.OPEN_CELL_DEFAULT_UPLOAD_URL;
                }
            }

            if (networksUrl == null) {
                if (testEnvironment) {
                    networksUrl = UploadConstants.OPENCELL_NETWORKS_TEST_UPLOAD_URL;
                } else {
                    networksUrl = UploadConstants.OPENCELL_NETWORKS_UPLOAD_URL;
                }
            }

            if (extras.containsKey(UploadConstants.PREF_NEW_DATA_CHECK_INTERVAL_KEY))
                newDataCheckInterval = extras.getLong(UploadConstants.PREF_NEW_DATA_CHECK_INTERVAL_KEY);

            if (newDataCheckInterval < UploadConstants.NEW_DATA_CHECK_INTERVAL_LONG_DEFAULT)
                newDataCheckInterval = UploadConstants.NEW_DATA_CHECK_INTERVAL_LONG_DEFAULT;

            if (extras.containsKey(UploadConstants.PREF_ONLY_WIFI_UPLOAD_KEY))
                wifiOnly = extras.getBoolean(UploadConstants.PREF_ONLY_WIFI_UPLOAD_KEY);

            // check if the maxLogFileSize parameter is provided through intent         
            if (extras.containsKey(UploadConstants.PREFKEY_MAX_LOG_SIZE_INT)) {
                maxLogFileSize = extras.getInt(UploadConstants.PREFKEY_MAX_LOG_SIZE_INT);

                mLibContext.getLogService().setMaxLogFileSize(maxLogFileSize);
            }

            // check if the logToFileEnabled parameter is provided through intent         
            if (extras.containsKey(UploadConstants.PREFKEY_LOG_TO_FILE)) {
                logToFileEnabled = extras.getBoolean(UploadConstants.PREFKEY_LOG_TO_FILE);

                mLibContext.getLogService().setFileLoggingEnabled(logToFileEnabled);
            }
        }

        writeToLog("onConfigurationReceiver ()");
        writeToLog("apiKey = " + apiKey);
        writeToLog("openCellUrl = " + openCellUrl);
        writeToLog("networks url = " + networksUrl);
        writeToLog("newDataCheckInterval = " + newDataCheckInterval);
        writeToLog("wifiOnly = " + wifiOnly);
        writeToLog("testEnvironment = " + testEnvironment);
    }
}

From source file:com.example.android.contactslist.ui.eventEntry.EventEntryFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    // If not being created from a previous state
    if (savedInstanceState == null) {
        // Sets the argument extra as the currently displayed contact
        setContact(getArguments() != null ? (Uri) getArguments().getParcelable(EXTRA_CONTACT_URI) : null);
    } else {/*from  w w w  . j a va  2s . com*/
        // If being recreated from a saved state, sets the contact from the incoming
        // savedInstanceState Bundle
        setContact((Uri) savedInstanceState.getParcelable(EXTRA_CONTACT_URI));

        //retrieve the saved contact address
        mAddressViewButton.setText(savedInstanceState.getString(BUNDLE_CONTACT_ADDRESS));

        //retrieve the saved event notes
        mEventNotes.setText(savedInstanceState.getString(BUNDLE_EVENT_NOTES));

        //retrieve the saved date
        mEventDate = savedInstanceState.getLong(BUNDLE_EVENT_DATE_TIME);
        // set the display to the event date and time
        setDateAndTimeViews(mEventDate);
    }

}

From source file:com.gelakinetic.mtgfam.fragments.CardViewFragment.java

/**
 * This will fill the UI elements with database information about the card specified in the given bundle
 *
 * @param extras The bundle passed to this fragment
 *///  ww w  .ja  v  a  2 s  .c  om
private void setInfoFromBundle(Bundle extras) {
    if (extras == null && mNameTextView != null) {
        mNameTextView.setText("");
        mCostTextView.setText("");
        mTypeTextView.setText("");
        mSetTextView.setText("");
        mAbilityTextView.setText("");
        mFlavorTextView.setText("");
        mArtistTextView.setText("");
        mNumberTextView.setText("");
        mPowTouTextView.setText("");
        mTransformButton.setVisibility(View.GONE);
        mTransformButtonDivider.setVisibility(View.GONE);
    } else if (extras != null) {
        long cardID = extras.getLong(CARD_ID);

        /* from onCreateView */
        setInfoFromID(cardID);
    }
}

From source file:com.vegnab.vegnab.MainVNActivity.java

public void onPlaceholderActionButtonClicked(Bundle args) {
    Bundle argsOut = new Bundle();
    if (LDebug.ON)
        Log.d(LOG_TAG, "In onPlaceholderActionButtonClicked");
    switch (args.getInt(EditPlaceholderFragment.BUTTON_KEY)) {
    case VNContract.PhActions.GO_TO_PICTURES: // go to the show/take/edit photos screen
        argsOut.putLong(PhPixGridFragment.ARG_PLACEHOLDER_ID,
                args.getLong(EditPlaceholderFragment.ARG_PLACEHOLDER_ID));
        PhPixGridFragment phGridFrag = PhPixGridFragment.newInstance(argsOut);
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        // put the present fragment on the backstack so the user can navigate back to it
        // the tag is for the fragment now being added, not the one replaced
        transaction.replace(R.id.fragment_container, phGridFrag, Tags.PLACEHOLDER_PIX_GRID);
        transaction.addToBackStack(null);
        transaction.commit();//from  ww  w .  j  a va2  s .  co  m
        break;
    }
}

From source file:com.silentcircle.contacts.editor.ContactEditorFragment.java

@Override
public void onCreate(Bundle savedState) {
    if (savedState != null) {
        // Restore mUri before calling super.onCreate so that onInitializeLoaders
        // would already have a uri and an action to work with
        mLookupUri = savedState.getParcelable(KEY_URI);
        mAction = savedState.getString(KEY_ACTION);
    }/*from  w  ww. j a  v a  2  s  . c o  m*/

    super.onCreate(savedState);

    if (savedState == null) {
        // If savedState is non-null, onRestoreInstanceState() will restore the generator.
        mViewIdGenerator = new ViewIdGenerator();
    } else {
        // Read state from savedState. No loading involved here
        mState = savedState.<RawContactDeltaList>getParcelable(KEY_EDIT_STATE);
        mRawContactIdRequestingPhoto = savedState.getLong(KEY_RAW_CONTACT_ID_REQUESTING_PHOTO);
        mViewIdGenerator = savedState.getParcelable(KEY_VIEW_ID_GENERATOR);
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
            mCurrentPhotoFile = savedState.getString(KEY_CURRENT_PHOTO_FILE);
        else
            mCurrentPhotoUri = savedState.getParcelable(KEY_CURRENT_PHOTO_URI);
        mContactIdForJoin = savedState.getLong(KEY_CONTACT_ID_FOR_JOIN);
        mContactWritableForJoin = savedState.getBoolean(KEY_CONTACT_WRITABLE_FOR_JOIN);
        mAggregationSuggestionsRawContactId = savedState.getLong(KEY_SHOW_JOIN_SUGGESTIONS);
        mEnabled = savedState.getBoolean(KEY_ENABLED);
        mStatus = savedState.getInt(KEY_STATUS);
        mNewLocalProfile = savedState.getBoolean(KEY_NEW_LOCAL_PROFILE);
        mIsUserProfile = savedState.getBoolean(KEY_IS_USER_PROFILE);
        mUpdatedPhotos = savedState.getParcelable(KEY_UPDATED_PHOTOS);
    }
}