├── .gitignore
├── AppImages
├── icon.png
├── image1.png
├── image2.png
├── image3.png
├── image4.png
└── sensorbox_preview.png
├── CountDownDialog
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── motionapps
│ │ └── countdowndialog
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── motionapps
│ │ │ └── countdowndialog
│ │ │ ├── CountDownDialog.kt
│ │ │ ├── CountDownInterface.kt
│ │ │ ├── CountDownMain.kt
│ │ │ └── CountDownStates.kt
│ └── res
│ │ ├── drawable
│ │ ├── rounded_button.xml
│ │ └── rounded_white.xml
│ │ ├── layout
│ │ └── countdown_timer.xml
│ │ └── values
│ │ ├── colors.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── motionapps
│ └── countdowndialog
│ └── ExampleUnitTest.kt
├── Gemfile
├── Gemfile.lock
├── LICENSE
├── README.md
├── WearOsLib
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── font
│ ├── roboto_family.xml
│ └── roboto_regular.ttf
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── motionapps
│ │ └── wearoslib
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── motionapps
│ │ │ └── wearoslib
│ │ │ ├── WearOsConstants.kt
│ │ │ ├── WearOsHandler.kt
│ │ │ ├── WearOsListener.kt
│ │ │ ├── WearOsNotify.kt
│ │ │ ├── WearOsStates.kt
│ │ │ ├── WearOsStorageHandler.kt
│ │ │ ├── WearOsSyncDialog.kt
│ │ │ └── WearOsSyncService.kt
│ └── res
│ │ ├── drawable
│ │ ├── ic_baseline_stop.xml
│ │ ├── ic_graph.xml
│ │ ├── rounded_black.xml
│ │ └── rounded_button.xml
│ │ ├── font
│ │ ├── roboto_family.xml
│ │ └── roboto_regular.ttf
│ │ ├── layout
│ │ └── wearos_sync_dialog.xml
│ │ └── values
│ │ ├── colors.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── motionapps
│ └── wearoslib
│ └── ExampleUnitTest.kt
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── motionapps
│ │ └── sensorbox
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── motionapps
│ │ │ └── sensorbox
│ │ │ ├── MsgListener.kt
│ │ │ ├── SensorBoxApp.kt
│ │ │ ├── activities
│ │ │ ├── About.kt
│ │ │ ├── MainActivity.kt
│ │ │ └── MeasurementActivity.kt
│ │ │ ├── di
│ │ │ ├── GpsModule.kt
│ │ │ ├── MainRepositoryModule.kt
│ │ │ └── MeasurementRepositoryModule.kt
│ │ │ ├── fragments
│ │ │ ├── HomeFragment.kt
│ │ │ ├── InfoSensorFragment.kt
│ │ │ ├── InfoSensorFragmentWearOs.kt
│ │ │ ├── SensorInfoView.kt
│ │ │ ├── advanced
│ │ │ │ ├── AdvancedFragment.kt
│ │ │ │ ├── CountersFragment.kt
│ │ │ │ ├── ExtraFragment.kt
│ │ │ │ ├── MeasurementPickerFragment.kt
│ │ │ │ └── extrahandlers
│ │ │ │ │ ├── AlarmHandler.kt
│ │ │ │ │ └── NoteHandler.kt
│ │ │ ├── displayers
│ │ │ │ ├── Displayer.kt
│ │ │ │ ├── GPSDisplayer.kt
│ │ │ │ ├── SensorDisplayer.kt
│ │ │ │ └── SensorWearOsDisplayer.kt
│ │ │ └── settings
│ │ │ │ ├── AnnotationFragment.kt
│ │ │ │ └── SettingsFragment.kt
│ │ │ ├── intro
│ │ │ ├── IntroActivity.kt
│ │ │ ├── PickFolderFragment.kt
│ │ │ ├── PolicyFragment.kt
│ │ │ ├── PowerSaverExplanationFragment.kt
│ │ │ └── PowerSaverFragment.kt
│ │ │ ├── permissions
│ │ │ ├── PermissionHandler.kt
│ │ │ └── PermissionSettingsDialog.kt
│ │ │ ├── types
│ │ │ ├── SensorAttributes.kt
│ │ │ └── SensorResources.kt
│ │ │ ├── uiHandlers
│ │ │ ├── GraphHandler.kt
│ │ │ ├── GraphUpdater.kt
│ │ │ ├── SensorViewHandler.kt
│ │ │ ├── StorageFunctions.kt
│ │ │ └── TextUpdater.kt
│ │ │ └── viewmodels
│ │ │ ├── MainRepository.kt
│ │ │ ├── MainViewModel.kt
│ │ │ ├── MeasurementRepository.kt
│ │ │ └── MeasurementViewModel.kt
│ └── res
│ │ ├── drawable
│ │ ├── divider.xml
│ │ ├── divider_gray.xml
│ │ ├── ic_acceleration_icon.xml
│ │ ├── ic_accuracy.xml
│ │ ├── ic_altitude.xml
│ │ ├── ic_android.xml
│ │ ├── ic_android_big.xml
│ │ ├── ic_android_dark.xml
│ │ ├── ic_baseline_add_24.xml
│ │ ├── ic_baseline_folder.xml
│ │ ├── ic_baseline_gps.xml
│ │ ├── ic_baseline_home_24.xml
│ │ ├── ic_baseline_location.xml
│ │ ├── ic_baseline_run.xml
│ │ ├── ic_baseline_settings_24.xml
│ │ ├── ic_baseline_storage.xml
│ │ ├── ic_battery.xml
│ │ ├── ic_bearing.xml
│ │ ├── ic_bell.xml
│ │ ├── ic_bug.xml
│ │ ├── ic_circle.xml
│ │ ├── ic_endless_time.xml
│ │ ├── ic_folder.xml
│ │ ├── ic_github.xml
│ │ ├── ic_gps.xml
│ │ ├── ic_gravity_icon.xml
│ │ ├── ic_gyroscope_icon.xml
│ │ ├── ic_heart_rate.xml
│ │ ├── ic_incognito.xml
│ │ ├── ic_info.xml
│ │ ├── ic_latitude.xml
│ │ ├── ic_launcher_small_round.xml
│ │ ├── ic_launcher_white_round.xml
│ │ ├── ic_launcher_white_square.xml
│ │ ├── ic_license.xml
│ │ ├── ic_light.xml
│ │ ├── ic_linear_acceleration_icon.xml
│ │ ├── ic_link.xml
│ │ ├── ic_long_time.xml
│ │ ├── ic_longitude.xml
│ │ ├── ic_magnet.xml
│ │ ├── ic_mail.xml
│ │ ├── ic_maxdelay.xml
│ │ ├── ic_maxvalue.xml
│ │ ├── ic_menu.xml
│ │ ├── ic_mindelay.xml
│ │ ├── ic_not_ok.xml
│ │ ├── ic_ok.xml
│ │ ├── ic_ok_big.xml
│ │ ├── ic_pen.xml
│ │ ├── ic_policy.xml
│ │ ├── ic_power.xml
│ │ ├── ic_pressure.xml
│ │ ├── ic_provider.xml
│ │ ├── ic_proximity.xml
│ │ ├── ic_resolution.xml
│ │ ├── ic_rotation_icon.xml
│ │ ├── ic_short_time.xml
│ │ ├── ic_speed.xml
│ │ ├── ic_steps.xml
│ │ ├── ic_steps_detector.xml
│ │ ├── ic_storage.xml
│ │ ├── ic_temperature.xml
│ │ ├── ic_vendor.xml
│ │ ├── ic_version.xml
│ │ ├── ic_walk.xml
│ │ ├── ic_water_drop.xml
│ │ ├── ic_wear_os_download_data.xml
│ │ ├── ic_wear_os_off.xml
│ │ ├── ic_wear_os_on.xml
│ │ ├── rounded_black.xml
│ │ ├── rounded_button.xml
│ │ ├── rounded_red.xml
│ │ ├── rounded_transparent_outline.xml
│ │ └── rounded_white.xml
│ │ ├── font
│ │ ├── roboto_family.xml
│ │ └── roboto_regular.ttf
│ │ ├── layout-land
│ │ ├── activity_measurement_chronometer.xml
│ │ ├── activity_measurement_textview.xml
│ │ ├── fragment_explanation_power_saver.xml
│ │ ├── fragment_info_map.xml
│ │ ├── fragment_info_sensor.xml
│ │ ├── fragment_info_textview.xml
│ │ ├── fragment_measurement_picker.xml
│ │ ├── fragment_pick_folder.xml
│ │ ├── fragment_policy.xml
│ │ └── fragment_power_saver.xml
│ │ ├── layout-v24
│ │ └── pref_screen.xml
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_measurement_chronometer.xml
│ │ ├── activity_measurement_textview.xml
│ │ ├── app_bar_main.xml
│ │ ├── content_main.xml
│ │ ├── countdown_timer.xml
│ │ ├── fragment_annotation.xml
│ │ ├── fragment_counters.xml
│ │ ├── fragment_explanation_power_saver.xml
│ │ ├── fragment_extra.xml
│ │ ├── fragment_home.xml
│ │ ├── fragment_info_map.xml
│ │ ├── fragment_info_sensor.xml
│ │ ├── fragment_info_textview.xml
│ │ ├── fragment_measurement_picker.xml
│ │ ├── fragment_pick_folder.xml
│ │ ├── fragment_policy.xml
│ │ ├── fragment_power_saver.xml
│ │ ├── item_layout_annotation.xml
│ │ ├── item_layout_sensorrow.xml
│ │ ├── item_layout_sensorrow_info.xml
│ │ ├── nav_header_main.xml
│ │ ├── pref_category.xml
│ │ ├── pref_preference.xml
│ │ ├── pref_screen.xml
│ │ ├── template_double_picker.xml
│ │ └── template_picker.xml
│ │ ├── menu
│ │ ├── activity_main_drawer.xml
│ │ └── main.xml
│ │ ├── mipmap
│ │ └── ic_icon_square.png
│ │ ├── navigation
│ │ └── mobile_navigation.xml
│ │ ├── raw
│ │ └── notices.xml
│ │ ├── values
│ │ ├── arrays.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── drawables.xml
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── wear.xml
│ │ └── xml
│ │ ├── backup_descriptor.xml
│ │ ├── data_extraction_rules.xml
│ │ ├── media_capabilities.xml
│ │ └── root_preferences.xml
│ └── test
│ └── java
│ └── com
│ └── motionapps
│ └── sensorbox
│ └── ExampleUnitTest.kt
├── build.gradle
├── fastlane
├── Fastfile
├── Pluginfile
├── README.md
├── metadata
│ └── android
│ │ └── en-GB
│ │ ├── changelogs
│ │ ├── 1000026.txt
│ │ └── 65.txt
│ │ ├── full_description.txt
│ │ ├── images
│ │ ├── featureGraphic.png
│ │ ├── icon.png
│ │ ├── phoneScreenshots
│ │ │ ├── 1_en-GB.png
│ │ │ ├── 2_en-GB.png
│ │ │ ├── 3_en-GB.png
│ │ │ └── 4_en-GB.png
│ │ └── wearScreenshots
│ │ │ ├── 1_en-GB.png
│ │ │ └── 2_en-GB.png
│ │ ├── short_description.txt
│ │ ├── title.txt
│ │ └── video.txt
└── report.xml
├── flipper
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── balda
│ └── flipper
│ ├── DocumentFileCompat.java
│ ├── FileDescription.java
│ ├── FileUtils.java
│ ├── MediaStoreCompat.java
│ ├── MediaStoreCompatException.java
│ ├── OperationFailedException.java
│ ├── Root.java
│ └── StorageManagerCompat.java
├── gradle.properties
├── gradle
└── wrapper
│ └── gradle-wrapper.properties
├── sensorservices
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── motionapps
│ │ └── sensorservices
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── motionapps
│ │ │ └── sensorservices
│ │ │ ├── handlers
│ │ │ ├── GPSHandler.kt
│ │ │ ├── PoweManagement.kt
│ │ │ ├── StorageHandler.kt
│ │ │ └── measurements
│ │ │ │ ├── ActivityRecognition.kt
│ │ │ │ ├── AlarmNoiseHandler.kt
│ │ │ │ ├── ExtraInfoHandler.kt
│ │ │ │ ├── GPSMeasurement.kt
│ │ │ │ ├── MeasurementInterface.kt
│ │ │ │ ├── SensorMeasurement.kt
│ │ │ │ └── SignificantMotion.kt
│ │ │ ├── serviceController
│ │ │ └── ServiceController.kt
│ │ │ ├── services
│ │ │ ├── MeasurementService.kt
│ │ │ ├── MeasurementStates.kt
│ │ │ └── Notify.kt
│ │ │ └── types
│ │ │ ├── EndHolder.kt
│ │ │ ├── SensorHolder.kt
│ │ │ └── SensorsNeeds.kt
│ └── res
│ │ ├── drawable
│ │ ├── ic_graph.xml
│ │ └── ic_stop.xml
│ │ ├── raw
│ │ ├── alert.wav
│ │ ├── beep.wav
│ │ ├── end.wav
│ │ └── start.wav
│ │ ├── values-v34
│ │ └── strings.xml
│ │ └── values
│ │ ├── colors.xml
│ │ └── strings.xml
│ └── test
│ └── java
│ └── com
│ └── motionapps
│ └── sensorservices
│ └── ExampleUnitTest.kt
├── settings.gradle
└── wear
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
├── androidTest
└── java
│ └── com
│ └── motionapps
│ └── sensorbox
│ └── ExampleInstrumentedTest.kt
├── main
├── AndroidManifest.xml
├── java
│ └── com
│ │ └── motionapps
│ │ └── sensorbox
│ │ ├── activities
│ │ ├── MainActivity.kt
│ │ ├── MainSettings.kt
│ │ ├── MapsActivity.kt
│ │ ├── MoveToMain.kt
│ │ ├── PermissionActivity.kt
│ │ ├── PermissionActivityForResult.kt
│ │ ├── PickSensorMeasure.kt
│ │ ├── PickSensorShow.kt
│ │ ├── SettingsPicker.kt
│ │ └── StopActivity.kt
│ │ ├── adapters
│ │ ├── MainActivityAdapter.kt
│ │ ├── SensorBasicAdapter.kt
│ │ ├── SensorPickerAdapter.kt
│ │ ├── SettingsAdapter.kt
│ │ └── SettingsPickerAdapter.kt
│ │ ├── charts
│ │ ├── GraphHandler.kt
│ │ └── GraphViewer.kt
│ │ ├── communication
│ │ ├── DataSync.kt
│ │ ├── MsgListener.kt
│ │ └── SensorTools.kt
│ │ └── rlRecording
│ │ └── RealTimeSensorService.kt
└── res
│ ├── drawable
│ ├── ic_archive.xml
│ ├── ic_baseline_location.xml
│ ├── ic_baseline_timer.xml
│ ├── ic_battery_full.xml
│ ├── ic_brightness.xml
│ ├── ic_cancel.xml
│ ├── ic_check_circle.xml
│ ├── ic_cpu.xml
│ ├── ic_incognito.xml
│ ├── ic_info.xml
│ ├── ic_info_outline.xml
│ ├── ic_launcher_white_square.xml
│ ├── ic_policy.xml
│ ├── ic_poll.xml
│ ├── ic_sampling.xml
│ ├── ic_save_green.xml
│ ├── ic_save_red.xml
│ └── rounded_white.xml
│ ├── layout
│ ├── activity_graph_viewer.xml
│ ├── activity_main.xml
│ ├── activity_maps.xml
│ ├── activity_permission.xml
│ ├── activity_pick_sensor.xml
│ ├── activity_pick_sensor_measure.xml
│ ├── activity_settings.xml
│ ├── activity_settings_picker.xml
│ ├── button_layout_menu.xml
│ ├── button_picksensor_row.xml
│ ├── button_picksensor_start.xml
│ ├── button_settings.xml
│ ├── move_to_main.xml
│ ├── sensor_text_row.xml
│ ├── settings_sampling_row.xml
│ └── stop_activity.xml
│ ├── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ ├── styles.xml
│ └── wear.xml
│ └── xml
│ └── media_capabilities.xml
├── release
└── res
│ └── values
│ └── google_maps_api.xml
└── test
└── java
└── com
└── motionapps
└── sensorbox
└── ExampleUnitTest.kt
/.gitignore:
--------------------------------------------------------------------------------
1 | /local.properties
2 | /.gradle/
3 | /.idea/
4 | /app/*.json
5 | /wear/*.json
6 |
--------------------------------------------------------------------------------
/AppImages/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/AppImages/icon.png
--------------------------------------------------------------------------------
/AppImages/image1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/AppImages/image1.png
--------------------------------------------------------------------------------
/AppImages/image2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/AppImages/image2.png
--------------------------------------------------------------------------------
/AppImages/image3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/AppImages/image3.png
--------------------------------------------------------------------------------
/AppImages/image4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/AppImages/image4.png
--------------------------------------------------------------------------------
/AppImages/sensorbox_preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/AppImages/sensorbox_preview.png
--------------------------------------------------------------------------------
/CountDownDialog/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/CountDownDialog/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | compileSdk 34
6 |
7 | defaultConfig {
8 | minSdkVersion 19
9 | targetSdkVersion 34
10 | multiDexEnabled true
11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12 | consumerProguardFiles "consumer-rules.pro"
13 | }
14 |
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
19 | }
20 | nfrelease{
21 | initWith release
22 | }
23 | }
24 | compileOptions {
25 | sourceCompatibility JavaVersion.VERSION_17
26 | targetCompatibility JavaVersion.VERSION_17
27 | }
28 | kotlinOptions {
29 | jvmTarget = JavaVersion.VERSION_17
30 | }
31 | namespace 'com.motionapps.countdowndialog'
32 | }
33 |
34 | dependencies {
35 | implementation fileTree(dir: "libs", include: ["*.jar"])
36 | implementation "androidx.multidex:multidex:2.0.1"
37 | implementation 'androidx.core:core-ktx:1.12.0'
38 | implementation 'androidx.appcompat:appcompat:1.6.1'
39 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
40 | implementation 'com.google.android.material:material:1.11.0'
41 | implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
42 | implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
43 | implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
44 | implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
45 | implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
46 | testImplementation 'junit:junit:4.13.2'
47 | androidTestImplementation 'androidx.test.ext:junit:1.1.5'
48 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
49 |
50 | }
--------------------------------------------------------------------------------
/CountDownDialog/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/CountDownDialog/consumer-rules.pro
--------------------------------------------------------------------------------
/CountDownDialog/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/CountDownDialog/src/androidTest/java/com/motionapps/countdowndialog/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.countdowndialog
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.motionapps.countdowndialog.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/CountDownDialog/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/CountDownDialog/src/main/java/com/motionapps/countdowndialog/CountDownDialog.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.countdowndialog
2 |
3 | import android.app.Dialog
4 | import android.content.Context
5 | import android.os.Bundle
6 | import android.view.Window
7 |
8 | /**
9 | * Dialog composes of textView, where the seconds left are shown
10 | * CountDown can be canceled by cancel button in the dialog
11 | * @param context
12 | */
13 | class CountDownDialog(context: Context) : Dialog(context) {
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | requestWindowFeature(Window.FEATURE_NO_TITLE)
18 | window?.setBackgroundDrawableResource(android.R.color.transparent)
19 | setContentView(R.layout.countdown_timer)
20 | setCancelable(false)
21 | setCanceledOnTouchOutside(false)
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/CountDownDialog/src/main/java/com/motionapps/countdowndialog/CountDownInterface.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.countdowndialog
2 |
3 | /**
4 | * interface for the other components to implement
5 | * refresh interval is 100 ms, but only whole seconds are passed
6 | */
7 | interface CountDownInterface {
8 | fun onTick(seconds: String)
9 | fun onCountDownEnd()
10 | }
--------------------------------------------------------------------------------
/CountDownDialog/src/main/java/com/motionapps/countdowndialog/CountDownStates.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.countdowndialog
2 |
3 | /**
4 | * CountDown states, which can be used for own use
5 | *
6 | */
7 | sealed class CountDownStates {
8 |
9 | class OnTick(val tick: String): CountDownStates()
10 | object OnCancel: CountDownStates()
11 | object OnNothing: CountDownStates()
12 | object OnFinish: CountDownStates()
13 |
14 | }
--------------------------------------------------------------------------------
/CountDownDialog/src/main/res/drawable/rounded_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/CountDownDialog/src/main/res/drawable/rounded_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/CountDownDialog/src/main/res/layout/countdown_timer.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
24 |
25 |
38 |
--------------------------------------------------------------------------------
/CountDownDialog/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #000000
4 | #FFFFFF
5 |
--------------------------------------------------------------------------------
/CountDownDialog/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Cancel
4 |
--------------------------------------------------------------------------------
/CountDownDialog/src/test/java/com/motionapps/countdowndialog/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.countdowndialog
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 |
3 | gem "fastlane"
4 | plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
5 | eval_gemfile(plugins_path) if File.exist?(plugins_path)
6 |
--------------------------------------------------------------------------------
/WearOsLib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/WearOsLib/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 |
4 | android {
5 | compileSdk 34
6 |
7 | defaultConfig {
8 | minSdkVersion 24
9 | targetSdkVersion 34
10 |
11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12 | consumerProguardFiles "consumer-rules.pro"
13 | }
14 |
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
19 | }
20 | nfrelease{
21 | initWith debug
22 | }
23 | }
24 |
25 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_17
27 | targetCompatibility JavaVersion.VERSION_17
28 | }
29 | kotlinOptions {
30 | jvmTarget = JavaVersion.VERSION_17
31 | }
32 | namespace 'com.motionapps.wearoslib'
33 | }
34 |
35 | dependencies {
36 | implementation fileTree(dir: "libs", include: ["*.jar"])
37 | implementation project(path: ':flipper')
38 |
39 | implementation 'androidx.preference:preference-ktx:1.2.1'
40 | implementation 'androidx.core:core-ktx:1.10.1'
41 | implementation 'androidx.appcompat:appcompat:1.6.1'
42 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
43 |
44 | testImplementation 'junit:junit:4.13.2'
45 | androidTestImplementation 'androidx.test.ext:junit:1.1.5'
46 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
47 |
48 | implementation 'com.google.android.gms:play-services-wearable:18.1.0'
49 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
50 |
51 | implementation 'com.github.GrenderG:Toasty:1.5.2'
52 | }
--------------------------------------------------------------------------------
/WearOsLib/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/WearOsLib/consumer-rules.pro
--------------------------------------------------------------------------------
/WearOsLib/font/roboto_family.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/WearOsLib/font/roboto_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/WearOsLib/font/roboto_regular.ttf
--------------------------------------------------------------------------------
/WearOsLib/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/WearOsLib/src/androidTest/java/com/motionapps/wearoslib/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.wearoslib
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.motionapps.wearoslib.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/WearOsLib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/WearOsLib/src/main/java/com/motionapps/wearoslib/WearOsConstants.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.wearoslib
2 |
3 | /**
4 | * Constants, which are used by both sides at phone and
5 | */
6 | object WearOsConstants {
7 |
8 | // these paths needs to be the same in manifest
9 | // also both of them needs XML file with these capabilities
10 | const val PHONE_APP_CAPABILITY = "phone_app"
11 | const val PHONE_MESSAGE_PATH = "/com.motionapps.sensorbox.Activity" // in phone app
12 |
13 | const val WEAR_APP_CAPABILITY = "wear_app"
14 | const val WEAR_MESSAGE_PATH = "/com.motionapps.sensorbox.Sensors" // in wear app
15 |
16 | // basic messages to send
17 | const val WEAR_STATUS = "SEND_STATUS"
18 | const val WEAR_STATUS_EXTRA = "SEND_STATUS_EXTRA"
19 | const val WEAR_KILL_APP = "KILL_WEAR_APP"
20 | const val WEAR_SEND_PATHS = "WEAR_SEND_PATHS"
21 | const val WEAR_SEND_PATHS_EXTRA = "WEAR_SEND_PATHS_EXTRA"
22 | const val WEAR_SEND_FILE = "WEAR_SEND_FILE"
23 | const val WEAR_HEART_RATE_PERMISSION_REQUIRED = "HEART_RATE_PERMISSION"
24 | const val WEAR_HEART_RATE_PERMISSION_REQUIRED_BOOLEAN = "HEART_RATE_PERMISSION_BOOLEAN"
25 |
26 | const val START_MAIN_ACTIVITY = "START_MAIN_ACTIVITY"
27 | const val START_MEASUREMENT = "START_MEASUREMENT"
28 | const val STOP_SYNC = "STOP_SYNC"
29 | const val NUMBER_OF_FILES = "NUMBER_OF_FILES"
30 | const val DELETE_ALL_MEASUREMENTS = "DELETE_ALL_MEASUREMENTS"
31 | const val DELETE_FOLDER = "DELETE_FOLDER"
32 |
33 | // Realtime broadcasting of samples to chart
34 | const val WEAR_START_SENSOR_REAL_TIME = "START_WEAR_SENSOR_REAL_TIME"
35 | const val WEAR_END_SENSOR_REAL_TIME = "END_WEAR_SENSOR_REAL_TIME"
36 | const val WEAR_SEND_SENSOR_INFO = "SEND_WEAR_SENSOR_INFO"
37 | const val WEAR_SEND_SENSOR_INFO_EXTRA = "SEND_WEAR_SENSOR_INFO_EXTRA"
38 |
39 | // to send sample from sensor
40 | const val SAMPLE_PATH = "/com.motionapps.sensorbox."
41 | const val SAMPLE_PATH_VALUE = "/com.motionapps.sensorbox.sample."
42 | const val SAMPLE_PATH_TIME = "/com.motionapps.sensorbox.sample.time"
43 | const val FILE_TO_TRANSFER_PATH = "/com.motionapps.sensorbox.file_to_transfer"
44 |
45 | }
--------------------------------------------------------------------------------
/WearOsLib/src/main/java/com/motionapps/wearoslib/WearOsListener.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.wearoslib
2 |
3 | interface WearOsListener {
4 |
5 | suspend fun onWearOsStates(wearOsStates: WearOsStates)
6 |
7 | }
--------------------------------------------------------------------------------
/WearOsLib/src/main/java/com/motionapps/wearoslib/WearOsStates.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.wearoslib
2 |
3 | sealed class WearOsStates {
4 | class PresenceResult(val present: Boolean): WearOsStates() // if the Wear Os is present
5 | // Memory status
6 | class Status(val running: Boolean, val measurementsToSync: Int, val sizeOfData: Double, val totalNumberOfFiles: Int ): WearOsStates()
7 | // to turn off Wear Os
8 | object Offline: WearOsStates()
9 | // waiting for the result
10 | object AwaitResult: WearOsStates()
11 | }
--------------------------------------------------------------------------------
/WearOsLib/src/main/res/drawable/ic_baseline_stop.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WearOsLib/src/main/res/drawable/ic_graph.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WearOsLib/src/main/res/drawable/rounded_black.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/WearOsLib/src/main/res/drawable/rounded_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/WearOsLib/src/main/res/font/roboto_family.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/WearOsLib/src/main/res/font/roboto_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Foxpace/SensorBox/3d96414bd41822da147a7f42dbd68ee0172e0f59/WearOsLib/src/main/res/font/roboto_regular.ttf
--------------------------------------------------------------------------------
/WearOsLib/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #00000000
4 | #FFFFFF
5 | #000000
6 |
--------------------------------------------------------------------------------
/WearOsLib/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SensorBox
4 | Restart connection please
5 | Syncing Wear Os data
6 | Stop
7 |
8 | Measurements:
9 | Wear Os measurement synchronization
10 | Total size:
11 | Synchronize
12 |
--------------------------------------------------------------------------------
/WearOsLib/src/test/java/com/motionapps/wearoslib/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.wearoslib
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/motionapps/sensorbox/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.motionapps.sensorbox", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/SensorBoxApp.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox
2 |
3 | import android.app.Application
4 | import android.content.Context
5 | import android.os.Build
6 | import androidx.multidex.MultiDex
7 | import dagger.hilt.android.HiltAndroidApp
8 |
9 | /**
10 | * building block for the Hilt dependency injection framework
11 | *
12 | */
13 | @HiltAndroidApp
14 | class SensorBoxApp: Application(){
15 |
16 | override fun attachBaseContext(context: Context?) {
17 | super.attachBaseContext(context)
18 | if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
19 | MultiDex.install(this)
20 | }
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/di/GpsModule.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.di
2 |
3 | import android.content.Context
4 | import com.motionapps.sensorbox.fragments.displayers.GPSDisplayer
5 | import com.motionapps.sensorservices.handlers.GPSHandler
6 | import dagger.Module
7 | import dagger.Provides
8 | import dagger.hilt.InstallIn
9 | import dagger.hilt.android.components.FragmentComponent
10 | import dagger.hilt.android.qualifiers.ApplicationContext
11 | import dagger.hilt.android.scopes.FragmentScoped
12 | import kotlinx.coroutines.ExperimentalCoroutinesApi
13 | import kotlinx.coroutines.InternalCoroutinesApi
14 |
15 | @ExperimentalCoroutinesApi
16 | @Module
17 | @InstallIn(FragmentComponent::class)
18 | object GpsModule {
19 | /**
20 | * Provides basic GPSHandler - can register GPS updates and specify parameters, listeners, ...
21 | * @return
22 | */
23 | @InternalCoroutinesApi
24 | @FragmentScoped
25 | @Provides
26 | fun provideGPSHandler(): GPSHandler{
27 | return GPSHandler()
28 | }
29 |
30 | /**
31 | * Uses GPSHandler to get info about location and shows it in specific tabs
32 | * @param context
33 | * @param gpsHandler - uses GPSHandler to manage access to location
34 | * @return
35 | */
36 | @InternalCoroutinesApi
37 | @FragmentScoped
38 | @Provides
39 | fun providesGPSDisplayer(@ApplicationContext context: Context, gpsHandler: GPSHandler): GPSDisplayer{
40 | return GPSDisplayer(context, gpsHandler)
41 | }
42 |
43 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/di/MeasurementRepositoryModule.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.di
2 |
3 | import com.motionapps.countdowndialog.CountDownMain
4 | import com.motionapps.sensorbox.uiHandlers.GraphUpdater
5 | import com.motionapps.sensorbox.viewmodels.MeasurementRepository
6 | import com.motionapps.wearoslib.WearOsHandler
7 | import dagger.Module
8 | import dagger.Provides
9 | import dagger.hilt.InstallIn
10 | import dagger.hilt.android.components.ActivityRetainedComponent
11 | import dagger.hilt.android.scopes.ActivityRetainedScoped
12 |
13 |
14 | @Module
15 | @InstallIn(ActivityRetainedComponent::class)
16 | object MeasurementRepositoryModule {
17 |
18 | /**
19 | * Repository for MeasurementActivity
20 | * Contains countdown lib, graphUpdater - updates chart with registered sensor, and WearOs handler
21 | *
22 | * @param countDownMain - created in MainRepository - reusable instances
23 | * @param graphUpdater - created in MainRepository - reusable instances
24 | * @param wearOsHandler - created in MainRepository - reusable instances
25 | * @return
26 | */
27 | @ActivityRetainedScoped
28 | @Provides
29 | fun getMeasurementRepository(countDownMain: CountDownMain, graphUpdater: GraphUpdater, wearOsHandler: WearOsHandler): MeasurementRepository {
30 | return MeasurementRepository(countDownMain, graphUpdater, wearOsHandler)
31 |
32 | }
33 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/fragments/InfoSensorFragment.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.fragments
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import androidx.navigation.fragment.navArgs
9 | import com.motionapps.sensorbox.fragments.displayers.GPSDisplayer
10 | import com.motionapps.sensorbox.fragments.displayers.SensorDisplayer
11 | import com.motionapps.sensorservices.types.SensorNeeds
12 | import dagger.hilt.android.AndroidEntryPoint
13 | import kotlinx.coroutines.ExperimentalCoroutinesApi
14 | import kotlinx.coroutines.InternalCoroutinesApi
15 | import javax.inject.Inject
16 |
17 | @InternalCoroutinesApi
18 | @ExperimentalCoroutinesApi
19 | @AndroidEntryPoint
20 | /**
21 | * used to show sensor attributes or GPS
22 | * assisted mainly by displayers
23 | * Android sensor / GPS only, Wear Os has its own implementation
24 | */
25 | class InfoSensorFragment : Fragment() {
26 |
27 | private val args: InfoSensorFragmentArgs by navArgs()
28 |
29 | @Inject
30 | lateinit var gpsDisplayer: GPSDisplayer
31 |
32 | @Inject
33 | lateinit var sensorDisplayer: SensorDisplayer
34 |
35 |
36 | override fun onCreateView(
37 | inflater: LayoutInflater, container: ViewGroup?,
38 | savedInstanceState: Bundle?
39 | ): View {
40 | return when(args.type){
41 | SensorNeeds.GPS -> {
42 | gpsDisplayer.getView(requireContext(), inflater, container, args)
43 | }
44 | else -> {
45 | sensorDisplayer.getView(requireContext(), inflater, container, args)
46 | }
47 | }
48 | }
49 |
50 | override fun onDestroy() {
51 | super.onDestroy()
52 | sensorDisplayer.onDestroy()
53 | gpsDisplayer.onDestroy()
54 | }
55 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/fragments/InfoSensorFragmentWearOs.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.fragments
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import androidx.fragment.app.viewModels
9 | import androidx.navigation.fragment.navArgs
10 | import com.motionapps.sensorbox.fragments.displayers.SensorWearOsDisplayer
11 | import com.motionapps.sensorbox.viewmodels.MainViewModel
12 | import dagger.hilt.android.AndroidEntryPoint
13 | import kotlinx.coroutines.ExperimentalCoroutinesApi
14 | import kotlinx.coroutines.InternalCoroutinesApi
15 |
16 | @InternalCoroutinesApi
17 | @ExperimentalCoroutinesApi
18 | @AndroidEntryPoint
19 |
20 | /**
21 | * Same as InfoSensorFragment but with Wear Os
22 | * Stops sending of the Wear Os data onDestroy
23 | *
24 | */
25 | class InfoSensorFragmentWearOs : Fragment() {
26 |
27 | val args: InfoSensorFragmentWearOsArgs by navArgs()
28 | private val mainViewModel: MainViewModel by viewModels(ownerProducer = {requireActivity()})
29 |
30 | private lateinit var sensorWearOsDisplayer: SensorWearOsDisplayer
31 |
32 | override fun onCreateView(
33 | inflater: LayoutInflater, container: ViewGroup?,
34 | savedInstanceState: Bundle?
35 | ): View? {
36 | sensorWearOsDisplayer = SensorWearOsDisplayer(mainViewModel)
37 | return sensorWearOsDisplayer.getView(requireContext(), inflater, container, args)
38 | }
39 |
40 | override fun onDestroy() {
41 | super.onDestroy()
42 | mainViewModel.stopWearOsSensor(requireContext())
43 | sensorWearOsDisplayer.onDestroy()
44 | }
45 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/fragments/SensorInfoView.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.fragments
2 |
3 | /**
4 | * Stores data for the line of the sensor attribute
5 | *
6 | * @property title - of the attribute
7 | * @property value - of the attribut
8 | * @property icon - of the attribut
9 | */
10 | data class SensorInfoView(val title: String, val value: String, val icon: Int)
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/fragments/advanced/AdvancedFragment.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.fragments.advanced
2 |
3 | import android.os.Build
4 | import androidx.core.content.ContextCompat
5 | import androidx.navigation.NavDirections
6 | import androidx.navigation.Navigation
7 | import com.motionapps.sensorbox.R
8 | import com.motionapps.sensorbox.fragments.HomeFragment
9 | import com.motionapps.sensorbox.fragments.HomeFragmentDirections
10 | import com.motionapps.sensorservices.handlers.StorageHandler
11 | import kotlinx.coroutines.ExperimentalCoroutinesApi
12 | import kotlinx.coroutines.InternalCoroutinesApi
13 |
14 |
15 | @ExperimentalCoroutinesApi
16 | @InternalCoroutinesApi
17 |
18 | /**
19 | * Same as HomeFragment
20 | * The click of the button leads to fragment to pick more specific settings
21 | */
22 | class AdvancedFragment : HomeFragment() {
23 |
24 |
25 | override fun initMainButton() {
26 | mainButton?.setText(R.string.next)
27 | mainButton?.setOnClickListener {
28 | if (!StorageHandler.isAccess(requireContext())) {
29 | if (Build.VERSION_CODES.Q <= Build.VERSION.SDK_INT) {
30 | Navigation.findNavController(requireView()).navigate(
31 | HomeFragmentDirections.actionNavHomeToPickFolderFragment(
32 | ContextCompat.getColor(requireContext(), R.color.colorPrimaryDark)
33 | )
34 | )
35 | return@setOnClickListener
36 | } else if(permissionHandler != null){
37 | permissionHandler?.showDialogStorage(this)
38 | return@setOnClickListener
39 | }
40 | }
41 | val action: NavDirections = AdvancedFragmentDirections.actionAdvancedToPicker()
42 | Navigation.findNavController(requireView()).navigate(action)
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/fragments/advanced/MeasurementPickerFragment.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.fragments.advanced
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import android.widget.LinearLayout
8 | import androidx.fragment.app.Fragment
9 | import androidx.navigation.NavDirections
10 | import androidx.navigation.Navigation
11 | import com.motionapps.sensorbox.R
12 | import com.motionapps.sensorservices.services.MeasurementService.Companion.ENDLESS
13 | import kotlinx.coroutines.ExperimentalCoroutinesApi
14 | import kotlinx.coroutines.InternalCoroutinesApi
15 |
16 |
17 | @ExperimentalCoroutinesApi
18 | @InternalCoroutinesApi
19 | /**
20 | * 3 buttons to pick kind of the measurement LONG / ENDLESS / SHORT
21 | */
22 | class MeasurementPickerFragment : Fragment() {
23 | override fun onCreateView(
24 | inflater: LayoutInflater, container: ViewGroup?,
25 | savedInstanceState: Bundle?
26 | ): View {
27 |
28 | val view: View = inflater.inflate(R.layout.fragment_measurement_picker, container, false)
29 |
30 | // (view.findViewById(R.id.picker_measurement_long)).also {
31 | // it.setOnClickListener {
32 | // val action: NavDirections = MeasurementPickerFragmentDirections.actionMeasurementPickerFragmentToCountersFragment(true)
33 | // Navigation.findNavController(requireView()).navigate(action)
34 | // }
35 | // }
36 |
37 | (view.findViewById(R.id.picker_measurement_endless)).also {
38 | it.setOnClickListener {
39 | val action: NavDirections = MeasurementPickerFragmentDirections.actionMeasurementPickerFragmentToExtraFragment(ENDLESS)
40 | Navigation.findNavController(requireView()).navigate(action)
41 | }
42 | }
43 |
44 | (view.findViewById(R.id.picker_measurement_short)).also {
45 | it.setOnClickListener {
46 | val action: NavDirections = MeasurementPickerFragmentDirections.actionMeasurementPickerFragmentToCountersFragment(false)
47 | Navigation.findNavController(requireView()).navigate(action)
48 | }
49 | }
50 | return view
51 | }
52 |
53 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/fragments/displayers/Displayer.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.fragments.displayers
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.navigation.NavArgs
8 |
9 | /**
10 | * Interface for objects, that want to shoe sensor or other attributes of it
11 | */
12 | interface Displayer {
13 | fun getView(context: Context, inflater: LayoutInflater, viewGroup: ViewGroup?, args: NavArgs): View?
14 | fun onDestroy()
15 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/intro/PowerSaverExplanationFragment.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.intro
2 |
3 | import android.annotation.SuppressLint
4 | import android.os.Build
5 | import android.os.Bundle
6 | import android.view.LayoutInflater
7 | import android.view.View
8 | import android.view.ViewGroup
9 | import androidx.annotation.RequiresApi
10 | import androidx.core.content.ContextCompat
11 | import androidx.fragment.app.Fragment
12 | import com.github.appintro.SlideBackgroundColorHolder
13 | import com.motionapps.sensorbox.R
14 |
15 | @RequiresApi(Build.VERSION_CODES.M)
16 | @SuppressLint("BatteryLife")
17 | /**
18 | * Needed custom layout and fragment object for background colour
19 | *
20 | */
21 | class PowerSaverExplanationFragment : Fragment(), SlideBackgroundColorHolder {
22 |
23 | override fun onCreateView(
24 | inflater: LayoutInflater, container: ViewGroup?,
25 | savedInstanceState: Bundle?
26 | ): View? {
27 |
28 | return inflater.inflate(R.layout.fragment_explanation_power_saver, container, false)
29 | }
30 |
31 | override val defaultBackgroundColor: Int
32 | get() = ContextCompat.getColor(requireContext(), R.color.colorRedLT)
33 |
34 | override fun setBackgroundColor(backgroundColor: Int) {}
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/motionapps/sensorbox/intro/PowerSaverFragment.kt:
--------------------------------------------------------------------------------
1 | package com.motionapps.sensorbox.intro
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import android.widget.Button
9 | import androidx.annotation.RequiresApi
10 | import androidx.core.content.ContextCompat
11 | import androidx.fragment.app.Fragment
12 | import com.github.appintro.SlideBackgroundColorHolder
13 | import com.motionapps.sensorbox.R
14 | import com.motionapps.sensorservices.handlers.PowerManagement
15 |
16 | @RequiresApi(Build.VERSION_CODES.M)
17 | /**
18 | * Asks user to add app to the whitelist
19 | *
20 | */
21 | class PowerSaverFragment : Fragment(), SlideBackgroundColorHolder {
22 |
23 | override fun onCreateView(
24 | inflater: LayoutInflater, container: ViewGroup?,
25 | savedInstanceState: Bundle?
26 | ): View {
27 |
28 | val view: View = inflater.inflate(R.layout.fragment_power_saver, container, false)
29 |
30 | (view.findViewById