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


Java KeyEvent.KEYCODE_FOCUS属性代码示例

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


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

示例1: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_BACK:
            setResult(RESULT_CANCELED);
            finish();
            return true;
        case KeyEvent.KEYCODE_FOCUS:
        case KeyEvent.KEYCODE_CAMERA:
            // Handle these events so they don't launch the Camera app
            return true;
        // Use volume up/down to turn on light
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            cameraManager.setTorch(false);
            return true;
        case KeyEvent.KEYCODE_VOLUME_UP:
            cameraManager.setTorch(true);
            return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:kkyflying,项目名称:CodeScaner,代码行数:21,代码来源:CaptureActivity.java

示例2: onKeyDown

/**
 * Handles focus, camera, volume up and volume down keys.
 * <p>
 * Note that this view is not usually focused, so the Activity should call this directly.
 */
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_FOCUS:
        case KeyEvent.KEYCODE_CAMERA:
            // Handle these events so they don't launch the Camera app
            return true;
        // Use volume up/down to turn on light
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            setTorchOff();
            return true;
        case KeyEvent.KEYCODE_VOLUME_UP:
            setTorchOn();
            return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:yinhaojun,项目名称:ZxingForAndroid,代码行数:22,代码来源:DecoratedBarcodeView.java

示例3: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_BACK:
            restartPreviewAfterDelay(0L);
            return true;
        case KeyEvent.KEYCODE_FOCUS:
        case KeyEvent.KEYCODE_CAMERA:
            // Handle these events so they don't launch the Camera app
            return true;
        // Use volume up/down to turn on light
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            cameraManager.setTorch(false);
            return true;
        case KeyEvent.KEYCODE_VOLUME_UP:
            cameraManager.setTorch(true);
            return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:10045125,项目名称:QrCode,代码行数:20,代码来源:QrCodeView.java

示例4: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        if (source == Source.NATIVE_APP_INTENT) {
            setResult(RESULT_CANCELED);
            finish();
            return true;
        } else if ((source == Source.NONE || source == Source.ZXING_LINK) && lastResult != null) {
            resetStatusView();
            if (handler != null) {
                handler.sendEmptyMessage(R.id.restart_preview);
            }
            return true;
        }
    } else if (keyCode == KeyEvent.KEYCODE_FOCUS || keyCode == KeyEvent.KEYCODE_CAMERA) {
        // Handle these events so they don't launch the Camera app
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:guzhigang001,项目名称:Zxing,代码行数:20,代码来源:CaptureActivity.java

示例5: onKeyDown

@Override
public boolean onKeyDown(final int keyCode, final KeyEvent event) {
    switch (keyCode) {
    case KeyEvent.KEYCODE_FOCUS:
    case KeyEvent.KEYCODE_CAMERA:
        // don't launch camera app
        return true;
    case KeyEvent.KEYCODE_VOLUME_DOWN:
    case KeyEvent.KEYCODE_VOLUME_UP:
        cameraHandler.post(new Runnable() {
            @Override
            public void run() {
                cameraManager.setTorch(keyCode == KeyEvent.KEYCODE_VOLUME_UP);
            }
        });
        return true;
    }

    return super.onKeyDown(keyCode, event);
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:20,代码来源:ScanActivity.java

示例6: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
  switch (keyCode) {
    case KeyEvent.KEYCODE_BACK:
      if (source == IntentSource.NATIVE_APP_INTENT) {
        setResult(RESULT_CANCELED);
        finish();
        return true;
      }
      if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
        restartPreviewAfterDelay(0L);
        return true;
      }
      break;
    case KeyEvent.KEYCODE_FOCUS:
    case KeyEvent.KEYCODE_CAMERA:
      // Handle these events so they don't launch the Camera app
      return true;
    // Use volume up/down to turn on light
    case KeyEvent.KEYCODE_VOLUME_DOWN:
      cameraManager.setTorch(false);
      return true;
    case KeyEvent.KEYCODE_VOLUME_UP:
      cameraManager.setTorch(true);
      return true;
  }
  return super.onKeyDown(keyCode, event);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:28,代码来源:CaptureActivity.java

示例7: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
	switch (keyCode) {
	case KeyEvent.KEYCODE_BACK:
		if (source == IntentSource.NATIVE_APP_INTENT) {
			setResult(RESULT_CANCELED);
			finish();
			return true;
		}
		if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK)
				&& lastResult != null) {
			restartPreviewAfterDelay(0L);
			return true;
		}
		break;
	case KeyEvent.KEYCODE_FOCUS:
	case KeyEvent.KEYCODE_CAMERA:
		// Handle these events so they don't launch the Camera app
		return true;
		// Use volume up/down to turn on light
	case KeyEvent.KEYCODE_VOLUME_DOWN:
		cameraManager.setTorch(false);
		return true;
	case KeyEvent.KEYCODE_VOLUME_UP:
		cameraManager.setTorch(true);
		return true;
	}
	return super.onKeyDown(keyCode, event);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:29,代码来源:CaptureActivity.java

