├── QrScanner ├── app │ ├── .gitignore │ ├── app-debug.apk │ ├── app-release.apk │ ├── src │ │ ├── main │ │ │ ├── assets │ │ │ │ ├── RobotoLight.ttf │ │ │ │ ├── RobotoMedium.ttf │ │ │ │ └── RobotoRegular.ttf │ │ │ ├── res │ │ │ │ ├── drawable │ │ │ │ │ ├── logo.jpg │ │ │ │ │ └── dialog_background.xml │ │ │ │ ├── drawable-hdpi │ │ │ │ │ ├── ic_back.png │ │ │ │ │ ├── ic_clear.png │ │ │ │ │ ├── ic_copy.png │ │ │ │ │ ├── ic_date.png │ │ │ │ │ ├── ic_share.png │ │ │ │ │ ├── ic_done_gr.png │ │ │ │ │ ├── ic_flash_on.png │ │ │ │ │ ├── ic_history.png │ │ │ │ │ ├── ic_search.png │ │ │ │ │ └── ic_flash_off.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ ├── ic_back.png │ │ │ │ │ ├── ic_clear.png │ │ │ │ │ ├── ic_copy.png │ │ │ │ │ ├── ic_date.png │ │ │ │ │ ├── ic_share.png │ │ │ │ │ ├── ic_done_gr.png │ │ │ │ │ ├── ic_flash_on.png │ │ │ │ │ ├── ic_history.png │ │ │ │ │ ├── ic_search.png │ │ │ │ │ └── ic_flash_off.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ ├── ic_back.png │ │ │ │ │ ├── ic_copy.png │ │ │ │ │ ├── ic_date.png │ │ │ │ │ ├── ic_clear.png │ │ │ │ │ ├── ic_done_gr.png │ │ │ │ │ ├── ic_history.png │ │ │ │ │ ├── ic_search.png │ │ │ │ │ ├── ic_share.png │ │ │ │ │ ├── ic_flash_off.png │ │ │ │ │ └── ic_flash_on.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ ├── ic_back.png │ │ │ │ │ ├── ic_clear.png │ │ │ │ │ ├── ic_copy.png │ │ │ │ │ ├── ic_date.png │ │ │ │ │ ├── ic_search.png │ │ │ │ │ ├── ic_share.png │ │ │ │ │ ├── ic_done_gr.png │ │ │ │ │ ├── ic_flash_on.png │ │ │ │ │ ├── ic_history.png │ │ │ │ │ └── ic_flash_off.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ │ ├── ic_back.png │ │ │ │ │ ├── ic_clear.png │ │ │ │ │ ├── ic_copy.png │ │ │ │ │ ├── ic_date.png │ │ │ │ │ ├── ic_share.png │ │ │ │ │ ├── ic_done_gr.png │ │ │ │ │ ├── ic_history.png │ │ │ │ │ ├── ic_search.png │ │ │ │ │ ├── ic_flash_off.png │ │ │ │ │ └── ic_flash_on.png │ │ │ │ ├── values │ │ │ │ │ ├── strings.xml │ │ │ │ │ ├── colors.xml │ │ │ │ │ └── styles.xml │ │ │ │ └── layout │ │ │ │ │ ├── long_item_divider_without_margin.xml │ │ │ │ │ ├── activity_launch_screen.xml │ │ │ │ │ ├── custom_dialog.xml │ │ │ │ │ ├── activity_history.xml │ │ │ │ │ ├── activity_main.xml │ │ │ │ │ └── history_item.xml │ │ │ ├── java │ │ │ │ └── kz │ │ │ │ │ └── zhakhanyergali │ │ │ │ │ └── qrscanner │ │ │ │ │ ├── SQLite │ │ │ │ │ ├── ORM │ │ │ │ │ │ ├── InterfaceORM.java │ │ │ │ │ │ └── HistoryORM.java │ │ │ │ │ └── DatabaseWrapper.java │ │ │ │ │ ├── Entity │ │ │ │ │ └── History.java │ │ │ │ │ ├── Activity │ │ │ │ │ ├── LaunchScreenActivity.java │ │ │ │ │ ├── HistoryActivity.java │ │ │ │ │ └── MainActivity.java │ │ │ │ │ ├── CustomWidgets │ │ │ │ │ ├── FontCache.java │ │ │ │ │ ├── CustomButton.java │ │ │ │ │ ├── CustomEditText.java │ │ │ │ │ └── CustomTextView.java │ │ │ │ │ └── Adapter │ │ │ │ │ └── HistoryAdapter.java │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── kz │ │ │ │ └── zhakhanyergali │ │ │ │ └── qrscanner │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── kz │ │ │ └── zhakhanyergali │ │ │ └── qrscanner │ │ │ └── ExampleInstrumentedTest.java │ ├── proguard-rules.pro │ └── build.gradle ├── settings.gradle ├── .idea │ ├── copyright │ │ └── profiles_settings.xml │ ├── dictionaries │ │ └── zhakhanyergali.xml │ ├── inspectionProfiles │ │ ├── profiles_settings.xml │ │ └── Project_Default.xml │ ├── modules.xml │ ├── runConfigurations.xml │ ├── gradle.xml │ ├── compiler.xml │ └── misc.xml ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradlew.bat └── gradlew ├── .DS_Store └── README.md /QrScanner/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /QrScanner/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/.DS_Store -------------------------------------------------------------------------------- /QrScanner/app/app-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/app-debug.apk -------------------------------------------------------------------------------- /QrScanner/app/app-release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/app-release.apk -------------------------------------------------------------------------------- /QrScanner/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /QrScanner/.idea/dictionaries/zhakhanyergali.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /QrScanner/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /QrScanner/app/src/main/assets/RobotoLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/assets/RobotoLight.ttf -------------------------------------------------------------------------------- /QrScanner/app/src/main/assets/RobotoMedium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/assets/RobotoMedium.ttf -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable/logo.jpg -------------------------------------------------------------------------------- /QrScanner/app/src/main/assets/RobotoRegular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/assets/RobotoRegular.ttf -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_back.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_clear.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_copy.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_date.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_share.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_back.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_clear.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_copy.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_date.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_share.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_back.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_copy.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_date.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_done_gr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_done_gr.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_flash_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_flash_on.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_history.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_search.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_done_gr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_done_gr.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_flash_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_flash_on.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_history.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_search.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_clear.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_done_gr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_done_gr.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_history.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_search.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_share.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_back.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_clear.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_copy.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_date.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_search.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_share.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_back.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_clear.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_copy.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_date.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_share.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-hdpi/ic_flash_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-hdpi/ic_flash_off.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-mdpi/ic_flash_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-mdpi/ic_flash_off.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_flash_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_flash_off.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xhdpi/ic_flash_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xhdpi/ic_flash_on.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_done_gr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_done_gr.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_flash_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_flash_on.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_history.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_done_gr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_done_gr.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_history.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_search.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxhdpi/ic_flash_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxhdpi/ic_flash_off.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_flash_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_flash_off.png -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable-xxxhdpi/ic_flash_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yergali28/Qr-Code-Scanner/HEAD/QrScanner/app/src/main/res/drawable-xxxhdpi/ic_flash_on.png -------------------------------------------------------------------------------- /QrScanner/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | QrScanner 3 | Hover to QR-code 4 | 5 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/layout/long_item_divider_without_margin.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /QrScanner/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Nov 21 07:14:27 ALMT 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /QrScanner/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /QrScanner/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | @android:color/black 5 | #FF4081 6 | #f1f1f1 7 | @android:color/white 8 | #f06f15 9 | 10 | -------------------------------------------------------------------------------- /QrScanner/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/drawable/dialog_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /QrScanner/app/src/test/java/kz/zhakhanyergali/qrscanner/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/SQLite/ORM/InterfaceORM.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.SQLite.ORM; 2 | 3 | import android.content.Context; 4 | import android.database.Cursor; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by zhakhanyergali on 21.11.17. 10 | */ 11 | 12 | public interface InterfaceORM { 13 | 14 | public T cursorToObject(Cursor cursor); 15 | public void add(Context context, T t); 16 | public void clearAll(Context context); 17 | public List getAll(Context context); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /QrScanner/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /QrScanner/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /QrScanner/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /QrScanner/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/Entity/History.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.Entity; 2 | 3 | /** 4 | * Created by zhakhanyergali on 21.11.17. 5 | */ 6 | 7 | public class History { 8 | 9 | private int id; 10 | private String date; 11 | private String context; 12 | 13 | public int getId() { 14 | return id; 15 | } 16 | 17 | public void setId(int id) { 18 | this.id = id; 19 | } 20 | 21 | public String getDate() { 22 | return date; 23 | } 24 | 25 | public void setDate(String date) { 26 | this.date = date; 27 | } 28 | 29 | public String getContext() { 30 | return context; 31 | } 32 | 33 | public void setContext(String context) { 34 | this.context = context; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /QrScanner/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android qr code scanner 2 | 3 | 4 | 5 | [](https://play.google.com/store/apps/details?id=yergalizhakhan.kz.qrcodescannerkotlin) 6 | 7 | ### Description 8 | Full stable QR code scanner in android. 9 | 10 | ### Functionality 11 | User can: 12 | * use flashlight 13 | * search in the internet with scanned qr code value 14 | * copy to clipboard qr code value 15 | * share qr code value 16 | * see own history of scanned qr codes 17 | 18 | ### Screenshots 19 | ![2017-11-23 11 27 00](https://user-images.githubusercontent.com/33349723/33159841-4de6736c-d041-11e7-8dc6-70c63be768e9.png) 20 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/Activity/LaunchScreenActivity.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.Activity; 2 | 3 | import android.content.Intent; 4 | import android.os.Handler; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | 8 | import kz.zhakhanyergali.qrscanner.R; 9 | 10 | public class LaunchScreenActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_launch_screen); 16 | 17 | int secondsDelayed = 3; 18 | new Handler().postDelayed(new Runnable() { 19 | public void run() { 20 | startActivity(new Intent(LaunchScreenActivity.this, MainActivity.class)); 21 | finish(); 22 | } 23 | }, secondsDelayed * 1000); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/CustomWidgets/FontCache.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.CustomWidgets; 2 | 3 | import android.content.Context; 4 | import android.graphics.Typeface; 5 | 6 | import java.util.HashMap; 7 | 8 | /** 9 | * Created by zhakhanyergali on 11.10.17. 10 | */ 11 | 12 | public class FontCache { 13 | 14 | private static HashMap fontCache = new HashMap<>(); 15 | 16 | public static Typeface getTypeface(String fontname, Context context) { 17 | Typeface typeface = fontCache.get(fontname); 18 | 19 | if (typeface == null) { 20 | try { 21 | typeface = Typeface.createFromAsset(context.getAssets(), fontname); 22 | } catch (Exception e) { 23 | return null; 24 | } 25 | 26 | fontCache.put(fontname, typeface); 27 | } 28 | 29 | return typeface; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /QrScanner/app/src/androidTest/java/kz/zhakhanyergali/qrscanner/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("kz.zhakhanyergali.qrscanner", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /QrScanner/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/zhakhanyergali/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /QrScanner/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | buildToolsVersion "26.0.1" 6 | defaultConfig { 7 | applicationId "kz.zhakhanyergali.qrscanner" 8 | minSdkVersion 18 9 | targetSdkVersion 26 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | compile 'com.android.support:appcompat-v7:26.+' 28 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 29 | compile 'com.android.support:design:26.+' 30 | compile 'com.android.support:cardview-v7:26.+' 31 | compile 'com.jakewharton:butterknife:8.8.1' 32 | compile 'me.dm7.barcodescanner:zxing:1.9.8' 33 | testCompile 'junit:junit:4.12' 34 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' 35 | } 36 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/SQLite/DatabaseWrapper.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.SQLite; 2 | 3 | import android.content.Context; 4 | import android.database.sqlite.SQLiteDatabase; 5 | import android.database.sqlite.SQLiteOpenHelper; 6 | import android.util.Log; 7 | 8 | import kz.zhakhanyergali.qrscanner.SQLite.ORM.HistoryORM; 9 | 10 | /** 11 | * Created by zhakhanyergali on 21.11.17. 12 | */ 13 | 14 | public class DatabaseWrapper extends SQLiteOpenHelper { 15 | 16 | private static final String TAG = DatabaseWrapper.class.getCanonicalName(); 17 | 18 | public static final String DATABASE_NAME = "QrScanner.db"; 19 | public static final int DATABASE_VERSION = 1; 20 | 21 | public DatabaseWrapper(Context context){ 22 | super(context, DATABASE_NAME, null, DATABASE_VERSION); 23 | } 24 | 25 | @Override 26 | public void onCreate(SQLiteDatabase db) { 27 | Log.i(TAG, "Creating database [" + DATABASE_NAME + "]"); 28 | 29 | db.execSQL(HistoryORM.SQL_CREATE_TABLE); 30 | } 31 | 32 | @Override 33 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 34 | Log.i(TAG, "Upgrading database [" + DATABASE_NAME + "v." + oldVersion + "to v." + newVersion + "]"); 35 | 36 | db.execSQL(HistoryORM.SQL_DROP_TABLE); 37 | 38 | onCreate(db); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/layout/activity_launch_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 22 | 23 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/CustomWidgets/CustomButton.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.CustomWidgets; 2 | 3 | import android.content.Context; 4 | import android.graphics.Typeface; 5 | import android.util.AttributeSet; 6 | import android.widget.Button; 7 | 8 | /** 9 | * Created by zhakhanyergali on 11.10.17. 10 | */ 11 | 12 | public class CustomButton extends Button { 13 | 14 | public static final String ANDROID_SCHEMA = "http://schemas.android.com/apk/res/android"; 15 | 16 | public CustomButton(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | 19 | applyCustomFont(context, attrs); 20 | } 21 | 22 | public CustomButton(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | 25 | applyCustomFont(context, attrs); 26 | } 27 | 28 | private void applyCustomFont(Context context, AttributeSet attrs) { 29 | int textStyle = attrs.getAttributeIntValue(ANDROID_SCHEMA, "textStyle", Typeface.NORMAL); 30 | 31 | Typeface customFont = selectTypeface(context, textStyle); 32 | setTypeface(customFont); 33 | } 34 | 35 | private Typeface selectTypeface(Context context, int textStyle) { 36 | 37 | switch (textStyle) { 38 | case Typeface.BOLD: // medium 39 | return FontCache.getTypeface("RobotoMedium.ttf", context); 40 | 41 | case Typeface.NORMAL: // regular 42 | return FontCache.getTypeface("RobotoRegular.ttf", context); 43 | 44 | default: // light 45 | return FontCache.getTypeface("RobotoLight.ttf", context); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/CustomWidgets/CustomEditText.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.CustomWidgets; 2 | 3 | import android.content.Context; 4 | import android.graphics.Typeface; 5 | import android.util.AttributeSet; 6 | import android.widget.EditText; 7 | 8 | /** 9 | * Created by zhakhanyergali on 11.10.17. 10 | */ 11 | 12 | public class CustomEditText extends EditText { 13 | 14 | public static final String ANDROID_SCHEMA = "http://schemas.android.com/apk/res/android"; 15 | 16 | public CustomEditText(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | 19 | applyCustomFont(context, attrs); 20 | } 21 | 22 | public CustomEditText(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | 25 | applyCustomFont(context, attrs); 26 | } 27 | 28 | private void applyCustomFont(Context context, AttributeSet attrs) { 29 | int textStyle = attrs.getAttributeIntValue(ANDROID_SCHEMA, "textStyle", Typeface.NORMAL); 30 | 31 | Typeface customFont = selectTypeface(context, textStyle); 32 | setTypeface(customFont); 33 | } 34 | 35 | private Typeface selectTypeface(Context context, int textStyle) { 36 | 37 | switch (textStyle) { 38 | case Typeface.BOLD: // medium 39 | return FontCache.getTypeface("RobotoMedium.ttf", context); 40 | 41 | case Typeface.NORMAL: // regular 42 | return FontCache.getTypeface("RobotoRegular.ttf", context); 43 | 44 | default: // light 45 | return FontCache.getTypeface("RobotoLight.ttf", context); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/CustomWidgets/CustomTextView.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.CustomWidgets; 2 | 3 | import android.content.Context; 4 | import android.graphics.Typeface; 5 | import android.util.AttributeSet; 6 | import android.widget.TextView; 7 | 8 | /** 9 | * Created by zhakhanyergali on 11.10.17. 10 | */ 11 | 12 | public class CustomTextView extends TextView { 13 | 14 | public static final String ANDROID_SCHEMA = "http://schemas.android.com/apk/res/android"; 15 | 16 | public CustomTextView(Context context, AttributeSet attrs) { 17 | super(context, attrs); 18 | 19 | applyCustomFont(context, attrs); 20 | } 21 | 22 | public CustomTextView(Context context, AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | 25 | applyCustomFont(context, attrs); 26 | } 27 | 28 | private void applyCustomFont(Context context, AttributeSet attrs) { 29 | int textStyle = attrs.getAttributeIntValue(ANDROID_SCHEMA, "textStyle", Typeface.NORMAL); 30 | 31 | Typeface customFont = selectTypeface(context, textStyle); 32 | setTypeface(customFont); 33 | } 34 | 35 | private Typeface selectTypeface(Context context, int textStyle) { 36 | 37 | switch (textStyle) { 38 | case Typeface.BOLD: // medium 39 | return FontCache.getTypeface("RobotoMedium.ttf", context); 40 | 41 | case Typeface.NORMAL: // regular 42 | return FontCache.getTypeface("RobotoRegular.ttf", context); 43 | 44 | default: // light 45 | return FontCache.getTypeface("RobotoLight.ttf", context); 46 | } 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /QrScanner/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /QrScanner/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Android 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/Activity/HistoryActivity.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.Activity; 2 | 3 | import android.os.Handler; 4 | import android.support.v4.widget.SwipeRefreshLayout; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.support.v7.widget.LinearLayoutManager; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.View; 10 | import android.widget.Toast; 11 | 12 | import java.util.List; 13 | 14 | import butterknife.BindView; 15 | import butterknife.ButterKnife; 16 | import butterknife.OnClick; 17 | import kz.zhakhanyergali.qrscanner.Adapter.HistoryAdapter; 18 | import kz.zhakhanyergali.qrscanner.Entity.History; 19 | import kz.zhakhanyergali.qrscanner.R; 20 | import kz.zhakhanyergali.qrscanner.SQLite.ORM.HistoryORM; 21 | 22 | public class HistoryActivity extends AppCompatActivity implements SwipeRefreshLayout.OnRefreshListener { 23 | 24 | // Init ui elements 25 | @BindView(R.id.historySwipeRefreshLayout) 26 | SwipeRefreshLayout historySwipeRefreshLayout; 27 | @BindView(R.id.historyRecyclerView) 28 | RecyclerView historyRecyclerView; 29 | 30 | // Variables 31 | HistoryORM h = new HistoryORM(); 32 | List historyList; 33 | private RecyclerView.LayoutManager layoutManager; 34 | private RecyclerView.Adapter adapter; 35 | 36 | @Override 37 | protected void onCreate(Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | setContentView(R.layout.activity_history); 40 | ButterKnife.bind(this); 41 | 42 | historySwipeRefreshLayout.setOnRefreshListener(this); 43 | 44 | layoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); 45 | historyRecyclerView.setLayoutManager(layoutManager); 46 | getData(); 47 | } 48 | 49 | @Override 50 | public void onRefresh() { 51 | new Handler().postDelayed(new Runnable() { 52 | @Override 53 | public void run() { 54 | // Отменяем анимацию обновления 55 | getData(); 56 | historySwipeRefreshLayout.setRefreshing(false); 57 | } 58 | }, 2000); 59 | } 60 | 61 | private void getData() { 62 | historyList = h.getAll(getApplicationContext()); 63 | adapter = new HistoryAdapter(historyList); 64 | historyRecyclerView.setAdapter(adapter); 65 | } 66 | 67 | @OnClick 68 | void historyOnClickEvents(View v) { 69 | 70 | switch (v.getId()) { 71 | case R.id.backButton: 72 | finish(); 73 | break; 74 | case R.id.clearButton: 75 | h.clearAll(getApplicationContext()); 76 | Toast.makeText(getApplicationContext(), "The history is cleared, please refresh this page!", Toast.LENGTH_LONG).show(); 77 | break; 78 | } 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/layout/custom_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 25 | 26 | 30 | 31 | 35 | 36 | 47 | 48 | 59 | 60 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/layout/activity_history.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 28 | 29 | 39 | 40 | 52 | 53 | 54 | 55 | 56 | 57 | 61 | 62 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 28 | 29 | 40 | 41 | 53 | 54 | 55 | 56 | 57 | 58 | 62 | 63 | 74 | 75 | 76 | 77 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/res/layout/history_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 18 | 19 | 27 | 28 | 33 | 34 | 39 | 40 | 51 | 52 | 53 | 54 | 59 | 60 | 67 | 68 | 75 | 76 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/SQLite/ORM/HistoryORM.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.SQLite.ORM; 2 | 3 | import android.content.Context; 4 | import android.database.Cursor; 5 | import android.database.sqlite.SQLiteDatabase; 6 | import android.util.Log; 7 | 8 | import java.util.ArrayList; 9 | import java.util.List; 10 | 11 | import kz.zhakhanyergali.qrscanner.Entity.History; 12 | import kz.zhakhanyergali.qrscanner.SQLite.DatabaseWrapper; 13 | 14 | /** 15 | * Created by zhakhanyergali on 21.11.17. 16 | */ 17 | 18 | public class HistoryORM implements InterfaceORM { 19 | 20 | private static final String TAG = HistoryORM.class.getCanonicalName(); 21 | 22 | private static final String TABLE_NAME = "history"; 23 | private static final String COMMA_SEPARATOR = ", "; 24 | 25 | private static final String COLUMN_ID_TYPE = "integer PRIMARY KEY AUTOINCREMENT"; 26 | private static final String COLUMN_ID = "id"; 27 | 28 | private static final String COLUMN_CONTEXT_TYPE = "TEXT"; 29 | private static final String COLUMN_CONTEXT = "context"; 30 | 31 | private static final String COLUMN_DATE_TYPE = "TEXT"; 32 | private static final String COLUMN_DATE = "date"; 33 | 34 | public static final String SQL_CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" + 35 | COLUMN_ID + " " + COLUMN_ID_TYPE + COMMA_SEPARATOR + 36 | COLUMN_DATE + " " + COLUMN_DATE_TYPE + COMMA_SEPARATOR + COLUMN_CONTEXT + " " + COLUMN_CONTEXT_TYPE + ")"; 37 | 38 | public static final String SQL_DROP_TABLE = 39 | "DROP TABLE IF EXISTS " + TABLE_NAME; 40 | 41 | @Override 42 | public History cursorToObject(Cursor cursor) { 43 | History h = new History(); 44 | h.setId(cursor.getInt(cursor.getColumnIndex(COLUMN_ID))); 45 | h.setDate(cursor.getString(cursor.getColumnIndex(COLUMN_DATE))); 46 | h.setContext(cursor.getString(cursor.getColumnIndex(COLUMN_CONTEXT))); 47 | return h; 48 | } 49 | 50 | @Override 51 | public void add(Context context, History h) { 52 | DatabaseWrapper databaseWrapper = new DatabaseWrapper(context); 53 | SQLiteDatabase database = databaseWrapper.getReadableDatabase(); 54 | 55 | String query = "INSERT INTO " + TABLE_NAME + "(" + COLUMN_DATE + ", " + COLUMN_CONTEXT + ") VALUES ( '" + h.getDate() + "', '" + h.getContext() + "' )"; 56 | database.execSQL(query); 57 | 58 | database.close(); 59 | } 60 | 61 | @Override 62 | public void clearAll(Context context) { 63 | DatabaseWrapper databaseWrapper = new DatabaseWrapper(context); 64 | SQLiteDatabase database = databaseWrapper.getReadableDatabase(); 65 | database.delete(TABLE_NAME, null, null); 66 | } 67 | 68 | @Override 69 | public List getAll(Context context) { 70 | DatabaseWrapper databaseWrapper = new DatabaseWrapper(context); 71 | SQLiteDatabase database = databaseWrapper.getReadableDatabase(); 72 | List historyList = new ArrayList<>(); 73 | 74 | Cursor cursor = database.rawQuery("SELECT * FROM " + TABLE_NAME, null); 75 | try { 76 | if (cursor.moveToFirst()) { 77 | do { 78 | History h = cursorToObject(cursor); 79 | historyList.add(h); 80 | } while(cursor.moveToNext()); 81 | } 82 | } catch (Exception e) { 83 | Log.d(TAG, "Error while trying to get history from database"); 84 | } finally { 85 | if (cursor != null && !cursor.isClosed()) { 86 | cursor.close(); 87 | } 88 | } 89 | database.close(); 90 | 91 | return historyList; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/Adapter/HistoryAdapter.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.Adapter; 2 | 3 | import android.content.ClipData; 4 | import android.content.ClipboardManager; 5 | import android.content.Context; 6 | import android.content.Intent; 7 | import android.net.Uri; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.ImageView; 13 | import android.widget.TextView; 14 | import android.widget.Toast; 15 | 16 | import kz.zhakhanyergali.qrscanner.Activity.MainActivity; 17 | import kz.zhakhanyergali.qrscanner.R; 18 | 19 | import java.util.List; 20 | 21 | import kz.zhakhanyergali.qrscanner.Entity.History; 22 | 23 | /** 24 | * Created by zhakhanyergali on 08.11.17. 25 | */ 26 | 27 | public class HistoryAdapter extends RecyclerView.Adapter { 28 | 29 | // Variables 30 | private List historyList; 31 | private Context context; 32 | 33 | public HistoryAdapter(List historyList) { 34 | this.historyList = historyList; 35 | } 36 | 37 | @Override 38 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 39 | 40 | View v = null; 41 | 42 | v = LayoutInflater.from(parent.getContext()).inflate(R.layout.history_item, parent, false); 43 | 44 | ViewHolder vh = new ViewHolder(v); 45 | context = parent.getContext(); 46 | return vh; 47 | } 48 | 49 | @Override 50 | public void onBindViewHolder(final ViewHolder holder, final int position) { 51 | holder.context.setText((position + 1) + ". " + historyList.get(position).getContext()); 52 | holder.date.setText(historyList.get(position).getDate()); 53 | holder.search.setOnClickListener(new View.OnClickListener() { 54 | @Override 55 | public void onClick(View v) { 56 | String url; 57 | if(Patterns.WEB_URL.matcher(historyList.get(position).getContext()).matches()) { 58 | url = historyList.get(position).getContext(); 59 | }else { 60 | url = "http://www.google.com/#q=" + historyList.get(position).getContext(); 61 | } 62 | Intent intent= new Intent(Intent.ACTION_VIEW, Uri.parse(url)); 63 | context.startActivity(intent); 64 | } 65 | }); 66 | holder.copy.setOnClickListener(new View.OnClickListener() { 67 | @Override 68 | public void onClick(View v) { 69 | ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); 70 | ClipData clip = ClipData.newPlainText("", historyList.get(position).getContext()); 71 | clipboard.setPrimaryClip(clip); 72 | 73 | Toast.makeText(context, "Copied to clipboard", Toast.LENGTH_SHORT).show(); 74 | } 75 | }); 76 | holder.share.setOnClickListener(new View.OnClickListener() { 77 | @Override 78 | public void onClick(View v) { 79 | Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 80 | sharingIntent.setType("text/plain"); 81 | String shareBody = historyList.get(position).getContext(); 82 | sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); 83 | context.startActivity(Intent.createChooser(sharingIntent, "Share ")); 84 | 85 | } 86 | }); 87 | } 88 | 89 | @Override 90 | public int getItemCount() { 91 | return historyList.size(); 92 | } 93 | 94 | public class ViewHolder extends RecyclerView.ViewHolder { 95 | 96 | public TextView context, date; 97 | public ImageView search, copy, share; 98 | 99 | public ViewHolder(View itemView) { 100 | super(itemView); 101 | context = (TextView) itemView.findViewById(R.id.contextTextView); 102 | date = (TextView) itemView.findViewById(R.id.dateTextView); 103 | search = (ImageView) itemView.findViewById(R.id.searchImageView); 104 | copy = (ImageView) itemView.findViewById(R.id.copyImageView); 105 | share = (ImageView) itemView.findViewById(R.id.shareImageView); 106 | } 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /QrScanner/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /QrScanner/app/src/main/java/kz/zhakhanyergali/qrscanner/Activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package kz.zhakhanyergali.qrscanner.Activity; 2 | 3 | import android.Manifest; 4 | import android.app.Dialog; 5 | import android.content.ClipData; 6 | import android.content.ClipboardManager; 7 | import android.content.Context; 8 | import android.content.DialogInterface; 9 | import android.content.Intent; 10 | import android.content.pm.PackageManager; 11 | import android.icu.util.Calendar; 12 | import android.net.Uri; 13 | import android.support.v4.app.ActivityCompat; 14 | import android.support.v7.app.AppCompatActivity; 15 | import android.os.Bundle; 16 | import android.view.View; 17 | import android.view.ViewGroup; 18 | import android.view.Window; 19 | import android.widget.Button; 20 | import android.widget.ImageView; 21 | import android.widget.TextView; 22 | import android.widget.Toast; 23 | 24 | import com.google.zxing.Result; 25 | 26 | import butterknife.BindView; 27 | import butterknife.OnClick; 28 | import kz.zhakhanyergali.qrscanner.Entity.History; 29 | import kz.zhakhanyergali.qrscanner.R; 30 | import kz.zhakhanyergali.qrscanner.SQLite.ORM.HistoryORM; 31 | import me.dm7.barcodescanner.zxing.ZXingScannerView; 32 | 33 | public class MainActivity extends AppCompatActivity implements ZXingScannerView.ResultHandler { 34 | 35 | // Init ui elements 36 | @BindView(R.id.lightButton) ImageView flashImageView; 37 | 38 | //Variables 39 | Intent i; 40 | HistoryORM h = new HistoryORM(); 41 | private ZXingScannerView mScannerView; 42 | private boolean flashState = false; 43 | 44 | @Override 45 | protected void onCreate(Bundle savedInstanceState) { 46 | super.onCreate(savedInstanceState); 47 | setContentView(R.layout.activity_main); 48 | 49 | ActivityCompat.requestPermissions(MainActivity.this, 50 | new String[]{Manifest.permission.CAMERA}, 51 | 1); 52 | 53 | ViewGroup contentFrame = (ViewGroup) findViewById(R.id.content_frame); 54 | mScannerView = new ZXingScannerView(this); 55 | contentFrame.addView(mScannerView); 56 | } 57 | 58 | @Override 59 | public void onResume() { 60 | super.onResume(); 61 | mScannerView.setResultHandler(this); 62 | mScannerView.startCamera(); 63 | } 64 | 65 | @Override 66 | public void onPause() { 67 | super.onPause(); 68 | mScannerView.stopCamera(); 69 | } 70 | 71 | @Override 72 | public void handleResult(final Result rawResult) { 73 | 74 | // adding result to history 75 | String mydate = java.text.DateFormat.getDateTimeInstance().format(Calendar.getInstance().getTime()); 76 | History history = new History(); 77 | history.setContext(rawResult.getText()); 78 | history.setDate(mydate); 79 | h.add(getApplicationContext(), history); 80 | 81 | // show custom alert dialog 82 | final Dialog dialog = new Dialog(this); 83 | dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 84 | dialog.setCancelable(true); 85 | dialog.setContentView(R.layout.custom_dialog); 86 | 87 | View v = dialog.getWindow().getDecorView(); 88 | v.setBackgroundResource(android.R.color.transparent); 89 | 90 | TextView text = (TextView) dialog.findViewById(R.id.someText); 91 | text.setText(rawResult.getText()); 92 | ImageView img = (ImageView) dialog.findViewById(R.id.imgOfDialog); 93 | img.setImageResource(R.drawable.ic_done_gr); 94 | 95 | Button webSearch = (Button) dialog.findViewById(R.id.searchButton); 96 | Button copy = (Button) dialog.findViewById(R.id.copyButton); 97 | Button share = (Button) dialog.findViewById(R.id.shareButton); 98 | webSearch.setOnClickListener(new View.OnClickListener() { 99 | @Override 100 | public void onClick(View v) { 101 | String url; 102 | if(Patterns.WEB_URL.matcher(rawResult.getText()).matches()) { 103 | url = rawResult.getText(); 104 | }else { 105 | url = "http://www.google.com/#q=" + rawResult.getText(); 106 | } 107 | Intent intent= new Intent(Intent.ACTION_VIEW, Uri.parse(url)); 108 | startActivity(intent); 109 | dialog.dismiss(); 110 | mScannerView.resumeCameraPreview(MainActivity.this); 111 | } 112 | }); 113 | copy.setOnClickListener(new View.OnClickListener() { 114 | @Override 115 | public void onClick(View v) { 116 | ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); 117 | ClipData clip = ClipData.newPlainText("", rawResult.getText()); 118 | clipboard.setPrimaryClip(clip); 119 | 120 | Toast.makeText(getApplicationContext(), "Copied to clipboard", Toast.LENGTH_SHORT).show(); 121 | 122 | dialog.dismiss(); 123 | mScannerView.resumeCameraPreview(MainActivity.this); 124 | } 125 | }); 126 | share.setOnClickListener(new View.OnClickListener() { 127 | @Override 128 | public void onClick(View v) { 129 | Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); 130 | sharingIntent.setType("text/plain"); 131 | String shareBody = rawResult.getText(); 132 | sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); 133 | startActivity(Intent.createChooser(sharingIntent, "Share ")); 134 | 135 | dialog.dismiss(); 136 | mScannerView.resumeCameraPreview(MainActivity.this); 137 | } 138 | }); 139 | dialog.setOnCancelListener(new DialogInterface.OnCancelListener() { 140 | @Override 141 | public void onCancel(DialogInterface dialog) { 142 | mScannerView.resumeCameraPreview(MainActivity.this); 143 | } 144 | }); 145 | dialog.show(); 146 | } 147 | 148 | @Override 149 | public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { 150 | switch (requestCode) { 151 | case 1: { 152 | if (grantResults.length > 0 153 | && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 154 | } else { 155 | Toast.makeText(MainActivity.this, "Permission denied to camera", Toast.LENGTH_SHORT).show(); 156 | } 157 | return; 158 | } 159 | } 160 | } 161 | 162 | @OnClick 163 | void mainActivityOnClickEvents(View v) { 164 | 165 | switch (v.getId()) { 166 | case R.id.historyButton: 167 | i = new Intent(this, HistoryActivity.class); 168 | startActivity(i); 169 | break; 170 | case R.id.lightButton: 171 | if(flashState==false) { 172 | v.setBackgroundResource(R.drawable.ic_flash_off); 173 | Toast.makeText(getApplicationContext(), "Flashlight turned on", Toast.LENGTH_SHORT).show(); 174 | mScannerView.setFlash(true); 175 | flashState = true; 176 | }else if(flashState) { 177 | v.setBackgroundResource(R.drawable.ic_flash_on); 178 | Toast.makeText(getApplicationContext(), "Flashlight turned off", Toast.LENGTH_SHORT).show(); 179 | mScannerView.setFlash(false); 180 | flashState = false; 181 | } 182 | break; 183 | } 184 | 185 | } 186 | } 187 | --------------------------------------------------------------------------------