Java Code Examples for android.content.Intent#getFloatExtra()

The following examples show how to use android.content.Intent#getFloatExtra() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinkingBeaconManager.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
private void parseTemperatureData(final Intent intent, final LinkingBeacon beacon) {
    if (intent.getExtras().containsKey(LinkingBeaconUtil.TEMPERATURE)) {
        TemperatureData temp = beacon.getTemperatureData();
        if (temp == null) {
            temp = new TemperatureData();
            beacon.setTemperatureData(temp);
        }

        long timeStamp = intent.getLongExtra(LinkingBeaconUtil.TIME_STAMP, 0);
        float value = intent.getFloatExtra(LinkingBeaconUtil.TEMPERATURE, 0);
        temp.setTimeStamp(timeStamp);
        temp.setValue(value);

        mDBAdapter.insertTemperature(beacon, temp);

        notifyBeaconTemperatureEventListener(beacon, temp);
    }
}
 
Example 2
Source File: IntentUtils.java    From Shield with MIT License 6 votes vote down vote up
public static float getFloatParam(String name, float defaultValue, Fragment fragment) {
    if (fragment.getArguments() != null && fragment.getArguments().containsKey(name)) {
        return fragment.getArguments().getFloat(name);
    }

    Intent i = fragment.getActivity().getIntent();
    try {
        Uri uri = i.getData();
        if (uri != null) {
            String val = uri.getQueryParameter(name);
            if (!TextUtils.isEmpty(val))
                return Float.parseFloat(val);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    return i.getFloatExtra(name, defaultValue);
}
 
Example 3
Source File: LinkingBeaconManager.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
private void parseBatteryData(final Intent intent, final LinkingBeacon beacon) {
    if (intent.getExtras().containsKey(LinkingBeaconUtil.LOW_BATTERY) ||
            intent.getExtras().containsKey(LinkingBeaconUtil.BATTERY_LEVEL)) {
        BatteryData battery = beacon.getBatteryData();
        if (battery == null) {
            battery = new BatteryData();
            beacon.setBatteryData(battery);
        }

        long timeStamp = intent.getLongExtra(LinkingBeaconUtil.TIME_STAMP, 0);
        boolean lowBattery = intent.getBooleanExtra(LinkingBeaconUtil.LOW_BATTERY, false);
        float level = intent.getFloatExtra(LinkingBeaconUtil.BATTERY_LEVEL, 0);
        battery.setTimeStamp(timeStamp);
        battery.setLowBatteryFlag(lowBattery);
        battery.setLevel(level);

        mDBAdapter.insertBattery(beacon, battery);

        notifyBeaconBatteryEventListener(beacon, battery);
    }
}
 
Example 4
Source File: LinkingBeaconManager.java    From DeviceConnect-Android with MIT License 6 votes vote down vote up
private void parseAtmosphericPressureData(final Intent intent, final LinkingBeacon beacon) {
    if (intent.getExtras().containsKey(LinkingBeaconUtil.ATMOSPHERIC_PRESSURE)) {
        AtmosphericPressureData atm = beacon.getAtmosphericPressureData();
        if (atm == null) {
            atm = new AtmosphericPressureData();
            beacon.setAtmosphericPressureData(atm);
        }

        long timeStamp = intent.getLongExtra(LinkingBeaconUtil.TIME_STAMP, 0);
        float value = intent.getFloatExtra(LinkingBeaconUtil.ATMOSPHERIC_PRESSURE, 0);
        atm.setTimeStamp(timeStamp);
        atm.setValue(value);

        mDBAdapter.insertAtmosphericPressure(beacon, atm);

        notifyBeaconAtmosphericPressureEventListener(beacon, atm);
    }
}
 
Example 5
Source File: MainActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Decides which animation to run based the intent that started the activity.
 */
public void initActivityAnimation() {
    Intent intent = this.getIntent();
    fromToolbarPosition = intent.getFloatExtra(
            this.getResources().getString(R.string.decorative_toolbar_position_y), -1
    );

    fromMainToolbarPosition = intent.getFloatExtra(
            this.getResources().getString(R.string.main_toolbar_position_y), -1
    );

    // If the position is equal to the default value,
    // then the intent was not put into from another MainActivity
    if (fromToolbarPosition != -1) {
        AnimationService.setActivityToolbarReset(mMainToolbar, mDecorativeToolbar, this, fromToolbarPosition, fromMainToolbarPosition);
    } else {
        AnimationService.setActivityToolbarCircularRevealAnimation(mDecorativeToolbar);
    }

    AnimationService.setActivityIconRevealAnimation(mCircleIconWrapper, mTitleView);
}
 
Example 6
Source File: Mapa.java    From android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mapa);

    // Recoge los datos enviados por la Activity que la invoca
    Intent i = getIntent();
    latitud = i.getFloatExtra("latitud", 0);
    longitud = i.getFloatExtra("longitud", 0);
    nombre = i.getStringExtra("nombre");

    // Transforma las coordenadas al sistema LatLng y las almacena
    uk.me.jstott.jcoord.LatLng ubicacion = Util.DeUMTSaLatLng(latitud, longitud, 'N', 30);
    this.latitud = ubicacion.getLat();
    this.longitud = ubicacion.getLng();

    // Inicializa el sistema de mapas de Google
    MapsInitializer.initialize(this);

    // Obtiene una referencia al objeto que permite "manejar" el mapa
    mapa = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
}
 
