diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 273ef26b..3e0bef3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,42 +9,82 @@ on: branches: [ master ] jobs: - build: - name: Build ${{ matrix.os }}, java-${{ matrix.java_version }}, node-${{ matrix.node_version }} + build-webui: + name: Build aw-webui (node-${{ matrix.node_version }}) runs-on: ${{ matrix.os }} - env: - SUPPLY_TRACK: production # used by fastlane to determine track to publish to strategy: - fail-fast: false matrix: os: [ubuntu-20.04] - java_version: [11] node_version: [16] - ruby_version: ['3.0'] - ndk_version: ['21.4.7075529'] - rust_build: [false] # if true, will build aw-server-rust, otherwise will fetch artifact from recent CI run - skip_webui: [true] steps: - uses: actions/checkout@v2 with: submodules: 'recursive' - # Build in release mode if: (longer build times) - # - on a tag (release) - # FIXME: Can't use with matrix rust_build=false + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node_version }} + + # Set up caches + - name: Get npm cache dir + id: npm-cache-dir + run: | + echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v1 + name: Cache npm + env: + cache-name: node + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-${{ env.cache-name }}- + + - name: Build webui + run: | + make aw-webui + + - name: Upload web UI + uses: actions/upload-artifact@v3 + with: + name: webui + path: mobile/src/main/assets/webui/ + + build-rust: + name: Build aw-server-rust (ndk-${{ matrix.ndk_version }}) + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04] + ndk_version: ['21.4.7075529'] + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' - name: Set RELEASE run: | echo "RELEASE=${{ startsWith(github.ref_name, 'v') }}" >> $GITHUB_ENV - - name: Set up JDK - uses: actions/setup-java@v1 + - name: Cache JNI libs + uses: actions/cache@v1 + id: cache-jniLibs + env: + cache-name: jniLibs with: - java-version: ${{ matrix.java_version }} + path: mobile/src/main/jniLibs/ + key: ${{ env.cache-name }}-release-${{ env.RELEASE }}-ndk-${{ matrix.ndk_version }}-${{ hashFiles('.git/modules/aw-server-rust/HEAD') }} + - name: Display structure of downloaded files + if: steps.cache-jniLibs.outputs.cache-hit == 'true' + run: | + pushd mobile/src/main/jniLibs && ls -R && popd # Android SDK & NDK - name: Set up Android SDK + if: steps.cache-jniLibs.outputs.cache-hit != 'true' uses: android-actions/setup-android@v2 - name: Install NDK + if: steps.cache-jniLibs.outputs.cache-hit != 'true' run: | sdkmanager "ndk;${{ matrix.ndk_version }}" ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ matrix.ndk_version }}" @@ -54,102 +94,104 @@ jobs: # Rust - name: Set up Rust nightly uses: actions-rs/toolchain@v1 - if: ${{ matrix.rust_build }} + if: steps.cache-jniLibs.outputs.cache-hit != 'true' with: profile: minimal toolchain: nightly override: true - name: Set up Rust toolchain for Android NDK + if: steps.cache-jniLibs.outputs.cache-hit != 'true' run: | ./aw-server-rust/install-ndk.sh - # Ruby & Fastlane - - name: Set up Ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby_version }} - - name: Install fastlane - run: | - gem install bundler - bundle install - - # Node - - name: Set up Node - uses: actions/setup-node@v1 - if: ${{ !matrix.skip_webui }} - with: - node-version: ${{ matrix.node_version }} - - # Set up caches - - name: Get npm cache dir - id: npm-cache-dir - if: ${{ !matrix.skip_webui }} - run: | - echo "::set-output name=dir::$(npm config get cache)" - - uses: actions/cache@v1 - name: Cache npm - if: ${{ !matrix.skip_webui }} - env: - cache-name: node - with: - path: ${{ steps.npm-cache-dir.outputs.dir }} - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-${{ env.cache-name }}- - name: Cache cargo build uses: actions/cache@v1 - if: ${{ matrix.rust_build }} + if: steps.cache-jniLibs.outputs.cache-hit != 'true' env: cache-name: cargo-build-target with: path: aw-server-rust/target - key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-${{ env.cache-name }}- + key: ${{ env.cache-name }}-release-${{ env.RELEASE }}-${{ hashFiles('**/Cargo.lock') }} - # Test - - name: Test + - name: Build aw-server-rust + if: steps.cache-jniLibs.outputs.cache-hit != 'true' run: | - make test + make aw-server-rust - # Build webui - - name: Build webui - if: ${{ !matrix.skip_webui }} + - name: Check that jniLibs present run: | - make aw-webui + test -e mobile/src/main/jniLibs/x86_64/libaw_server.so - # Build or fetch aw-server-rust artifacts - - name: Download prebuilt aw-server-rust Android libs - uses: dawidd6/action-download-artifact@v2 - if: ${{ !matrix.rust_build }} + - name: Upload JNI libs + uses: actions/upload-artifact@v3 with: - repo: ActivityWatch/aw-server-rust - branch: master - workflow: build.yml - # Optional, uploaded artifact name, - # will download all artifacts if not specified - # and extract them in respective subdirectories - # https://github.com/actions/download-artifact#download-all-artifacts - name: binaries-android - path: aw-server-rust/target/ - # Optional, the status or conclusion of a completed workflow to search for - # Can be one of a workflow conculsion:: - # "failure", "success", "neutral", "cancelled", "skipped", "timed_out", "action_required" - # Or a workflow status: - # "completed", "in_progress", "queued" - # Default: "completed" - workflow_conclusion: success - - name: Build aw-server-rust - env: - USE_PREBUILT: ${{ !matrix.rust_build }} + name: jniLibs + path: mobile/src/main/jniLibs/ + + + build-apk: + name: Build APK (${{ matrix.os }}, java-${{ matrix.java_version }}, node-${{ matrix.node_version }}) + runs-on: ${{ matrix.os }} + needs: [build-rust, build-webui] + env: + SUPPLY_TRACK: production # used by fastlane to determine track to publish to + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + java_version: [11] + ruby_version: ['3.0'] + ndk_version: ['21.4.7075529'] + steps: + - uses: actions/checkout@v2 + with: + submodules: 'recursive' + + # Build in release mode if on a tag/release (longer build times) + - name: Set RELEASE run: | - # will build if USE_PREBUILT is true, - # otherwise will just move files into the right place - make aw-server-rust + echo "RELEASE=${{ startsWith(github.ref_name, 'v') }}" >> $GITHUB_ENV + + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java_version }} + + # Android SDK & NDK + - name: Set up Android SDK + uses: android-actions/setup-android@v2 + - name: Install NDK + run: | + sdkmanager "ndk;${{ matrix.ndk_version }}" + ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ matrix.ndk_version }}" + ls $ANDROID_NDK_HOME + echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV + + # Ruby & Fastlane + - name: Set up Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + - name: Install fastlane + run: | + gem install bundler + bundle install + + - name: Download JNI libs + uses: actions/download-artifact@v3 + with: + name: jniLibs + path: mobile/src/main/jniLibs - name: Check that jniLibs present run: | test -e mobile/src/main/jniLibs/x86_64/libaw_server.so + - name: Download web UI + uses: actions/download-artifact@v3 + with: + name: webui + path: mobile/src/main/assets/webui + - name: Set version if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag run: | @@ -159,9 +201,10 @@ jobs: mobile/build.gradle bundle exec fastlane update_version - - name: Assemble debug & test APK + # Test + - name: Test run: | - make build-apk-debug + make test # Install age & load secrets - name: Install age @@ -182,20 +225,14 @@ jobs: run: | make dist/aw-android.apk - - name: Upload artifact + - name: Upload release APK uses: actions/upload-artifact@v3 with: name: aw-android path: dist/aw-android*.apk - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: apks - path: dist/apk/ - test-e2e: - needs: [build] + needs: [build-rust, build-webui] name: Test E2E ${{ matrix.android_avd }} #-${{ matrix.os }}-eAPI-${{ matrix.android_emu_version }}-java-${{ matrix.java_version }}-node-${{ matrix.node_version }} runs-on: ${{ matrix.os }} env: @@ -220,15 +257,22 @@ jobs: with: submodules: 'recursive' - # Will download all artifacts to path - - name: Download build artifacts + - name: Download JNI libs uses: actions/download-artifact@v3 with: - name: apks - path: dist/apk + name: jniLibs + path: mobile/src/main/jniLibs + + - name: Download web UI + uses: actions/download-artifact@v3 + with: + name: webui + path: mobile/src/main/assets/webui + - name: Display structure of downloaded files - working-directory: dist - run: ls -R + run: | + pushd mobile/src/main/assets/webui && ls -R && popd + pushd mobile/src/main/jniLibs && ls -R && popd # # # Below code is majorly from https://github.com/actions/runner-images/issues/6152#issuecomment-1243718140 - name: Create Android emulator @@ -318,16 +362,26 @@ jobs: # # $ANDROID_HOME/tools/emulator -port 18725 -verbose -no-audio -gpu swiftshader_indirect -logcat *:v @$MATRIX_AVD & # ffmpeg -f avfoundation -i 0 -t 120 out$SUFFIX.mov & - - name: Test App + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java_version }} + + # Android SDK & NDK + - name: Set up Android SDK + uses: android-actions/setup-android@v2 + - name: Install NDK + run: | + sdkmanager "ndk;${{ matrix.ndk_version }}" + ANDROID_NDK_HOME="$ANDROID_SDK_ROOT/ndk/${{ matrix.ndk_version }}" + ls $ANDROID_NDK_HOME + echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV + + - name: Run E2E tests timeout-minutes: 20 id: test run: | - adb install dist/apk/debug/mobile-debug.apk - adb install dist/apk/androidTest/debug/mobile-debug-androidTest.apk - adb shell pm list instrumentation - adb shell am instrument -w \ - -e class net.activitywatch.android.ScreenshotTest \ - net.activitywatch.android.debug.test/androidx.test.runner.AndroidJUnitRunner + make test-e2e - name: Output and save logcat to file if: ${{ success() || steps.test.conclusion == 'failure'}} @@ -385,15 +439,15 @@ jobs: # cat GITHUB_STEP_SUMMARY.html >> $GITHUB_STEP_SUMMARY release-fastlane: - needs: [build] + needs: [build-apk] if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag runs-on: ubuntu-latest steps: - # Will download all artifacts to path - - name: Download build artifacts + - name: Download release APK uses: actions/download-artifact@v3 with: + name: aw-android path: dist - name: Display structure of downloaded files @@ -424,15 +478,16 @@ jobs: bundle exec fastlane supply run --apk dist/*/*.apk release-gh: - needs: [build] + needs: [build-apk] if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag runs-on: ubuntu-latest steps: # Will download all artifacts to path - - name: Download build artifacts + - name: Download release APK uses: actions/download-artifact@v3 with: + name: aw-android path: dist - name: Display structure of downloaded files diff --git a/.idea/misc.xml b/.idea/misc.xml index 79d4e7cc..6686234c 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -45,7 +45,7 @@ - + diff --git a/Makefile b/Makefile index cb4f5ec8..9e2eae79 100644 --- a/Makefile +++ b/Makefile @@ -29,19 +29,29 @@ test-unit: ./gradlew test test-e2e: - # Run only screenshot test, for now + ./gradlew connectedAndroidTest --stacktrace + +test-e2e-screenshot-only: + @# To only run screenshot test: ./gradlew connectedAndroidTest \ -Pandroid.testInstrumentationRunnerArguments.class=net.activitywatch.android.ScreenshotTest test-e2e-adb: - # Requires that you have a device connected with the necessary APKs installed - # Alternative to using gradle, if you don't want to rebuild. - # Run only screenshot test, for now - adb shell pm list instrumentation + @# Requires that you have a device connected with the necessary APKs installed + @# Alternative to using gradle, if you don't want to rebuild. + @# + @# To list instrumentation tests, run: + @# adb shell pm list instrumentation + @# + @# Run only screenshot test, for now adb shell am instrument -w \ -e class net.activitywatch.android.ScreenshotTest net.activitywatch.android.debug.test/androidx.test.runner.AndroidJUnitRunner +install-apk-debug: $(APKDIR)/debug/mobile-debug.apk + adb install $(APKDIR)/debug/mobile-debug.apk + adb install $(APKDIR)/debug/mobile-debug-androidTest.apk + # APK targets $(APKDIR)/release/mobile-release-unsigned.apk: TERM=xterm ./gradlew assembleRelease @@ -97,18 +107,19 @@ $(JNILIBS): $(JNI_arm7)/libaw_server.so $(JNI_arm8)/libaw_server.so $(JNI_x86)/l @ls -lL $@/*/* # Check that symlinks are valid # There must be a better way to do this without repeating almost the same rule over and over? +# NOTE: These must be hard links for CI caching to work $(JNI_arm7)/libaw_server.so: $(TARGET_arm7)/$(RELEASE_TYPE)/libaw_server.so mkdir -p $$(dirname $@) - ln -sfnv $$(pwd)/$^ $@ + ln -fnv $$(pwd)/$^ $@ $(JNI_arm8)/libaw_server.so: $(TARGET_arm8)/$(RELEASE_TYPE)/libaw_server.so mkdir -p $$(dirname $@) - ln -sfnv $$(pwd)/$^ $@ + ln -fnv $$(pwd)/$^ $@ $(JNI_x86)/libaw_server.so: $(TARGET_x86)/$(RELEASE_TYPE)/libaw_server.so mkdir -p $$(dirname $@) - ln -sfnv $$(pwd)/$^ $@ + ln -fnv $$(pwd)/$^ $@ $(JNI_x64)/libaw_server.so: $(TARGET_x64)/$(RELEASE_TYPE)/libaw_server.so mkdir -p $$(dirname $@) - ln -sfnv $$(pwd)/$^ $@ + ln -fnv $$(pwd)/$^ $@ RUSTFLAGS_ANDROID="-C debuginfo=2 -Awarnings" # Explanation of RUSTFLAGS: diff --git a/build.gradle b/build.gradle index 056f55d9..e0cfdf74 100644 --- a/build.gradle +++ b/build.gradle @@ -2,10 +2,10 @@ buildscript { ext.kotlin_version = '1.7.20' - ext.androidXTestVersion = '1.4.0' - ext.espressoVersion = '3.5.0-rc01' - ext.extJUnitVersion = '1.1.3' - ext.servicesVersion = "1.4.2-rc01" + ext.androidXTestVersion = '1.5.0' + ext.espressoVersion = '3.5.0' + ext.extJUnitVersion = '1.1.4' + ext.servicesVersion = '1.4.2' repositories { google() mavenCentral() diff --git a/mobile/build.gradle b/mobile/build.gradle index 1d95749d..2bc5ac99 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -1,6 +1,5 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 33 @@ -18,7 +17,8 @@ android { versionCode 25 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - testInstrumentationRunnerArguments useTestStorageService: 'true' + // NOTE: This only works for API level 28 and above + //testInstrumentationRunnerArguments useTestStorageService: 'true' // WARNING: Never commit this uncommented! packagingOptions { @@ -57,6 +57,10 @@ android { applicationVariants.all { variant -> variant.resValue "string", "versionName", 'v' + variant.versionName } + + buildFeatures { + viewBinding true + } } dependencies { @@ -72,7 +76,7 @@ dependencies { implementation 'androidx.annotation:annotation:1.5.0' implementation 'com.google.android.material:material:1.7.0' - implementation 'com.jakewharton.threetenabp:threetenabp:1.1.1' + implementation 'com.jakewharton.threetenabp:threetenabp:1.4.3' testImplementation "junit:junit:4.13.2" androidTestImplementation "androidx.test.ext:junit-ktx:$extJUnitVersion" diff --git a/mobile/src/androidTest/java/net/activitywatch/android/ExampleInstrumentedTest.kt b/mobile/src/androidTest/java/net/activitywatch/android/BasicTest.kt similarity index 83% rename from mobile/src/androidTest/java/net/activitywatch/android/ExampleInstrumentedTest.kt rename to mobile/src/androidTest/java/net/activitywatch/android/BasicTest.kt index 07cce989..077ee62f 100644 --- a/mobile/src/androidTest/java/net/activitywatch/android/ExampleInstrumentedTest.kt +++ b/mobile/src/androidTest/java/net/activitywatch/android/BasicTest.kt @@ -4,7 +4,6 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.Test -import org.junit.Before import org.junit.runner.RunWith import org.junit.Assert.* @@ -17,12 +16,12 @@ import java.time.Instant * See [testing documentation](http://d.android.com/tools/testing). */ @RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { +class BasicTest { @Test fun useAppContext() { // Context of the app under test. val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("net.activitywatch.android", appContext.packageName) + assertEquals("net.activitywatch.android.debug", appContext.packageName) } @Test @@ -33,7 +32,7 @@ class ExampleInstrumentedTest { val bucketId = "test-${Math.random()}" val oldLen = ri.getBucketsJSON().length() ri.createBucket("""{"id": "$bucketId", "type": "test", "hostname": "test", "client": "test"}""") - assertEquals(ri.getBucketsJSON().length(), oldLen + 1) + assertEquals(oldLen + 1, ri.getBucketsJSON().length()) } @Test @@ -42,8 +41,8 @@ class ExampleInstrumentedTest { val ri = RustInterface(appContext) val bucketId = "test-${Math.random()}" ri.createBucket("""{"id": "$bucketId", "type": "test", "hostname": "test", "client": "test"}""") + val oldLen = ri.getEventsJSON(bucketId, 3).length() ri.heartbeat(bucketId, """{"timestamp": "${Instant.now()}", "duration": 0, "data": {"key": "value"}}""", 1.0) - sleep(10) - assertEquals(1, ri.getEventsJSON(bucketId).length()) + assertEquals(oldLen + 1, ri.getEventsJSON(bucketId, 3).length()) } } diff --git a/mobile/src/androidTest/java/net/activitywatch/android/ScreenshotTest.kt b/mobile/src/androidTest/java/net/activitywatch/android/ScreenshotTest.kt index 35f7a004..4040f3c7 100644 --- a/mobile/src/androidTest/java/net/activitywatch/android/ScreenshotTest.kt +++ b/mobile/src/androidTest/java/net/activitywatch/android/ScreenshotTest.kt @@ -51,7 +51,12 @@ class ScreenshotTest { Log.i(TAG, "Taking screenshot") val bitmap = takeScreenshot() - bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") + // Only supported on API levels >=28 + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P) { + bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") + } else { + Log.i(TAG, "Screenshot not saved to test storage, API level too low") + } Log.i(TAG, "Took screenshot!") } } diff --git a/mobile/src/main/java/net/activitywatch/android/MainActivity.kt b/mobile/src/main/java/net/activitywatch/android/MainActivity.kt index 8999580a..30c18abb 100644 --- a/mobile/src/main/java/net/activitywatch/android/MainActivity.kt +++ b/mobile/src/main/java/net/activitywatch/android/MainActivity.kt @@ -9,10 +9,10 @@ import androidx.appcompat.app.ActionBarDrawerToggle import androidx.appcompat.app.AppCompatActivity import android.view.Menu import android.view.MenuItem -import kotlinx.android.synthetic.main.activity_main.* -import kotlinx.android.synthetic.main.app_bar_main.* import androidx.fragment.app.Fragment import android.util.Log +import net.activitywatch.android.databinding.ActivityMainBinding +import net.activitywatch.android.databinding.AppBarMainBinding import net.activitywatch.android.fragments.TestFragment import net.activitywatch.android.fragments.WebUIFragment import net.activitywatch.android.watcher.UsageStatsWatcher @@ -24,6 +24,8 @@ const val baseURL = "http://127.0.0.1:5600" class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener, WebUIFragment.OnFragmentInteractionListener { + private lateinit var binding: ActivityMainBinding + val version: String get() { return packageManager.getPackageInfo(packageName, 0).versionName @@ -35,20 +37,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - - setSupportActionBar(toolbar) - - val toggle = ActionBarDrawerToggle( - this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close - ) - drawer_layout.addDrawerListener(toggle) - toggle.syncState() - - // Hide the top menu/title bar - supportActionBar?.hide() + binding = ActivityMainBinding.inflate(layoutInflater) + val view = binding.root + setContentView(view) - nav_view.setNavigationItemSelectedListener(this) + binding.navView.setNavigationItemSelectedListener(this) val ri = RustInterface(this) ri.startServerTask(this) @@ -74,8 +67,8 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte } override fun onBackPressed() { - if (drawer_layout.isDrawerOpen(GravityCompat.START)) { - drawer_layout.closeDrawer(GravityCompat.START) + if (binding.drawerLayout.isDrawerOpen(GravityCompat.START)) { + binding.drawerLayout.closeDrawer(GravityCompat.START) } else { super.onBackPressed() } @@ -93,7 +86,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte // as you specify a parent activity in AndroidManifest.xml. return when (item.itemId) { R.id.action_settings -> { - Snackbar.make(coordinator_layout, "The settings button was clicked, but it's not yet implemented!", Snackbar.LENGTH_LONG) + Snackbar.make(binding.coordinatorLayout, "The settings button was clicked, but it's not yet implemented!", Snackbar.LENGTH_LONG) .setAction("Action", null).show() true } @@ -123,11 +116,11 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte url = "$baseURL/#/settings/" } R.id.nav_share -> { - Snackbar.make(coordinator_layout, "The share button was clicked, but it's not yet implemented!", Snackbar.LENGTH_LONG) + Snackbar.make(binding.coordinatorLayout, "The share button was clicked, but it's not yet implemented!", Snackbar.LENGTH_LONG) .setAction("Action", null).show() } R.id.nav_send -> { - Snackbar.make(coordinator_layout, "The send button was clicked, but it's not yet implemented!", Snackbar.LENGTH_LONG) + Snackbar.make(binding.coordinatorLayout, "The send button was clicked, but it's not yet implemented!", Snackbar.LENGTH_LONG) .setAction("Action", null).show() } } @@ -149,7 +142,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte fragmentManager.beginTransaction().replace(R.id.fragment_container, fragment).commit() } - drawer_layout.closeDrawer(GravityCompat.START) + binding.drawerLayout.closeDrawer(GravityCompat.START) return true } } diff --git a/mobile/src/main/java/net/activitywatch/android/RustInterface.kt b/mobile/src/main/java/net/activitywatch/android/RustInterface.kt index e615e16c..9ebe3fef 100644 --- a/mobile/src/main/java/net/activitywatch/android/RustInterface.kt +++ b/mobile/src/main/java/net/activitywatch/android/RustInterface.kt @@ -1,7 +1,6 @@ package net.activitywatch.android import android.content.Context -import android.os.AsyncTask import android.os.Handler import android.os.Looper import android.system.Os diff --git a/mobile/src/main/res/layout/app_bar_main.xml b/mobile/src/main/res/layout/app_bar_main.xml index 4c84fb92..3602a412 100644 --- a/mobile/src/main/res/layout/app_bar_main.xml +++ b/mobile/src/main/res/layout/app_bar_main.xml @@ -7,7 +7,7 @@ android:layout_height="match_parent" tools:context=".MainActivity"> - @@ -19,8 +19,8 @@ android:background="#FFFFFF" app:popupTheme="@style/AppTheme.PopupOverlay" /> - + - \ No newline at end of file + diff --git a/mobile/src/main/res/values/styles.xml b/mobile/src/main/res/values/styles.xml index c5cb28fe..34d729d6 100644 --- a/mobile/src/main/res/values/styles.xml +++ b/mobile/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ -