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.nextgis.firereporter.ScanexDataFragment.java

public void onReceiveResult(int resultCode, Bundle resultData) {

    if ((resultCode & GetFiresService.SERVICE_START) != 0) {
        ((MainActivity) getSherlockActivity()).refresh();
    }//from  w  w w .j  ava  2 s. co  m

    if ((resultCode & GetFiresService.SERVICE_SCANEXSTART) != 0) {
        ((MainActivity) getSherlockActivity()).refresh();
    }

    if ((resultCode & GetFiresService.SERVICE_SCANEXDATA) != 0) {
        ScanexSubscibesFragment ListFragment = (ScanexSubscibesFragment) getChildFragmentManager()
                .findFragmentByTag("LIST");
        if (ListFragment != null) {
            int nType = resultData.getInt(GetFiresService.TYPE);
            if (nType == GetFiresService.SCANEX_SUBSCRIPTION) {
                ListFragment.add((ScanexSubscriptionItem) resultData.getParcelable(GetFiresService.ITEM));
            } else if (nType == GetFiresService.SCANEX_NOTIFICATION) {
                long nSubID = resultData.getLong(GetFiresService.SUBSCRIPTION_ID);
                //long nNoteID = resultData.getLong("note_id");
                ScanexNotificationItem item = (ScanexNotificationItem) resultData
                        .getParcelable(GetFiresService.ITEM);
                ListFragment.add(nSubID, item);

                ScanexNotificationsFragment NotesFragment = (ScanexNotificationsFragment) getChildFragmentManager()
                        .findFragmentByTag("DETAILES");
                if (NotesFragment != null) {
                    NotesFragment.add(item);
                }
            }
        }
    }

    if ((resultCode & GetFiresService.SERVICE_STOP) != 0) {
        ((MainActivity) getSherlockActivity()).completeRefresh();
    }

    if ((resultCode & GetFiresService.SERVICE_ERROR) != 0) {
        Toast.makeText(getSherlockActivity(), resultData.getString(GetFiresService.ERR_MSG), Toast.LENGTH_LONG)
                .show();
    }
}

From source file:com.matthewmitchell.peercoin_android_wallet.ui.WalletActivity.java

@Override
protected Dialog onCreateDialog(final int id, final Bundle args) {
    if (id == DIALOG_RESTORE_WALLET)
        return createRestoreWalletDialog();
    else if (id == DIALOG_BACKUP_WALLET)
        return createBackupWalletDialog();
    else if (id == DIALOG_TIMESKEW_ALERT)
        return createTimeskewAlertDialog(args.getLong("diff_minutes"));
    else if (id == DIALOG_VERSION_ALERT)
        return createVersionAlertDialog();
    else if (id == DIALOG_LOW_STORAGE_ALERT)
        return createLowStorageAlertDialog();
    else/*from  w  ww  . j a v  a  2s  . co m*/
        throw new IllegalArgumentException();
}

From source file:com.nextgis.maplibui.activity.ModifyAttributesActivity.java

protected void createView(final IGISApplication app, Bundle savedState) {
    //create and fill controls
    Bundle extras = getIntent().getExtras();

    if (extras != null) {
        int layerId = extras.getInt(KEY_LAYER_ID);
        MapBase map = app.getMap();//from  w  w w.  jav a 2  s .  co  m
        mLayer = (VectorLayer) map.getLayerById(layerId);

        if (null != mLayer) {
            mSharedPreferences = mLayer.getPreferences();

            mFields = new HashMap<>();
            mFeatureId = extras.getLong(KEY_FEATURE_ID);
            mIsViewOnly = extras.getBoolean(KEY_VIEW_ONLY, false);
            mIsGeometryChanged = extras.getBoolean(KEY_GEOMETRY_CHANGED, true);
            mGeometry = (GeoGeometry) extras.getSerializable(KEY_GEOMETRY);
            LinearLayout layout = (LinearLayout) findViewById(R.id.controls_list);
            fillControls(layout, savedState);
        } else {
            Toast.makeText(this, R.string.error_layer_not_inited, Toast.LENGTH_SHORT).show();
            finish();
        }
    }
}

From source file:com.renard.ocr.BaseDocumentActivitiy.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    Log.i(LOG_TAG, "onRestoreInstanceState " + this);
    super.onRestoreInstanceState(savedInstanceState);

    if (savedInstanceState.containsKey(DATE_CAMERA_INTENT_STARTED_STATE)) {
        dateCameraIntentStarted = new Date(savedInstanceState.getLong(DATE_CAMERA_INTENT_STARTED_STATE));
    }/*  w ww .ja  v  a 2  s  .  c  o m*/
    if (savedInstanceState.containsKey(CAMERA_PIC_URI_STATE)) {
        cameraPicUri = Uri.parse(savedInstanceState.getString(CAMERA_PIC_URI_STATE));
    }
    rotateXDegrees = savedInstanceState.getInt(ROTATE_X_DEGREES_STATE);

    if (savedInstanceState.getBoolean(STATE_RECEIVER_REGISTERED)) {
        registerImageLoaderReceiver();
    }
    final int index = savedInstanceState.getInt(IMAGE_SOURCE);
    mImageSource = ImageSource.values()[index];
}