Example 7
Source File: RSCActivity.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
	final String action = intent.getAction();

	if (RSCService.BROADCAST_RSC_MEASUREMENT.equals(action)) {
		final float speed = intent.getFloatExtra(RSCService.EXTRA_SPEED, 0.0f);
		final int cadence = intent.getIntExtra(RSCService.EXTRA_CADENCE, 0);
		final long totalDistance = intent.getLongExtra(RSCService.EXTRA_TOTAL_DISTANCE, -1);
		final boolean running = intent.getBooleanExtra(RSCService.EXTRA_ACTIVITY, false);
		// Update GUI
		onMeasurementReceived(speed, cadence, totalDistance, running);
	} else if (RSCService.BROADCAST_STRIDES_UPDATE.equals(action)) {
		final int strides = intent.getIntExtra(RSCService.EXTRA_STRIDES, 0);
		final long distance = intent.getLongExtra(RSCService.EXTRA_DISTANCE, -1);
		// Update GUI
		onStripesUpdate(distance, strides);
	}
}
 
Example 8
Source File: CameraActivity.java    From Tess-TwoDemo with Apache License 2.0 5 votes vote down vote up
private void setupViews(@NonNull Intent mIntent){
    leftRight = mIntent.getIntExtra(EasyCamera.EXTRA_MARGIN_BY_WIDTH,0);
    topBottom = mIntent.getIntExtra(EasyCamera.EXTRA_MARGIN_BY_HEIGHT,0);
    ratio = mIntent.getFloatExtra(EasyCamera.EXTRA_VIEW_RATIO, 1f);
    imageUri = mIntent.getParcelableExtra(EasyCamera.EXTRA_OUTPUT_URI);
    imagePath = FileUtils.getRealFilePath(this,imageUri);
}
 
Example 9
Source File: TimeObserverService.java    From GeometricWeather with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void readData(Intent intent) {
    if (intent != null) {
        if (intent.getBooleanExtra(KEY_CONFIG_CHANGED, false)) {
            pollingRate = intent.getFloatExtra(KEY_POLLING_RATE, 1.5f);
            todayForecastTime = intent.getStringExtra(KEY_TODAY_FORECAST_TIME);
            tomorrowForecastTime = intent.getStringExtra(KEY_TOMORROW_FORECAST_TIME);
        }
        if (intent.getBooleanExtra(KEY_POLLING_FAILED, false)) {
            lastUpdateNormalViewTime = System.currentTimeMillis() - getPollingInterval() + 15 * 60 * 1000;
        }
    }
}
 
