Compare commits

..
26 Commits
Author SHA1 Message Date
Markus Fisch faf300db3e Advance version number to 1.3.7 2019-01-18 18:40:36 +01:00
Markus Fisch 2fbdd03225 Normalize URL scheme for resolveActivity()
Because Intent.resolveActivity() fails to resolve URLs
with uppercase schemes. Uri.normalizeScheme() will make
the scheme lowercase.
2019-01-18 18:28:08 +01:00
Markus Fisch 9f825f9d5d Update build tools and gradle wrapper 2019-01-18 18:27:50 +01:00
Markus Fisch 5ff1904148 Update build tools and Kotlin versions 2018-11-21 17:33:14 +01:00
Markus Fisch 16e80ff80e Update camera view library
setTapToFocus() is now available in the library.
2018-10-26 21:31:24 +02:00
Markus Fisch 1dcd1845a7 Update build tools and gradle wrapper 2018-10-09 10:00:33 +02:00
Markus Fisch 955f507023 Update tools version 2018-10-04 22:28:40 +02:00
Markus Fisch 47a3224b27 Advance version number to 1.3.6 2018-10-04 21:12:26 +02:00
Markus Fisch d2bf09d321 Update camera view library 2018-10-04 21:00:56 +02:00
Markus Fisch deee39b367 Use property access syntax to get scene modes 2018-10-04 20:57:59 +02:00
Markus Fisch 4829433725 Revert "Pick camera mode with kotlin's first syntax"
`first` throws if there is no such element so it can't
be used to pick an item that can be there.

