0
0
mirror of https://github.com/markusfisch/BinaryEye.git synced 2024-09-19 19:42:18 +02:00

Open README on GitHub from action menu

To make everybody aware the app's using ZXing and what
that is and what license it has.
This commit is contained in:
Markus Fisch 2017-09-02 13:35:01 +02:00
parent 366548dc2a
commit 7789c21a96
6 changed files with 31 additions and 6 deletions

View File

@ -100,7 +100,7 @@ class MainActivity : AppCompatActivity() {
if (!Intent.ACTION_SEND.equals(intent.getAction()) ||
!"text/plain".equals(type) ||
text.isEmpty()) {
return;
return
}
// consume this intent

View File

@ -15,9 +15,11 @@ import de.markusfisch.android.binaryeye.zxing.Zxing
import de.markusfisch.android.binaryeye.R
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Rect
import android.hardware.Camera
import android.net.Uri
import android.os.Bundle
import android.os.Vibrator
import android.support.v4.app.Fragment
@ -144,6 +146,10 @@ class CameraFragment : Fragment() {
toggleTorchMode()
true
}
R.id.info -> {
openReadme()
true
}
else -> super.onOptionsItemSelected(item)
}
}
@ -154,11 +160,16 @@ class CameraFragment : Fragment() {
parameters?.setFlashMode(if (flash)
Camera.Parameters.FLASH_MODE_OFF
else
Camera.Parameters.FLASH_MODE_TORCH);
Camera.Parameters.FLASH_MODE_TORCH)
flash = flash xor true
parameters?.let { camera.setParameters(parameters) }
}
private fun openReadme() {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(
"https://github.com/markusfisch/BinaryEye/blob/master/README.md")))
}
private fun startDecoding() {
activity ?: return

View File

@ -95,13 +95,13 @@ class LockOnView : SurfaceView {
val matrix = Matrix()
matrix.setScale(-1f, 1f)
markerTopRight = Bitmap.createBitmap(markerTopLeft,
0, 0, width, height, matrix, false);
0, 0, width, height, matrix, false)
matrix.setScale(1f, -1f)
markerBottomLeft = Bitmap.createBitmap(markerTopLeft,
0, 0, width, height, matrix, false);
0, 0, width, height, matrix, false)
matrix.setScale(-1f, -1f)
markerBottomRight = Bitmap.createBitmap(markerTopLeft,
0, 0, width, height, matrix, false);
0, 0, width, height, matrix, false)
}
private fun initSurfaceHolder(context: Context) {

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFFFFFFF"
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z"/>
</vector>

View File

@ -1,6 +1,11 @@
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:material="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/info"
android:title="@string/info"
android:icon="@drawable/ic_action_info"
material:showAsAction="ifRoom"/>
<item
android:id="@+id/flash"
android:title="@string/flash"

View File

@ -7,7 +7,6 @@
<string name="copy_to_clipboard">Copy to clipboard</string>
<string name="put_into_clipboard">Put into clipboard</string>
<string name="open_url">Open url</string>
<string name="share">Share</string>
<string name="cannot_resolve_action">No application can open that</string>
<string name="format">Format</string>
<string name="size">Size in pixels</string>
@ -15,4 +14,5 @@
<string name="create">CREATE</string>
<string name="error_no_content">Missing content</string>
<string name="view_barcode">View barcode</string>
<string name="info">Info</string>
</resources>