Example 10
Source File: MergeActivity.java    From ContactMerger with Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    String event = intent.getStringExtra("event");
    if (event == null) {
        return;
    }
    if ("start".equals(event)) {
        progressBar.setProgress(0);
        progressBar.setMax(1000);
        progressContainer.setVisibility(View.VISIBLE);
        return;
    }
    if ("progress".equals(event)) {
        float f = intent.getFloatExtra("progress", 0f);
        progressBar.setProgress((int)(1000 * f));
        progressBar.setMax(1000);
        progressContainer.setVisibility(View.VISIBLE);
        progressBar.postInvalidate();
        loadText.setText("Analyzing your contacts.\nThis can take a few minutes.\n" +
                ((int)(f * 100)) + "%"
        );
        return;
    }
    if ("finish".equals(event)) {
        progressBar.setProgress(1000);
        progressBar.setMax(1000);
        progressContainer.setVisibility(View.GONE);
        updateList();
        return;
    }
    if ("abort".equals(event)) {
        progressBar.setProgress(0);
        progressBar.setMax(1);
        progressContainer.setVisibility(View.GONE);
        startScan.setVisibility(View.VISIBLE);
        return;
    }
}
 
Example 11
Source File: Mapa.java    From android with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_mapa);
    
    // Recoge los datos enviados por la Activity que la invoca
    Intent i = getIntent();
    latitud = i.getFloatExtra("latitud", 0);
    longitud = i.getFloatExtra("longitud", 0);
    nombre = i.getStringExtra("nombre");
    
    // Transforma las coordenadas al sistema LatLng y las almacena
    uk.me.jstott.jcoord.LatLng ubicacion = Util.DeUMTSaLatLng(latitud, longitud, 'N', 30);
    this.latitud = ubicacion.getLat();
    this.longitud = ubicacion.getLng();
    this.nombre = nombre;
    
    // Inicializa el sistema de mapas de Google
    //try {
        MapsInitializer.initialize(this);
    /*} catch (GooglePlayServicesNotAvailableException e) {
        e.printStackTrace();
    }*/
    
    // Obtiene una referencia al objeto que permite "manejar" el mapa
    mapa = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

            //getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
}
 
Example 12
Source File: HTActivity.java    From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onReceive(final Context context, final Intent intent) {
	final String action = intent.getAction();

	if (HTService.BROADCAST_HTS_MEASUREMENT.equals(action)) {
		final float value = intent.getFloatExtra(HTService.EXTRA_TEMPERATURE, 0.0f);
		// Update GUI
		onTemperatureMeasurementReceived(value);
	} else if (HTService.BROADCAST_BATTERY_LEVEL.equals(action)) {
		final int batteryLevel = intent.getIntExtra(HTService.EXTRA_BATTERY_LEVEL, 0);
		// Update GUI
		onBatteryLevelChanged(batteryLevel);
	}
}
 
Example 13
Source File: DumbSettingBrightnessActivity.java    From Easer with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Handler handler = new StopHandler(this);
    Intent intent = this.getIntent();
    float brightness = intent.getFloatExtra(EXTRA_BRIGHTNESS, 0);
    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.screenBrightness = brightness;
    getWindow().setAttributes(params);

    Message message = handler.obtainMessage(StopHandler.DELAYED_MESSAGE);
    handler.sendMessageDelayed(message,1000);
}
 
Example 14
Source File: IntentHelper.java    From OnActivityResult with Apache License 2.0 4 votes vote down vote up
public static float getExtraFloat(final Intent intent, final String key, final float defaultValue) {
    return intent.getFloatExtra(key, defaultValue);
}
 
Example 15
Source File: UCropActivity.java    From PictureSelector with Apache License 2.0 4 votes vote down vote up
/**
 * This method extracts {@link com.yalantis.ucrop.UCrop.Options #optionsBundle} from incoming intent
 * and setups Activity, {@link OverlayView} and {@link CropImageView} properly.
 */