From source file:com.example.linhdq.test.documents.creation.NewDocumentActivity.java

@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
    Log.i(LOG_TAG, "onRestoreInstanceState " + this);
    super.onRestoreInstanceState(savedInstanceState);

    if (savedInstanceState.containsKey(DATE_CAMERA_INTENT_STARTED_STATE)) {
        dateCameraIntentStarted = new Date(savedInstanceState.getLong(DATE_CAMERA_INTENT_STARTED_STATE));
    }/* w w w. j ava 2  s  .  com*/
    if (savedInstanceState.containsKey(CAMERA_PIC_URI_STATE)) {
        cameraPicUri = Uri.parse(savedInstanceState.getString(CAMERA_PIC_URI_STATE));
    }
    if (savedInstanceState.getBoolean(STATE_RECEIVER_REGISTERED)) {
        registerImageLoaderReceiver();
    }
    final int index = savedInstanceState.getInt(IMAGE_SOURCE);
    mImageSource = ImageSource.values()[index];
}

From source file:com.tweetlanes.android.core.view.HomeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    AccountDescriptor account = getApp().getCurrentAccount();

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        // Notifications
        String accountKey = extras.getString("account_key");
        String notificationType = extras.getString("notification_type");
        long notificationPostId = extras.getLong("notification_post_id");
        String laneName = extras.getString("lane");
        final String urlToLoad = extras.getString("urlToLoad");

        if (accountKey != null) {
            getIntent().removeExtra("account_key");
            getIntent().removeExtra("notification_type");
            AccountDescriptor notificationAccount = getApp().getAccountByKey(accountKey);

            Notifier.saveLastNotificationActioned(this, accountKey, notificationType, notificationPostId);

            Constant.LaneType notificationLaneType = notificationType.equals(
                    SharedPreferencesConstants.NOTIFICATION_TYPE_MENTION) ? Constant.LaneType.USER_MENTIONS
                            : Constant.LaneType.DIRECT_MESSAGES;

            if (notificationAccount != null) {
                long notificationAccountId = notificationAccount.getId();
                long currentAccountId = account.getId();
                if (notificationAccountId == currentAccountId) {
                    int index = account.getCurrentLaneIndex(notificationLaneType);
                    if (index > -1) {
                        mDefaultLaneOverride = index;
                    }/* w  w w  .  ja  va  2  s  . com*/
                } else {
                    showAccount(notificationAccount, notificationLaneType);
                }
            }
        } else if (laneName != null) {
            getIntent().removeExtra("lane");
            int index = account.getCurrentLaneIndex(Constant.LaneType.valueOf(laneName.trim().toUpperCase()));
            if (index > -1) {
                mDefaultLaneOverride = index;
            }
        } else if (urlToLoad != null) {
            getIntent().removeExtra("urlToLoad");
            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
            alertDialogBuilder.setMessage(getString(R.string.unknown_intent));
            alertDialogBuilder.setPositiveButton(getString(R.string.yes),
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            Intent viewIntent = new Intent("android.intent.action.VIEW",
                                    Uri.parse(urlToLoad.trim()));
                            startActivity(viewIntent);
                        }
                    });
            alertDialogBuilder.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });
            alertDialogBuilder.create().show();
        }
    }

    super.onCreate(savedInstanceState);

    // Attempt at fixing a crash found in HomeActivity
    if (account == null) {
        Toast.makeText(getApplicationContext(), "No cached account found, restarting",
                Constant.DEFAULT_TOAST_DISPLAY_TIME).show();
        restartApp();
        return;
    }

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayUseLogoEnabled(true);
    actionBar.setTitle(null);
    actionBar.setDisplayShowTitleEnabled(false);

    mSpinnerAdapter = new AccountAdapter(this, getApp().getAccounts());

    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(mSpinnerAdapter, mOnNavigationListener);
    actionBar.setSelectedNavigationItem(0);

    onCreateNavigationListener();
    configureListNavigation();

    mViewSwitcher = (ViewSwitcher) findViewById(R.id.rootViewSwitcher);
    updateViewVisibility();

    onCreateHandleIntents();

    account.setDisplayedLaneDefinitionsDirty(false);

    Notifier.setNotificationAlarm(this);

    clearTempFolder();

    cacheFollowers();

    //Launch change log dialog
    final WhatsNewDialog whatsNewDialog = new WhatsNewDialog(this);
    whatsNewDialog.show();
}

From source file:com.weebly.opus1269.copyeverywhere.ui.main.MainActivity.java

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

    // Check whether we're recreating a previously destroyed instance
    if (savedInstanceState != null) {
        // Restore value of members from saved state
        mSelectedPos = savedInstanceState.getInt(STATE_POS);
        mSelectedItemID = savedInstanceState.getLong(STATE_ITEM_ID);
        mQueryString = savedInstanceState.getString(STATE_QUERY_STRING);
    }/*from  w w  w.  j  av  a  2 s  .c o m*/

    // get preferences
    mFavFilter = Prefs.isFavFilter();

    // start if needed
    ClipboardWatcherService.startService();

    setContentView(R.layout.activity_main);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    setupRecyclerView();

    if (AppUtils.isDualPane()) {
        // create the clip viewer for the two pane option
        final ClipViewerFragment fragment = ClipViewerFragment.newInstance(new ClipItem(), "");
        getSupportFragmentManager().beginTransaction().replace(R.id.clip_viewer_container, fragment).commit();
    }

    // Prepare the loader. Either re-connect with an existing one, or start a new one.
    //noinspection ThisEscapedInObjectConstruction
    getSupportLoaderManager().initLoader(0, null, this);

    final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.hide();

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    setTitle((ClipItem) null);

    handleIntent();
}

