From a01d4b81c74217669dfeed155de5abc4885bb0c2 Mon Sep 17 00:00:00 2001 From: Rumperuu Date: Tue, 11 Sep 2018 08:33:50 +0100 Subject: [PATCH] Initial commit --- .gitignore | 65 + .idea/codeStyles/Project.xml | 29 + .idea/misc.xml | 34 + .idea/modules.xml | 9 + .idea/runConfigurations.xml | 12 + LICENSE | 21 + README.md | 4 + app/.gitignore | 1 + app/build.gradle | 36 + app/proguard-rules.pro | 17 + .../ac/lancaster/auditor/ApplicationTest.java | 13 + app/src/main/AndroidManifest.xml | 39 + .../lancaster/auditor/BallotVerifyActivity.kt | 27 + .../uk/ac/lancaster/auditor/MainActivity.kt | 23 + .../barcode/BarcodeCaptureActivity.java | 285 ++++ .../auditor/barcode/BarcodeScanActivity.kt | 56 + .../auditor/barcode/BarcodeTracker.java | 40 + .../barcode/BarcodeTrackerFactory.java | 39 + .../auditor/camera/CameraSource.java | 1212 +++++++++++++++++ .../auditor/camera/CameraSourcePreview.java | 182 +++ .../res/layout/activity_ballot_verify.xml | 33 + .../main/res/layout/activity_barcode_scan.xml | 34 + app/src/main/res/layout/activity_main.xml | 31 + app/src/main/res/layout/barcode_capture.xml | 16 + .../main/res/layout/content_ballot_verify.xml | 23 + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10486 bytes app/src/main/res/values-w820dp/dimens.xml | 6 + app/src/main/res/values/colors.xml | 7 + app/src/main/res/values/dimens.xml | 6 + app/src/main/res/values/strings.xml | 17 + app/src/main/res/values/styles.xml | 20 + build.gradle | 34 + gradle.properties | 18 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 160 +++ gradlew.bat | 90 ++ settings.gradle | 1 + 42 files changed, 2646 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/uk/ac/lancaster/auditor/ApplicationTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/uk/ac/lancaster/auditor/BallotVerifyActivity.kt create mode 100644 app/src/main/java/uk/ac/lancaster/auditor/MainActivity.kt create mode 100644 app/src/main/java/uk/ac/lancaster/auditor/barcode/BarcodeCaptureActivity.java create mode 100644 app/src/main/java/uk/ac/lancaster/auditor/barcode/BarcodeScanActivity.kt create mode 100644 app/src/main/java/uk/ac/lancaster/auditor/barcode/BarcodeTracker.java create mode 100644 app/src/main/java/uk/ac/lancaster/auditor/barcode/BarcodeTrackerFactory.java create mode 100644 app/src/main/java/uk/ac/lancaster/auditor/camera/CameraSource.java create mode 100644 app/src/main/java/uk/ac/lancaster/auditor/camera/CameraSourcePreview.java create mode 100644 app/src/main/res/layout/activity_ballot_verify.xml create mode 100644 app/src/main/res/layout/activity_barcode_scan.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/layout/barcode_capture.xml create mode 100644 app/src/main/res/layout/content_ballot_verify.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/values-w820dp/dimens.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/dimens.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/styles.xml create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..39b6783 --- /dev/null +++ b/.gitignore @@ -0,0 +1,65 @@ +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +.idea/caches + +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Google Services (e.g. APIs or Firebase) +google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..30aa626 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..99202cc --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0cc77a6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..9d0e302 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Varvet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f022427 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# BarcodeReaderSample +A barcode scanner example using Google Play services. + +[This tutorial](https://www.varvet.com/blog/android-qr-code-reader-made-easy/) should be of interest :). diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..a6e7740 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,36 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +android { + compileSdkVersion 26 + buildToolsVersion '27.0.3' + + defaultConfig { + applicationId "uk.ac.lancaster.auditor" + minSdkVersion 19 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:design:26.1.0' + testImplementation 'junit:junit:4.12' + implementation 'com.android.support:appcompat-v7:26.1.0' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' + implementation 'com.google.android.gms:play-services-vision:15.0.2' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} +repositories { + mavenCentral() +} + +apply plugin: 'kotlin-android-extensions' diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..669dec1 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/algar/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/app/src/androidTest/java/uk/ac/lancaster/auditor/ApplicationTest.java b/app/src/androidTest/java/uk/ac/lancaster/auditor/ApplicationTest.java new file mode 100644 index 0000000..69d1ae3 --- /dev/null +++ b/app/src/androidTest/java/uk/ac/lancaster/auditor/ApplicationTest.java @@ -0,0 +1,13 @@ +package uk.ac.lancaster.auditor; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..338492f --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/uk/ac/lancaster/auditor/BallotVerifyActivity.kt b/app/src/main/java/uk/ac/lancaster/auditor/BallotVerifyActivity.kt new file mode 100644 index 0000000..fffd08e --- /dev/null +++ b/app/src/main/java/uk/ac/lancaster/auditor/BallotVerifyActivity.kt @@ -0,0 +1,27 @@ +package uk.ac.lancaster.auditor + +import android.os.Bundle +import android.support.v7.app.AppCompatActivity +import android.webkit.WebView + +import kotlinx.android.synthetic.main.activity_ballot_verify.* + +class BallotVerifyActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_ballot_verify) + setSupportActionBar(toolbar) + + val extras = intent.extras + if (extras != null) { + val ballotHandle = extras.getString("ballotHandle") + val myWebView: WebView = findViewById(R.id.webview) + // myWebView.loadUrl("http://127.0.0.1:8000/event/audit?handle=$ballotHandle") + myWebView.loadUrl("https://en.wikipedia.org/") + myWebView.settings.javaScriptEnabled = true + } + + } + +} diff --git a/app/src/main/java/uk/ac/lancaster/auditor/MainActivity.kt b/app/src/main/java/uk/ac/lancaster/auditor/MainActivity.kt new file mode 100644 index 0000000..92ca00e --- /dev/null +++ b/app/src/main/java/uk/ac/lancaster/auditor/MainActivity.kt @@ -0,0 +1,23 @@ +package uk.ac.lancaster.auditor + +import android.content.Intent +import android.os.Bundle +import android.support.v7.app.AppCompatActivity +import android.widget.Button +import android.widget.TextView +import uk.ac.lancaster.auditor.barcode.BarcodeScanActivity + +class MainActivity : AppCompatActivity() { + + private lateinit var mResultTextView: TextView + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + findViewById