Skip to content

Commit e977e08

Browse files
committed
Code refactoring and libraries updated
1 parent 39b1de2 commit e977e08

File tree

14 files changed

+107
-77
lines changed

14 files changed

+107
-77
lines changed

.gitignore

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ captures/
3434

3535
# IntelliJ
3636
*.iml
37-
.idea/workspace.xml
38-
.idea/tasks.xml
39-
.idea/gradle.xml
40-
.idea/assetWizardSettings.xml
41-
.idea/dictionaries
42-
.idea/libraries
43-
.idea/caches
37+
.idea
4438

4539
# Keystore files
4640
# Uncomment the following line if you do not want to check your keystore files in.

app/build.gradle

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
13
plugins {
24
id("com.android.application")
35
id("kotlin-android")
@@ -7,9 +9,9 @@ plugins {
79
android {
810
defaultConfig {
911
applicationId "com.gapps.videonoapi"
10-
compileSdk 34
12+
compileSdk 36
1113
minSdkVersion 21
12-
targetSdkVersion 34
14+
targetSdkVersion 36
1315
versionCode 1
1416
versionName "1.0"
1517
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -19,7 +21,7 @@ android {
1921
buildTypes {
2022
release {
2123
minifyEnabled false
22-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
2325
}
2426
}
2527
buildFeatures {
@@ -31,26 +33,27 @@ android {
3133
sourceCompatibility JavaVersion.VERSION_11
3234
}
3335

34-
kotlinOptions {
35-
jvmTarget = JavaVersion.VERSION_11.toString()
36+
kotlin {
37+
compilerOptions {
38+
jvmTarget = JvmTarget.JVM_11
39+
}
3640
}
3741

3842
namespace "com.gapps.videonoapi"
3943
}
4044

4145
dependencies {
42-
implementation fileTree(dir: 'libs', include: ['*.jar'])
43-
implementation 'androidx.appcompat:appcompat:1.6.1'
44-
implementation 'androidx.core:core-ktx:1.12.0'
46+
implementation("androidx.appcompat:appcompat:1.7.1")
47+
implementation("androidx.core:core-ktx:1.17.0")
4548

46-
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
47-
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
49+
implementation("com.squareup.okhttp3:okhttp:5.1.0")
50+
implementation("com.squareup.okhttp3:logging-interceptor:5.1.0")
4851

4952
//Gson
50-
implementation(project(':embedded_video_lib'))
53+
implementation(project(":embedded_video_lib"))
5154

52-
implementation 'androidx.recyclerview:recyclerview:1.3.2'
53-
implementation("io.coil-kt:coil:2.5.0")
54-
implementation("io.coil-kt:coil-gif:2.4.0")
55-
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
55+
implementation("androidx.recyclerview:recyclerview:1.4.0")
56+
implementation("io.coil-kt:coil:2.7.0")
57+
implementation("io.coil-kt:coil-gif:2.7.0")
58+
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
5659
}

app/src/main/java/com/gapps/videonoapi/ui/main/MainActivity.kt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ package com.gapps.videonoapi.ui.main
22

33
import android.content.Intent
44
import android.os.Bundle
5+
import androidx.core.view.ViewCompat
6+
import androidx.core.view.WindowCompat
7+
import androidx.core.view.WindowInsetsCompat
58
import androidx.recyclerview.widget.LinearLayoutManager
69
import com.gapps.library.api.VideoService
710
import com.gapps.library.api.models.video.VideoPreviewModel
811
import com.gapps.library.utils.isVideoUrl
9-
import com.gapps.videonoapi.R
1012
import com.gapps.videonoapi.databinding.ActivityMainBinding
1113
import com.gapps.videonoapi.ui.base.BaseActivity
1214
import com.gapps.videonoapi.ui.main.adapters.VideoAdapter
1315
import com.gapps.videonoapi.ui.text.TextActivity
1416
import com.gapps.videonoapi.utils.extensions.alphaSmooth
1517
import com.gapps.videonoapi.utils.extensions.convertDpToPx
16-
import com.gapps.videonoapi.utils.recycler_view.MarginItemDecoration
1718
import com.gapps.videonoapi.utils.scroll.ScrollListener
1819
import com.gapps.videonoapi.video_utils.ultimedia.UltimediaVideoInfoModel
1920
import com.gapps.videonoapi.video_utils.youtube.MyYoutubeVideoInfoModel
@@ -52,6 +53,23 @@ class MainActivity : BaseActivity() {
5253
binding = ActivityMainBinding.inflate(layoutInflater)
5354
setContentView(binding.root)
5455

56+
WindowCompat.getInsetsController(window, window.decorView).isAppearanceLightStatusBars =
57+
true
58+
59+
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, windowInsets ->
60+
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
61+
62+
v.setPadding(
63+
insets.left,
64+
insets.top,
65+
insets.right,
66+
insets.bottom
67+
)
68+
69+
// Return CONSUMED to prevent further propagation of insets to child views
70+
windowInsets
71+
}
72+
5573
initService()
5674

5775
initViews()

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:app="http://schemas.android.com/apk/res-auto"
43
xmlns:tools="http://schemas.android.com/tools"
54
android:layout_width="match_parent"
65
android:layout_height="match_parent"
@@ -20,5 +19,5 @@
2019
android:layout_width="match_parent"
2120
android:layout_height="wrap_content"
2221
android:layout_margin="16dp"
23-
android:text="Clear links" />
24-
</LinearLayout>
22+
android:text="@string/clear_links" />
23+
</LinearLayout>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
android:id="@+id/video_link"
2424
style="@style/ItemText"
2525
android:layout_weight="1"
26-
tools:text="https://www.youtube.com/watch?v=M4BSGZ07NNA" />
26+
tools:text="https://www.youtube.com/watch?v=M4BSGZ07NNA"
27+
android:layout_width="0dp" />
2728

2829
<FrameLayout
2930
android:layout_width="48dp"
@@ -83,4 +84,4 @@
8384
tools:text="Title will be here."
8485
tools:visibility="visible" />
8586
</FrameLayout>
86-
</LinearLayout>
87+
</LinearLayout>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
<string name="refresh">Refresh</string>
1212
<string name="text_test">Text test</string>
1313
<string name="collapse_all">Collapse all</string>
14+
<string name="clear_links">Clear links</string>
1415
</resources>

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.9.21'
4+
ext.kotlin_version = "2.2.20"
55

66
repositories {
77
google()
88
mavenCentral()
99
}
1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:8.1.4'
11+
classpath "com.android.tools.build:gradle:8.11.1"
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1313
// NOTE: Do not place your application dependencies here; they belong
1414
// in the individual module build.gradle files

embedded_video_lib/build.gradle

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2+
13
plugins {
24
id("com.android.library")
35
id("kotlin-android")
46
}
57

68
android {
79
defaultConfig {
8-
compileSdk 34
10+
compileSdk 36
911
minSdkVersion 21
10-
targetSdkVersion 34
12+
targetSdkVersion 36
1113

1214
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13-
consumerProguardFiles 'consumer-rules.pro'
15+
consumerProguardFiles "consumer-rules.pro"
1416

1517
vectorDrawables.useSupportLibrary = true
1618
}
1719

1820
buildTypes {
1921
release {
2022
minifyEnabled false
21-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
2224
}
2325
}
2426
buildFeatures {
@@ -30,8 +32,10 @@ android {
3032
sourceCompatibility JavaVersion.VERSION_11
3133
}
3234

33-
kotlinOptions {
34-
jvmTarget = JavaVersion.VERSION_11.toString()
35+
kotlin {
36+
compilerOptions {
37+
jvmTarget = JvmTarget.JVM_11
38+
}
3539
}
3640

3741

@@ -40,15 +44,15 @@ android {
4044

4145
dependencies {
4246
//AndroidX
43-
api 'androidx.appcompat:appcompat:1.6.1'
44-
api 'com.google.android.material:material:1.11.0'
45-
api 'androidx.core:core-ktx:1.12.0'
47+
api("androidx.appcompat:appcompat:1.7.1")
48+
api("com.google.android.material:material:1.13.0")
49+
api("androidx.core:core-ktx:1.17.0")
4650

4751
//Gson
48-
api 'com.google.code.gson:gson:2.10.1'
52+
api("com.google.code.gson:gson:2.13.2")
4953
//Coroutines
50-
api 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0'
54+
api("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2")
5155

5256
//OkHttp
53-
api 'com.squareup.okhttp3:okhttp:4.12.0'
57+
api("com.squareup.okhttp3:okhttp:5.1.0")
5458
}

embedded_video_lib/src/main/java/com/gapps/library/ui/bottom_menu/BottomVideoController.kt

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ package com.gapps.library.ui.bottom_menu
22

33
import android.annotation.SuppressLint
44
import android.content.Context
5-
import android.graphics.*
6-
import android.os.Build
5+
import android.graphics.Bitmap
6+
import android.graphics.BitmapFactory
7+
import android.graphics.Color
8+
import android.graphics.PorterDuff
9+
import android.graphics.PorterDuffColorFilter
710
import android.util.Log
811
import android.view.LayoutInflater
912
import android.view.View
1013
import android.view.ViewGroup
11-
import android.view.WindowManager
1214
import android.webkit.WebChromeClient
1315
import android.webkit.WebResourceRequest
1416
import android.webkit.WebView
@@ -20,11 +22,11 @@ import androidx.annotation.ColorInt
2022
import androidx.annotation.DrawableRes
2123
import androidx.annotation.StringRes
2224
import androidx.appcompat.widget.AppCompatImageButton
23-
import androidx.core.content.ContextCompat
2425
import androidx.core.graphics.ColorUtils
26+
import androidx.core.graphics.toColorInt
2527
import androidx.core.view.ViewCompat
28+
import androidx.core.view.WindowInsetsCompat
2629
import androidx.core.view.isVisible
27-
import androidx.core.view.updatePadding
2830
import com.gapps.library.R
2931
import com.gapps.library.ui.bottom_dialog.BottomSheetDialogFixed
3032
import com.gapps.library.utils.getHeightFromWidth
@@ -232,9 +234,6 @@ class BottomVideoController private constructor(
232234
bottomSheetDialog.apply {
233235
setContentView(menuView)
234236

235-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
236-
window?.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
237-
}
238237
setOnShowListener {
239238
isVisible = true
240239
}
@@ -245,12 +244,17 @@ class BottomVideoController private constructor(
245244
}
246245

247246

248-
ViewCompat.setOnApplyWindowInsetsListener(menuContainer) { view, insets ->
249-
view?.apply {
250-
setPadding(paddingLeft, paddingTop, paddingRight, insets.systemWindowInsetBottom)
251-
}
247+
ViewCompat.setOnApplyWindowInsetsListener(menuContainer) { v, windowInsets ->
248+
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
249+
250+
v.setPadding(
251+
insets.left,
252+
insets.top,
253+
insets.right,
254+
insets.bottom
255+
)
252256

253-
insets
257+
windowInsets
254258
}
255259
}
256260

@@ -268,7 +272,7 @@ class BottomVideoController private constructor(
268272
private set
269273

270274
@ColorInt
271-
var textColor = Color.parseColor("#80000000")
275+
var textColor = "#80000000".toColorInt()
272276
private set
273277

274278
@ColorInt

embedded_video_lib/src/main/res/layout/layout_hc_video_view.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
<androidx.appcompat.widget.AppCompatTextView
4545
android:id="@+id/vna_text_url_preview_title"
46-
style="@style/VNAText.Title"
46+
style="@style/VnaText.Title"
4747
android:layout_width="match_parent"
4848
android:layout_height="wrap_content"
4949
android:layout_gravity="end"
@@ -53,7 +53,7 @@
5353

5454
<androidx.appcompat.widget.AppCompatTextView
5555
android:id="@+id/vna_player_type"
56-
style="@style/VNAText.Hosting"
56+
style="@style/VnaText.Hosting"
5757
android:layout_width="wrap_content"
5858
android:layout_height="wrap_content"
5959
android:layout_marginTop="3dp"
@@ -116,4 +116,4 @@
116116
android:text="@string/vna_open_in" />
117117
</FrameLayout>
118118
</LinearLayout>
119-
</LinearLayout>
119+
</LinearLayout>

0 commit comments

Comments
 (0)