diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 586bf68..91b8ecd 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -49,6 +49,7 @@ dependencies {
implementation(libs.androidx.lifecycle.viewmodel.ktx)
implementation(libs.androidx.navigation.fragment.ktx)
implementation(libs.androidx.navigation.ui.ktx)
+ implementation(libs.play.services.code.scanner)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
diff --git a/app/src/main/java/com/lhw/pdf/ui/NetworkFragment.kt b/app/src/main/java/com/lhw/pdf/ui/NetworkFragment.kt
new file mode 100644
index 0000000..22183a7
--- /dev/null
+++ b/app/src/main/java/com/lhw/pdf/ui/NetworkFragment.kt
@@ -0,0 +1,42 @@
+package com.lhw.pdf.ui
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.google.mlkit.vision.barcode.common.Barcode
+import com.google.mlkit.vision.codescanner.GmsBarcodeScannerOptions
+import com.google.mlkit.vision.codescanner.GmsBarcodeScanning
+import com.lhw.pdf.R
+import com.lhw.pdf.databinding.FragmentNetworkBinding
+import com.lhw.pdf.databinding.FragmentSlideshowBinding
+
+class NetworkFragment : Fragment() {
+ private var _binding: FragmentNetworkBinding? = null
+ // This property is only valid between onCreateView and
+ // onDestroyView.
+ private val binding get() = _binding!!
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ _binding = FragmentNetworkBinding.inflate(inflater, container, false)
+ val root: View = binding.root
+
+ binding.btnScanQrCode.setOnClickListener { getQrCode() }
+ return root
+ }
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ _binding = null
+ }
+
+ private fun getQrCode() {
+ val options = GmsBarcodeScannerOptions.Builder().setBarcodeFormats(Barcode.FORMAT_QR_CODE, Barcode.FORMAT_AZTEC).enableAutoZoom().build()
+ val scanner = GmsBarcodeScanning.getClient(requireContext(), options)
+ scanner.startScan()
+ .addOnSuccessListener { println("QR scan success: ${it.rawValue}") }
+ .addOnCanceledListener { println("QR scan canceled") }
+ .addOnFailureListener { println("QR scan failure: $it") }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lhw/pdf/ui/gallery/GalleryViewModel.kt b/app/src/main/java/com/lhw/pdf/ui/gallery/GalleryViewModel.kt
index 1128741..2c44217 100644
--- a/app/src/main/java/com/lhw/pdf/ui/gallery/GalleryViewModel.kt
+++ b/app/src/main/java/com/lhw/pdf/ui/gallery/GalleryViewModel.kt
@@ -1,7 +1,6 @@
package com.lhw.pdf.ui.gallery
import android.graphics.Bitmap
-import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
diff --git a/app/src/main/res/layout/fragment_network.xml b/app/src/main/res/layout/fragment_network.xml
new file mode 100644
index 0000000..a7931fd
--- /dev/null
+++ b/app/src/main/res/layout/fragment_network.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/menu/activity_main_drawer.xml b/app/src/main/res/menu/activity_main_drawer.xml
index d7f2df2..184041c 100644
--- a/app/src/main/res/menu/activity_main_drawer.xml
+++ b/app/src/main/res/menu/activity_main_drawer.xml
@@ -16,5 +16,9 @@
android:id="@+id/nav_slideshow"
android:icon="@drawable/ic_menu_slideshow"
android:title="@string/menu_slideshow" />
+
\ No newline at end of file
diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml
index 14959d4..4d2f607 100644
--- a/app/src/main/res/navigation/mobile_navigation.xml
+++ b/app/src/main/res/navigation/mobile_navigation.xml
@@ -22,4 +22,10 @@
android:name="com.lhw.pdf.ui.slideshow.SlideshowFragment"
android:label="@string/menu_slideshow"
tools:layout="@layout/fragment_slideshow" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c918ec7..44ae16a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -10,4 +10,5 @@
Home
Gallery
Slideshow
+ Network
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 08538c9..af93e3e 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -13,6 +13,7 @@ lifecycleViewmodelKtx = "2.8.4"
navigationFragmentKtx = "2.7.7"
navigationUiKtx = "2.7.7"
pdfboxAndroid = "2.0.27.0"
+playServicesCodeScanner = "16.1.0"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -27,6 +28,7 @@ androidx-lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifec
androidx-navigation-fragment-ktx = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigationFragmentKtx" }
androidx-navigation-ui-ktx = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigationUiKtx" }
pdfbox-android = { module = "com.tom-roush:pdfbox-android", version.ref = "pdfboxAndroid" }
+play-services-code-scanner = { group = "com.google.android.gms", name = "play-services-code-scanner", version.ref = "playServicesCodeScanner" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }