Skip to content

Commit 157410e

Browse files
- Migrated build scripts from Groovy to Kotlin DSL
- Updated Gradle version to 8.13 - Upgraded target and compile SDK to 35 - Updated Lens SDK to version 2.8.0 - Added edge-to-edge display support
1 parent 759a8ea commit 157410e

File tree

12 files changed

+164
-118
lines changed

12 files changed

+164
-118
lines changed

app/build.gradle

Lines changed: 0 additions & 69 deletions
This file was deleted.

app/build.gradle.kts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
plugins {
2+
id("com.android.application")
3+
id("kotlin-android")
4+
id("kotlin-kapt")
5+
id("org.jetbrains.kotlin.android")
6+
}
7+
8+
android {
9+
namespace = "com.zoho.lens.demo"
10+
11+
defaultConfig {
12+
applicationId = "com.zoho.lens"
13+
minSdk = 23
14+
compileSdk = 35
15+
targetSdk = 35
16+
versionCode = 1
17+
versionName = "1.0"
18+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19+
multiDexEnabled = true
20+
}
21+
22+
dataBinding {
23+
enable = true
24+
}
25+
26+
buildTypes {
27+
getByName("debug") {
28+
isMinifyEnabled = false
29+
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard_rules.pro")
30+
isZipAlignEnabled = true
31+
}
32+
}
33+
34+
lint {
35+
// but continue the build even when errors are found:
36+
abortOnError = false
37+
checkReleaseBuilds = false
38+
}
39+
40+
packaging {
41+
resources {
42+
excludes += setOf("META-INF/versions/9/OSGI-INF/MANIFEST.MF")
43+
}
44+
}
45+
46+
compileOptions {
47+
sourceCompatibility = JavaVersion.VERSION_1_8
48+
targetCompatibility = JavaVersion.VERSION_1_8
49+
}
50+
51+
kotlin {
52+
compilerOptions {
53+
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_1_8)
54+
}
55+
}
56+
}
57+
58+
dependencies {
59+
implementation(fileTree(mapOf("include" to listOf("*.jar"), "dir" to "libs")))
60+
androidTestImplementation("androidx.test.espresso:espresso-core:3.1.0") {
61+
exclude(group = "com.android.support", module = "support-annotations")
62+
}
63+
64+
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.32")
65+
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20")
66+
testImplementation("junit:junit:4.13.2")
67+
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
68+
implementation("androidx.appcompat:appcompat:1.7.0")
69+
implementation("com.google.android.material:material:1.12.0")
70+
implementation("androidx.lifecycle:lifecycle-extensions:2.2.0")
71+
72+
implementation("com.zoho:lens:2.8.0")
73+
}
74+
75+
kapt {
76+
generateStubs = true
77+
}

app/src/main/java/com/zoho/lens/demo/LensSample.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ import android.content.Intent
55
import android.net.Uri
66
import android.os.Build
77
import android.os.Bundle
8+
import android.util.TypedValue
89
import android.view.View
910
import android.view.WindowInsets
1011
import android.view.WindowManager
1112
import android.widget.SeekBar
1213
import android.widget.Toast
1314
import androidx.appcompat.app.AppCompatActivity
15+
import androidx.core.view.ViewCompat
16+
import androidx.core.view.WindowCompat
17+
import androidx.core.view.WindowInsetsCompat
18+
import androidx.core.view.updatePadding
1419
import androidx.databinding.DataBindingUtil
1520
import androidx.lifecycle.MutableLiveData
1621
import androidx.lifecycle.ViewModelProviders
@@ -47,6 +52,17 @@ class LensSample : AppCompatActivity() {
4752

4853
LensSDK.onCreate(this)
4954
viewDataBinding = DataBindingUtil.setContentView(this, R.layout.activity_lens)
55+
WindowCompat.setDecorFitsSystemWindows(window, false)
56+
viewDataBinding.let { binding ->
57+
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { _: View?, insets: WindowInsetsCompat ->
58+
val systemBar = insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout() or WindowInsetsCompat.Type.navigationBars())
59+
val navigationBar = insets.getInsets(WindowInsetsCompat.Type.navigationBars())
60+
val dp16 = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16f, resources.displayMetrics).toInt()
61+
val dp08 = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 08f, resources.displayMetrics).toInt()
62+
viewDataBinding.buttonLayout.updatePadding(left = systemBar.left, top = systemBar.top, right = systemBar.right)
63+
insets
64+
}
65+
}
5066

5167
var isAR = false
5268
sessionKey = intent.getStringExtra("sessionKey")

app/src/main/res/layout/activity_lens.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
android:layout_height="wrap_content">
3232

3333
<LinearLayout
34+
android:id="@+id/button_layout"
3435
android:layout_width="wrap_content"
3536
android:layout_height="wrap_content"
3637
android:orientation="horizontal">

build.gradle

Lines changed: 0 additions & 26 deletions
This file was deleted.

build.gradle.kts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
buildscript {
3+
val kotlinVersion by extra("2.2.0")
4+
repositories {
5+
google()
6+
maven("https://jcenter.bintray.com")
7+
}
8+
dependencies {
9+
classpath("com.android.tools.build:gradle:8.11.1")
10+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
11+
}
12+
}
13+
14+
allprojects {
15+
repositories {
16+
google()
17+
maven("https://jcenter.bintray.com")
18+
mavenCentral()
19+
maven { url = uri("https://maven.zohodl.com/") }
20+
}
21+
}
22+
23+
tasks.register<Delete>("clean") {
24+
delete(fileTree(rootProject.buildDir) {
25+
exclude("ant.properties", "build.xml", "library.xml", "build.gradle", "lens_android.conf", "settings.xml")
26+
})
27+
}

gradle/wrapper/gradle-wrapper.jar

-15.7 KB
Binary file not shown.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
#Wed Sep 18 15:48:32 IST 2024
1+
#Tue Jan 13 15:56:50 IST 2026
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
5+
networkTimeout=10000
6+
validateDistributionUrl=true
57
zipStoreBase=GRADLE_USER_HOME
68
zipStorePath=wrapper/dists

gradlew

Lines changed: 28 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 9 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)