From source file:com.google.android.apps.paco.ExperimentExecutorCustomRendering.java

private void getSignallingData() {
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        notificationHolderId = extras.getLong(NotificationCreator.NOTIFICATION_ID);
        NotificationHolder notificationHolder = experimentProviderUtil
                .getNotificationById(notificationHolderId);
        if (notificationHolder != null) {
            scheduledTime = notificationHolder.getAlarmTime();
            notificationMessage = notificationHolder.getMessage();
            notificationSource = notificationHolder.getNotificationSource();
            Log.i(PacoConstants.TAG, "Starting experimentExecutor from signal: " + experiment.getTitle()
                    + ". alarmTime: " + new DateTime(scheduledTime).toString());
        } else {//from w w w. j av  a  2s  . c  o  m
            scheduledTime = null;
        }

        if (isExpiredEsmPing()) {
            Toast.makeText(this, R.string.survey_expired, Toast.LENGTH_LONG).show();
            finish();
        }
    }
    if (notificationHolderId == null) {
        lookForActiveNotificationForExperiment();
    }
}

From source file:ca.rmen.android.scrumchatter.meeting.detail.MeetingActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (TAG == null)
        TAG = Constants.TAG + "/" + MeetingActivity.class.getSimpleName() + "/" + System.currentTimeMillis();
    Log.v(TAG, "onCreate: savedInstanceState = " + savedInstanceState + ", intent = " + getIntent()
            + ", intent flags = " + getIntent().getFlags());

    mBinding = DataBindingUtil.setContentView(this, R.layout.meeting_activity);
    mBinding.pager.addOnPageChangeListener(mOnPageChangeListener);
    ActionBar supportActionBar = getSupportActionBar();
    if (supportActionBar != null)
        supportActionBar.setDisplayHomeAsUpEnabled(true);

    // If this is the first time we open the activity, we will use the meeting id provided in the intent.
    // If we are recreating the activity (because of a device rotation, for example), we will display the meeting that the user
    // had previously swiped to, using the ViewPager.
    long meetingId = savedInstanceState == null ? getIntent().getLongExtra(Meetings.EXTRA_MEETING_ID, -1)
            : savedInstanceState.getLong(Meetings.EXTRA_MEETING_ID);

    // Perform initialization which must be done on a background thread:
    // Create the pager adapter. The pager adapter constructor reads from the DB, so
    // we need to create it in a background thread.  When it's ready, we'll use it 
    // with the ViewPager, and open the ViewPager to the correct meeting.
    MeetingPagerAdapter.create(this)
            .doOnSuccess(meetingPagerAdapter -> mMeetingPagerAdapter = meetingPagerAdapter)
            .subscribe(meetingPagerAdapter -> onPagerAdapterCreated(meetingId, meetingPagerAdapter));
}

From source file:com.github.yuukis.businessmap.app.MainActivity.java

@SuppressWarnings("unchecked")
private void initialize(Bundle savedInstanceState) {
    Bundle args = getIntent().getExtras();

    FragmentManager fm = getSupportFragmentManager();
    mMapFragment = (ContactsMapFragment) fm.findFragmentById(R.id.contacts_map);
    mListFragment = (ContactsListFragment) fm.findFragmentById(R.id.contacts_list);
    mTaskFragment = (ContactsTaskFragment) fm.findFragmentById(R.id.contacts_task);
    mGroupList = ContactUtils.getContactsGroupList(this);

    GroupAdapter adapter = new GroupAdapter(this, mGroupList);
    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    actionBar.setListNavigationCallbacks(adapter, this);

    int navigationIndex = 0;
    if (savedInstanceState != null) {
        navigationIndex = savedInstanceState.getInt(KEY_NAVIGATION_INDEX);
        mContactsList = (List<ContactsItem>) savedInstanceState.getSerializable(KEY_CONTACTS_LIST);
    } else if (args != null) {
        if (args.containsKey(KEY_CONTACTS_GROUP_ID)) {
            long groupId = args.getLong(KEY_CONTACTS_GROUP_ID);
            for (int i = 0; i < mGroupList.size(); i++) {
                ContactsGroup contactsGroup = mGroupList.get(i);
                if (groupId == contactsGroup.getId()) {
                    navigationIndex = i;
                    break;
                }/*from  w  ww .j  a v  a  2  s  .c om*/
            }
        }
    }
    actionBar.setSelectedNavigationItem(navigationIndex);
    mCurrentGroupContactsList = new ArrayList<ContactsItem>();
}