Example usage for android.os Bundle getDouble

List of usage examples for android.os Bundle getDouble

Introduction

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

Prototype

public double getDouble(String key, double 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:me.diskstation.ammon.gpsrunner.ui.OverviewFragment.java

public void updateViews(Bundle updatedRun) {
    long timeInterval = updatedRun.getLong("timeInterval", 0);
    double distance = updatedRun.getDouble("distance", 0.0d);
    double velocity = updatedRun.getDouble("velocity", 0.0d);
    durationView.setText(vf.formatTimeInterval(timeInterval));
    distanceView.setText(vf.formatDistance(distance));
    velocityView.setText(vf.formatVelocity(velocity));
}

From source file:org.mariotaku.twidere.fragment.GoogleMapFragment.java

public void center(final boolean animate) {
    final Bundle args = getArguments();
    if (mMapView == null || args == null || !args.containsKey(EXTRA_LATITUDE)
            || !args.containsKey(EXTRA_LONGITUDE))
        return;/*from w  ww  .  j  a  v  a 2 s .  c  om*/
    final double lat = args.getDouble(EXTRA_LATITUDE, 0.0), lng = args.getDouble(EXTRA_LONGITUDE, 0.0);
    final CameraUpdate c = CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 12);
    if (animate) {
        mMapView.animateCamera(c);
    } else {
        mMapView.moveCamera(c);
    }
}

From source file:fr.eoit.activity.fragment.manufacture.ProductionPlanFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View fragment = inflater.inflate(R.layout.manufacture_production_plan, container, false);

    Mining.loadMiningData(getActivity(), Mining.ONLY_BASIC_ASTEROIDS);

    Bundle args = getArguments();

    itemId = args.getInt("itemId", 0);
    sellPrice = args.getDouble("sellPrice", 0);
    producePrice = args.getDouble("producePrice", 0);
    unitPerBatch = args.getInt("unitPerBatch", 0);
    baseProductionTime = args.getInt("productionTime", 0);
    int categorieId = args.getInt("categorieId");

    TextView runsTextView = (TextView) fragment.findViewById(R.id.RUNS);
    runsTextView.setOnKeyListener(new RunsListener());
    runsTextView.setText("1");
    totalPriceTextView = (TextView) fragment.findViewById(R.id.TOTAL_PROFIT_VALUE);
    totalTimeTextView = (TextView) fragment.findViewById(R.id.TOTAL_TIME_VALUE);

    stepsFragments[0] = (EnhancedMaterialListFragment) getFragmentManager()
            .findFragmentById(R.id.PRODUCTION_STEP0);
    stepsFragments[1] = (EnhancedMaterialListFragment) getFragmentManager()
            .findFragmentById(R.id.PRODUCTION_STEP1);
    stepsFragments[2] = (EnhancedMaterialListFragment) getFragmentManager()
            .findFragmentById(R.id.PRODUCTION_STEP2);
    stepsFragments[3] = (EnhancedMaterialListFragment) getFragmentManager()
            .findFragmentById(R.id.PRODUCTION_STEP3);
    stepsFragments[4] = (EnhancedMaterialListFragment) getFragmentManager()
            .findFragmentById(R.id.PRODUCTION_STEP4);
    stepsFragments[5] = (EnhancedMaterialListFragment) getFragmentManager()
            .findFragmentById(R.id.PRODUCTION_STEP5);

    stepsFragments[0].getView().setVisibility(View.GONE);
    stepsFragments[1].getView().setVisibility(View.GONE);
    stepsFragments[2].getView().setVisibility(View.GONE);
    stepsFragments[3].getView().setVisibility(View.GONE);
    stepsFragments[4].getView().setVisibility(View.GONE);
    stepsFragments[5].getView().setVisibility(View.GONE);

    getLoaderManager().initLoader(BASE_PRODUCTION_NEEDS_LOADER_ID, null,
            new BaseProductionNeedsLoader.BaseProductionNeedsLoaderCallBacks(getActivity(), this, itemId,
                    categorieId));/*from   w ww . j  a va  2s .c  om*/

    return fragment;
}

From source file:planets.position.LunarEclipse.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.lunar_main);

    prevEclButton = (Button) findViewById(R.id.prevLEclButton);
    nextEclButton = (Button) findViewById(R.id.nextLEclButton);
    eclipseList = (ListView) findViewById(R.id.lunarEclList);

    // load bundle from previous activity
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        offset = bundle.getDouble("Offset", 0);
        g[1] = bundle.getDouble("Lat", 0);
        g[0] = bundle.getDouble("Long", 0);
        g[2] = bundle.getDouble("Elevation", 0);
    }/*from  ww w .  j a v  a  2s. c om*/

    cr = getApplicationContext().getContentResolver();
    getSupportLoaderManager().initLoader(LUNAR_LOADER, null, this);

    c = Calendar.getInstance();
    // convert local time to utc
    c.add(Calendar.MINUTE, (int) (offset * -60));
    // calculate Julian date
    time = utc2jd(c.get(Calendar.MONTH) + 1, c.get(Calendar.DAY_OF_MONTH), c.get(Calendar.YEAR),
            c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND));
    if (time == null) {
        Log.e("Solar Eclipse error", "utc2jd error");
        Toast.makeText(getApplicationContext(), "Date conversion error,\nplease restart the activity",
                Toast.LENGTH_LONG).show();
        this.finish();
    }
    // jdTT = time[0];
    // jdUT = time[1];

    computeEclipses = new ComputeEclipsesTask();
    computeEclipses.execute(time[1], 0.0);

    prevEclButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            computeEclipses = new ComputeEclipsesTask();
            computeEclipses.execute(firstEcl, 1.0);
        }
    });

    nextEclButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            computeEclipses = new ComputeEclipsesTask();
            computeEclipses.execute(lastEcl, 0.0);
        }
    });

    eclipseList.setOnItemClickListener(new EclipseSelectedListener());

}