@SuppressWarnings("deprecation")
private void processOptions(@NonNull Intent intent) {
    // Bitmap compression options
    String compressionFormatName = intent.getStringExtra(UCrop.Options.EXTRA_COMPRESSION_FORMAT_NAME);
    Bitmap.CompressFormat compressFormat = null;
    if (!TextUtils.isEmpty(compressionFormatName)) {
        compressFormat = Bitmap.CompressFormat.valueOf(compressionFormatName);
    }
    mCompressFormat = (compressFormat == null) ? DEFAULT_COMPRESS_FORMAT : compressFormat;

    mCompressQuality = intent.getIntExtra(UCrop.Options.EXTRA_COMPRESSION_QUALITY, UCropActivity.DEFAULT_COMPRESS_QUALITY);

    // custom options
    mOverlayView.setDimmedBorderColor(intent.getIntExtra(UCrop.Options.EXTRA_DIMMED_LAYER_BORDER_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_frame)));
    isDragFrame = intent.getBooleanExtra(UCrop.Options.EXTRA_DRAG_CROP_FRAME, true);

    mOverlayView.setDimmedStrokeWidth(intent.getIntExtra(UCrop.Options.EXTRA_CIRCLE_STROKE_WIDTH_LAYER, 1));
    isScaleEnabled = intent.getBooleanExtra(UCrop.Options.EXTRA_SCALE, true);
    isRotateEnabled = intent.getBooleanExtra(UCrop.Options.EXTRA_ROTATE, true);


    // Gestures options
    int[] allowedGestures = intent.getIntArrayExtra(UCrop.Options.EXTRA_ALLOWED_GESTURES);
    if (allowedGestures != null && allowedGestures.length == TABS_COUNT) {
        mAllowedGestures = allowedGestures;
    }

    // Crop image view options
    mGestureCropImageView.setMaxBitmapSize(intent.getIntExtra(UCrop.Options.EXTRA_MAX_BITMAP_SIZE, CropImageView.DEFAULT_MAX_BITMAP_SIZE));
    mGestureCropImageView.setMaxScaleMultiplier(intent.getFloatExtra(UCrop.Options.EXTRA_MAX_SCALE_MULTIPLIER, CropImageView.DEFAULT_MAX_SCALE_MULTIPLIER));
    mGestureCropImageView.setImageToWrapCropBoundsAnimDuration(intent.getIntExtra(UCrop.Options.EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION, CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION));

    // Overlay view options
    mOverlayView.setFreestyleCropEnabled(intent.getBooleanExtra(UCrop.Options.EXTRA_FREE_STYLE_CROP, OverlayView.DEFAULT_FREESTYLE_CROP_MODE != OverlayView.FREESTYLE_CROP_MODE_DISABLE));
    mOverlayView.setDragFrame(isDragFrame);
    mOverlayView.setDimmedColor(intent.getIntExtra(UCrop.Options.EXTRA_DIMMED_LAYER_COLOR, getResources().getColor(R.color.ucrop_color_default_dimmed)));
    mOverlayView.setCircleDimmedLayer(intent.getBooleanExtra(UCrop.Options.EXTRA_CIRCLE_DIMMED_LAYER, OverlayView.DEFAULT_CIRCLE_DIMMED_LAYER));

    mOverlayView.setShowCropFrame(intent.getBooleanExtra(UCrop.Options.EXTRA_SHOW_CROP_FRAME, OverlayView.DEFAULT_SHOW_CROP_FRAME));
    mOverlayView.setCropFrameColor(intent.getIntExtra(UCrop.Options.EXTRA_CROP_FRAME_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_frame)));
    mOverlayView.setCropFrameStrokeWidth(intent.getIntExtra(UCrop.Options.EXTRA_CROP_FRAME_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_frame_stoke_width)));

    mOverlayView.setShowCropGrid(intent.getBooleanExtra(UCrop.Options.EXTRA_SHOW_CROP_GRID, OverlayView.DEFAULT_SHOW_CROP_GRID));
    mOverlayView.setCropGridRowCount(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_ROW_COUNT, OverlayView.DEFAULT_CROP_GRID_ROW_COUNT));
    mOverlayView.setCropGridColumnCount(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_COLUMN_COUNT, OverlayView.DEFAULT_CROP_GRID_COLUMN_COUNT));
    mOverlayView.setCropGridColor(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_grid)));
    mOverlayView.setCropGridStrokeWidth(intent.getIntExtra(UCrop.Options.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width)));

    // Aspect ratio options
    float aspectRatioX = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_X, 0);
    float aspectRatioY = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_Y, 0);

    int aspectRationSelectedByDefault = intent.getIntExtra(UCrop.Options.EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT, 0);
    ArrayList<AspectRatio> aspectRatioList = intent.getParcelableArrayListExtra(UCrop.Options.EXTRA_ASPECT_RATIO_OPTIONS);

    if (aspectRatioX > 0 && aspectRatioY > 0) {
        if (mWrapperStateAspectRatio != null) {
            mWrapperStateAspectRatio.setVisibility(View.GONE);
        }
        mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY);
    } else if (aspectRatioList != null && aspectRationSelectedByDefault < aspectRatioList.size()) {
        mGestureCropImageView.setTargetAspectRatio(aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioX() /
                aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioY());
    } else {
        mGestureCropImageView.setTargetAspectRatio(CropImageView.SOURCE_IMAGE_ASPECT_RATIO);
    }

    // Result bitmap max size options
    int maxSizeX = intent.getIntExtra(UCrop.EXTRA_MAX_SIZE_X, 0);
    int maxSizeY = intent.getIntExtra(UCrop.EXTRA_MAX_SIZE_Y, 0);

    if (maxSizeX > 0 && maxSizeY > 0) {
        mGestureCropImageView.setMaxResultImageSizeX(maxSizeX);
        mGestureCropImageView.setMaxResultImageSizeY(maxSizeY);
    }
}
 
