Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ release.properties
# Ignore Gradle GUI config
gradle-app.setting

# Properties
gradle.properties

# Mobile Tools for Java (J2ME)
.mtj.tmp/

Expand Down
16 changes: 0 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,13 @@
* limitations under the License.
*/

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: '../dependencies.gradle'

android {
compileSdk versions.compileSdk

defaultConfig {
minSdk versions.minSdk
targetSdk versions.targetSdk

applicationId "github.nisrulz.projectqreader"
versionCode versions.appVersionCode
versionName versions.appVersionName
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

buildFeatures {
// Enabled View Binding
Expand All @@ -44,7 +29,6 @@ android {
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Support
implementation androidX

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/github/nisrulz/projectqreader/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ class MainActivity : AppCompatActivity() {

internal fun readQRCodeFromDrawable(resID: Int) {
qrEader = QREader.Builder(this, object : QRDataListener {
override fun onDetected(data: String) {
override fun onDetected(data: String?) {
Log.d("QREader", "Value : $data")
binding.txtQrCodeInfo.post { binding.txtQrCodeInfo.text = data }
}

override fun onReadQrError(exception: Exception) {
Toast.makeText(this@MainActivity, exception.localizedMessage, Toast.LENGTH_LONG)
override fun onReadQrError(exception: Exception?) {
Toast.makeText(this@MainActivity, exception?.localizedMessage, Toast.LENGTH_LONG)
.show()
}
}).build()
Expand All @@ -167,12 +167,12 @@ class MainActivity : AppCompatActivity() {
// Init QREader
// ------------
qrEader = QREader.Builder(this, object : QRDataListener {
override fun onDetected(data: String) {
override fun onDetected(data: String?) {
Log.d("QREader", "Value : $data")
binding.txtQrCodeInfo.post { binding.txtQrCodeInfo.text = data }
}

override fun onReadQrError(exception: Exception) {
override fun onReadQrError(exception: Exception?) {
Toast.makeText(this@MainActivity, "Cannot open camera", Toast.LENGTH_LONG).show()

}
Expand Down
13 changes: 2 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
*/

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
// Gradle will not find vars defined in an external file when referring to them
// in the buildscript block, unless you link it from the buildscript block, too.
apply from: 'dependencies.gradle'
apply from: "${rootDir}/configs/dependencies.gradle"

repositories {
google()
Expand All @@ -31,13 +30,5 @@ buildscript {
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
apply from: "${rootDir}/configs/all_projects.gradle"
35 changes: 35 additions & 0 deletions configs/all_projects.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 Nishant Srivastava
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

allprojects {
repositories {
google()
mavenCentral()
}

switch (project.name) {
case "app": apply plugin: 'com.android.application'; break
default: apply plugin: 'com.android.library'; break
}
apply plugin: 'kotlin-android'

android {
compileSdk versions.compileSdk
}

apply from: "${rootDir}/configs/dependencies.gradle"
apply from: "${rootDir}/configs/android.gradle"
}
32 changes: 32 additions & 0 deletions configs/android.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2016 Nishant Srivastava
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

android {
defaultConfig {
minSdk versions.minSdk
targetSdk versions.targetSdk
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
50 changes: 50 additions & 0 deletions configs/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2016 Nishant Srivastava
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

ext {
versions = [
appVersionCode : 2,
appVersionName : '1.0.1',

minSdk : 21,
targetSdk : 31,
compileSdk : 31,

appcompat : '1.0.2',
annotation : '1.2.0',
lifeycle_runtime: '2.3.1',

vision : '21.0.0',

]

visionDeps = "com.google.firebase:firebase-ml-vision:$versions.vision"

androidXDeps = [
appcompat : "androidx.appcompat:appcompat:$versions.appcompat",
annotation : "androidx.annotation:annotation:$versions.annotation",
lifecycle_runtime: "androidx.lifecycle:lifecycle-runtime-ktx:$versions.lifeycle_runtime"
]

gradlePlug = [
android : "com.android.tools.build:gradle:7.0.3",
kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31",
nexus_plugin: "com.vanniktech:gradle-maven-publish-plugin:0.18.0",
]

gradlePlugins = gradlePlug.values()
androidX = androidXDeps.values()
}
37 changes: 37 additions & 0 deletions configs/library.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2016 Nishant Srivastava
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// To publish to the local maven repository on your machine (~/.m2/repository),
// run: ./gradlew publishToMavenLocal
apply plugin: "com.vanniktech.maven.publish"

final versionCode = 13
final versionName = "2.2.0"

android {
defaultConfig {
// define version
buildConfigField 'int', 'VERSION_CODE', "${versionCode}"
buildConfigField 'String', 'VERSION_NAME', "\"${versionName}\""

consumerProguardFiles 'consumer-proguard-rules.pro'
}
}

dependencies {
implementation androidXDeps.annotation
api visionDeps
}
58 changes: 0 additions & 58 deletions dependencies.gradle

This file was deleted.

27 changes: 27 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
android.enableJetifier=true
android.useAndroidX=true

# Disable signing for generating an unsigned build
# RELEASE_SIGNING_ENABLED=false

# QReader Configs
GROUP=com.github.nisrulz
POM_ARTIFACT_ID=qreader
VERSION_NAME=2.2.0

POM_NAME=QReader
POM_DESCRIPTION=Android library that uses google\'s mobile vision api and simplify the QR code reading process.
POM_INCEPTION_YEAR=2016
POM_URL=https://github.com/nisrulz/qreader

POM_LICENSE_NAME=The Apache Software License, Version 2.0
POM_LICENSE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENSE_DIST=repo

POM_SCM_URL=https://github.com/nisrulz/qreader
POM_SCM_CONNECTION=scm:git:git://github.com/nisrulz/qreader.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/nisrulz/qreader.git

POM_DEVELOPER_ID=nisrulz
POM_DEVELOPER_NAME=Nishant Srivastava
POM_DEVELOPER_URL=https://github.com/nisrulz/
Loading