Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
e
os
GmsCore
Commits
1a3dc7f7
Commit
1a3dc7f7
authored
Feb 10, 2021
by
Mohit Mali
Committed by
Amit Kumar
Feb 10, 2021
Browse files
Add feature purpose for microg exposure notifications
parent
ff1ac66f
Changes
3
Hide whitespace changes
Inline
Side-by-side
play-services-core/src/main/kotlin/org/microg/gms/ui/SettingsFragment.kt
View file @
1a3dc7f7
...
...
@@ -16,6 +16,9 @@ import org.microg.gms.gcm.getGcmServiceInfo
import
org.microg.gms.snet.getSafetyNetServiceInfo
import
org.microg.nlp.client.UnifiedLocationClient
import
org.microg.tools.ui.ResourceSettingsFragment
import
android.content.ActivityNotFoundException
import
android.content.ComponentName
import
android.content.Intent
class
SettingsFragment
:
ResourceSettingsFragment
()
{
override
fun
onCreatePreferences
(
savedInstanceState
:
Bundle
?,
rootKey
:
String
?)
{
...
...
@@ -41,6 +44,10 @@ class SettingsFragment : ResourceSettingsFragment() {
findNavController
().
navigate
(
requireContext
(),
NearbyPreferencesIntegration
.
exposureNotificationNavigationId
)
true
}
findPreference
<
Preference
>(
PREF_EXPOSURE_INSTALL
)
?.
onPreferenceClickListener
=
Preference
.
OnPreferenceClickListener
{
startApplication
(
"foundation.e.apps"
)
true
}
findPreference
<
Preference
>(
PREF_ABOUT
)
!!
.
onPreferenceClickListener
=
Preference
.
OnPreferenceClickListener
{
findNavController
().
navigate
(
requireContext
(),
R
.
id
.
openAbout
)
true
...
...
@@ -55,6 +62,32 @@ class SettingsFragment : ResourceSettingsFragment() {
}
}
private
fun
launchComponent
(
packageName
:
String
,
name
:
String
)
{
val
launch_intent
=
Intent
(
"android.intent.action.MAIN"
)
launch_intent
.
addCategory
(
"android.intent.category.LAUNCHER"
)
launch_intent
.
component
=
ComponentName
(
packageName
,
name
)
launch_intent
.
putExtra
(
"open_search"
,
true
)
launch_intent
.
flags
=
Intent
.
FLAG_ACTIVITY_NEW_TASK
requireActivity
().
startActivity
(
launch_intent
)
}
fun
startApplication
(
application_name
:
String
?)
{
try
{
val
intent
=
Intent
(
"android.intent.action.MAIN"
)
intent
.
addCategory
(
"android.intent.category.LAUNCHER"
)
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NO_ANIMATION
)
val
resolveinfo_list
=
requireActivity
().
packageManager
.
queryIntentActivities
(
intent
,
0
)
for
(
info
in
resolveinfo_list
)
{
if
(
info
.
activityInfo
.
packageName
==
application_name
)
{
launchComponent
(
info
.
activityInfo
.
packageName
,
info
.
activityInfo
.
name
)
break
}
}
}
catch
(
e
:
ActivityNotFoundException
)
{
e
.
message
}
}
private
suspend
fun
updateDetails
()
{
if
(
getGcmServiceInfo
(
requireContext
()).
configuration
.
enabled
)
{
val
database
=
GcmDatabase
(
context
)
...
...
@@ -74,6 +107,9 @@ class SettingsFragment : ResourceSettingsFragment() {
findPreference
<
Preference
>(
PREF_EXPOSURE
)
?.
isVisible
=
NearbyPreferencesIntegration
.
isAvailable
findPreference
<
Preference
>(
PREF_EXPOSURE
)
?.
icon
=
NearbyPreferencesIntegration
.
getIcon
(
requireContext
())
findPreference
<
Preference
>(
PREF_EXPOSURE
)
?.
summary
=
NearbyPreferencesIntegration
.
getExposurePreferenceSummary
(
requireContext
())
println
(
"MicroG_Status::-"
+
NearbyPreferencesIntegration
.
isAvailable
)
}
companion
object
{
...
...
@@ -83,6 +119,7 @@ class SettingsFragment : ResourceSettingsFragment() {
const
val
PREF_UNIFIEDNLP
=
"pref_unifiednlp"
const
val
PREF_CHECKIN
=
"pref_checkin"
const
val
PREF_EXPOSURE
=
"pref_exposure"
const
val
PREF_EXPOSURE_INSTALL
=
"pref_exposure_install"
}
init
{
...
...
play-services-core/src/main/res/values/strings.xml
View file @
1a3dc7f7
...
...
@@ -65,6 +65,7 @@ This can take a couple of minutes."</string>
<string
name=
"service_status_manual"
>
Manual
</string>
<string
name=
"service_status_enabled_short"
>
On
</string>
<string
name=
"service_status_disabled_short"
>
Off
</string>
<string
name=
"pref_exposure_install_summary"
>
Tap to add support for Exposure Notifications
</string>
<string
name=
"games_title"
>
Google Play Games
</string>
<string
name=
"games_info_title"
><xliff:g
example=
"F-Droid"
>
%1$s
</xliff:g>
would like to use Play Games
</string>
...
...
play-services-core/src/main/res/xml/preferences_start.xml
View file @
1a3dc7f7
...
...
@@ -66,6 +66,11 @@
android:key=
"pref_exposure"
android:title=
"@string/service_name_exposure"
app:isPreferenceVisible=
"false"
/>
<Preference
android:key=
"pref_exposure_install"
android:title=
"@string/service_name_exposure"
android:summary=
"@string/pref_exposure_install_summary"
>
</Preference>
</PreferenceCategory>
<PreferenceCategory
android:layout=
"@layout/preference_category_no_label"
>
<Preference
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment