zxing.utils.InactivityTimer Java Examples

The following examples show how to use zxing.utils.InactivityTimer. 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: CaptureActivity.java    From Gizwits-SmartSocket_Android with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	Window window = getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	setContentView(R.layout.activity_capture);

	scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
	scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
	scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
	scanLine = (ImageView) findViewById(R.id.capture_scan_line);

	inactivityTimer = new InactivityTimer(this);

	TranslateAnimation animation = new TranslateAnimation(
			Animation.RELATIVE_TO_PARENT, 0.0f,
			Animation.RELATIVE_TO_PARENT, 0.0f,
			Animation.RELATIVE_TO_PARENT, -1.0f,
			Animation.RELATIVE_TO_PARENT, 0.0f);
	animation.setDuration(4500);
	animation.setRepeatCount(-1);
	animation.setRepeatMode(Animation.RESTART);
	scanLine.startAnimation(animation);

	btnCancel = (Button) findViewById(R.id.btn_cancel);
	ivReturn = (ImageView) findViewById(R.id.iv_return);
	OnClickListener myClick = new OnClickListener() {
		@Override
		public void onClick(View arg0) {
			CaptureActivity.this.finish();
		}
	};
	btnCancel.setOnClickListener(myClick);
	ivReturn.setOnClickListener(myClick);
}
 
Example #2
Source File: CaptureActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	/**
	 * 设置为竖屏
	 */
	if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}

	Window window = getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	setContentView(R.layout.activity_gos_capture);

	scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
	scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
	scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
	scanLine = (ImageView) findViewById(R.id.capture_scan_line);

	inactivityTimer = new InactivityTimer(this);

	TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
			Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT,
			0.0f);
	animation.setDuration(4500);
	animation.setRepeatCount(-1);
	animation.setRepeatMode(Animation.RESTART);
	scanLine.startAnimation(animation);

	btnCancel = (Button) findViewById(R.id.btn_cancel);
	ivReturn = (ImageView) findViewById(R.id.iv_return);
	OnClickListener myClick = new OnClickListener() {
		@Override
		public void onClick(View arg0) {
			CaptureActivity.this.finish();
		}
	};
	btnCancel.setOnClickListener(myClick);
	ivReturn.setOnClickListener(myClick);
}
 
Example #3
Source File: CaptureActivity.java    From Gizwits-SmartBuld_Android with MIT License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	/**
	 * 设置为竖屏
	 */
	if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}

	Window window = getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	setContentView(R.layout.activity_gos_capture);

	scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
	scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
	scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
	scanLine = (ImageView) findViewById(R.id.capture_scan_line);

	inactivityTimer = new InactivityTimer(this);

	TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
			Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT,
			0.0f);
	animation.setDuration(4500);
	animation.setRepeatCount(-1);
	animation.setRepeatMode(Animation.RESTART);
	scanLine.startAnimation(animation);

	btnCancel = (Button) findViewById(R.id.btn_cancel);
	ivReturn = (ImageView) findViewById(R.id.iv_return);
	OnClickListener myClick = new OnClickListener() {
		@Override
		public void onClick(View arg0) {
			CaptureActivity.this.finish();
		}
	};
	btnCancel.setOnClickListener(myClick);
	ivReturn.setOnClickListener(myClick);
}
 
Example #4
Source File: CaptureActivity.java    From gokit-android with MIT License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	/**
	 * 设置为竖屏
	 */
	if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}

	Window window = getWindow();
	window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	setContentView(R.layout.activity_gos_capture);

	scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
	scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
	scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
	scanLine = (ImageView) findViewById(R.id.capture_scan_line);

	inactivityTimer = new InactivityTimer(this);

	TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f,
			Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, -1.0f, Animation.RELATIVE_TO_PARENT,
			0.0f);
	animation.setDuration(4500);
	animation.setRepeatCount(-1);
	animation.setRepeatMode(Animation.RESTART);
	scanLine.startAnimation(animation);

	btnCancel = (Button) findViewById(R.id.btn_cancel);
	ivReturn = (ImageView) findViewById(R.id.iv_return);
	OnClickListener myClick = new OnClickListener() {
		@Override
		public void onClick(View arg0) {
			CaptureActivity.this.finish();
		}
	};
	btnCancel.setOnClickListener(myClick);
	ivReturn.setOnClickListener(myClick);
}