示例8: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_BACK:
            if (source == IntentSource.NATIVE_APP_INTENT) {
                setResult(RESULT_CANCELED);
                finish();
                return true;
            }
            if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK) && lastResult != null) {
                restartPreviewAfterDelay(0L);
                return true;
            }
            break;
        case KeyEvent.KEYCODE_FOCUS:
        case KeyEvent.KEYCODE_CAMERA:
            // Handle these events so they don't launch the Camera app
            return true;
        // Use volume up/down to turn on light
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            cameraManager.setTorch(false);
            return true;
        case KeyEvent.KEYCODE_VOLUME_UP:
            cameraManager.setTorch(true);
            return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:xiong-it,项目名称:ZXingAndroidExt,代码行数:28,代码来源:QrCodeScannerActivity.java

示例9: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {

        // First check if we're paused in continuous mode, and if so, just unpause.
        if (isPaused) {
            Log.d(TAG, "only resuming continuous recognition, not quitting...");
            resumeContinuousDecoding();
            return true;
        }

        // Exit the app if we're not viewing an OCR result.
        if (lastResult == null) {
            setResult(RESULT_CANCELED);
            finish();
            return true;
        } else {
            // Go back to previewing in regular OCR mode.
            resetStatusView();
            if (handler != null) {
                handler.sendEmptyMessage(R.id.restart_preview);
            }
            return true;
        }
    } else if (keyCode == KeyEvent.KEYCODE_CAMERA) {
        if (isContinuousModeActive) {
            onShutterButtonPressContinuous();
        } else {
            handler.hardwareShutterButtonClick();
        }
        return true;
    } else if (keyCode == KeyEvent.KEYCODE_FOCUS) {
        // Only perform autofocus if user is not holding down the button.
        if (event.getRepeatCount() == 0) {
            cameraManager.requestAutoFocus(500L);
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:mercuriete,项目名称:android-mrz-reader,代码行数:40,代码来源:CaptureActivity.java

示例10: onKeyDown

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
        case KeyEvent.KEYCODE_BACK:
            if (source == IntentSource.NATIVE_APP_INTENT) {
                setResult(RESULT_CANCELED);
                finish();
                return true;
            }
            if ((source == IntentSource.NONE || source == IntentSource.ZXING_LINK)
                    && lastResult != null) {
                restartPreviewAfterDelay(0L);
                return true;
            }
            break;
        case KeyEvent.KEYCODE_FOCUS:
        case KeyEvent.KEYCODE_CAMERA:
            // Handle these events so they don't launch the Camera app
            return true;
        // Use volume up/down to turn on light
        case KeyEvent.KEYCODE_VOLUME_DOWN:
            cameraManager.setTorch(false);
            return true;
        case KeyEvent.KEYCODE_VOLUME_UP:
            cameraManager.setTorch(true);
            return true;
    }
    return super.onKeyDown(keyCode, event);
}
 
开发者ID:yun2win,项目名称:tvConnect_android,代码行数:29,代码来源:CaptureActivity.java


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