This reverts commit 9efd43e496.
2018-10-04 14:54:26 +02:00
Felizia BernutzandMarkus Fisch 9efd43e496 Pick camera mode with kotlin's first syntax
Makes the code a little bit shorter and more kotlin like.
2018-10-04 09:51:41 +02:00
Felizia BernutzandMarkus Fisch 5bd904ba4f Handle no supported scene modes (#5)
Handle nullable result of getSupportedSceneModes()

Only search for SCENE_MODE_BARCODE if there are any supported scene
modes. This extra check prevents triggering onCameraError() when there
are no supported scene modes, which would result in an unusable
application.
2018-09-22 10:23:49 +02:00
Markus Fisch 3244f0775f Advance version number to 1.3.5 2018-08-08 18:48:06 +02:00
Markus Fisch f4d625a048 Fix some minor style issues 2018-08-08 18:29:34 +02:00
Markus Fisch c838486ca1 Apply Kotlin Coding Conventions
Functions that don't fit on a single line should use
the following syntax:

https://kotlinlang.org/docs/reference/coding-conventions.html#function-formatting
2018-07-29 23:37:02 +02:00
Markus Fisch d4a9ea1a4b Fix directory name of german resources
Because `values-de-DE` results in:
> Error: Invalid resource directory name
2018-07-29 23:35:55 +02:00
Markus Fisch 4123905853 Add german translation for encode button
Remove `app_name` because that's in `donottranslate.xml`.

And convert spaces to tabs.
2018-07-29 23:29:53 +02:00
Markus FischandGitHub 720811bf3b Add German translation
Merge pull request #4 from ialokim/german
2018-07-29 23:27:50 +02:00
Markus FischandGitHub 375fb4aa46 Fix Share intent handling
Merge pull request #3 from ialokim/encode-indent
2018-07-29 23:26:42 +02:00
Ialokim aa4b79d13d added German translation 2018-07-29 19:43:53 +02:00
Ialokim 1e9c303646 handle Intent.SEND correctly, directly opening EncodeFragment 2018-07-29 19:20:37 +02:00
Markus Fisch d3ab28f2b3 Update Kotlin version 2018-07-29 15:44:54 +02:00
Markus Fisch 7b67778a29 Return scan result for ZXing' SCAN intents
Of course, handling ZXing' SCAN intents makes only
sense when the app is returning the scanned data.

And that's why responding to IMAGE_CAPTURE does not
make sense at all. Removed that.
2018-07-29 15:40:47 +02:00
Markus Fisch d2c8ef719b Respond to IMAGE_CAPTURE and ZXing' SCAN intents
So a user can pick Binary Eye in the share menu.
2018-07-29 13:32:24 +02:00
Markus Fisch 7bed192300 Update build tools and target SDK 2018-07-05 21:32:03 +02:00
12 changed files with 84 additions and 45 deletions
+11
View File
@@ -1,5 +1,16 @@
# Change Log
## 1.3.7
* Normalize URL schemes
## 1.3.6
* Fix handling of camera scene modes
## 1.3.5
* Add german translation
* Fix handling of data intents
* Respond to ZXing' SCAN intents
## 1.3.4
* Fix pre-processing for Android 7+
* Fix adaptive icons for Android 8+
+2 -2
View File
@@ -14,8 +14,8 @@ android {
minSdkVersion 9
targetSdkVersion sdk_version
versionCode 10
versionName '1.3.4'
versionCode 13
versionName '1.3.7'
// it's recommended to set this value to the lowest API level
// able to provide all the functionality
Binary file not shown.
Binary file not shown.
+5 -1
View File
@@ -29,11 +29,15 @@
<activity
android:name=".activity.CameraActivity"
android:label="@string/scan_code">
<intent-filter>
<intent-filter android:label="@string/compose_barcode">
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain"/>
</intent-filter>
<intent-filter>
<action android:name="com.google.zxing.client.android.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
@@ -24,7 +24,6 @@ import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import android.view.Menu
import android.view.MenuItem
import android.view.MotionEvent
import android.view.View
import android.widget.SeekBar
import android.widget.Toast
@@ -56,6 +55,7 @@ class CameraActivity : AppCompatActivity() {
private var frameOrientation: Int = 0
private var invert = false
private var flash = false
private var returnResult = false
override fun onRequestPermissionsResult(
requestCode: Int,
@@ -89,7 +89,6 @@ class CameraActivity : AppCompatActivity() {
zoomBar = findViewById(R.id.zoom) as SeekBar
initCameraView()
setTapToFocus()
initZoomBar()
restoreZoom()
initFlashFab(findViewById(R.id.flash))
@@ -109,6 +108,10 @@ class CameraActivity : AppCompatActivity() {
override fun onResume() {
super.onResume()
System.gc()
returnResult = "com.google.zxing.client.android.SCAN".equals(
intent.action
)
handleSendText(intent)
if (hasCameraPermission()) {
cameraView.openAsync(
CameraView.findCameraId(
@@ -179,7 +182,8 @@ class CameraActivity : AppCompatActivity() {
// consume this intent
intent.setAction(null)
startActivity(MainActivity.getEncodeIntent(this, text))
startActivity(MainActivity.getEncodeIntent(this, text, true))
finish()
}
private fun hasCameraPermission(): Boolean {
@@ -199,6 +203,7 @@ class CameraActivity : AppCompatActivity() {
private fun initCameraView() {
cameraView.setUseOrientationListener(true)
cameraView.setTapToFocus()
cameraView.setOnCameraListener(object : CameraView.OnCameraListener {
override fun onConfigureParameters(
parameters: Camera.Parameters
@@ -214,10 +219,13 @@ class CameraActivity : AppCompatActivity() {
} else {
zoomBar.visibility = View.GONE
}
for (mode in parameters.getSupportedSceneModes()) {
if (mode.equals(Camera.Parameters.SCENE_MODE_BARCODE)) {
parameters.sceneMode = mode
break
val sceneModes = parameters.supportedSceneModes
sceneModes?.let {
for (mode in sceneModes) {
if (mode.equals(Camera.Parameters.SCENE_MODE_BARCODE)) {
parameters.sceneMode = mode
break
}
}
}
CameraView.setAutoFocus(parameters)
@@ -250,31 +258,6 @@ class CameraActivity : AppCompatActivity() {
})
}
private fun setTapToFocus() {
val runnable = Runnable {
cameraView.setFocusArea(null)
}
cameraView.setOnTouchListener({ v: View, event: MotionEvent ->
if (event.getActionMasked() == MotionEvent.ACTION_UP) {
val camera = cameraView.camera
camera?.cancelAutoFocus()
cameraView.setFocusArea(
cameraView.calculateFocusRect(
event.x,
event.y,
100
)
)
camera?.autoFocus({ _: Boolean, _: Camera ->
cameraView.removeCallbacks(runnable)
cameraView.postDelayed(runnable, 3000)
})
v.performClick()
}
true
})
}
private fun initZoomBar() {
zoomBar.setOnSeekBarChangeListener(object :
SeekBar.OnSeekBarChangeListener {
@@ -393,6 +376,14 @@ class CameraActivity : AppCompatActivity() {
cancelDecoding()
vibrator.vibrate(100)
if (returnResult) {
val resultIntent = Intent()
resultIntent.putExtra("SCAN_RESULT", result.text)
setResult(RESULT_OK, resultIntent)
finish()
return
}
startActivity(
MainActivity.getDecodeIntent(
this,
@@ -59,14 +59,26 @@ class MainActivity : AppCompatActivity() {
private const val DECODE = "decode"
private const val DECODE_FORMAT = "decode_format"
fun getEncodeIntent(context: Context, text: String? = ""): Intent {
fun getEncodeIntent(
context: Context,
text: String? = "",
isExternal: Boolean = false
): Intent {
val intent = Intent(context, MainActivity::class.java)
intent.putExtra(ENCODE, text)
if (isExternal) {
intent.addFlags(
android.content.Intent.FLAG_ACTIVITY_NO_HISTORY or
android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK or
android.content.Intent.FLAG_ACTIVITY_NEW_TASK
)
}
return intent
}
fun getDecodeIntent(
context: Context, text: String,
context: Context,
text: String,
format: BarcodeFormat
): Intent {
val intent = Intent(context, MainActivity::class.java)
@@ -102,7 +102,10 @@ class DecodeFragment : Fragment() {
if (activity == null || url.isEmpty()) {
return
}
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse(url).normalizeScheme()
)
if (intent.resolveActivity(activity.getPackageManager()) != null) {
startActivity(intent)
} else {
@@ -118,7 +118,7 @@ class EncodeFragment : Fragment() {
private fun updateSize(power: Int) {
val size = getSize(power)
sizeView.setText("${size}x${size}")
sizeView.setText("${size}x$size")
}
private fun getSize(power: Int) = 128 * (power + 1)
+18
View File
@@ -0,0 +1,18 @@
<resources>
<string name="no_camera_no_fun">Diese App kann ohne Kamerazugriff nicht funktionieren. Tschüss!</string>
<string name="camera_error">Auf die Kamera kann nicht zugegriffen werden, bitte versuche es nochmal</string>
<string name="scan_code">Code scannen</string>
<string name="compose_barcode">Barcode erstellen</string>
<string name="content">Inhalt</string>
<string name="copy_to_clipboard">In die Zwischenablage kopieren</string>
<string name="put_into_clipboard">In die Zwischenablage legen</string>
<string name="open_url">URL öffnen</string>
<string name="cannot_resolve_action">Keine App kann das öffnen</string>
<string name="format">Format</string>
<string name="size">Größe in Pixeln</string>
<string name="input_content_here">Gib den Inhalt hier ein</string>
<string name="encode">KODIEREN</string>
<string name="error_no_content">Fehlender Inhalt</string>
<string name="view_barcode">Barcode ansehen</string>
<string name="info">Info</string>
</resources>
+5 -5
View File
@@ -1,8 +1,8 @@
buildscript {
ext.kotlin_version = '1.2.41'
ext.tools_version = '3.1.2'
ext.build_tools_version = '27.0.3'
ext.sdk_version = 27
ext.kotlin_version = '1.3.10'
ext.tools_version = '3.3.0'
ext.build_tools_version = '28.0.3'
ext.sdk_version = 28
ext.support_version = '25.3.1'
repositories {
@@ -22,7 +22,7 @@ buildscript {
}
plugins {
id 'org.sonarqube' version '2.6'
id 'org.sonarqube' version '2.6.2'
}
allprojects {
+1 -1
View File
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip