0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-12-03 08:17:26 +00:00

added an option to hide app icon and bumped up deps

This commit is contained in:
X1nto 2021-03-02 19:15:36 +04:00
parent 66055c95b0
commit 764fe0d7ff
8 changed files with 62 additions and 12 deletions

1
.gitignore vendored
View file

@ -7,3 +7,4 @@ build/
user.gradle
local.properties
.directory
play-services-core/release

View file

@ -6,13 +6,13 @@
buildscript {
ext.safeParcelVersion = '1.6.0'
ext.kotlinVersion = '1.3.72'
ext.kotlinVersion = '1.4.31'
ext.coroutineVersion = '1.3.7'
ext.annotationVersion = '1.1.0'
ext.appcompatVersion = '1.1.0'
ext.fragmentVersion = '1.2.5'
ext.lifecycleVersion = '2.2.0'
ext.lifecycleVersion = '2.3.0'
ext.mediarouterVersion = '1.1.0'
ext.navigationVersion = '2.3.0'
ext.preferenceVersion = '1.1.1'
@ -35,7 +35,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion"
}

View file

@ -38,14 +38,14 @@ dependencies {
// AndroidX UI
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "androidx.mediarouter:mediarouter:1.2.0"
implementation "androidx.mediarouter:mediarouter:1.2.2"
implementation "androidx.preference:preference-ktx:$preferenceVersion"
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.3'
implementation "androidx.lifecycle:lifecycle-service:$lifecycleVersion"
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.21'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.31'
implementation project(path: ':play-services-basement')
api project(':play-services-location-api')

View file

@ -279,7 +279,6 @@
</intent-filter>
</service>
<!-- microG Settings shown in Launcher -->
<activity
android:name="org.microg.gms.ui.SettingsActivity"
android:icon="@mipmap/ic_launcher"
@ -289,14 +288,26 @@
android:theme="@style/Theme.AppCompat.DayNight">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- microG Settings shown in Launcher -->
<activity-alias
android:name="org.microg.gms.ui.SettingsActivityLauncher"
android:targetActivity="org.microg.gms.ui.SettingsActivity"
android:enabled="false"
android:exported="true">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity-alias>
<!-- microG Settings embedded in System Settings on SDK 23 and newer -->
<activity-alias
android:name="org.microg.gms.ui.SettingsActivityLink"

View file

@ -25,6 +25,8 @@ class SettingsFragment : ResourceSettingsFragment() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
super.onCreatePreferences(savedInstanceState, rootKey)
val pm = requireActivity().packageManager
findPreference<Preference>(PREF_CHECKIN)?.setOnPreferenceClickListener {
findNavController().navigate(requireContext(), R.id.openCheckinSettings)
true
@ -40,7 +42,7 @@ class SettingsFragment : ResourceSettingsFragment() {
findPreference<Preference>(PREF_ABOUT)?.summary = getString(R.string.about_version_str, AboutFragment.getSelfVersion(context))
findPreference<SwitchPreferenceCompat>(PREF_CAST_DOUBLE_FIX_ENABLED)?.setOnPreferenceChangeListener { _, newValue ->
context?.packageManager?.setComponentEnabledSetting(
pm?.setComponentEnabledSetting(
ComponentName(requireActivity().applicationContext, CastMediaRouteProviderService::class.java),
when (newValue) {
true -> PackageManager.COMPONENT_ENABLED_STATE_DISABLED
@ -49,6 +51,25 @@ class SettingsFragment : ResourceSettingsFragment() {
PackageManager.DONT_KILL_APP)
true
}
findPreference<SwitchPreferenceCompat>(PREF_CAST_HIDE_LAUNCHER_ICON)?.apply {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
setOnPreferenceChangeListener { _, newValue ->
pm.setComponentEnabledSetting(
ComponentName.createRelative(requireActivity(), "org.microg.gms.ui.SettingsActivityLauncher"),
when (newValue) {
true -> PackageManager.COMPONENT_ENABLED_STATE_DISABLED
else -> PackageManager.COMPONENT_ENABLED_STATE_ENABLED
},
PackageManager.DONT_KILL_APP
)
true
}
} else {
preferenceScreen.removePreference(this)
}
}
}
override fun onResume() {
@ -76,6 +97,7 @@ class SettingsFragment : ResourceSettingsFragment() {
const val PREF_GCM = "pref_gcm"
const val PREF_CHECKIN = "pref_checkin"
const val PREF_CAST_DOUBLE_FIX_ENABLED = "pref_cast_double_fix_enabled"
const val PREF_CAST_HIDE_LAUNCHER_ICON = "pref_hide_launcher_icon"
const val BRAND_SPOOF_FIX_ENABLED = "brand_spoof_fix_enabled"
}

View file

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorAccent">
<path
android:fillColor="#000000"
android:pathData="M2.81,2.81L1.39,4.22l2.27,2.27C2.61,8.07 2,9.96 2,12c0,5.52 4.48,10 10,10c2.04,0 3.93,-0.61 5.51,-1.66l2.27,2.27l1.41,-1.41L2.81,2.81zM12,20c-4.41,0 -8,-3.59 -8,-8c0,-1.48 0.41,-2.86 1.12,-4.06l10.94,10.94C14.86,19.59 13.48,20 12,20zM7.94,5.12L6.49,3.66C8.07,2.61 9.96,2 12,2c5.52,0 10,4.48 10,10c0,2.04 -0.61,3.93 -1.66,5.51l-1.46,-1.46C19.59,14.86 20,13.48 20,12c0,-4.41 -3.59,-8 -8,-8C10.52,4 9.14,4.41 7.94,5.12z"/>
</vector>

View file

@ -102,6 +102,7 @@ This can take a couple of minutes."</string>
<string name="pref_about_title">About Vanced microG</string>
<string name="pref_cast_double_fix">Cast duplication fix</string>
<string name="pref_hide_launcher_icon">Hide microG icon in the app launcher</string>
<string name="brand_spoof_button">Huawei</string>

View file

@ -48,6 +48,11 @@
android:icon="@drawable/ic_cast_black"
android:summary="@string/pref_cast_double_fix_summary"
android:defaultValue="false"/>
<SwitchPreferenceCompat
android:key="pref_hide_launcher_icon"
android:title="@string/pref_hide_launcher_icon"
android:icon="@drawable/ic_baseline_hide_source_24"
android:defaultValue="true"/>
</PreferenceCategory>
<PreferenceCategory android:layout="@layout/preference_category_no_label">
<Preference