From 80e6e5f367d9091be6ec8c9feaf9b6ce33d9182c Mon Sep 17 00:00:00 2001 From: Rajat Mittal Date: Sat, 2 Dec 2023 13:57:20 +0000 Subject: [PATCH] Multidex removed File download related changes --- .idea/deploymentTargetDropDown.xml | 36 ++++++++++++++++++- app/build.gradle.kts | 4 --- app/src/main/AndroidManifest.xml | 2 +- .../rajat/sample/pdfviewer/MainActivity.kt | 2 +- pdfViewer/build.gradle.kts | 2 -- pdfViewer/src/main/AndroidManifest.xml | 5 ++- .../com/rajat/pdfviewer/PdfViewerActivity.kt | 11 ++---- 7 files changed, 42 insertions(+), 20 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index a010da0..0a85b38 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -3,7 +3,41 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6a55fd4..9160a4f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -16,7 +16,6 @@ android { targetSdk = 34 versionCode = 2 versionName = "1.1" - multiDexEnabled = true testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true @@ -79,15 +78,12 @@ dependencies { testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") - implementation("androidx.multidex:multidex:2.0.1") implementation(project(":pdfViewer")) - testImplementation("androidx.test:core:1.5.0") androidTestImplementation("androidx.test:runner:1.5.2") androidTestImplementation("androidx.test:rules:1.5.0") androidTestImplementation("androidx.test.ext:junit-ktx:1.1.5") - // compose implementation(platform("androidx.compose:compose-bom:2023.10.01")) androidTestImplementation(platform("androidx.compose:compose-bom:2023.10.01")) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6ec9118..95ffadf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,7 +6,7 @@ + android:maxSdkVersion="28" /> diff --git a/app/src/main/java/com/rajat/sample/pdfviewer/MainActivity.kt b/app/src/main/java/com/rajat/sample/pdfviewer/MainActivity.kt index 0561784..5f618c7 100644 --- a/app/src/main/java/com/rajat/sample/pdfviewer/MainActivity.kt +++ b/app/src/main/java/com/rajat/sample/pdfviewer/MainActivity.kt @@ -28,7 +28,7 @@ class MainActivity : AppCompatActivity() { setContentView(view) binding.onlinePdf.setOnClickListener { - launchPdfFromUrl(download_file_url1) + launchPdfFromUrl(download_file_url) } binding.pickPdfButton.setOnClickListener { diff --git a/pdfViewer/build.gradle.kts b/pdfViewer/build.gradle.kts index 85aefd1..5c88069 100644 --- a/pdfViewer/build.gradle.kts +++ b/pdfViewer/build.gradle.kts @@ -11,7 +11,6 @@ android { defaultConfig { minSdk = 21 - multiDexEnabled = true testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro") } @@ -58,7 +57,6 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3") implementation("com.google.android.material:material:1.10.0") - implementation("androidx.multidex:multidex:2.0.1") testImplementation("junit:junit:4.13.2") androidTestImplementation("androidx.test.ext:junit:1.1.5") androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") diff --git a/pdfViewer/src/main/AndroidManifest.xml b/pdfViewer/src/main/AndroidManifest.xml index 5de3cd4..569fef9 100644 --- a/pdfViewer/src/main/AndroidManifest.xml +++ b/pdfViewer/src/main/AndroidManifest.xml @@ -2,9 +2,8 @@ - + android:maxSdkVersion="28" /> + diff --git a/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfViewerActivity.kt b/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfViewerActivity.kt index 7c09272..b6271db 100644 --- a/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfViewerActivity.kt +++ b/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfViewerActivity.kt @@ -1,5 +1,6 @@ package com.rajat.pdfviewer +import android.Manifest import android.Manifest.permission import android.app.Activity import android.app.AlertDialog @@ -109,12 +110,6 @@ class PdfViewerActivity : AppCompatActivity() { } } - private fun isActionBarPresent(): Boolean { - val typedValue = TypedValue() - theme.resolveAttribute(android.R.attr.windowActionBar, typedValue, true) - return typedValue.data != 0 - } - private fun configureToolbar() { val typedArray = theme.obtainStyledAttributes(R.styleable.PdfRendererView_toolbar) try { @@ -434,8 +429,8 @@ class PdfViewerActivity : AppCompatActivity() { } private fun checkAndStartDownload() { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { - // For OS versions below Android 13, use the old method + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { + // For OS versions below Android 11, use the old method if (ContextCompat.checkSelfPermission( this, permission.WRITE_EXTERNAL_STORAGE ) == PackageManager.PERMISSION_GRANTED