优化部分已知细节问题
This commit is contained in:
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
25
.idea/codeStyles/Project.xml
generated
25
.idea/codeStyles/Project.xml
generated
@@ -24,31 +24,6 @@
|
|||||||
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
|
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
|
||||||
</formatting-settings>
|
</formatting-settings>
|
||||||
</DBN-SQL>
|
</DBN-SQL>
|
||||||
<Objective-C-extensions>
|
|
||||||
<file>
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
|
||||||
</file>
|
|
||||||
<class>
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
|
||||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
|
||||||
</class>
|
|
||||||
<extensions>
|
|
||||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
|
||||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
|
||||||
</extensions>
|
|
||||||
</Objective-C-extensions>
|
|
||||||
<DBN-PSQL>
|
<DBN-PSQL>
|
||||||
<case-options enabled="true">
|
<case-options enabled="true">
|
||||||
<option name="KEYWORD_CASE" value="lower" />
|
<option name="KEYWORD_CASE" value="lower" />
|
||||||
|
|||||||
2
.idea/markdown-navigator/profiles_settings.xml
generated
2
.idea/markdown-navigator/profiles_settings.xml
generated
@@ -1,3 +1,3 @@
|
|||||||
<component name="MarkdownNavigator.ProfileManager">
|
<component name="MarkdownNavigator.ProfileManager">
|
||||||
<settings default="" pdf-export="" />
|
<settings default="" pdf-export="" plain-text-search-scope="Project Files" />
|
||||||
</component>
|
</component>
|
||||||
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -25,7 +25,7 @@
|
|||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
|
|||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.king.zxing.CaptureFragment;
|
import com.king.zxing.CaptureFragment;
|
||||||
@@ -36,4 +37,12 @@ public class CaptureFragmentActivity extends AppCompatActivity {
|
|||||||
public void replaceFragment(@IdRes int id, Fragment fragment) {
|
public void replaceFragment(@IdRes int id, Fragment fragment) {
|
||||||
getSupportFragmentManager().beginTransaction().replace(id, fragment).commit();
|
getSupportFragmentManager().beginTransaction().replace(id, fragment).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onClick(View v){
|
||||||
|
switch (v.getId()){
|
||||||
|
case R.id.ivLeft:
|
||||||
|
onBackPressed();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class CodeActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void OnClick(View v){
|
public void onClick(View v){
|
||||||
switch (v.getId()){
|
switch (v.getId()){
|
||||||
case R.id.ivLeft:
|
case R.id.ivLeft:
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class CustomActivity extends AppCompatActivity implements OnCaptureCallba
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClick(View v){
|
public void onClick(View v){
|
||||||
switch (v.getId()){
|
switch (v.getId()){
|
||||||
case R.id.ivLeft:
|
case R.id.ivLeft:
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class CustomCaptureActivity extends CaptureActivity {
|
|||||||
|
|
||||||
isContinuousScan = getIntent().getBooleanExtra(MainActivity.KEY_IS_CONTINUOUS,false);
|
isContinuousScan = getIntent().getBooleanExtra(MainActivity.KEY_IS_CONTINUOUS,false);
|
||||||
//获取CaptureHelper,里面有扫码相关的配置设置
|
//获取CaptureHelper,里面有扫码相关的配置设置
|
||||||
getCaptureHelper().playBeep(true)//播放音效
|
getCaptureHelper().playBeep(false)//播放音效
|
||||||
.vibrate(true)//震动
|
.vibrate(true)//震动
|
||||||
.supportVerticalCode(true)//支持扫垂直条码,建议有此需求时才使用。
|
.supportVerticalCode(true)//支持扫垂直条码,建议有此需求时才使用。
|
||||||
.continuousScan(isContinuousScan);//是否连扫
|
.continuousScan(isContinuousScan);//是否连扫
|
||||||
@@ -102,7 +102,7 @@ public class CustomCaptureActivity extends CaptureActivity {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClick(View v){
|
public void onClick(View v){
|
||||||
switch (v.getId()){
|
switch (v.getId()){
|
||||||
case R.id.ivLeft:
|
case R.id.ivLeft:
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
|
|||||||
@@ -41,10 +41,10 @@ public class EasyCaptureActivity extends CaptureActivity {
|
|||||||
StatusBarUtils.immersiveStatusBar(this,toolbar,0.2f);
|
StatusBarUtils.immersiveStatusBar(this,toolbar,0.2f);
|
||||||
TextView tvTitle = findViewById(R.id.tvTitle);
|
TextView tvTitle = findViewById(R.id.tvTitle);
|
||||||
tvTitle.setText(getIntent().getStringExtra(MainActivity.KEY_TITLE));
|
tvTitle.setText(getIntent().getStringExtra(MainActivity.KEY_TITLE));
|
||||||
|
getCaptureHelper().playBeep(true).vibrate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClick(View v){
|
public void onClick(View v){
|
||||||
switch (v.getId()){
|
switch (v.getId()){
|
||||||
case R.id.ivLeft:
|
case R.id.ivLeft:
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public class MainActivity extends AppCompatActivity implements EasyPermissions.P
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClick(View v){
|
public void onClick(View v){
|
||||||
isContinuousScan = false;
|
isContinuousScan = false;
|
||||||
switch (v.getId()){
|
switch (v.getId()){
|
||||||
case R.id.btn0:
|
case R.id.btn0:
|
||||||
|
|||||||
@@ -12,6 +12,6 @@
|
|||||||
|
|
||||||
<style name="OnClick">
|
<style name="OnClick">
|
||||||
<item name="android:clickable">true</item>
|
<item name="android:clickable">true</item>
|
||||||
<item name="android:onClick">OnClick</item>
|
<item name="android:onClick">onClick</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.hardware.Camera;
|
import android.hardware.Camera;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
@@ -129,6 +130,7 @@ public class CaptureHelper implements CaptureLifecycle,CaptureTouchEvent,Capture
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(){
|
public void onCreate(){
|
||||||
inactivityTimer = new InactivityTimer(activity);
|
inactivityTimer = new InactivityTimer(activity);
|
||||||
@@ -166,7 +168,6 @@ public class CaptureHelper implements CaptureLifecycle,CaptureTouchEvent,Capture
|
|||||||
public void onHandleDecode(Result result, Bitmap barcode, float scaleFactor) {
|
public void onHandleDecode(Result result, Bitmap barcode, float scaleFactor) {
|
||||||
inactivityTimer.onActivity();
|
inactivityTimer.onActivity();
|
||||||
beepManager.playBeepSoundAndVibrate();
|
beepManager.playBeepSoundAndVibrate();
|
||||||
|
|
||||||
onResult(result);
|
onResult(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,9 +178,7 @@ public class CaptureHelper implements CaptureLifecycle,CaptureTouchEvent,Capture
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link Activity#onResume()}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume(){
|
public void onResume(){
|
||||||
beepManager.updatePrefs();
|
beepManager.updatePrefs();
|
||||||
@@ -196,9 +195,7 @@ public class CaptureHelper implements CaptureLifecycle,CaptureTouchEvent,Capture
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link Activity#onPause()}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause(){
|
public void onPause(){
|
||||||
if (captureHandler != null) {
|
if (captureHandler != null) {
|
||||||
@@ -214,9 +211,7 @@ public class CaptureHelper implements CaptureLifecycle,CaptureTouchEvent,Capture
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link Activity#onDestroy()}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy(){
|
public void onDestroy(){
|
||||||
inactivityTimer.shutdown();
|
inactivityTimer.shutdown();
|
||||||
@@ -414,7 +409,7 @@ public class CaptureHelper implements CaptureLifecycle,CaptureTouchEvent,Capture
|
|||||||
* @param result 扫码结果
|
* @param result 扫码结果
|
||||||
*/
|
*/
|
||||||
public void onResult(Result result){
|
public void onResult(Result result){
|
||||||
String text = result.getText();
|
final String text = result.getText();
|
||||||
if(isContinuousScan){
|
if(isContinuousScan){
|
||||||
if(onCaptureCallback!=null){
|
if(onCaptureCallback!=null){
|
||||||
onCaptureCallback.onResultCallback(text);
|
onCaptureCallback.onResultCallback(text);
|
||||||
@@ -422,18 +417,37 @@ public class CaptureHelper implements CaptureLifecycle,CaptureTouchEvent,Capture
|
|||||||
if(isAutoRestartPreviewAndDecode){
|
if(isAutoRestartPreviewAndDecode){
|
||||||
restartPreviewAndDecode();
|
restartPreviewAndDecode();
|
||||||
}
|
}
|
||||||
}else{
|
return;
|
||||||
//如果设置了回调,并且onCallback返回为true,则表示拦截
|
|
||||||
if(onCaptureCallback!=null && onCaptureCallback.onResultCallback(text)){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.putExtra(Intents.Scan.RESULT,text);
|
|
||||||
activity.setResult(Activity.RESULT_OK,intent);
|
|
||||||
activity.finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(isPlayBeep){//如果播放音效,则稍微延迟一点,给予播放音效时间
|
||||||
|
captureHandler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
//如果设置了回调,并且onCallback返回为true,则表示拦截
|
||||||
|
if(onCaptureCallback!=null && onCaptureCallback.onResultCallback(text)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.putExtra(Intents.Scan.RESULT,text);
|
||||||
|
activity.setResult(Activity.RESULT_OK,intent);
|
||||||
|
activity.finish();
|
||||||
|
}
|
||||||
|
},100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//如果设置了回调,并且onCallback返回为true,则表示拦截
|
||||||
|
if(onCaptureCallback!=null && onCaptureCallback.onResultCallback(text)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.putExtra(Intents.Scan.RESULT,text);
|
||||||
|
activity.setResult(Activity.RESULT_OK,intent);
|
||||||
|
activity.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置是否连续扫码,如果想支持连续扫码,则将此方法返回{@code true}并重写{@link #onResult(Result)}
|
* 设置是否连续扫码,如果想支持连续扫码,则将此方法返回{@code true}并重写{@link #onResult(Result)}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import android.os.Bundle;
|
|||||||
public interface CaptureLifecycle {
|
public interface CaptureLifecycle {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link android.app.Activity#onCreate(Bundle)}
|
* {@link Activity#onCreate(Bundle)}
|
||||||
*/
|
*/
|
||||||
void onCreate();
|
void onCreate();
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ final class DecodeHandler extends Handler {
|
|||||||
lastZoomTime = System.currentTimeMillis();
|
lastZoomTime = System.currentTimeMillis();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "zoom not supported");
|
Log.i(TAG, "Zoom not supported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user