From 7fb5225b4df0ef64f71bdeb978dfd6e2dde38f33 Mon Sep 17 00:00:00 2001 From: Ailiwean <1581209979@qq.com> Date: Sun, 18 Oct 2020 19:47:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96,=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E9=A1=B5=E9=9D=A2requestLayout=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/compiler.xml | 6 + .idea/gradle.xml | 1 + .idea/jarRepositories.xml | 5 + .idea/misc.xml | 2 +- app/build.gradle | 7 +- app/proguard-rules.pro | 4 +- app/src/main/AndroidManifest.xml | 16 ++- .../main/java/com/android/NBZxing/App.java | 22 ++++ .../java/com/android/NBZxing/CusScanView.kt | 4 - .../java/com/android/NBZxing/MainActiviy.kt | 25 ++++ .../{MainActivity.kt => ScanActivity.kt} | 22 +++- app/src/main/res/layout/activity_main.xml | 1 - app/src/main/res/layout/activity_select.xml | 17 +++ app/src/main/res/layout/tool_title.xml | 2 +- build.gradle | 1 + gradle/wrapper/gradle-wrapper.properties | 4 - .../cameraview/TextureViewPreview.java | 5 +- .../google/android/cameraview/Camera2.java | 8 +- .../android/cameraview/PreviewImpl.java | 14 ++- .../main/java/com/ailiwean/core/Utils.java | 57 --------- .../src/main/java/com/ailiwean/core/Utils.kt | 114 ++++++++++++++++++ .../com/ailiwean/core/able/AbleManager.kt | 11 +- .../ailiwean/core/helper/ImgparseHelper.kt | 70 +++++++++++ .../ailiwean/core/helper/VibrateHelper.java | 5 +- .../com/ailiwean/core/view/FreeZxingView.kt | 108 ++++------------- .../com/ailiwean/core/view/ScanLightView.java | 2 +- .../core/zxing/BitmapLuminanceSource.java | 8 +- .../com/ailiwean/core/zxing/ScanRect.java | 2 +- .../android/cameraview/BaseCameraView.kt | 43 +------ .../google/android/cameraview/CameraView.java | 13 +- .../res/layout/nbzxing_default_floorview.xml | 2 +- module_camera/src/main/res/values/public.xml | 13 +- .../ailiwean/module_grayscale/Dispatch.java | 2 +- .../module_grayscale/GrayScaleDispatch.kt | 6 +- 34 files changed, 378 insertions(+), 244 deletions(-) create mode 100644 .idea/compiler.xml create mode 100644 app/src/main/java/com/android/NBZxing/App.java create mode 100644 app/src/main/java/com/android/NBZxing/MainActiviy.kt rename app/src/main/java/com/android/NBZxing/{MainActivity.kt => ScanActivity.kt} (81%) create mode 100644 app/src/main/res/layout/activity_select.xml delete mode 100644 module_camera/src/main/java/com/ailiwean/core/Utils.java create mode 100644 module_camera/src/main/java/com/ailiwean/core/Utils.kt create mode 100644 module_camera/src/main/java/com/ailiwean/core/helper/ImgparseHelper.kt diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index d84fb97..a2d6f5e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -16,6 +16,7 @@ diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index eb2873e..936e1c8 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -26,5 +26,10 @@ - + diff --git a/app/build.gradle b/app/build.gradle index caa056b..a35c13c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,9 +16,9 @@ android { defaultConfig { applicationId "com.android.NBZxing" minSdkVersion 17 - targetSdkVersion 29 - versionCode 15 - versionName "1.15" + targetSdkVersion 27 + versionCode 17 + versionName "1.21" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" signingConfig signingConfigs.release compileOptions { @@ -46,6 +46,7 @@ dependencies { api "androidx.appcompat:appcompat:1.1.0" implementation 'com.zhihu.android:matisse:0.5.3-beta3' api "com.github.bumptech.glide:glide:4.11.0" + api 'com.tencent.bugly:crashreport:3.2.3' // // implementation 'com.github.ailiwean:NBZxing-Scale:0.0.3' // implementation 'com.github.ailiwean:NBZxing:0.0.25' diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 57fb851..1ee2372 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1 +1,3 @@ --keep public class com.ailiwean.module_grayscale.GrayScaleDispatch \ No newline at end of file +-keep public class com.ailiwean.module_grayscale.GrayScaleDispatch +-dontwarn com.tencent.bugly.** +-keep public class com.tencent.bugly.**{*;} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 87dcffb..ec54547 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,22 +5,36 @@ + + + + + + + + + - + + diff --git a/app/src/main/java/com/android/NBZxing/App.java b/app/src/main/java/com/android/NBZxing/App.java new file mode 100644 index 0000000..428725e --- /dev/null +++ b/app/src/main/java/com/android/NBZxing/App.java @@ -0,0 +1,22 @@ +package com.android.NBZxing; + +import android.app.Application; + +import com.tencent.bugly.crashreport.CrashReport; + + +/** + * @Package: com.android.NBZxing + * @ClassName: App + * @Description: + * @Author: SWY + * @CreateDate: 2020/10/1 9:22 PM + */ +public class App extends Application { + + @Override + public void onCreate() { + super.onCreate(); + CrashReport.initCrashReport(getApplicationContext(), "99de934384", true); + } +} diff --git a/app/src/main/java/com/android/NBZxing/CusScanView.kt b/app/src/main/java/com/android/NBZxing/CusScanView.kt index e3615a1..08ec9b0 100644 --- a/app/src/main/java/com/android/NBZxing/CusScanView.kt +++ b/app/src/main/java/com/android/NBZxing/CusScanView.kt @@ -17,10 +17,6 @@ import com.google.android.cameraview.AspectRatio */ class CusScanView @JvmOverloads constructor(context: Context, attributeSet: AttributeSet? = null, def: Int = 0) : NBZxingView(context, attributeSet, def) { - init { - setAspectRatio(AspectRatio.of(16, 9)) - } - override fun resultBack(content: String) { Toast.makeText(context, content, Toast.LENGTH_SHORT).show() } diff --git a/app/src/main/java/com/android/NBZxing/MainActiviy.kt b/app/src/main/java/com/android/NBZxing/MainActiviy.kt new file mode 100644 index 0000000..f7f06a5 --- /dev/null +++ b/app/src/main/java/com/android/NBZxing/MainActiviy.kt @@ -0,0 +1,25 @@ +package com.android.NBZxing + +import android.os.Bundle +import android.view.View +import androidx.appcompat.app.AppCompatActivity + +/** + * @Package: com.android.NBZxing + * @ClassName: MainActiviy + * @Description: + * @Author: SWY + * @CreateDate: 2020/10/18 7:26 PM + */ +class MainActiviy : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_select) + } + + fun toClick(view: View) { + ScanActivity.startSelf(this) + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/android/NBZxing/MainActivity.kt b/app/src/main/java/com/android/NBZxing/ScanActivity.kt similarity index 81% rename from app/src/main/java/com/android/NBZxing/MainActivity.kt rename to app/src/main/java/com/android/NBZxing/ScanActivity.kt index 559cb40..5bc9bd1 100644 --- a/app/src/main/java/com/android/NBZxing/MainActivity.kt +++ b/app/src/main/java/com/android/NBZxing/ScanActivity.kt @@ -2,6 +2,7 @@ package com.android.NBZxing import android.Manifest import android.app.Activity +import android.content.Context import android.content.Intent import android.content.pm.ActivityInfo import android.content.pm.PackageManager @@ -9,15 +10,25 @@ import android.graphics.Color import android.os.Build import android.os.Bundle import android.view.View +import android.view.Window +import android.view.WindowManager import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import com.zhihu.matisse.Matisse import com.zhihu.matisse.MimeType import com.zhihu.matisse.engine.impl.GlideEngine -class MainActivity : AppCompatActivity() { +class ScanActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + +// requestWindowFeature(Window.FEATURE_NO_TITLE) +// window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, +// WindowManager.LayoutParams.FLAG_FULLSCREEN); +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { +// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, +// WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS) +// } setContentView(R.layout.activity_main) findViewById(R.id.zxingview) .synchLifeStart(this) @@ -28,10 +39,13 @@ class MainActivity : AppCompatActivity() { // .commit(); } - fun initView() { + companion object { + fun startSelf(context: Context) { + context.startActivity(Intent(context, ScanActivity::class.java)) + } + } - findViewById(R.id.vToolBar) - .setBackgroundColor(Color.parseColor("#2f000000")) + fun initView() { findViewById(R.id.vTitle).text = "扫一扫" diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 369b4f9..f55c41e 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -12,5 +12,4 @@ - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_select.xml b/app/src/main/res/layout/activity_select.xml new file mode 100644 index 0000000..de234d3 --- /dev/null +++ b/app/src/main/res/layout/activity_select.xml @@ -0,0 +1,17 @@ + + + + +