Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd54bc604e | ||
|
|
59b62ecbc4 | ||
|
|
de6a2863f3 | ||
|
|
4b2eb80612 | ||
|
|
2de40d2277 | ||
|
|
7673b7cb0d | ||
|
|
097c5e4453 |
@@ -1,5 +1,14 @@
|
||||
# Change Log
|
||||
|
||||
## 1.68.5
|
||||
* Downgrade ZXingCpp for compatibilty
|
||||
|
||||
## 1.68.4
|
||||
* Fix generating 1D barcodes
|
||||
|
||||
## 1.68.3
|
||||
* Stability improvement
|
||||
|
||||
## 1.68.2
|
||||
* Fix barcode regeneration
|
||||
|
||||
|
||||
+4
-4
@@ -8,8 +8,8 @@ android {
|
||||
minSdk 9
|
||||
targetSdk sdk_version
|
||||
|
||||
versionCode 156
|
||||
versionName '1.68.2'
|
||||
versionCode 159
|
||||
versionName '1.68.5'
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
@@ -77,8 +77,8 @@ dependencies {
|
||||
|
||||
// External
|
||||
implementation 'com.github.markusfisch:CameraView:1.10.0'
|
||||
implementation 'com.github.markusfisch:ScalingImageView:1.4.1'
|
||||
implementation 'com.github.markusfisch:zxing-cpp:v3.0.2.0'
|
||||
implementation 'com.github.markusfisch:ScalingImageView:1.4.3'
|
||||
implementation 'com.github.markusfisch:zxing-cpp:v2.3.0.4'
|
||||
|
||||
// Testing
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
|
||||
@@ -604,6 +604,7 @@ class CameraActivity : AppCompatActivity() {
|
||||
tryRotate = prefs.autoRotate,
|
||||
tryInvert = true,
|
||||
tryDownscale = true,
|
||||
returnCodabarStartEnd = true,
|
||||
maxNumberOfSymbols = 1,
|
||||
textMode = TextMode.PLAIN
|
||||
)
|
||||
|
||||
@@ -68,7 +68,12 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
if (state == null) {
|
||||
supportFragmentManager?.setFragment(getFragmentForIntent(intent))
|
||||
val fragment = intent?.getFragmentForIntent()
|
||||
if (fragment == null) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
supportFragmentManager?.setFragment(fragment)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,32 +83,29 @@ class MainActivity : AppCompatActivity() {
|
||||
private const val ENCODE = "encode"
|
||||
const val DECODED = "decoded"
|
||||
|
||||
private fun getFragmentForIntent(intent: Intent?): Fragment {
|
||||
intent ?: return PreferencesFragment()
|
||||
return when {
|
||||
intent.hasExtra(PREFERENCES) -> PreferencesFragment()
|
||||
intent.hasExtra(HISTORY) -> HistoryFragment()
|
||||
private fun Intent.getFragmentForIntent(): Fragment? = when {
|
||||
hasExtra(PREFERENCES) -> PreferencesFragment()
|
||||
hasExtra(HISTORY) -> HistoryFragment()
|
||||
|
||||
intent.dataString?.let(::isEncodeDeeplink) == true -> {
|
||||
val uri = Uri.parse(intent.dataString)
|
||||
EncodeFragment.newInstance(
|
||||
content = uri.getQueryParameter("content"),
|
||||
format = uri.getQueryParameter("format")?.uppercase(),
|
||||
execute = uri.getQueryParameter("execute")
|
||||
.let { it == "" || it.toBoolean() }
|
||||
)
|
||||
}
|
||||
|
||||
intent.hasExtra(ENCODE) -> EncodeFragment.newInstance(
|
||||
intent.getStringExtra(ENCODE)
|
||||
dataString?.let(::isEncodeDeeplink) == true -> {
|
||||
val uri = Uri.parse(dataString)
|
||||
EncodeFragment.newInstance(
|
||||
content = uri.getQueryParameter("content"),
|
||||
format = uri.getQueryParameter("format")?.uppercase(),
|
||||
execute = uri.getQueryParameter("execute")
|
||||
.let { it == "" || it.toBoolean() }
|
||||
)
|
||||
|
||||
intent.hasExtra(DECODED) -> intent.getScanExtra(DECODED)?.let {
|
||||
DecodeFragment.newInstance(it)
|
||||
} ?: DecodeFragment()
|
||||
|
||||
else -> PreferencesFragment()
|
||||
}
|
||||
|
||||
hasExtra(ENCODE) -> EncodeFragment.newInstance(
|
||||
getStringExtra(ENCODE)
|
||||
)
|
||||
|
||||
hasExtra(DECODED) -> getScanExtra(DECODED)?.let {
|
||||
DecodeFragment.newInstance(it)
|
||||
}
|
||||
|
||||
else -> PreferencesFragment()
|
||||
}
|
||||
|
||||
fun getPreferencesIntent(context: Context): Intent {
|
||||
@@ -148,15 +150,22 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun Intent.getScanExtra(name: String): Scan? = try {
|
||||
if (
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU
|
||||
) {
|
||||
@Suppress("DEPRECATION")
|
||||
getParcelableExtra(name)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
private fun Intent.getScanExtra(name: String): Scan? = if (
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
|
||||
) {
|
||||
try {
|
||||
getParcelableExtra(name, Scan::class.java)
|
||||
} catch (_: Throwable) {
|
||||
// `getParcelableExtra(name, Class)` can throw on some versions
|
||||
// of Android when the ClassLoader associated with the Bundle's
|
||||
// lazy-decoded value is null in certain scenarios (e.g., after
|
||||
// an activity restart where the system re-delivers the intent).
|
||||
// Simply fallback to the "deprecated" `getParcelableExtra(name)`
|
||||
// which works in this case, because it doesn't verify the
|
||||
// parcelable's class against Scan::class.java.
|
||||
null
|
||||
}
|
||||
} catch (_: Throwable) {
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} ?: getParcelableExtra(name)
|
||||
|
||||
@@ -49,6 +49,7 @@ class PickActivity : AppCompatActivity() {
|
||||
tryRotate = true,
|
||||
tryInvert = true,
|
||||
tryDownscale = true,
|
||||
returnCodabarStartEnd = true,
|
||||
maxNumberOfSymbols = 1,
|
||||
formats = prefs.barcodeFormats.toFormatSet()
|
||||
)
|
||||
|
||||
@@ -108,7 +108,7 @@ class ContentBarcode<T>(
|
||||
content: T,
|
||||
format: BarcodeFormat,
|
||||
val ecLevel: Int = -1,
|
||||
val margin: Int = 1,
|
||||
val margin: Int = -1,
|
||||
colors: BarcodeColors = BarcodeColors.BLACK_ON_WHITE
|
||||
) : Barcode<T>(content, format, colors) {
|
||||
override fun toBitmap(size: Int) = ZxingCpp.encodeAsBitmap(
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
* Stability improvement
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
* Fix generating 1D barcodes
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
* Downgrade ZXingCpp for compatibilty
|
||||
|
||||
Reference in New Issue
Block a user