From source file:com.reliqartz.firsttipcalc.gui.SplitterFragment.java

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

    mSplitInfo = getString(R.string.split_info_text_view);
    if (savedInstanceState != null) {
        mFinalBill = savedInstanceState.getDouble(FINAL_BILL, mFinalBill);
    }//  w  w w . j av  a2  s  .c  om
}

From source file:planets.position.EclipseData.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.eclipse_data);

    eclDateText = (TextView) findViewById(R.id.ecl_date_text);
    eclTypeText = (TextView) findViewById(R.id.ecl_type_text);
    eclGlobalDataText = (TextView) findViewById(R.id.ecl_globalData);
    eclLocalDataText = (TextView) findViewById(R.id.ecl_localData);

    cr = getApplicationContext().getContentResolver();
    // load bundle from previous activity
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        eclipseNum = bundle.getInt("eclipseNum", 0);
        offset = bundle.getDouble("Offset", 0);
        localEcl = bundle.getBoolean("local");
        if (bundle.getBoolean("db")) {
            if (localEcl) {
                getSupportLoaderManager().initLoader(SOLAR_LOCAL_LOADER, null, this);
            } else {
                getSupportLoaderManager().initLoader(SOLAR_LOADER, null, this);
            }// ww  w.  ja  v  a2s.c  om
            helpSE = true;
            fillSolarData();
        } else {
            if (localEcl) {
                getSupportLoaderManager().initLoader(LUNAR_LOCAL_LOADER, null, this);
            } else {
                getSupportLoaderManager().initLoader(LUNAR_LOADER, null, this);
            }
            helpSE = false;
            fillLunarData();
        }
    }
}

From source file:planets.position.SolarEclipse.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.solar_main);

    prevEclButton = (Button) findViewById(R.id.prevSEclButton);
    nextEclButton = (Button) findViewById(R.id.nextSEclButton);
    eclipseList = (ListView) findViewById(R.id.solarEclList);

    // load bundle from previous activity
    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
        offset = bundle.getDouble("Offset", 0);
        g[1] = bundle.getDouble("Lat", 0);
        g[0] = bundle.getDouble("Long", 0);
        g[2] = bundle.getDouble("Elevation", 0);
    }//  w w w.  j av  a  2s. c  o  m

    cr = getApplicationContext().getContentResolver();
    getSupportLoaderManager().initLoader(SOLAR_LOADER, null, this);

    c = Calendar.getInstance();
    // convert local time to utc
    c.add(Calendar.MINUTE, (int) (offset * -60));
    // calculate Julian date
    time = utc2jd(c.get(Calendar.MONTH) + 1, c.get(Calendar.DAY_OF_MONTH), c.get(Calendar.YEAR),
            c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND));
    if (time == null) {
        Log.e("Solar Eclipse error", "utc2jd error");
        Toast.makeText(getApplicationContext(), "Date conversion error,\nplease restart the activity",
                Toast.LENGTH_LONG).show();
        this.finish();
    }
    // jdTT = time[0];
    // jdUT = time[1];

    computeEclipses = new ComputeEclipsesTask();
    computeEclipses.execute(time[1], 0.0);

    prevEclButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            computeEclipses = new ComputeEclipsesTask();
            computeEclipses.execute(firstEcl, 1.0);
        }
    });

    nextEclButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            computeEclipses = new ComputeEclipsesTask();
            computeEclipses.execute(lastEcl, 0.0);
        }
    });

    eclipseList.setOnItemClickListener(new EclipseSelectedListener());
}

