更新CameraX至v1.2.2
This commit is contained in:
@@ -77,7 +77,7 @@ public class CustomCaptureActivity extends CaptureActivity {
|
||||
getCameraScan().setPlayBeep(true)//设置是否播放音效,默认为false
|
||||
.setVibrate(true)//设置是否震动,默认为false
|
||||
// .setCameraConfig(new CameraConfig())//设置相机配置信息,CameraConfig可覆写options方法自定义配置
|
||||
.setCameraConfig(new ResolutionCameraConfig(this))//设置CameraConfig,可以根据自己的需求去自定义配置
|
||||
// .setCameraConfig(new ResolutionCameraConfig(this))//设置CameraConfig,可以根据自己的需求去自定义配置
|
||||
.setNeedAutoZoom(false)//二维码太小时可自动缩放,默认为false
|
||||
.setNeedTouchZoom(true)//支持多指触摸捏合缩放,默认为true
|
||||
.setDarkLightLux(45f)//设置光线足够暗的阈值(单位:lux),需要通过{@link #bindFlashlightView(View)}绑定手电筒才有效
|
||||
@@ -117,12 +117,10 @@ public class CustomCaptureActivity extends CaptureActivity {
|
||||
}
|
||||
|
||||
private void showToast(String text){
|
||||
if(toast == null){
|
||||
toast = Toast.makeText(this,text,Toast.LENGTH_SHORT);
|
||||
}else{
|
||||
toast.setText(text);
|
||||
toast.setDuration(Toast.LENGTH_SHORT);
|
||||
if(toast != null){
|
||||
toast.cancel();
|
||||
}
|
||||
toast = Toast.makeText(this,text,Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ import com.king.zxing.util.LogUtils;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
@@ -72,6 +74,8 @@ public class MainActivity extends AppCompatActivity implements EasyPermissions.P
|
||||
|
||||
private Toast toast;
|
||||
|
||||
private ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -97,12 +101,10 @@ public class MainActivity extends AppCompatActivity implements EasyPermissions.P
|
||||
}
|
||||
|
||||
private void showToast(String text){
|
||||
if(toast == null){
|
||||
toast = Toast.makeText(this,text,Toast.LENGTH_SHORT);
|
||||
}else{
|
||||
toast.setDuration(Toast.LENGTH_SHORT);
|
||||
toast.setText(text);
|
||||
if(toast != null){
|
||||
toast.cancel();
|
||||
}
|
||||
toast = Toast.makeText(this,text,Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
@@ -165,7 +167,7 @@ public class MainActivity extends AppCompatActivity implements EasyPermissions.P
|
||||
}
|
||||
|
||||
private void asyncThread(Runnable runnable){
|
||||
new Thread(runnable).start();
|
||||
executor.execute(runnable);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
BIN
app/src/main/res/drawable-xxhdpi/ic_laser_line.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_laser_line.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
@@ -13,7 +13,10 @@
|
||||
android:id="@+id/viewfinderView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:viewfinderStyle="popular"/>
|
||||
app:viewfinderStyle="popular"
|
||||
app:laserStyle="image"
|
||||
app:laserDrawableRatio="0.8"
|
||||
app:laserDrawable="@drawable/ic_laser_line"/>
|
||||
<ImageView
|
||||
android:id="@+id/ivFlash"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user