Skip to content

Commit

Permalink
Merge pull request #52 from ImaginativeShohag/barcode-scanner
Browse files Browse the repository at this point in the history
Barcode scanner
  • Loading branch information
ImaginativeShohag authored Dec 27, 2024
2 parents e8d5832 + c4ee87b commit 4ed2765
Show file tree
Hide file tree
Showing 21 changed files with 919 additions and 71 deletions.
33 changes: 11 additions & 22 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
Expand Down Expand Up @@ -61,12 +50,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# - name: Enable KVM group perms
# run: |
# echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
# sudo udevadm control --reload-rules
# sudo udevadm trigger --name-match=kvm
# ls /dev/kvm
- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls /dev/kvm
- name: Initialize local properties
env:
Expand Down Expand Up @@ -115,11 +104,11 @@ jobs:
- name: Run tests
run: ./gradlew test

# - name: Setup GMD
# run: ./gradlew :benchmarks:pixel6Api35Setup
# --info
# -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
# -Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"
- name: Setup GMD
run: ./gradlew :benchmarks:pixel6Api35Setup
--info
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect"

- name: Build all build type and flavor permutations (Ignore baseline profile generation)
run: ./gradlew assemble
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Feel free to request features or suggestions for improvements.

- Counter (Beginner)
- Counter with ViewModel (Beginner)
- AnimatedVisibility (Beginner)
- `AnimatedVisibility` (Beginner)
- Lottie (Beginner)
- Select image and crop for upload (Intermediate)
- Capture image and crop for upload (Intermediate)
Expand All @@ -72,6 +72,7 @@ Feel free to request features or suggestions for improvements.
- Navigation Data Pass (Intermediate)
- Reactive Model (Beginner)
- Baseline Profiles (Intermediate)
- [Barcode Scanner](https://developers.google.com/ml-kit/vision/barcode-scanning) ([Google code scanner](https://developers.google.com/ml-kit/vision/barcode-scanning/code-scanner) and [ML Kit Barcode](https://developers.google.com/ml-kit/vision/barcode-scanning/android)) (Intermediate)

| ![Counter](images/counter.gif) | ![Animated Visibility](images/animated-visibility.gif) | ![Lottie](images/lottie.gif) |
|:------------------------------------:|:------------------------------------------------------:|:----------------------------:|
Expand Down Expand Up @@ -105,6 +106,7 @@ Feel free to request features or suggestions for improvements.
- [ ] Update all `LaunchedEffect` with lambda issue using `rememberUpdatedState`: https://developer.android.com/develop/ui/compose/side-effects#rememberupdatedstate
- [ ] Add example for AppColorLocal from Jaber vai
- [x] Update to coil 3
- [ ] Update ktlint

# Note

Expand Down
17 changes: 14 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ dependencies {
implementation(libs.androidx.paging.compose)

// Accompanist
implementation(libs.accompanist.systemuicontroller)
implementation(libs.accompanist.flowlayout)
implementation(libs.accompanist.swiperefresh)
implementation(libs.accompanist.permissions)

// ----------------------------------------------------------------

Expand Down Expand Up @@ -250,6 +248,19 @@ dependencies {
implementation(platform(libs.firebase.bom))

implementation(libs.firebase.analytics.ktx)

// Code Scanner
implementation(libs.google.playservice.code.scanner)
implementation(libs.mlkit.barcode.scanning)

// Camera
implementation(libs.camerax.core)
implementation(libs.camerax.camera2)
implementation(libs.camerax.lifecycle)
implementation(libs.camerax.video)
implementation(libs.camerax.view)
implementation(libs.camerax.mlkit.vision)
implementation(libs.camerax.extensions)
}

baselineProfile {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<uses-feature
android:name="android.hardware.camera.any"
android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />

<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
Expand Down Expand Up @@ -121,6 +126,10 @@
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />

<meta-data
android:name="com.google.mlkit.vision.DEPENDENCIES"
android:value="barcode_ui" />

<!-- File Provider -->
<provider
android:name="androidx.core.content.FileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ import org.imaginativeworld.whynotcompose.ui.screens.composition.textfield.TextF
import org.imaginativeworld.whynotcompose.ui.screens.home.index.HomeIndexScreen
import org.imaginativeworld.whynotcompose.ui.screens.home.splash.SplashScreen
import org.imaginativeworld.whynotcompose.ui.screens.tutorial.animatedvisibility.AnimatedVisibilityScreen
import org.imaginativeworld.whynotcompose.ui.screens.tutorial.barcodescanner.index.BarcodeScannerScreen
import org.imaginativeworld.whynotcompose.ui.screens.tutorial.barcodescanner.index.BarcodeScannerViewModel
import org.imaginativeworld.whynotcompose.ui.screens.tutorial.baselineprofiles.BaselineProfilesScreen
import org.imaginativeworld.whynotcompose.ui.screens.tutorial.baselineprofiles.BaselineProfilesViewModel
import org.imaginativeworld.whynotcompose.ui.screens.tutorial.captureimageandcrop.CaptureImageAndCropScreen
Expand Down Expand Up @@ -294,6 +296,8 @@ sealed class TutorialsScreen(val route: String) {
data object TutorialPopBackStack : TutorialsScreen("tutorial/pop-back-stack")

data object TutorialBaselineProfiles : TutorialsScreen("tutorial/baseline-profiles")

data object TutorialBarcodeScanner : TutorialsScreen("tutorial/barcode-scanner")
}

// ================================================================
Expand Down Expand Up @@ -1206,6 +1210,17 @@ private fun NavGraphBuilder.addTutorialIndexScreen(
}
)
}

composable(TutorialsScreen.TutorialBarcodeScanner.route) {
val viewModel: BarcodeScannerViewModel = hiltViewModel()

BarcodeScannerScreen(
viewModel = viewModel,
goBack = {
navController.popBackStackOrIgnore()
}
)
}
}

// ================================================================
Expand Down
Loading

0 comments on commit 4ed2765

Please sign in to comment.