Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit 3dad397d authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

EN: (UI) Add low priority, unexported EXPOSURE_NOTIFICATION_SETTINGS activity.

Useful when bundling the library with EN apps.
parent 0cd028af
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -19,5 +19,14 @@
                <action android:name="org.microg.gms.nearby.exposurenotification.CONFIRM" />
            </intent-filter>
        </activity>
        <activity
            android:name="org.microg.gms.nearby.core.ui.ExposureNotificationsSettingsActivity"
            android:exported="false"
            android:process=":ui"
            android:theme="@style/Theme.AppCompat.DayNight">
            <intent-filter android:priority="-100">
                <action android:name="com.google.android.gms.settings.EXPOSURE_NOTIFICATION_SETTINGS" />
            </intent-filter>
        </activity>
    </application>
</manifest>
+1 −7
Original line number Diff line number Diff line
@@ -6,20 +6,14 @@
package org.microg.gms.nearby.core.ui

import android.annotation.TargetApi
import android.content.DialogInterface
import android.os.Bundle
import android.text.format.DateFormat
import android.util.Log
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.core.view.setPadding
import androidx.lifecycle.lifecycleScope
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import com.db.williamchart.data.Scale
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import org.microg.gms.nearby.exposurenotification.ExposureDatabase
import java.util.*
import kotlin.math.roundToInt
@@ -42,7 +36,7 @@ class ExposureNotificationsRpisFragment : PreferenceFragmentCompat() {
        deleteAll.onPreferenceClickListener = Preference.OnPreferenceClickListener {
            AlertDialog.Builder(requireContext())
                    .setTitle(R.string.pref_exposure_rpi_delete_all_title)
                    .setView(R.layout.exposure_notification_confirm_delete)
                    .setView(R.layout.exposure_notifications_confirm_delete)
                    .setPositiveButton(R.string.pref_exposure_rpi_delete_all_warning_confirm_button) { _, _ ->
                        lifecycleScope.launchWhenStarted {
                            ExposureDatabase.with(requireContext()) { it.deleteAllCollectedAdvertisements() }
+30 −0
Original line number Diff line number Diff line
/*
 * SPDX-FileCopyrightText: 2020, microG Project Team
 * SPDX-License-Identifier: Apache-2.0
 */
package org.microg.gms.nearby.core.ui

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import androidx.navigation.ui.AppBarConfiguration
import androidx.navigation.ui.NavigationUI

class ExposureNotificationsSettingsActivity : AppCompatActivity() {
    private var appBarConfiguration: AppBarConfiguration? = null

    private val navController: NavController
        get() = (supportFragmentManager.findFragmentById(R.id.navhost) as NavHostFragment?)!!.navController

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.exposure_notifications_settings_activity)
        appBarConfiguration = AppBarConfiguration.Builder(navController.graph).build()
        NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration!!)
    }

    override fun onSupportNavigateUp(): Boolean {
        return NavigationUI.navigateUp(navController, appBarConfiguration!!) || super.onSupportNavigateUp()
    }
}
+0 −0

File moved.

+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ SPDX-FileCopyrightText: 2020, microG Project Team
  ~ SPDX-License-Identifier: Apache-2.0
  -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/navhost"
        android:name="androidx.navigation.fragment.NavHostFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:defaultNavHost="true"
        app:navGraph="@navigation/nav_nearby" />
</LinearLayout>
Loading