当前位置: 首页>>代码示例>>Java>>正文


Java Intent.getFloatExtra方法代码示例

本文整理汇总了Java中android.content.Intent.getFloatExtra方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getFloatExtra方法的具体用法?Java Intent.getFloatExtra怎么用?Java Intent.getFloatExtra使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.getFloatExtra方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@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 float totalDistance = intent.getFloatExtra(RSCService.EXTRA_TOTAL_DISTANCE, RSCManagerCallbacks.NOT_AVAILABLE);
		final int activity = intent.getIntExtra(RSCService.EXTRA_ACTIVITY, RSCManagerCallbacks.ACTIVITY_WALKING);
		// Update GUI
		onMeasurementReceived(speed, cadence, totalDistance, activity);
	} else if (RSCService.BROADCAST_STRIDES_UPDATE.equals(action)) {
		final int strides = intent.getIntExtra(RSCService.EXTRA_STRIDES, 0);
		final float distance = intent.getFloatExtra(RSCService.EXTRA_DISTANCE, 0);
		// Update GUI
		onStripesUpdate(distance, strides);
	}
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:19,代码来源:RSCActivity.java

示例2: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(final Context context, final Intent intent) {
	final String action = intent.getAction();

	if (CSCService.BROADCAST_WHEEL_DATA.equals(action)) {
		final float speed = intent.getFloatExtra(CSCService.EXTRA_SPEED, 0.0f); // [m/s]
		final float distance = intent.getFloatExtra(CSCService.EXTRA_DISTANCE, CSCManagerCallbacks.NOT_AVAILABLE);
		final float totalDistance = intent.getFloatExtra(CSCService.EXTRA_TOTAL_DISTANCE, CSCManagerCallbacks.NOT_AVAILABLE);
		// Update GUI
		onMeasurementReceived(speed, distance, totalDistance);
	} else if (CSCService.BROADCAST_CRANK_DATA.equals(action)) {
		final float ratio = intent.getFloatExtra(CSCService.EXTRA_GEAR_RATIO, 0);
		final int cadence = intent.getIntExtra(CSCService.EXTRA_CADENCE, 0);
		// Update GUI
		onGearRatioUpdate(ratio, cadence);
	}
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:18,代码来源:CSCActivity.java

示例3: initActivityAnimation

import android.content.Intent; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:SebastianRask,项目名称:Pocket-Plays-for-Twitch,代码行数:24,代码来源:MainActivity.java

示例4: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    try {
        float fRemoteWeight = intent.getFloatExtra("floatScaleWeight", 0.0f);
        String sRemoteUnit = intent.getStringExtra("stringScaleUnit");

        // Assume KG as the default unit
        if ((sRemoteUnit == null ) || (sRemoteUnit.length() < 1)){
            sRemoteUnit = "KG";
        } else {
            sRemoteUnit = sRemoteUnit.toUpperCase();
        }
        Log.d(TAG, "RemoteScale Data Received: " + fRemoteWeight + " " + sRemoteUnit);

        // Update the on Screen Display
        mWeight.setText(Float.toString(fRemoteWeight));
        mWeightUnit.setText(sRemoteUnit);

        // Save the data so we can record it if the user taps a waste stream button
        ScaleMeasurement.Builder measurementBuilder = new ScaleMeasurement.Builder();
        measurementBuilder.rawScaleWeight(fRemoteWeight);
        measurementBuilder.scaleWeight(fRemoteWeight);
        measurementBuilder.units(sRemoteUnit);
        mLatestScaleMeasurement = measurementBuilder.build();

    }  catch (Exception e) {
        Log.e(TAG, "REMOTE DATA BROADCAST RECEIVER ERROR: " + e.getMessage());
    }
}
 
开发者ID:etsy,项目名称:divertsy-client,代码行数:30,代码来源:MainActivity.java

示例5: setupViews

import android.content.Intent; //导入方法依赖的package包/类
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);
}
 
开发者ID:fengzhizi715,项目名称:Tess-TwoDemo,代码行数:8,代码来源:CameraActivity.java

示例6: onCreate

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    Handler handler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) {
            if(msg.what == DELAYED_MESSAGE) {
                UpdateScreenBrightness.this.finish();

            }
            return false;
        }

    });

    Intent brightnessIntent = this.getIntent();
    float brightness = brightnessIntent.getFloatExtra("brightness value", 0);
    WindowManager.LayoutParams lp = getWindow().getAttributes();
    lp.screenBrightness = brightness;
    getWindow().setAttributes(lp);

    Message message = handler.obtainMessage(DELAYED_MESSAGE);
    //this next line is very important, you need to finish your activity with slight delay
    handler.sendMessageDelayed(message,1);
}
 
开发者ID:hamedbaatour,项目名称:cSun,代码行数:28,代码来源:UpdateScreenBrightness.java

示例7: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onActivityResult(int requestcode, int resultCode, Intent data) {
    super.onActivityResult(requestcode, resultCode, data);
    if (resultCode == RESULT) {
        if (data.getFloatExtra(CustomValueKey, 0) != 0)
            EmptyInput(data.getFloatExtra(CustomValueKey, 0));
    }
}
 
开发者ID:coder3101,项目名称:Matrix-Calculator-for-Android,代码行数:9,代码来源:FillingMatrix.java

示例8: setImageData