From source file:it.garybrady.travel.GeofenceConstruct.java

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

    // Set the pattern for the latitude and longitude format
    String latLngPattern = getString(R.string.lat_lng_pattern);

    // Set the format for latitude and longitude
    mLatLngFormat = new DecimalFormat(latLngPattern);

    // Localize the format
    mLatLngFormat.applyLocalizedPattern(mLatLngFormat.toLocalizedPattern());

    // Set the pattern for the radius format
    String radiusPattern = getString(R.string.radius_pattern);

    // Set the format for the radius
    mRadiusFormat = new DecimalFormat(radiusPattern);

    // Localize the pattern
    mRadiusFormat.applyLocalizedPattern(mRadiusFormat.toLocalizedPattern());

    // Create a new broadcast receiver to receive updates from the listeners and service
    mBroadcastReceiver = new GeofenceSampleReceiver();

    // Create an intent filter for the broadcast receiver
    mIntentFilter = new IntentFilter();

    // Action for broadcast Intents that report successful addition of geofences
    mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_ADDED);

    // Action for broadcast Intents that report successful removal of geofences
    mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCES_REMOVED);

    // Action for broadcast Intents containing various types of geofencing errors
    mIntentFilter.addAction(GeofenceUtils.ACTION_GEOFENCE_ERROR);

    // All Location Services sample apps use this category
    mIntentFilter.addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES);

    // Instantiate a new geofence storage area
    mPrefs = new SimpleGeofenceStore(this);

    // Instantiate the current List of geofences
    mCurrentGeofences = new ArrayList<Geofence>();

    // Instantiate a Geofence requester
    mGeofenceRequester = new GeofenceRequester(this);

    // Instantiate a Geofence remover
    mGeofenceRemover = new GeofenceRemover(this);

    // Attach to the main UI
    setContentView(R.layout.activity_confirm_geofence);

    // Get handles to the Geofence editor fields in the UI
    mLatitude1 = (EditText) findViewById(R.id.value_latitude_1);
    mLongitude1 = (EditText) findViewById(R.id.value_longitude_1);
    mLongitude1.setEnabled(false);/*from  ww w.  ja v a 2 s.c  o  m*/
    mLatitude1.setEnabled(false);

    mRadius1 = (EditText) findViewById(R.id.value_radius_1);
    title = (EditText) findViewById(R.id.etTitle);

    Bundle b = getIntent().getExtras();
    if (b.getString("title", null) != null) {
        title.setText(b.getString("title"));
    }
    Double rLat = b.getDouble("lat", 0);
    Double rLng = b.getDouble("lng", 0);
    Double rRad = b.getDouble("radius", 0);

    String temp = rLat.toString();
    mLatitude1.setText(temp);
    temp = rLng.toString();
    mLongitude1.setText(temp);
    temp = rRad.toString();
    mRadius1.setText(temp);

}

From source file:it.trilogis.android.fao.WorldWindActivity.java

protected void setupCustomView(Bundle bundle) {
    try {//from w  w w.  j  a v a2s  .  c om

        // Get parameters
        double lat = bundle.getDouble("latitude", Constants.DEFAULT_LATITUDE);
        double lon = bundle.getDouble("longitude", Constants.DEFAULT_LONGITUDE);
        double range = bundle.getDouble("range", Constants.DEFAULT_VIEW_DISTANCE_KM);
        double heading = bundle.getDouble("heading", Constants.DEFAULT_VIEW_HEADING);
        double tilt = bundle.getDouble("tilt", Constants.DEFAULT_VIEW_TILT);

        BasicView view = (BasicView) this.wwd.getView();
        Globe globe = this.wwd.getModel().getGlobe();

        // Set the initial position to lat and long passed, where you can see the WMS Layers
        if (lat > 0 && lon > 0) {
            view.setLookAtPosition(Position.fromDegrees(lat, lon,
                    globe.getElevation(Angle.fromDegrees(lat), Angle.fromDegrees(lon))));
        } else {
            view.setLookAtPosition(Position.fromDegrees(Constants.DEFAULT_LATITUDE, Constants.DEFAULT_LONGITUDE,
                    globe.getElevation(Angle.fromDegrees(Constants.DEFAULT_LATITUDE),
                            Angle.fromDegrees(Constants.DEFAULT_LONGITUDE))));
        }

        // Set range
        if (range > 0) {
            view.setRange(range);
        } else {
            view.setRange(Constants.DEFAULT_VIEW_DISTANCE_KM);
        }

        // Set the direction of view
        if (heading >= 0 && heading <= 360) {
            view.setHeading(Angle.fromDegrees(heading));
        } else {
            view.setHeading(Angle.fromDegrees(Constants.DEFAULT_VIEW_HEADING));
        }

        // Set angle of view
        if (tilt >= 0 && tilt <= 90) {
            view.setTilt(Angle.fromDegrees(tilt));
        } else {
            view.setTilt(Angle.fromDegrees(Constants.DEFAULT_VIEW_TILT));
        }

    } catch (Exception e) {
        setupView();
    }
}

From source file:tw.idv.palatis.danboorugallery.SettingsActivity.java

@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    setupSimplePreferencesScreen();/*from w w  w  .  ja  v  a2  s. c  o m*/

    if (savedInstanceState != null) {
        mCacheSizeCalculated = savedInstanceState.getBoolean(KEY_CACHE_SIZE_CALCULATED, false);
        mCacheSize = savedInstanceState.getDouble(KEY_CACHE_SIZE, -1);
        mMaxCacheSize = savedInstanceState.getDouble(KEY_CACHE_SIZE_MAX, -1);
        mMemCacheSize = savedInstanceState.getDouble(KEY_MEM_CACHE_SIZE, -1);
        mMaxMemCacheSize = savedInstanceState.getDouble(KEY_MEM_CACHE_SIZE_MAX, -1);
        mPostCount = savedInstanceState.getInt(KEY_POST_COUNT, -1);
    }
}