Example 16
Source File: WalletFragment.java    From tron-wallet-android with Apache License 2.0 4 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    mTRX_price = intent.getFloatExtra("tron_price", 0.0f);
    mTRX_24hChange = intent.getFloatExtra("tron_24h_change", 0.0f);
    onPricesUpdated();
}
 
Example 17
Source File: PictureMultiCuttingActivity.java    From Matisse-Kotlin with Apache License 2.0 4 votes vote down vote up
/**
 * This method extracts {@link UCrop.Options #optionsBundle} from incoming intent
 * and setups Activity, {@link OverlayView} and {@link CropImageView} properly.
 */
@SuppressWarnings("deprecation")
private void processOptions(@NonNull Intent intent) {
    // Bitmap compression options
    String compressionFormatName = intent.getStringExtra(UCropMulti.Options.EXTRA_COMPRESSION_FORMAT_NAME);
    Bitmap.CompressFormat compressFormat = null;
    if (!TextUtils.isEmpty(compressionFormatName)) {
        compressFormat = Bitmap.CompressFormat.valueOf(compressionFormatName);
    }
    mCompressFormat = (compressFormat == null) ? DEFAULT_COMPRESS_FORMAT : compressFormat;

    mCompressQuality = intent.getIntExtra(UCrop.Options.EXTRA_COMPRESSION_QUALITY, PictureMultiCuttingActivity.DEFAULT_COMPRESS_QUALITY);

    // Gestures options
    int[] allowedGestures = intent.getIntArrayExtra(UCropMulti.Options.EXTRA_ALLOWED_GESTURES);
    if (allowedGestures != null && allowedGestures.length == TABS_COUNT) {
        mAllowedGestures = allowedGestures;
    }

    // Crop image view options
    mGestureCropImageView.setMaxBitmapSize(intent.getIntExtra(UCropMulti.Options.EXTRA_MAX_BITMAP_SIZE, CropImageView.DEFAULT_MAX_BITMAP_SIZE));
    mGestureCropImageView.setMaxScaleMultiplier(intent.getFloatExtra(UCropMulti.Options.EXTRA_MAX_SCALE_MULTIPLIER, CropImageView.DEFAULT_MAX_SCALE_MULTIPLIER));
    mGestureCropImageView.setImageToWrapCropBoundsAnimDuration(intent.getIntExtra(UCropMulti.Options.EXTRA_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION, CropImageView.DEFAULT_IMAGE_TO_CROP_BOUNDS_ANIM_DURATION));

    // Overlay view options
    mOverlayView.setDragFrame(isDragFrame);
    mOverlayView.setFreestyleCropEnabled(intent.getBooleanExtra(UCropMulti.Options.EXTRA_FREE_STYLE_CROP, false));
    circleDimmedLayer = intent.getBooleanExtra(UCropMulti.Options.EXTRA_CIRCLE_DIMMED_LAYER, OverlayView.DEFAULT_CIRCLE_DIMMED_LAYER);
    mOverlayView.setDimmedColor(intent.getIntExtra(UCropMulti.Options.EXTRA_DIMMED_LAYER_COLOR, getResources().getColor(R.color.ucrop_color_default_dimmed)));
    mOverlayView.setCircleDimmedLayer(circleDimmedLayer);

    mOverlayView.setShowCropFrame(intent.getBooleanExtra(UCropMulti.Options.EXTRA_SHOW_CROP_FRAME, OverlayView.DEFAULT_SHOW_CROP_FRAME));
    mOverlayView.setCropFrameColor(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_FRAME_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_frame)));
    mOverlayView.setCropFrameStrokeWidth(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_FRAME_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_frame_stoke_width)));

    mOverlayView.setShowCropGrid(intent.getBooleanExtra(UCropMulti.Options.EXTRA_SHOW_CROP_GRID, OverlayView.DEFAULT_SHOW_CROP_GRID));
    mOverlayView.setCropGridRowCount(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_GRID_ROW_COUNT, OverlayView.DEFAULT_CROP_GRID_ROW_COUNT));
    mOverlayView.setCropGridColumnCount(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_GRID_COLUMN_COUNT, OverlayView.DEFAULT_CROP_GRID_COLUMN_COUNT));
    mOverlayView.setCropGridColor(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_GRID_COLOR, getResources().getColor(R.color.ucrop_color_default_crop_grid)));
    mOverlayView.setCropGridStrokeWidth(intent.getIntExtra(UCropMulti.Options.EXTRA_CROP_GRID_STROKE_WIDTH, getResources().getDimensionPixelSize(R.dimen.ucrop_default_crop_grid_stoke_width)));

    // Aspect ratio options
    float aspectRatioX = intent.getFloatExtra(UCropMulti.EXTRA_ASPECT_RATIO_X, 0);
    float aspectRatioY = intent.getFloatExtra(UCropMulti.EXTRA_ASPECT_RATIO_Y, 0);

    int aspectRationSelectedByDefault = intent.getIntExtra(UCropMulti.Options.EXTRA_ASPECT_RATIO_SELECTED_BY_DEFAULT, 0);
    ArrayList<AspectRatio> aspectRatioList = intent.getParcelableArrayListExtra(UCropMulti.Options.EXTRA_ASPECT_RATIO_OPTIONS);

    if (aspectRatioX > 0 && aspectRatioY > 0) {
        mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY);
    } else if (aspectRatioList != null && aspectRationSelectedByDefault < aspectRatioList.size()) {
        mGestureCropImageView.setTargetAspectRatio(aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioX() /
                aspectRatioList.get(aspectRationSelectedByDefault).getAspectRatioY());
    } else {
        mGestureCropImageView.setTargetAspectRatio(CropImageView.SOURCE_IMAGE_ASPECT_RATIO);
    }

    // Result bitmap max size options
    int maxSizeX = intent.getIntExtra(UCropMulti.EXTRA_MAX_SIZE_X, 0);
    int maxSizeY = intent.getIntExtra(UCropMulti.EXTRA_MAX_SIZE_Y, 0);

    if (maxSizeX > 0 && maxSizeY > 0) {
        mGestureCropImageView.setMaxResultImageSizeX(maxSizeX);
        mGestureCropImageView.setMaxResultImageSizeY(maxSizeY);
    }
}
 
