├── .github └── workflows │ └── deploy-to-nexus.yml ├── .gitignore ├── Gemfile ├── LICENSE ├── Properties.kt ├── README.md ├── analytics ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── common │ │ └── analytics │ │ ├── AnalyticsPermissionData.kt │ │ ├── NordicAnalytics.kt │ │ ├── repository │ │ └── AnalyticsPermissionRepository.kt │ │ ├── view │ │ ├── AnalyticsPermissionAppBarButton.kt │ │ ├── AnalyticsPermissionRequestDialog.kt │ │ ├── AnalyticsPermissionSettingsSwitch.kt │ │ └── AnalyticsPermissionSwitchDialog.kt │ │ └── viewmodel │ │ └── AnalyticsPermissionViewModel.kt │ └── res │ ├── drawable │ └── ic_firebase.xml │ └── values │ └── strings.xml ├── app ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── common │ │ └── test │ │ ├── MainActivity.kt │ │ ├── TestApplication.kt │ │ ├── main │ │ ├── Main.kt │ │ └── page │ │ │ ├── BasicViewsPage.kt │ │ │ ├── FontsPage.kt │ │ │ ├── WarningPage.kt │ │ │ └── WizardPage.kt │ │ ├── simple │ │ ├── Advanced.kt │ │ ├── Hello.kt │ │ └── Settings.kt │ │ └── tab │ │ ├── Second.kt │ │ └── Third.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-mdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xxhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ ├── mipmap-xxxhdpi │ ├── ic_launcher.webp │ └── ic_launcher_round.webp │ └── values │ └── strings.xml ├── build.gradle.kts ├── core ├── .gitignore ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── no │ └── nordicsemi │ └── android │ └── common │ └── core │ ├── AppLauncher.kt │ ├── ApplicationScope.kt │ ├── BroadcastReceiver+Compose.kt │ ├── Ext.kt │ ├── SingleEventSharedFlow.kt │ └── SparseArrayExt.kt ├── docs └── html │ ├── analytics │ ├── index.html │ ├── navigation.html │ ├── no.nordicsemi.android.common.analytics.view │ │ ├── -analytics-permission-button.html │ │ ├── -analytics-permission-request-dialog.html │ │ ├── -analytics-permission-switch-dialog.html │ │ ├── -analytics-permission-switch.html │ │ └── index.html │ └── no.nordicsemi.android.common.analytics │ │ ├── -analytics-permission-data │ │ ├── -analytics-permission-data.html │ │ ├── index.html │ │ ├── is-permission-granted.html │ │ └── was-info-dialog-shown.html │ │ ├── -nordic-analytics │ │ ├── index.html │ │ ├── log-event.html │ │ ├── permission-data.html │ │ └── set-analytics-enabled.html │ │ └── index.html │ ├── core │ ├── index.html │ ├── navigation.html │ └── no.nordicsemi.android.common.core │ │ ├── -app-launcher │ │ ├── index.html │ │ └── lunch.html │ │ ├── -application-scope.html │ │ ├── -g-o-o-g-l-e_-p-l-a-y_-l-i-n-k.html │ │ ├── index.html │ │ ├── map.html │ │ ├── parse-bold.html │ │ ├── register-receiver.html │ │ └── simple-shared-flow.html │ ├── images │ ├── anchor-copy-button.svg │ ├── copy-icon.svg │ ├── copy-successful-icon.svg │ ├── footer-go-to-link.svg │ ├── go-to-top-icon.svg │ └── logo-icon.svg │ ├── index.html │ ├── logger │ ├── index.html │ ├── navigation.html │ ├── no.nordicsemi.android.common.logger.view │ │ ├── -logger-app-bar-icon.html │ │ └── index.html │ └── no.nordicsemi.android.common.logger │ │ ├── -logger-launcher │ │ ├── index.html │ │ └── launch.html │ │ └── index.html │ ├── navigation.html │ ├── navigation │ ├── index.html │ ├── navigation.html │ ├── no.nordicsemi.android.common.navigation.viewmodel │ │ ├── -simple-navigation-view-model │ │ │ ├── -simple-navigation-view-model.html │ │ │ ├── index.html │ │ │ ├── nullable-parameter-of.html │ │ │ └── parameter-of.html │ │ └── index.html │ └── no.nordicsemi.android.common.navigation │ │ ├── -destination-id │ │ ├── -destination-id.html │ │ ├── index.html │ │ └── to-string.html │ │ ├── -navigation-destination │ │ ├── id.html │ │ ├── index.html │ │ └── plus.html │ │ ├── -navigation-result │ │ ├── -cancelled │ │ │ ├── -cancelled.html │ │ │ └── index.html │ │ ├── -success │ │ │ ├── -success.html │ │ │ ├── index.html │ │ │ └── value.html │ │ └── index.html │ │ ├── -navigation-view.html │ │ ├── -navigator │ │ ├── current-destination.html │ │ ├── index.html │ │ ├── is-in-hierarchy.html │ │ ├── navigate-to.html │ │ ├── navigate-up-with-result.html │ │ ├── navigate-up.html │ │ ├── open.html │ │ └── result-from.html │ │ ├── create-destination.html │ │ ├── create-simple-destination.html │ │ ├── define-destination-with-inner-navigation.html │ │ ├── define-destination.html │ │ ├── define-dialog-destination.html │ │ ├── get-or-null.html │ │ ├── get-state-flow.html │ │ ├── get.html │ │ ├── index.html │ │ ├── only-success.html │ │ ├── pop-up-to-destination.html │ │ ├── pop-up-to-start-destination.html │ │ └── with.html │ ├── package-list │ ├── permissions-ble │ ├── index.html │ ├── navigation.html │ └── no.nordicsemi.android.common.permissions.ble │ │ ├── -ble-permission-not-available-reason │ │ ├── -d-i-s-a-b-l-e-d │ │ │ └── index.html │ │ ├── -n-o-t_-a-v-a-i-l-a-b-l-e │ │ │ └── index.html │ │ ├── -p-e-r-m-i-s-s-i-o-n_-r-e-q-u-i-r-e-d │ │ │ └── index.html │ │ ├── entries.html │ │ ├── index.html │ │ ├── value-of.html │ │ └── values.html │ │ ├── -require-bluetooth.html │ │ ├── -require-location.html │ │ └── index.html │ ├── permissions-internet │ ├── index.html │ ├── navigation.html │ └── no.nordicsemi.android.common.permissions.internet │ │ ├── -require-internet.html │ │ └── index.html │ ├── permissions-nfc │ ├── index.html │ ├── navigation.html │ └── no.nordicsemi.android.common.permissions.nfc │ │ ├── -nfc-not-available-reason │ │ ├── -d-i-s-a-b-l-e-d │ │ │ └── index.html │ │ ├── -n-o-t_-a-v-a-i-l-a-b-l-e │ │ │ └── index.html │ │ ├── entries.html │ │ ├── index.html │ │ ├── value-of.html │ │ └── values.html │ │ ├── -require-nfc.html │ │ └── index.html │ ├── permissions-notification │ ├── index.html │ ├── navigation.html │ └── no.nordicsemi.android.common.permissions.notification │ │ ├── -request-notification-permission.html │ │ └── index.html │ ├── permissions-wifi │ ├── index.html │ ├── navigation.html │ └── no.nordicsemi.android.common.permissions.wifi │ │ ├── -require-location-for-wi-fi.html │ │ ├── -require-wi-fi.html │ │ ├── -wi-fi-permission-not-available-reason │ │ ├── -d-i-s-a-b-l-e-d │ │ │ └── index.html │ │ ├── -n-o-t_-a-v-a-i-l-a-b-l-e │ │ │ └── index.html │ │ ├── -p-e-r-m-i-s-s-i-o-n_-r-e-q-u-i-r-e-d │ │ │ └── index.html │ │ ├── entries.html │ │ ├── index.html │ │ ├── value-of.html │ │ └── values.html │ │ └── index.html │ ├── scripts │ ├── clipboard.js │ ├── main.js │ ├── navigation-loader.js │ ├── pages.json │ ├── platform-content-handler.js │ ├── prism.js │ ├── sourceset_dependencies.js │ └── symbol-parameters-wrapper_deferred.js │ ├── styles │ ├── font-jb-sans-auto.css │ ├── logo-styles.css │ ├── main.css │ ├── prism.css │ └── style.css │ ├── theme │ ├── index.html │ ├── navigation.html │ └── no.nordicsemi.android.common.theme │ │ ├── -nordic-activity │ │ ├── -companion │ │ │ └── index.html │ │ ├── -nordic-activity.html │ │ └── index.html │ │ ├── -nordic-theme.html │ │ ├── index.html │ │ ├── nordic-blue.html │ │ ├── nordic-blueslate.html │ │ ├── nordic-dark-gray.html │ │ ├── nordic-fall.html │ │ ├── nordic-grass.html │ │ ├── nordic-green.html │ │ ├── nordic-lake.html │ │ ├── nordic-light-gray.html │ │ ├── nordic-middle-gray.html │ │ ├── nordic-red.html │ │ ├── nordic-sky.html │ │ ├── nordic-sun.html │ │ └── nordic-typography.html │ ├── ui-kit │ ├── assets │ │ ├── abstract-class-kotlin.svg │ │ ├── abstract-class.svg │ │ ├── annotation-kotlin.svg │ │ ├── annotation.svg │ │ ├── arrow-down.svg │ │ ├── burger.svg │ │ ├── checkbox-off.svg │ │ ├── checkbox-on.svg │ │ ├── class-kotlin.svg │ │ ├── class.svg │ │ ├── cross.svg │ │ ├── enum-kotlin.svg │ │ ├── enum.svg │ │ ├── exception-class.svg │ │ ├── field-value.svg │ │ ├── field-variable.svg │ │ ├── filter.svg │ │ ├── function.svg │ │ ├── homepage.svg │ │ ├── interface-kotlin.svg │ │ ├── interface.svg │ │ ├── object.svg │ │ ├── placeholder.svg │ │ ├── theme-toggle.svg │ │ └── typealias-kotlin.svg │ ├── ui-kit.min.css │ └── ui-kit.min.js │ └── ui │ ├── index.html │ ├── navigation.html │ └── no.nordicsemi.android.common.ui.view │ ├── -app-bar-icon.html │ ├── -circular-icon.html │ ├── -floating-action-menu-item-secondary.html │ ├── -floating-action-menu-item.html │ ├── -floating-action-menu.html │ ├── -horizontal-label-radio-button-group.html │ ├── -navigation-drawer-divider-defaults │ ├── -item-padding.html │ └── index.html │ ├── -navigation-drawer-title-defaults │ ├── -item-padding.html │ └── index.html │ ├── -navigation-drawer-title.html │ ├── -nordic-app-bar.html │ ├── -nordic-large-app-bar.html │ ├── -nordic-logo.html │ ├── -nordic-medium-app-bar.html │ ├── -nordic-slider-defaults │ ├── colors.html │ └── index.html │ ├── -pager-view-entity │ ├── -pager-view-entity.html │ ├── index.html │ └── items.html │ ├── -pager-view-item │ ├── -pager-view-item.html │ ├── draw-view.html │ ├── index.html │ └── title.html │ ├── -pager-view.html │ ├── -progress-item-status │ ├── -d-i-s-a-b-l-e-d │ │ └── index.html │ ├── -e-r-r-o-r │ │ └── index.html │ ├── -s-u-c-c-e-s-s │ │ └── index.html │ ├── -w-o-r-k-i-n-g │ │ └── index.html │ ├── entries.html │ ├── index.html │ ├── value-of.html │ └── values.html │ ├── -progress-item.html │ ├── -radio-button-group.html │ ├── -radio-button-item │ ├── -radio-button-item.html │ ├── index.html │ ├── is-checked.html │ └── label.html │ ├── -radio-group-view-entity │ ├── -radio-group-view-entity.html │ ├── index.html │ └── items.html │ ├── -rssi-icon.html │ ├── -section-title.html │ ├── -status-item.html │ ├── -warning-view.html │ ├── -wizard-step-action │ ├── -action │ │ ├── -action.html │ │ ├── dangerous.html │ │ ├── enabled.html │ │ ├── index.html │ │ ├── on-click.html │ │ └── text.html │ ├── -progress-indicator │ │ └── index.html │ └── index.html │ ├── -wizard-step-component.html │ ├── -wizard-step-state │ ├── -c-o-m-p-l-e-t-e-d │ │ └── index.html │ ├── -c-u-r-r-e-n-t │ │ └── index.html │ ├── -i-n-a-c-t-i-v-e │ │ └── index.html │ ├── entries.html │ ├── index.html │ ├── value-of.html │ └── values.html │ └── index.html ├── fastlane ├── .gitignore ├── Appfile └── Fastfile ├── gradle.properties ├── gradle ├── libs.versions.toml └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── logger ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── common │ │ └── logger │ │ ├── LoggerLauncher.kt │ │ └── view │ │ └── LoggerAppBarIcon.kt │ └── res │ ├── drawable │ └── ic_logger.xml │ └── values │ └── strings.xml ├── navigation ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── no │ └── nordicsemi │ └── android │ └── common │ └── navigation │ ├── DestinationId.kt │ ├── NavigationDestination.kt │ ├── NavigationResult.kt │ ├── NavigationView.kt │ ├── Navigator.kt │ ├── di │ └── NavigationModule.kt │ ├── internal │ ├── NavController+Bundle.kt │ ├── NavigationManager.kt │ └── NavigationViewModel.kt │ └── viewmodel │ └── SimpleNavigationViewModel.kt ├── permissions-ble ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── common │ │ └── permissions │ │ └── ble │ │ ├── RequireBluetooth.kt │ │ ├── RequireLocation.kt │ │ ├── bluetooth │ │ └── BluetoothStateManager.kt │ │ ├── location │ │ └── LocationStateManager.kt │ │ ├── util │ │ ├── BlePermissionState.kt │ │ ├── LocalDataProvider.kt │ │ └── PermissionUtils.kt │ │ ├── view │ │ ├── BluetoothDisabledView.kt │ │ ├── BluetoothNotAvailableView.kt │ │ ├── BluetoothPermissionRequiredView.kt │ │ └── LocationPermissionRequiredView.kt │ │ └── viewmodel │ │ └── PermissionViewModel.kt │ └── res │ └── values │ └── strings.xml ├── permissions-internet ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── common │ │ └── permissions │ │ └── internet │ │ ├── RequireInternet.kt │ │ ├── repository │ │ └── InternetStateManager.kt │ │ ├── util │ │ └── InternetPermissionState.kt │ │ ├── view │ │ └── InternetNotAvailableView.kt │ │ └── viewmodel │ │ └── InternetPermissionViewModel.kt │ └── res │ └── values │ └── strings.xml ├── permissions-nfc ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── common │ │ └── permissions │ │ └── nfc │ │ ├── RequireNfc.kt │ │ ├── repostory │ │ └── NfcStateManager.kt │ │ ├── utils │ │ ├── NfcPermissionState.kt │ │ └── NfcPermissionUtils.kt │ │ ├── view │ │ ├── NfcDisabledView.kt │ │ └── NfcNotAvailableView.kt │ │ └── viewmodel │ │ └── NfcPermissionViewModel.kt │ └── res │ ├── drawable │ └── nfc_variant_off.xml │ └── values │ └── strings.xml ├── permissions-notification ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── no │ └── nordicsemi │ └── android │ └── common │ └── permissions │ └── notification │ ├── RequestNotificationPermission.kt │ ├── repository │ └── NotificationStateManager.kt │ ├── utils │ ├── LocalDataProvider.kt │ ├── NotificationPermissionState.kt │ └── NotificationPermissionUtils.kt │ ├── view │ └── NotificationPermissionRequestView.kt │ └── viewmodel │ └── NotificationPermissionViewModel.kt ├── permissions-wifi ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── common │ │ └── permissions │ │ └── wifi │ │ ├── RequireLocationForWiFi.kt │ │ ├── RequireWiFi.kt │ │ ├── location │ │ └── LocationStateManager.kt │ │ ├── state │ │ └── WifiStateManager.kt │ │ ├── utils │ │ ├── LocalDataProvider.kt │ │ ├── PermissionUtils.kt │ │ └── WiFiPermissionState.kt │ │ ├── view │ │ ├── LocationDisabledView.kt │ │ ├── LocationPermissionRequiredView.kt │ │ ├── WiFiDisabledView.kt │ │ ├── WiFiNotAvailableView.kt │ │ └── WiFiPermissionRequiredView.kt │ │ └── viewmodel │ │ └── PermissionViewModel.kt │ └── res │ └── values │ └── strings.xml ├── renovate.json ├── scanner ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── kotlin │ │ └── ble │ │ └── ui │ │ └── scanner │ │ ├── HiltModule.kt │ │ ├── ScannerScreen.kt │ │ ├── ScannerScreenResult.kt │ │ ├── ScannerView.kt │ │ ├── di │ │ └── ScannerHiltModule.kt │ │ ├── main │ │ ├── DeviceListItem.kt │ │ ├── DeviceListItems.kt │ │ ├── DevicesListView.kt │ │ └── viewmodel │ │ │ └── ScannerViewModel.kt │ │ ├── repository │ │ ├── DevicesScanFilter.kt │ │ ├── ScannerRepository.kt │ │ └── ScanningState.kt │ │ └── view │ │ ├── DeviceConnectingView.kt │ │ ├── DeviceDisconnectedView.kt │ │ ├── ScannerAppBar.kt │ │ └── internal │ │ ├── FilterView.kt │ │ ├── ScanEmptyView.kt │ │ └── ScanErrorView.kt │ └── res │ └── values │ └── strings.xml ├── settings.gradle.kts ├── theme ├── Module.md ├── build.gradle.kts └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── no │ │ └── nordicsemi │ │ └── android │ │ └── common │ │ └── theme │ │ ├── NordicActivity.kt │ │ ├── NordicColorScheme.kt │ │ ├── NordicTheme.kt │ │ └── Typography.kt │ └── res │ ├── drawable-anydpi-v23 │ └── ic_splash_screen.xml │ ├── drawable-anydpi-v31 │ └── ic_splash_screen.xml │ ├── drawable │ ├── ic_arrow_right.xml │ ├── ic_check.xml │ ├── ic_cross.xml │ ├── ic_dot.xml │ ├── ic_signal_max.xml │ ├── ic_signal_medium.xml │ ├── ic_signal_min.xml │ └── ic_splash_screen.9.png │ ├── values-night-v23 │ └── styles_splashscreen.xml │ ├── values-night │ ├── colors.xml │ ├── colors_splashscreen.xml │ └── colors_theme.xml │ ├── values-v21 │ └── styles.xml │ ├── values-v23 │ ├── styles.xml │ └── styles_splashscreen.xml │ ├── values-v27 │ └── styles.xml │ └── values │ ├── colors.xml │ ├── colors_nordic.xml │ ├── colors_splashscreen.xml │ ├── colors_theme.xml │ ├── strings.xml │ ├── styles.xml │ └── styles_splashscreen.xml └── ui ├── Module.md ├── build.gradle.kts └── src └── main ├── AndroidManifest.xml ├── java └── no │ └── nordicsemi │ └── android │ └── common │ └── ui │ └── view │ ├── AppBarIcon.kt │ ├── CircularIcon.kt │ ├── FloatingActionMenu.kt │ ├── NavigationDrawerTitle.kt │ ├── NordicAppBar.kt │ ├── NordicLargeAppBar.kt │ ├── NordicLogo.kt │ ├── NordicMediumAppBar.kt │ ├── NordicSliderDefaults.kt │ ├── PagerView.kt │ ├── ProgressItem.kt │ ├── RadioButtonGroup.kt │ ├── RssiIcon.kt │ ├── SectionTitle.kt │ ├── StatusItem.kt │ ├── WarningView.kt │ ├── WizardStepComponent.kt │ └── internal │ ├── BigIcon.kt │ └── Hint.kt └── res ├── drawable ├── ic_arrow_right.xml ├── ic_check.xml ├── ic_cross.xml ├── ic_dot.xml ├── ic_signal_max.xml ├── ic_signal_medium.xml ├── ic_signal_min.xml └── nordic_logo.xml ├── values-night └── colors.xml └── values ├── colors.xml └── strings.xml /.github/workflows/deploy-to-nexus.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to Nexus 2 | on: 3 | push: 4 | tags: 5 | - '*' 6 | workflow_dispatch: 7 | jobs: 8 | deployToNexus: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v4 12 | with: 13 | fetch-depth: 0 14 | - uses: actions/setup-java@v4 15 | with: 16 | distribution: 'jetbrains' 17 | java-version: '21' 18 | - shell: bash 19 | env: 20 | # The following env variables are used by gradle/publish-module.gradle 21 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} 22 | GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} 23 | # The following env variables are used by gradle/publish-root.gradle.kts 24 | OSSR_USERNAME: ${{ secrets.OSSR_USERNAME }} 25 | OSSR_PASSWORD: ${{ secrets.OSSR_PASSWORD }} 26 | SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} 27 | # The script generates sec.gpg file that is required by gradle/publish-module.gradle 28 | # and starts :deployNexus lane using fastlane. 29 | run: | 30 | java --version 31 | echo "${{ secrets.GPG_FILE }}" > sec.gpg.asc 32 | gpg -d --passphrase "${{ secrets.GPG_FILE_PSWD }}" --batch sec.gpg.asc > sec.gpg 33 | fastlane deployNexus 34 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gem "fastlane" 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2021, Nordic Semiconductor Playground 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /Properties.kt: -------------------------------------------------------------------------------- 1 | object Properties { 2 | val kotlin_version = "1.7.20" 3 | val compose_version = "1.3.0-rc01" 4 | val compose_compiler_version = "1.3.2" 5 | val material3_version = "1.0.0-rc01" 6 | val dagger_version = "2.44" 7 | val android_api_version = 33 8 | val android_min_api_version = 21 9 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nordic Common Libraries for Android 2 | 3 | A libraries with Nordic's common code for Android apps. 4 | 5 | ## Documentation 6 | 7 | The latest documentation can be found [here](https://nordicplayground.github.io/Android-Common-Libraries/html/index.html). 8 | 9 | ## Usage 10 | 11 | To use this library, add the following to your `build.gradle` file: 12 | 13 | ```gradle 14 | dependencies { 15 | implementation 'no.nordicsemi.android.common::' 16 | } 17 | ``` 18 | 19 | ## Sample app 20 | 21 | Run the sample app to see and test most of the components from the library. 22 | 23 | 1. Clone the repository. 24 | 2. Open the project in Android Studio. 25 | 3. Run the `app` module on a connected device or emulator. -------------------------------------------------------------------------------- /analytics/Module.md: -------------------------------------------------------------------------------- 1 | # Module analytics 2 | 3 | Set of classes related to Firebase Analytics. 4 | 5 | ## Configuration 6 | 7 | Use of this module requires the following plugins to be applied in the app: 8 | ```kotlin 9 | if (gradle.startParameter.taskRequests.toString().contains("Release")) { 10 | apply("com.google.gms.google-services") 11 | apply("com.google.firebase.crashlytics") 12 | } 13 | ``` 14 | and the _google-services.json_ file to be present in the app module. 15 | 16 | Read [Firebase Setup](https://firebase.google.com/docs/android/setup) for more. 17 | 18 | > **Note:** 19 | > 20 | > This package requires Hilt, as it's using Dependency Injection to provide the 21 | > [NordicAnalytics][no.nordicsemi.android.common.analytics.NordicAnalytics] class. 22 | 23 | # Package no.nordicsemi.android.common.analytics 24 | 25 | Main API for Nordic analytics. Contains set to methods to log events. 26 | 27 | # Package no.nordicsemi.android.common.analytics.view 28 | 29 | Set of common views used for enabling analytics in Nordic apps. 30 | -------------------------------------------------------------------------------- /analytics/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /analytics/src/main/java/no/nordicsemi/android/common/analytics/AnalyticsPermissionData.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.analytics 33 | 34 | /** 35 | * Analytics configuration, stored in the shared preferences. 36 | * 37 | * @property isPermissionGranted Initially, analytics are disabled, user needs to Opt-In to enable. 38 | * @property wasInfoDialogShown A flag indicating whether the info dialog has been shown. 39 | */ 40 | data class AnalyticsPermissionData( 41 | val isPermissionGranted: Boolean = false, 42 | val wasInfoDialogShown: Boolean = false 43 | ) 44 | -------------------------------------------------------------------------------- /analytics/src/main/res/drawable/ic_firebase.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/no/nordicsemi/android/common/test/TestApplication.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.test 33 | 34 | import android.app.Application 35 | import dagger.hilt.android.HiltAndroidApp 36 | 37 | @HiltAndroidApp 38 | class TestApplication : Application() -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /core/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /core/Module.md: -------------------------------------------------------------------------------- 1 | # Module core 2 | 3 | Common classes and interfaces used by other modules. 4 | 5 | # Package no.nordicsemi.android.common.core 6 | 7 | Common classes and interfaces used by other modules. -------------------------------------------------------------------------------- /core/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | -------------------------------------------------------------------------------- /core/src/main/java/no/nordicsemi/android/common/core/ApplicationScope.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | @file:Suppress("unused") 33 | 34 | package no.nordicsemi.android.common.core 35 | 36 | import kotlinx.coroutines.CoroutineScope 37 | import kotlinx.coroutines.Dispatchers 38 | import kotlinx.coroutines.SupervisorJob 39 | 40 | /** 41 | * Application scope for the application. 42 | * 43 | * Combines [SupervisorJob] with [Dispatchers.Default]. 44 | */ 45 | val ApplicationScope = CoroutineScope(SupervisorJob() + Dispatchers.Default) 46 | -------------------------------------------------------------------------------- /core/src/main/java/no/nordicsemi/android/common/core/Ext.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.core 33 | 34 | import androidx.compose.ui.text.AnnotatedString 35 | import androidx.compose.ui.text.SpanStyle 36 | import androidx.compose.ui.text.buildAnnotatedString 37 | import androidx.compose.ui.text.font.FontWeight 38 | import androidx.compose.ui.text.withStyle 39 | 40 | /** 41 | * Parses the string and makes the text between `` and `` bold using [AnnotatedString]. 42 | */ 43 | fun String.parseBold(): AnnotatedString { 44 | val parts = this.split("", "") 45 | return buildAnnotatedString { 46 | var bold = false 47 | for (part in parts) { 48 | if (bold) { 49 | withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) { 50 | append(part) 51 | } 52 | } else { 53 | append(part) 54 | } 55 | bold = !bold 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /core/src/main/java/no/nordicsemi/android/common/core/SingleEventSharedFlow.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.core 33 | 34 | import kotlinx.coroutines.channels.BufferOverflow 35 | import kotlinx.coroutines.flow.MutableSharedFlow 36 | 37 | /** 38 | * Creates a simple [MutableSharedFlow] with a buffer of 1 element and [BufferOverflow.DROP_OLDEST] 39 | * strategy. 40 | */ 41 | fun simpleSharedFlow() = MutableSharedFlow( 42 | extraBufferCapacity = 1, 43 | onBufferOverflow = BufferOverflow.DROP_OLDEST 44 | ) 45 | -------------------------------------------------------------------------------- /core/src/main/java/no/nordicsemi/android/common/core/SparseArrayExt.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.core 33 | 34 | import android.util.SparseArray 35 | 36 | /** 37 | * Maps the SparseArray to a new SparseArray using the provided modifier. 38 | * 39 | * @param modifier the modifier to apply to each element. 40 | * @return a new SparseArray with the modified elements. 41 | */ 42 | fun SparseArray.map( 43 | modifier: (T) -> R, 44 | ): SparseArray { 45 | val newArray = SparseArray(this.size()) 46 | for (i in 0 until this.size()) { 47 | newArray[this.keyAt(i)] = modifier(this.valueAt(i)) 48 | } 49 | return newArray 50 | } 51 | -------------------------------------------------------------------------------- /docs/html/images/anchor-copy-button.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/html/images/copy-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/images/copy-successful-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/images/footer-go-to-link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/images/go-to-top-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /docs/html/package-list: -------------------------------------------------------------------------------- 1 | $dokka.format:html-v1 2 | $dokka.linkExtension:html 3 | 4 | module:analytics 5 | no.nordicsemi.android.common.analytics 6 | no.nordicsemi.android.common.analytics.view 7 | module:core 8 | no.nordicsemi.android.common.core 9 | module:logger 10 | no.nordicsemi.android.common.logger 11 | no.nordicsemi.android.common.logger.view 12 | module:navigation 13 | no.nordicsemi.android.common.navigation 14 | no.nordicsemi.android.common.navigation.viewmodel 15 | module:permissions-ble 16 | no.nordicsemi.android.common.permissions.ble 17 | module:permissions-internet 18 | no.nordicsemi.android.common.permissions.internet 19 | module:permissions-nfc 20 | no.nordicsemi.android.common.permissions.nfc 21 | module:permissions-notification 22 | no.nordicsemi.android.common.permissions.notification 23 | module:permissions-wifi 24 | no.nordicsemi.android.common.permissions.wifi 25 | module:theme 26 | no.nordicsemi.android.common.theme 27 | module:ui 28 | no.nordicsemi.android.common.ui.view 29 | -------------------------------------------------------------------------------- /docs/html/scripts/clipboard.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | window.addEventListener('load', () => { 6 | document.querySelectorAll('span.copy-icon').forEach(element => { 7 | element.addEventListener('click', (el) => copyElementsContentToClipboard(element)); 8 | }) 9 | 10 | document.querySelectorAll('span.anchor-icon').forEach(element => { 11 | element.addEventListener('click', (el) => { 12 | if(element.hasAttribute('pointing-to')){ 13 | const location = hrefWithoutCurrentlyUsedAnchor() + '#' + element.getAttribute('pointing-to') 14 | copyTextToClipboard(element, location) 15 | } 16 | }); 17 | }) 18 | }) 19 | 20 | const copyElementsContentToClipboard = (element) => { 21 | const selection = window.getSelection(); 22 | const range = document.createRange(); 23 | range.selectNodeContents(element.parentNode.parentNode); 24 | selection.removeAllRanges(); 25 | selection.addRange(range); 26 | 27 | copyAndShowPopup(element, () => selection.removeAllRanges()) 28 | } 29 | 30 | const copyTextToClipboard = (element, text) => { 31 | var textarea = document.createElement("textarea"); 32 | textarea.textContent = text; 33 | textarea.style.position = "fixed"; 34 | document.body.appendChild(textarea); 35 | textarea.select(); 36 | 37 | copyAndShowPopup(element, () => document.body.removeChild(textarea)) 38 | } 39 | 40 | const copyAndShowPopup = (element, after) => { 41 | try { 42 | document.execCommand('copy'); 43 | element.nextElementSibling.classList.add('active-popup'); 44 | setTimeout(() => { 45 | element.nextElementSibling.classList.remove('active-popup'); 46 | }, 1200); 47 | } catch (e) { 48 | console.error('Failed to write to clipboard:', e) 49 | } 50 | finally { 51 | if(after) after() 52 | } 53 | } 54 | 55 | const hrefWithoutCurrentlyUsedAnchor = () => window.location.href.split('#')[0] 56 | 57 | -------------------------------------------------------------------------------- /docs/html/scripts/sourceset_dependencies.js: -------------------------------------------------------------------------------- 1 | sourceset_dependencies = '{":analytics/debug":[],":analytics/main":[],":analytics/release":[],":core/debug":[],":core/main":[],":core/release":[],":permissions-ble/debug":[],":permissions-ble/main":[],":permissions-ble/release":[],":permissions-nfc/debug":[],":permissions-nfc/main":[],":permissions-nfc/release":[],":navigation/debug":[],":navigation/main":[],":navigation/release":[],":ui/debug":[],":ui/main":[],":ui/release":[],":logger/debug":[],":logger/main":[],":logger/release":[],":permissions-wifi/debug":[],":permissions-wifi/main":[],":permissions-wifi/release":[],":theme/debug":[],":theme/main":[],":theme/release":[],":permissions-notification/debug":[],":permissions-notification/main":[],":permissions-notification/release":[],":permissions-internet/debug":[],":permissions-internet/main":[],":permissions-internet/release":[]}' -------------------------------------------------------------------------------- /docs/html/styles/font-jb-sans-auto.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 | */ 4 | 5 | /* Light weight */ 6 | @font-face { 7 | font-family: 'JetBrains Sans'; 8 | src: url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans-Light.woff2') format('woff2'), url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans-Light.woff') format('woff'); 9 | font-weight: 300; 10 | font-style: normal; 11 | font-display: swap; 12 | } 13 | /* Regular weight */ 14 | @font-face { 15 | font-family: 'JetBrains Sans'; 16 | src: url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans-Regular.woff2') format('woff2'), url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans-Regular.woff') format('woff'); 17 | font-weight: 400; 18 | font-style: normal; 19 | font-display: swap; 20 | } 21 | /* SemiBold weight */ 22 | @font-face { 23 | font-family: 'JetBrains Sans'; 24 | src: url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans-SemiBold.woff2') format('woff2'), url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans-SemiBold.woff') format('woff'); 25 | font-weight: 600; 26 | font-style: normal; 27 | font-display: swap; 28 | } 29 | 30 | @supports (font-variation-settings: normal) { 31 | @font-face { 32 | font-family: 'JetBrains Sans'; 33 | src: url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans.woff2') format('woff2 supports variations'), 34 | url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans.woff2') format('woff2-variations'), 35 | url('https://resources.jetbrains.com/storage/jetbrains-sans/JetBrainsSans.woff') format('woff-variations'); 36 | font-weight: 100 900; 37 | font-style: normal; 38 | font-display: swap; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /docs/html/styles/logo-styles.css: -------------------------------------------------------------------------------- 1 | :root { 2 | /* Navigation bar */ 3 | --dokka-logo-image-url: url(../images/logo-icon.svg); 4 | --dokka-logo-height: 120px; 5 | --dokka-logo-width: 120px; 6 | 7 | --color-background-nav: #00A9CE !important; 8 | --color-background-nav-dt: #333f48 !important; 9 | 10 | /* Selected menu */ 11 | --color-key-blue: #00A9CE !important; 12 | 13 | /* Tabs */ 14 | --active-section-color: #0077C8; 15 | --sidemenu-section-active-color: #0077C8; 16 | --active-tab-border-color: #0077C8; 17 | --hover-link-color: #0077C8; 18 | 19 | .toc--part[data-active]>.toc--row .toc--button:hover, .toc--part[data-active]>.toc--row .toc--link:hover { 20 | background-color: #2fb9df; 21 | } 22 | .sidebar { 23 | border-right: 1px solid rgba(39, 40, 44, .2); 24 | box-sizing: border-box; 25 | overflow: auto; 26 | width: var(--sidebar-width); 27 | background-color: #35414622; 28 | } 29 | 30 | } 31 | 32 | .theme-dark { 33 | --active-section-color: #00A9CE; 34 | --sidemenu-section-active-color: #00A9CE; 35 | --active-tab-border-color: #00A9CE; 36 | --hover-link-color: #00A9CE; 37 | } 38 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/abstract-class-kotlin.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/abstract-class.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/annotation-kotlin.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/annotation.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/arrow-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/burger.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/checkbox-off.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/checkbox-on.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/class-kotlin.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/class.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/cross.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/enum-kotlin.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/enum.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/exception-class.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/field-value.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/field-variable.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/filter.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/function.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/homepage.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/interface-kotlin.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/interface.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/object.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/placeholder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/theme-toggle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/html/ui-kit/assets/typealias-kotlin.svg: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /fastlane/.gitignore: -------------------------------------------------------------------------------- 1 | README.md 2 | report.xml -------------------------------------------------------------------------------- /fastlane/Appfile: -------------------------------------------------------------------------------- 1 | package_name("no.nordicsemi.android.common") 2 | -------------------------------------------------------------------------------- /fastlane/Fastfile: -------------------------------------------------------------------------------- 1 | # This file contains the fastlane.tools configuration 2 | # You can find the documentation at https://docs.fastlane.tools 3 | # 4 | # For a list of all available actions, check out 5 | # 6 | # https://docs.fastlane.tools/actions 7 | # 8 | # For a list of all available plugins, check out 9 | # 10 | # https://docs.fastlane.tools/plugins/available-plugins 11 | # 12 | 13 | # Uncomment the line if you want fastlane to automatically update itself 14 | # update_fastlane 15 | 16 | default_platform(:android) 17 | 18 | platform :android do 19 | 20 | desc "Deploy libraries to Nexus." 21 | lane :deployNexus do 22 | gradle(task: "publish") 23 | gradle(task: "releaseStagingRepositories") 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /logger/Module.md: -------------------------------------------------------------------------------- 1 | # Module logger 2 | 3 | Utility classes for easy integration with [nRF Logger](https://play.google.com/store/apps/details?id=no.nordicsemi.android.log). 4 | 5 | Logging uses [nRF Logger API](https://github.com/NordicSemiconductor/nRF-Logger-API). 6 | 7 | # Package no.nordicsemi.android.common.logger 8 | 9 | A package with utility classes for easy integration with nRF Logger. 10 | 11 | # Package no.nordicsemi.android.common.logger.view 12 | 13 | UI components for nRF Logger integration. -------------------------------------------------------------------------------- /logger/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | plugins { 33 | alias(libs.plugins.nordic.library.compose) 34 | alias(libs.plugins.nordic.nexus.android) 35 | } 36 | 37 | group = "no.nordicsemi.android.common" 38 | 39 | nordicNexusPublishing { 40 | POM_ARTIFACT_ID = "logger" 41 | POM_NAME = "Set of helper classes and UI components for Nordic logger." 42 | 43 | POM_DESCRIPTION = "Nordic Android Common Libraries" 44 | POM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 45 | POM_SCM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 46 | POM_SCM_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 47 | POM_SCM_DEV_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 48 | } 49 | 50 | android { 51 | namespace = "no.nordicsemi.android.common.logger" 52 | } 53 | 54 | dokka { 55 | dokkaSourceSets.named("main") { 56 | includes.from("Module.md") 57 | } 58 | } 59 | 60 | dependencies { 61 | implementation(project(":ui")) 62 | 63 | api(libs.nordic.log) 64 | } 65 | -------------------------------------------------------------------------------- /logger/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /logger/src/main/java/no/nordicsemi/android/common/logger/view/LoggerAppBarIcon.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.logger.view 33 | 34 | import androidx.compose.runtime.Composable 35 | import androidx.compose.ui.res.painterResource 36 | import androidx.compose.ui.res.stringResource 37 | import no.nordicsemi.android.common.logger.R 38 | import no.nordicsemi.android.common.ui.view.AppBarIcon 39 | 40 | @Composable 41 | fun LoggerAppBarIcon( 42 | onClick: () -> Unit, 43 | ) { 44 | AppBarIcon( 45 | painter = painterResource(id = R.drawable.ic_logger), 46 | contentDescription = stringResource(id = R.string.open_logger), 47 | onClick = onClick 48 | ) 49 | } 50 | -------------------------------------------------------------------------------- /logger/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | Open logger application. 35 | -------------------------------------------------------------------------------- /navigation/Module.md: -------------------------------------------------------------------------------- 1 | # Module navigation 2 | 3 | Wrapper for the [AndroidX Navigation Compose](https://developer.android.com/develop/ui/compose/navigation) component 4 | allowing passing typed arguments between destinations. 5 | 6 | > **Note:** 7 | > 8 | > This package requires Hilt, as it's using Dependency Injection to provide the 9 | > [Navigator][no.nordicsemi.android.common.navigation.Navigator] class. 10 | 11 | ### Deprecation 12 | 13 | This module may get deprecated in favor of the official Navigation Compose library, 14 | which now also supports typed destinations using Serialization. 15 | 16 | # Package no.nordicsemi.android.common.navigation 17 | 18 | Set of classes and Composables to simplify navigation in a Compose application. 19 | 20 | # Package no.nordicsemi.android.common.navigation.viewmodel 21 | 22 | A helper view model that can be used for navigation. -------------------------------------------------------------------------------- /navigation/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | -------------------------------------------------------------------------------- /navigation/src/main/java/no/nordicsemi/android/common/navigation/DestinationId.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.navigation 33 | 34 | /** 35 | * A destination identifier. 36 | * 37 | * @param A The Argument type. 38 | * @param R The Result type. 39 | */ 40 | data class DestinationId(internal val name: String) { 41 | override fun toString(): String = name 42 | } 43 | 44 | /** 45 | * Helper function to create a [DestinationId] from a string. 46 | * 47 | * @param A The argument type of the destination. 48 | * @param R The return type of the destination. 49 | */ 50 | fun createDestination(name: String): DestinationId = DestinationId(name) 51 | 52 | /** 53 | * Helper function to create a [DestinationId] from a string. 54 | * 55 | * The destination does not take any arguments and does not return any result. 56 | */ 57 | fun createSimpleDestination(name: String): DestinationId = DestinationId(name) -------------------------------------------------------------------------------- /navigation/src/main/java/no/nordicsemi/android/common/navigation/NavigationResult.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.navigation 33 | 34 | /** 35 | * The navigation result. 36 | */ 37 | sealed class NavigationResult { 38 | /** Navigation was cancelled. */ 39 | class Cancelled : NavigationResult() 40 | /** The navigation has returned a result. */ 41 | data class Success(val value: R) : NavigationResult() 42 | } -------------------------------------------------------------------------------- /navigation/src/main/java/no/nordicsemi/android/common/navigation/di/NavigationModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | @file:Suppress("unused") 33 | 34 | package no.nordicsemi.android.common.navigation.di 35 | 36 | import dagger.Binds 37 | import dagger.Module 38 | import dagger.hilt.InstallIn 39 | import dagger.hilt.android.components.ActivityRetainedComponent 40 | import no.nordicsemi.android.common.navigation.Navigator 41 | import no.nordicsemi.android.common.navigation.internal.NavigationManager 42 | 43 | @Module 44 | @InstallIn(ActivityRetainedComponent::class) 45 | internal interface NavigationModule { 46 | 47 | @Binds 48 | fun bindNavigator(navigator: NavigationManager): Navigator 49 | 50 | } -------------------------------------------------------------------------------- /permissions-ble/Module.md: -------------------------------------------------------------------------------- 1 | # Module permissions-ble 2 | 3 | Common views for displaying content that requires Bluetooth scanning or connecting. 4 | 5 | # Package no.nordicsemi.android.common.permissions.ble 6 | 7 | This package contains wrappers for views that require Bluetooth and Location. -------------------------------------------------------------------------------- /permissions-ble/src/main/java/no/nordicsemi/android/common/permissions/ble/util/BlePermissionState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.permissions.ble.util 33 | 34 | import no.nordicsemi.android.common.permissions.ble.BlePermissionNotAvailableReason 35 | 36 | /** 37 | * The state of Bluetooth permission. 38 | */ 39 | internal sealed class BlePermissionState { 40 | /** Bluetooth permission is granted. */ 41 | data object Available : BlePermissionState() 42 | /** 43 | * Bluetooth is not available. 44 | * 45 | * @param reason The reason why the BLE permission is not available. 46 | */ 47 | data class NotAvailable( 48 | val reason: BlePermissionNotAvailableReason, 49 | ) : BlePermissionState() 50 | } 51 | -------------------------------------------------------------------------------- /permissions-internet/Module.md: -------------------------------------------------------------------------------- 1 | # Module permissions-internet 2 | 3 | Common views for displaying content that requires Internet. 4 | 5 | # Package no.nordicsemi.android.common.permissions.internet 6 | 7 | This package contains a wrapper for views which require Internet. -------------------------------------------------------------------------------- /permissions-internet/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | plugins { 33 | alias(libs.plugins.nordic.feature) 34 | alias(libs.plugins.nordic.nexus.android) 35 | } 36 | 37 | group = "no.nordicsemi.android.common" 38 | 39 | nordicNexusPublishing { 40 | POM_ARTIFACT_ID = "permissions-internet" 41 | POM_NAME = "Nordic library for checking Internet permission." 42 | 43 | POM_DESCRIPTION = "Nordic Android Common Libraries" 44 | POM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 45 | POM_SCM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 46 | POM_SCM_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 47 | POM_SCM_DEV_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 48 | } 49 | 50 | android { 51 | namespace = "no.nordicsemi.android.common.permissions.internet" 52 | } 53 | 54 | dokka { 55 | dokkaSourceSets.named("main") { 56 | includes.from("Module.md") 57 | } 58 | } 59 | 60 | dependencies { 61 | implementation(project(":ui")) 62 | 63 | implementation(libs.androidx.compose.material.iconsExtended) 64 | } 65 | -------------------------------------------------------------------------------- /permissions-internet/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /permissions-internet/src/main/java/no/nordicsemi/android/common/permissions/internet/util/InternetPermissionState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.permissions.internet.util 33 | 34 | internal enum class InternetPermissionNotAvailableReason { 35 | NOT_AVAILABLE, 36 | DISABLED, 37 | } 38 | 39 | internal sealed class InternetPermissionState { 40 | 41 | data object Available : InternetPermissionState() 42 | 43 | data class NotAvailable( 44 | val reason: InternetPermissionNotAvailableReason, 45 | ) : InternetPermissionState() 46 | } -------------------------------------------------------------------------------- /permissions-internet/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 33 | INTERNET NOT AVAILABLE 34 | Connect to the Internet and try again. 35 | 36 | Internet required 37 | -------------------------------------------------------------------------------- /permissions-nfc/Module.md: -------------------------------------------------------------------------------- 1 | # Module permissions-nfc 2 | 3 | Common views for displaying content that requires NFC. 4 | 5 | # Package no.nordicsemi.android.common.permissions.nfc 6 | 7 | This package contains a wrapper for views which require NFC. -------------------------------------------------------------------------------- /permissions-nfc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | plugins { 33 | alias(libs.plugins.nordic.feature) 34 | alias(libs.plugins.nordic.nexus.android) 35 | } 36 | 37 | group = "no.nordicsemi.android.common" 38 | 39 | nordicNexusPublishing { 40 | POM_ARTIFACT_ID = "permissions-nfc" 41 | POM_NAME = "Nordic library for checking NFC permission." 42 | 43 | POM_DESCRIPTION = "Nordic Android Common Libraries" 44 | POM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 45 | POM_SCM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 46 | POM_SCM_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 47 | POM_SCM_DEV_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 48 | } 49 | 50 | android { 51 | namespace = "no.nordicsemi.android.common.permissions.nfc" 52 | } 53 | 54 | dokka { 55 | dokkaSourceSets.named("main") { 56 | includes.from("Module.md") 57 | } 58 | } 59 | 60 | dependencies { 61 | implementation(project(":ui")) 62 | } -------------------------------------------------------------------------------- /permissions-nfc/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /permissions-nfc/src/main/java/no/nordicsemi/android/common/permissions/nfc/utils/NfcPermissionState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.permissions.nfc.utils 33 | 34 | import no.nordicsemi.android.common.permissions.nfc.NfcNotAvailableReason 35 | 36 | internal sealed class NfcPermissionState { 37 | data object Available : NfcPermissionState() 38 | data class NotAvailable(val reason: NfcNotAvailableReason) : 39 | NfcPermissionState() 40 | } -------------------------------------------------------------------------------- /permissions-nfc/src/main/java/no/nordicsemi/android/common/permissions/nfc/utils/NfcPermissionUtils.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.permissions.nfc.utils 33 | 34 | import android.content.Context 35 | import android.content.pm.PackageManager 36 | import android.nfc.NfcManager 37 | 38 | internal class NfcPermissionUtils( 39 | private val context: Context, 40 | ) { 41 | val isNfcEnabled: Boolean 42 | get() = (context.getSystemService(Context.NFC_SERVICE) as NfcManager) 43 | .defaultAdapter 44 | .isEnabled 45 | 46 | val isNfcAvailable: Boolean 47 | get() = context.packageManager.hasSystemFeature(PackageManager.FEATURE_NFC) 48 | } -------------------------------------------------------------------------------- /permissions-nfc/src/main/res/drawable/nfc_variant_off.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 41 | -------------------------------------------------------------------------------- /permissions-nfc/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | Enable 35 | 36 | NFC NOT SUPPORTED 37 | "NFC not supported on this device.\nFeature unavailable. 38 | 39 | NFC DISABLED 40 | Click the button below to enable it. 41 | -------------------------------------------------------------------------------- /permissions-notification/Module.md: -------------------------------------------------------------------------------- 1 | # Module permissions-notification 2 | 3 | Common views for requesting [POST_NOTIFICATIONS][android.Manifest.permission.POST_NOTIFICATIONS] permission. 4 | 5 | On Android 13+ (API 33+) the `NotificationManager` requires a permission to show notifications. 6 | This module provides a wrapper which will automatically request the permission. 7 | 8 | The content is shown in any case. 9 | 10 | # Package no.nordicsemi.android.common.permissions.notification 11 | 12 | This package contains a wrapper for views that automatically request `POST_NOTIFICATIONS` permission 13 | on Android 13+. -------------------------------------------------------------------------------- /permissions-notification/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.nordic.feature) 3 | alias(libs.plugins.nordic.nexus.android) 4 | } 5 | 6 | group = "no.nordicsemi.android.common" 7 | 8 | nordicNexusPublishing { 9 | POM_ARTIFACT_ID = "permissions-notification" 10 | POM_NAME = "Nordic library for checking Notification permission." 11 | 12 | POM_DESCRIPTION = "Nordic Android Common Libraries" 13 | POM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 14 | POM_SCM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 15 | POM_SCM_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 16 | POM_SCM_DEV_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 17 | } 18 | 19 | android { 20 | namespace = "no.nordicsemi.android.common.permissions.notification" 21 | } 22 | 23 | dokka { 24 | dokkaSourceSets.named("main") { 25 | includes.from("Module.md") 26 | } 27 | } 28 | 29 | dependencies { 30 | implementation(libs.accompanist.permissions) 31 | 32 | implementation(libs.androidx.compose.material.iconsExtended) 33 | } -------------------------------------------------------------------------------- /permissions-notification/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /permissions-notification/src/main/java/no/nordicsemi/android/common/permissions/notification/utils/NotificationPermissionState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.permissions.notification.utils 33 | 34 | internal sealed class NotificationPermissionState { 35 | /** Represents the notification permission is available. */ 36 | data object Available : NotificationPermissionState() 37 | 38 | /** 39 | * Represents the notification permission is not available. 40 | * @param reason The reason for notification permission is not available. 41 | */ 42 | data class NotAvailable( 43 | val reason: NotAvailableReason, 44 | ) : NotificationPermissionState() 45 | } 46 | 47 | /** 48 | * Represents the reason for notification permission is not available. 49 | */ 50 | internal enum class NotAvailableReason { 51 | PERMISSION_REQUIRED, 52 | DENIED, 53 | } 54 | -------------------------------------------------------------------------------- /permissions-wifi/Module.md: -------------------------------------------------------------------------------- 1 | # Module permissions-wifi 2 | 3 | Common views for displaying content that requires Wi-Fi. 4 | 5 | # Package no.nordicsemi.android.common.permissions.wifi 6 | 7 | This package contains a wrapper for views which require Wi-Fi and Location for scanning for Wi-Fi 8 | networks. -------------------------------------------------------------------------------- /permissions-wifi/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.nordic.feature) 3 | alias(libs.plugins.nordic.nexus.android) 4 | } 5 | group = "no.nordicsemi.android.common" 6 | 7 | nordicNexusPublishing { 8 | POM_ARTIFACT_ID = "permissions-wifi" 9 | POM_NAME = "Nordic library for checking Wi-Fi state and permissions required for scanning for Wi-Fi networks." 10 | 11 | POM_DESCRIPTION = "Nordic Android Common Libraries" 12 | POM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 13 | POM_SCM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 14 | POM_SCM_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 15 | POM_SCM_DEV_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 16 | } 17 | 18 | android { 19 | namespace = "no.nordicsemi.android.common.permissions.wifi" 20 | } 21 | 22 | dokka { 23 | dokkaSourceSets.named("main") { 24 | includes.from("Module.md") 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation(project(":ui")) 30 | 31 | implementation(libs.androidx.compose.material.iconsExtended) 32 | } -------------------------------------------------------------------------------- /permissions-wifi/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /permissions-wifi/src/main/java/no/nordicsemi/android/common/permissions/wifi/utils/WiFiPermissionState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.common.permissions.wifi.utils 33 | 34 | import no.nordicsemi.android.common.permissions.wifi.WiFiPermissionNotAvailableReason 35 | 36 | /** 37 | * Represents the state of Wi-Fi permission. 38 | */ 39 | internal sealed class WiFiPermissionState { 40 | 41 | /** 42 | * Represents the Wi-Fi permission is available. 43 | */ 44 | data object Available : WiFiPermissionState() 45 | 46 | /** 47 | * Represents the Wi-Fi permission is not available. 48 | * @param reason The reason for Wi-Fi permission is not available. 49 | */ 50 | data class NotAvailable( 51 | val reason: WiFiPermissionNotAvailableReason, 52 | ) : WiFiPermissionState() 53 | } 54 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base", 5 | "group:all", 6 | ":dependencyDashboard", 7 | "schedule:daily" 8 | ], 9 | "commitMessageExtra": "{{{currentValue}}} to {{#if isPinDigest}}{{{newDigestShort}}}{{else}}{{#if isMajor}}{{prettyNewMajor}}{{else}}{{#if isSingleVersion}}{{prettyNewVersion}}{{else}}{{#if newValue}}{{{newValue}}}{{else}}{{{newDigestShort}}}{{/if}}{{/if}}{{/if}}{{/if}}", 10 | "packageRules": [ 11 | { 12 | "matchPackagePatterns": [ 13 | "org.jetbrains.kotlin.*", 14 | "com.google.devtools.ksp" 15 | ], 16 | "groupName": "kotlin" 17 | }, 18 | { 19 | "matchPackageNames": [ 20 | "org.slf4j:slf4j-api", 21 | "org.slf4j:slf4j-simple" 22 | ], 23 | "enabled": false 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /scanner/src/main/java/no/nordicsemi/android/kotlin/ble/ui/scanner/HiltModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.kotlin.ble.ui.scanner 33 | 34 | import android.content.Context 35 | import dagger.Module 36 | import dagger.Provides 37 | import dagger.hilt.InstallIn 38 | import dagger.hilt.android.qualifiers.ApplicationContext 39 | import dagger.hilt.components.SingletonComponent 40 | import no.nordicsemi.android.kotlin.ble.scanner.BleScanner 41 | 42 | @Module 43 | @InstallIn(SingletonComponent::class) 44 | internal class HiltModule { 45 | 46 | @Provides 47 | fun providesScanner( 48 | @ApplicationContext 49 | context: Context 50 | ): CentralManager { 51 | return BleScanner(context) 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /scanner/src/main/java/no/nordicsemi/android/kotlin/ble/ui/scanner/ScannerScreenResult.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.kotlin.ble.ui.scanner 33 | 34 | import no.nordicsemi.android.kotlin.ble.core.scanner.BleScanResults 35 | 36 | sealed interface ScannerScreenResult 37 | 38 | data object ScanningCancelled : ScannerScreenResult 39 | 40 | data class DeviceSelected(val scanResults: BleScanResults) : ScannerScreenResult 41 | -------------------------------------------------------------------------------- /scanner/src/main/java/no/nordicsemi/android/kotlin/ble/ui/scanner/di/ScannerHiltModule.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.kotlin.ble.ui.scanner.di 33 | 34 | import android.bluetooth.BluetoothAdapter 35 | import android.bluetooth.BluetoothManager 36 | import android.content.Context 37 | import dagger.Module 38 | import dagger.Provides 39 | import dagger.hilt.InstallIn 40 | import dagger.hilt.android.qualifiers.ApplicationContext 41 | import dagger.hilt.components.SingletonComponent 42 | 43 | @Suppress("unused") 44 | @Module 45 | @InstallIn(SingletonComponent::class) 46 | internal class ScannerHiltModule { 47 | 48 | @Provides 49 | fun provideBluetoothAdapter( 50 | @ApplicationContext context: Context 51 | ): BluetoothAdapter { 52 | val manager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager 53 | return manager.adapter 54 | } 55 | } -------------------------------------------------------------------------------- /scanner/src/main/java/no/nordicsemi/android/kotlin/ble/ui/scanner/repository/DevicesScanFilter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.kotlin.ble.ui.scanner.repository 33 | 34 | internal data class DevicesScanFilter( 35 | val filterUuidRequired: Boolean?, 36 | val filterNearbyOnly: Boolean, 37 | val filterWithNames: Boolean 38 | ) 39 | -------------------------------------------------------------------------------- /scanner/src/main/java/no/nordicsemi/android/kotlin/ble/ui/scanner/repository/ScannerRepository.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.kotlin.ble.ui.scanner.repository 33 | 34 | import android.annotation.SuppressLint 35 | import dagger.hilt.android.scopes.ViewModelScoped 36 | import no.nordicsemi.android.kotlin.ble.scanner.BleScanner 37 | import javax.inject.Inject 38 | 39 | @ViewModelScoped 40 | class ScannerRepository @Inject internal constructor( 41 | private val nordicScanner: BleScanner 42 | ) { 43 | 44 | @SuppressLint("MissingPermission") 45 | fun getScannerState() = nordicScanner.scan() 46 | } 47 | -------------------------------------------------------------------------------- /scanner/src/main/java/no/nordicsemi/android/kotlin/ble/ui/scanner/repository/ScanningState.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2024, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | package no.nordicsemi.android.kotlin.ble.ui.scanner.repository 33 | 34 | import no.nordicsemi.android.kotlin.ble.core.scanner.BleScanResults 35 | 36 | sealed class ScanningState { 37 | 38 | data object Loading : ScanningState() 39 | 40 | data class Error(val errorCode: Int) : ScanningState() 41 | 42 | data class DevicesDiscovered(val devices: List) : ScanningState() { 43 | val bonded: List = devices.filter { it.device.isBonded } 44 | 45 | val notBonded: List = devices.filter { !it.device.isBonded } 46 | 47 | fun size(): Int = bonded.size + notBonded.size 48 | 49 | fun isEmpty(): Boolean = devices.isEmpty() 50 | } 51 | 52 | fun isRunning(): Boolean { 53 | return this is Loading || this is DevicesDiscovered 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | pluginManagement { 33 | repositories { 34 | mavenLocal() 35 | google() 36 | mavenCentral() 37 | gradlePluginPortal() 38 | } 39 | } 40 | 41 | dependencyResolutionManagement { 42 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 43 | repositories { 44 | mavenLocal() 45 | google() 46 | mavenCentral() 47 | maven(url = "https://androidx.dev/storage/compose-compiler/repository/") 48 | } 49 | } 50 | rootProject.name = "Common Libraries" 51 | 52 | include(":app") 53 | include(":core") 54 | include(":theme") 55 | include(":ui") 56 | include(":logger") 57 | include(":navigation") 58 | include(":analytics") 59 | include(":permissions-ble") 60 | include(":permissions-internet") 61 | include(":permissions-nfc") 62 | include(":permissions-wifi") 63 | include(":permissions-notification") 64 | -------------------------------------------------------------------------------- /theme/Module.md: -------------------------------------------------------------------------------- 1 | # Module theme 2 | 3 | Set of classes and resources for Nordic theme. 4 | 5 | # Package no.nordicsemi.android.common.theme 6 | 7 | Set of classes and resources for Nordic theme. -------------------------------------------------------------------------------- /theme/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023, Nordic Semiconductor 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, are 6 | * permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this list of 9 | * conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 | * of conditions and the following disclaimer in the documentation and/or other materials 13 | * provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its contributors may be 16 | * used to endorse or promote products derived from this software without specific prior 17 | * written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 27 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | plugins { 33 | alias(libs.plugins.nordic.library.compose) 34 | alias(libs.plugins.nordic.nexus.android) 35 | } 36 | 37 | group = "no.nordicsemi.android.common" 38 | 39 | nordicNexusPublishing { 40 | POM_ARTIFACT_ID = "theme" 41 | POM_NAME = "Nordic theme library for Android." 42 | 43 | POM_DESCRIPTION = "Nordic Android Common Libraries" 44 | POM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 45 | POM_SCM_URL = "https://github.com/NordicPlayground/Android-Common-Libraries" 46 | POM_SCM_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 47 | POM_SCM_DEV_CONNECTION = "scm:git@github.com:NordicPlayground/Android-Common-Libraries.git" 48 | } 49 | 50 | android { 51 | namespace = "no.nordicsemi.android.common.theme" 52 | } 53 | 54 | dokka { 55 | dokkaSourceSets.named("main") { 56 | includes.from("Module.md") 57 | } 58 | } 59 | 60 | dependencies { 61 | implementation(libs.androidx.activity.compose) 62 | implementation(libs.androidx.core.splashscreen) 63 | } 64 | -------------------------------------------------------------------------------- /theme/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | -------------------------------------------------------------------------------- /theme/src/main/res/drawable/ic_arrow_right.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 41 | -------------------------------------------------------------------------------- /theme/src/main/res/drawable/ic_check.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 41 | -------------------------------------------------------------------------------- /theme/src/main/res/drawable/ic_cross.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 41 | -------------------------------------------------------------------------------- /theme/src/main/res/drawable/ic_dot.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 41 | -------------------------------------------------------------------------------- /theme/src/main/res/drawable/ic_signal_max.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 43 | 46 | 47 | -------------------------------------------------------------------------------- /theme/src/main/res/drawable/ic_signal_medium.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 43 | 46 | 47 | -------------------------------------------------------------------------------- /theme/src/main/res/drawable/ic_signal_min.xml: -------------------------------------------------------------------------------- 1 | 31 | 32 | 37 | 40 | 43 | 46 | 47 | -------------------------------------------------------------------------------- /theme/src/main/res/drawable/ic_splash_screen.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NordicPlayground/Android-Common-Libraries/1793317b20889288492c55888bf50adfc185c974/theme/src/main/res/drawable/ic_splash_screen.9.png -------------------------------------------------------------------------------- /theme/src/main/res/values-night-v23/styles_splashscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 38 | -------------------------------------------------------------------------------- /theme/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | @color/nordicDarkGray 36 | #17282C 37 | 38 | -------------------------------------------------------------------------------- /theme/src/main/res/values-night/colors_splashscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | @android:color/white 36 | @android:color/white 37 | 38 | -------------------------------------------------------------------------------- /theme/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 39 | -------------------------------------------------------------------------------- /theme/src/main/res/values-v23/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 43 | -------------------------------------------------------------------------------- /theme/src/main/res/values-v27/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | 47 | -------------------------------------------------------------------------------- /theme/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | @color/md_theme_primary 36 | #E1EFF2 37 | 38 | @color/md_theme_onBackground 39 | 40 | -------------------------------------------------------------------------------- /theme/src/main/res/values/colors_nordic.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | #00A9CE 35 | #6AD1E3 36 | #0033A0 37 | #0077C8 38 | #D0DF00 39 | #00A651 40 | #FFCD00 41 | #EE2F4E 42 | #F58220 43 | #D9E1E2 44 | #768692 45 | #333f48 46 | -------------------------------------------------------------------------------- /theme/src/main/res/values/colors_splashscreen.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 35 | @color/nordicBlue 36 | @android:color/black 37 | 38 | -------------------------------------------------------------------------------- /theme/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | Nordic Semiconductor 35 | Back 36 | Menu 37 | 38 | %d dBm 39 | 40 | -------------------------------------------------------------------------------- /theme/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 32 | 33 | 34 | 37 | 38 | 39 | 40 | 41 |