import android.content.Intent; //导入方法依赖的package包/类
private void setImageData(@NonNull Intent intent) {
    Uri inputUri = (Uri) intent.getParcelableExtra(UCrop.EXTRA_INPUT_URI);
    this.mOutputUri = (Uri) intent.getParcelableExtra(UCrop.EXTRA_OUTPUT_URI);
    processOptions(intent);
    if (inputUri == null || this.mOutputUri == null) {
        setResultException(new NullPointerException(getString(R.string
                .ucrop_error_input_data_is_absent)));
        finish();
    } else {
        try {
            this.mGestureCropImageView.setImageUri(inputUri);
        } catch (Exception e) {
            setResultException(e);
            finish();
        }
    }
    if (intent.getBooleanExtra(UCrop.EXTRA_ASPECT_RATIO_SET, false)) {
        this.mWrapperStateAspectRatio.setVisibility(8);
        float aspectRatioX = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_X, 0.0f);
        float aspectRatioY = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_Y, 0.0f);
        if (aspectRatioX <= 0.0f || aspectRatioY <= 0.0f) {
            this.mGestureCropImageView.setTargetAspectRatio(0.0f);
        } else {
            this.mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY);
        }
    }
    if (intent.getBooleanExtra(UCrop.EXTRA_MAX_SIZE_SET, false)) {
        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) {
            Log.w(TAG, "EXTRA_MAX_SIZE_X and EXTRA_MAX_SIZE_Y must be greater than 0");
            return;
        }
        this.mGestureCropImageView.setMaxResultImageSizeX(maxSizeX);
        this.mGestureCropImageView.setMaxResultImageSizeY(maxSizeY);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:38,代码来源:UCropActivity.java

示例9: onReceive

import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
   if (intent.getAction().equals(IncreasingRingPreference.ACTION_INCREASING_RING_CHANGED) &&
           intent.getIntExtra(IncreasingRingPreference.EXTRA_STREAM_TYPE, -1) ==
               AudioManager.STREAM_RING) {
       mRingerConfig.enabled = intent.getBooleanExtra(
               IncreasingRingPreference.EXTRA_ENABLED, false);
       mRingerConfig.minVolume = intent.getFloatExtra(
               IncreasingRingPreference.EXTRA_MIN_VOLUME, 0.1f);
       mRingerConfig.rampUpDuration = intent.getIntExtra(
               IncreasingRingPreference.EXTRA_RAMP_UP_DURATION, 10);
       if (DEBUG) log(mRingerConfig.toString());
   }
}
 
开发者ID:WrBug,项目名称:GravityBox,代码行数:15,代码来源:ModRinger.java

示例10: setImageData

import android.content.Intent; //导入方法依赖的package包/类
/**
 * This method extracts all data from the incoming intent and setups views properly.
 */
private void setImageData(@NonNull Intent intent) {
    Uri inputUri = intent.getParcelableExtra(UCrop.EXTRA_INPUT_URI);
    mOutputUri = intent.getParcelableExtra(UCrop.EXTRA_OUTPUT_URI);
    processOptions(intent);

    if (inputUri != null && mOutputUri != null) {
        try {
            mGestureCropImageView.setImageUri(inputUri, mOutputUri);
        } catch (Exception e) {
            setResultException(e);
            finish();
        }
    } else {
        setResultException(new NullPointerException(getString(R.string.ucrop_error_input_data_is_absent)));
        finish();
    }

    if (intent.getBooleanExtra(UCrop.EXTRA_ASPECT_RATIO_SET, false)) {
        if (mShowBottomControls) {
            mWrapperStateAspectRatio.setVisibility(View.GONE);
        }

        float aspectRatioX = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_X, 0);
        float aspectRatioY = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_Y, 0);

        if (aspectRatioX > 0 && aspectRatioY > 0) {
            mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY);
        } else {
            mGestureCropImageView.setTargetAspectRatio(CropImageView.SOURCE_IMAGE_ASPECT_RATIO);
        }
    }

    if (intent.getBooleanExtra(UCrop.EXTRA_MAX_SIZE_SET, false)) {
        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);
        } else {
            Log.w(TAG, "EXTRA_MAX_SIZE_X and EXTRA_MAX_SIZE_Y must be greater than 0");
        }
    }
}
 
开发者ID:BrandonVargas,项目名称:AndroidOCRFforID,代码行数:48,代码来源:UCropActivity.java

示例11: setImageData

import android.content.Intent; //导入方法依赖的package包/类
private void setImageData(Intent intent) {
    Uri inputUri = intent.getParcelableExtra(UCrop.EXTRA_INPUT_URI);
    mOutputUri = intent.getParcelableExtra(UCrop.EXTRA_OUTPUT_URI);

    if (inputUri != null && mOutputUri != null) {
        try {
            mGestureCropImageView.setImageUri(inputUri);
        } catch (Exception e) {
            setResultException(e);
            finish();
        }
    } else {
        setResultException(new NullPointerException("Both input and output Uri must be specified"));
        finish();
    }

    // 设置裁剪宽高比
    if (intent.getBooleanExtra(UCrop.EXTRA_ASPECT_RATIO_SET, false)) {
        float aspectRatioX = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_X, 0);
        float aspectRatioY = intent.getFloatExtra(UCrop.EXTRA_ASPECT_RATIO_Y, 0);

        if (aspectRatioX > 0 && aspectRatioY > 0) {
            mGestureCropImageView.setTargetAspectRatio(aspectRatioX / aspectRatioY);
        } else {
            mGestureCropImageView.setTargetAspectRatio(CropImageView.SOURCE_IMAGE_ASPECT_RATIO);
        }
    }

    // 设置裁剪的最大宽高
    if (intent.getBooleanExtra(UCrop.EXTRA_MAX_SIZE_SET, false)) {
        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);
        } else {
            Log.w(TAG, "EXTRA_MAX_SIZE_X and EXTRA_MAX_SIZE_Y must be greater than 0");
        }
    }
}
 
开发者ID:GitPhoenix,项目名称:VanGogh,代码行数:42,代码来源:VanCropActivity.java


注:本文中的android.content.Intent.getFloatExtra方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。