Example 18
Source File: AppViewActivity.java    From aptoide-client with GNU General Public License v2.0 4 votes vote down vote up
private void continueLoading() {
    final Intent intent = getActivity().getIntent();
    if (intent.getBooleanExtra(Constants.FROM_RELATED_KEY, false)) {
        appId = intent.getLongExtra(Constants.APP_ID_KEY, 0);
        md5sum = intent.getStringExtra(Constants.MD5SUM_KEY);
        appName = intent.getStringExtra(Constants.APPNAME_KEY);
        iconUrl = intent.getStringExtra(Constants.ICON_KEY);
        downloads = intent.getLongExtra(Constants.DOWNLOADS_KEY, 0);
        rating = intent.getFloatExtra(Constants.RATING_KEY, 0.0f);
        graphic = intent.getStringExtra(Constants.GRAPHIC_KEY);
        fileSize = intent.getLongExtra(Constants.FILESIZE_KEY, 0);
        storeId = intent.getLongExtra(Constants.STOREID_KEY, 0);
        storeName = intent.getStringExtra(Constants.STORENAME_KEY);
        packageName = intent.getStringExtra(Constants.PACKAGENAME_KEY);
        versionName = intent.getStringExtra(Constants.VERSIONNAME_KEY);

        executeSpiceRequestWithAppId(appId, storeName, packageName);
    } else if (intent.getBooleanExtra(Constants.FROM_SPONSORED_KEY, false)) {
        fromSponsored = true;
        appId = intent.getLongExtra(Constants.APP_ID_KEY, -1);
        adId = intent.getLongExtra(Constants.AD_ID_KEY, -1);
        packageName = intent.getStringExtra(Constants.PACKAGENAME_KEY);
        storeName = intent.getStringExtra(Constants.STORENAME_KEY);
        appName = intent.getStringExtra(Constants.APPNAME_KEY);
        String location = intent.getStringExtra(Constants.LOCATION_KEY);
        String keyword = intent.getStringExtra(Constants.KEYWORD_KEY);
        String cpc = intent.getStringExtra(Constants.CPC_KEY);
        String cpi = intent.getStringExtra(Constants.CPI_KEY);
        cpd = intent.getStringExtra(Constants.CPD_KEY);
        String whereFrom = intent.getStringExtra(Constants.WHERE_FROM_KEY);
        download_from = intent.getStringExtra(Constants.DOWNLOAD_FROM_KEY);

        executeSpiceRequestWithAppId(appId, storeName, packageName);
        AptoideUtils.AdNetworks.knock(cpc);

        if (intent.hasExtra("partnerExtra")) {
            final String clickUrl = intent.getBundleExtra("partnerExtra").getString("partnerClickUrl");
            ReferrerUtils.extractReferrer(packageName, appId, adId, -1, clickUrl, spiceManager, null, ReferrerUtils.RETRIES);
        }
    } else if (intent.getBooleanExtra(Constants.ROLLBACK_FROM_KEY, false)) {
        md5sum = intent.getStringExtra(Constants.MD5SUM_KEY);

        executeSpiceRequestWithMd5(md5sum, storeName);
    } else if (intent.getBooleanExtra(Constants.FROM_TIMELINE_KEY, false)) {  // From Timeline
        appName = intent.getStringExtra(Constants.APPNAME_KEY);
        storeName = intent.getStringExtra(Constants.STORENAME_KEY);
        md5sum = intent.getStringExtra(Constants.MD5SUM_KEY);

        executeSpiceRequestWithMd5(md5sum, storeName);
    } else if (intent.getBooleanExtra(Constants.FROM_COMMENT_KEY, false)) {
        appId = intent.getLongExtra(Constants.APP_ID_KEY, 0);
        appName = intent.getStringExtra(Constants.APPNAME_KEY);

        executeSpiceRequestWithAppId(appId, storeName, null);
    } else if (intent.getBooleanExtra("fromApkInstaller", false)) {
        autoDownload = true;
        appId = intent.getLongExtra(Constants.APP_ID_KEY, 0);
        appName = intent.getStringExtra(Constants.APPNAME_KEY);
        storeName = intent.getStringExtra(Constants.STORENAME_KEY);
        packageName = intent.getStringExtra(Constants.PACKAGENAME_KEY);

        executeSpiceRequestWithAppId(appId, storeName, packageName);
    } else if (intent.getBooleanExtra(Constants.GET_BACKUP_APPS_KEY, false)) {
        packageName = Defaults.BACKUP_APPS_PACKAGE;
        appName = Defaults.BACKUP_APPS_NAME;

        executeSpiceRequestWithPackageName(packageName, appName);
    } else if (intent.getBooleanExtra(Constants.FROM_MY_APP_KEY, false)) { // from browser
        appId = intent.getLongExtra(Constants.APP_ID_KEY, 0);

        executeSpiceRequestWithAppId(appId, storeName, packageName);
    } else if (intent.getBooleanExtra(Constants.SEARCH_FROM_KEY, false)) { // from search inside app
        appName = intent.getStringExtra(Constants.APPNAME_KEY);
        md5sum = intent.getStringExtra(Constants.MD5SUM_KEY);
        storeName = intent.getStringExtra(Constants.STORENAME_KEY);

        executeSpiceRequestWithMd5(md5sum, storeName);
    } else if (intent.getBooleanExtra(Constants.UPDATE_FROM_KEY, false)) {
        iconUrl = intent.getStringExtra(Constants.ICON_KEY);
        appName = intent.getStringExtra(Constants.APPNAME_KEY);
        versionName = intent.getStringExtra(Constants.VERSIONNAME_KEY);
        packageName = intent.getStringExtra(Constants.PACKAGENAME_KEY);
        md5sum = intent.getStringExtra(Constants.MD5SUM_KEY);
        storeName = intent.getStringExtra(Constants.STORENAME_KEY);

        executeSpiceRequestWithMd5(md5sum, storeName);
    } else if (intent.getBooleanExtra(Constants.MARKET_INTENT, false)) {
        packageName = intent.getStringExtra(Constants.PACKAGENAME_KEY);

        executeSpiceRequestWithPackageName(packageName, null);
    }


    mCollapsingToolbarLayout.setTitle(appName);
}
 
Example 19
Source File: UCrop.java    From Matisse-Kotlin with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieve cropped image aspect ratio from the result Intent
 *
 * @param intent crop result intent
 * @return aspect ratio as a floating point value (x:y) - so it will be 1 for 1:1 or 4/3 for 4:3
 */
public static float getOutputCropAspectRatio(@NonNull Intent intent) {
    return intent.getFloatExtra(EXTRA_OUTPUT_CROP_ASPECT_RATIO, 1);
}
 
Example 20
Source File: UCrop.java    From EasyPhotos with Apache License 2.0 2 votes vote down vote up
/**
 * Retrieve cropped image aspect ratio from the result Intent
 *
 * @param intent crop result intent
 * @return aspect ratio as a floating point value (x:y) - so it will be 1 for 1:1 or 4/3 for 4:3
 */
public static float getOutputCropAspectRatio(@NonNull Intent intent) {
    return intent.getFloatExtra(EXTRA_OUTPUT_CROP_ASPECT_RATIO, 0f);
}