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


Java Config类代码示例

本文整理汇总了Java中cn.hugo.android.scanner.config.Config的典型用法代码示例。如果您正苦于以下问题:Java Config类的具体用法?Java Config怎么用?Java Config使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Config类属于cn.hugo.android.scanner.config包,在下文中一共展示了Config类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AutoFocusManager

import cn.hugo.android.scanner.config.Config; //导入依赖的package包/类
AutoFocusManager(Context context, Camera camera) {
	this.camera = camera;
	SharedPreferences sharedPrefs = PreferenceManager
			.getDefaultSharedPreferences(context);
	String currentFocusMode = camera.getParameters().getFocusMode();
	useAutoFocus = sharedPrefs.getBoolean(Config.KEY_AUTO_FOCUS, true)
			&& FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
	Log.i(TAG, "Current focus mode '" + currentFocusMode
			+ "'; use auto focus? " + useAutoFocus);
	start();
}
 
开发者ID:oneapp1e,项目名称:BarcodeScanner,代码行数:12,代码来源:AutoFocusManager.java

示例2: DecodeThread

import cn.hugo.android.scanner.config.Config; //导入依赖的package包/类
DecodeThread(CaptureActivity activity,
		Collection<BarcodeFormat> decodeFormats,
		Map<DecodeHintType, ?> baseHints, String characterSet,
		ResultPointCallback resultPointCallback) {

	this.activity = activity;
	handlerInitLatch = new CountDownLatch(1);

	hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);
	if (baseHints != null) {
		hints.putAll(baseHints);
	}

	// The prefs can't change while the thread is running, so pick them up
	// once here.
	if (decodeFormats == null || decodeFormats.isEmpty()) {
		SharedPreferences prefs = PreferenceManager
				.getDefaultSharedPreferences(activity);
		decodeFormats = EnumSet.noneOf(BarcodeFormat.class);
		if (prefs.getBoolean(Config.KEY_DECODE_1D, false)) {
			decodeFormats.addAll(DecodeFormatManager.ONE_D_FORMATS);
		}
		if (prefs.getBoolean(Config.KEY_DECODE_QR, false)) {
			decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
		}
		if (prefs.getBoolean(Config.KEY_DECODE_DATA_MATRIX,
				false)) {
			decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
		}
	}
	hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

	if (characterSet != null) {
		hints.put(DecodeHintType.CHARACTER_SET, characterSet);
	}
	hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK,
			resultPointCallback);
	Log.i("DecodeThread", "Hints: " + hints);
}
 
开发者ID:oneapp1e,项目名称:BarcodeScanner,代码行数:40,代码来源:DecodeThread.java

示例3: updatePrefs

import cn.hugo.android.scanner.config.Config; //导入依赖的package包/类
/**
 * 扫描成功后可以播放提示音并震动,这两种功能都是用户自定义的 在Barcode Scanner中点击菜单键,点设置即可看到这两项的设置
 */
synchronized void updatePrefs() {
	SharedPreferences prefs = PreferenceManager
			.getDefaultSharedPreferences(activity);
	playBeep = shouldBeep(prefs, activity);
	vibrate = prefs.getBoolean(Config.KEY_VIBRATE, false);
	if (playBeep && mediaPlayer == null) {
		// The volume on STREAM_SYSTEM is not adjustable, and users found it
		// too loud,
		// so we now play on the music stream.
		activity.setVolumeControlStream(AudioManager.STREAM_MUSIC);
		mediaPlayer = buildMediaPlayer(activity);
	}
}
 
开发者ID:oneapp1e,项目名称:BarcodeScanner,代码行数:17,代码来源:BeepManager.java

示例4: shouldBeep

import cn.hugo.android.scanner.config.Config; //导入依赖的package包/类
private static boolean shouldBeep(SharedPreferences prefs, Context activity) {
	boolean shouldPlayBeep = prefs.getBoolean(Config.KEY_PLAY_BEEP, true);
	if (shouldPlayBeep) {
		// See if sound settings overrides this
		AudioManager audioService = (AudioManager) activity
				.getSystemService(Context.AUDIO_SERVICE);
		if (audioService.getRingerMode() != AudioManager.RINGER_MODE_NORMAL) {
			shouldPlayBeep = false;
		}
	}
	return shouldPlayBeep;
}
 
开发者ID:oneapp1e,项目名称:BarcodeScanner,代码行数:13,代码来源:BeepManager.java

示例5: setDesiredCameraParameters

import cn.hugo.android.scanner.config.Config; //导入依赖的package包/类
void setDesiredCameraParameters(Camera camera, boolean safeMode) {
	Camera.Parameters parameters = camera.getParameters();

	if (parameters == null) {
		Log.w(TAG,
				"Device error: no camera parameters are available. Proceeding without configuration.");
		return;
	}

	Log.i(TAG, "Initial camera parameters: " + parameters.flatten());

	if (safeMode) {
		Log.w(TAG,
				"In camera config safe mode -- most settings will not be honored");
	}

	SharedPreferences prefs = PreferenceManager
			.getDefaultSharedPreferences(context);

	// 初始化闪光灯
	initializeTorch(parameters, prefs, safeMode);

	// 默认使用自动对焦
	String focusMode = findSettableValue(
			parameters.getSupportedFocusModes(),
			Camera.Parameters.FOCUS_MODE_AUTO);

	// Maybe selected auto-focus but not available, so fall through here:
	if (!safeMode && focusMode == null) {
		focusMode = findSettableValue(parameters.getSupportedFocusModes(),
				Camera.Parameters.FOCUS_MODE_MACRO,
				Camera.Parameters.FOCUS_MODE_EDOF);
	}
	if (focusMode != null) {
		parameters.setFocusMode(focusMode);
	}

	if (prefs.getBoolean(Config.KEY_INVERT_SCAN, false)) {
		String colorMode = findSettableValue(
				parameters.getSupportedColorEffects(),
				Camera.Parameters.EFFECT_NEGATIVE);
		if (colorMode != null) {
			parameters.setColorEffect(colorMode);
		}
	}

	parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
	camera.setParameters(parameters);

	Camera.Parameters afterParameters = camera.getParameters();
	Camera.Size afterSize = afterParameters.getPreviewSize();
	if (afterSize != null
			&& (cameraResolution.x != afterSize.width || cameraResolution.y != afterSize.height)) {
		Log.w(TAG, "Camera said it supported preview size "
				+ cameraResolution.x + 'x' + cameraResolution.y
				+ ", but after setting it, preview size is "
				+ afterSize.width + 'x' + afterSize.height);
		cameraResolution.x = afterSize.width;
		cameraResolution.y = afterSize.height;
	}

	camera.setDisplayOrientation(90);
}
 
开发者ID:oneapp1e,项目名称:BarcodeScanner,代码行数:64,代码来源:CameraConfigurationManager.java


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