diff --git a/play-services-core/src/main/java/org/microg/gms/ui/SettingsFragment.java b/play-services-core/src/main/java/org/microg/gms/ui/SettingsFragment.java
index e8bcd0ee..24e39788 100755
--- a/play-services-core/src/main/java/org/microg/gms/ui/SettingsFragment.java
+++ b/play-services-core/src/main/java/org/microg/gms/ui/SettingsFragment.java
@@ -1,10 +1,16 @@
package org.microg.gms.ui;
+import android.content.ComponentName;
+import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.navigation.NavOptions;
import androidx.navigation.fragment.NavHostFragment;
+import androidx.preference.Preference;
+import androidx.preference.SwitchPreferenceCompat;
+
+import com.google.android.gms.cast.media.CastMediaRouteProviderService;
import com.mgoogle.android.gms.R;
@@ -18,6 +24,7 @@ public class SettingsFragment extends ResourceSettingsFragment {
public static final String PREF_ABOUT = "pref_about";
public static final String PREF_GCM = "pref_gcm";
public static final String PREF_CHECKIN = "pref_checkin";
+ public static final String PREF_CAST_DOUBLE_FIX_ENABLED = "pref_cast_double_fix_enabled";
public SettingsFragment() {
preferencesResource = R.xml.preferences_start;
@@ -41,6 +48,14 @@ public class SettingsFragment extends ResourceSettingsFragment {
UtilsKt.navigate(NavHostFragment.findNavController(SettingsFragment.this), getContext(), R.id.openAbout, null);
return true;
});
+ findPreference(PREF_CAST_DOUBLE_FIX_ENABLED).setOnPreferenceChangeListener((preference, newValue) -> {
+ boolean isEnabled = (boolean) newValue;
+ getContext().getPackageManager().setComponentEnabledSetting(
+ new ComponentName(getContext().getApplicationContext(), CastMediaRouteProviderService.class),
+ isEnabled ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED : PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+ PackageManager.DONT_KILL_APP);
+ return true;
+ });
if (GcmPrefs.get(getContext()).isEnabled()) {
GcmDatabase database = new GcmDatabase(getContext());
int regCount = database.getRegistrationList().size();
diff --git a/play-services-core/src/main/res/drawable/ic_cast_black.xml b/play-services-core/src/main/res/drawable/ic_cast_black.xml
new file mode 100644
index 00000000..95b6bf72
--- /dev/null
+++ b/play-services-core/src/main/res/drawable/ic_cast_black.xml
@@ -0,0 +1,10 @@
+
+
+
\ No newline at end of file
diff --git a/play-services-core/src/main/res/values-it/strings.xml b/play-services-core/src/main/res/values-it/strings.xml
index e6acb930..4cede008 100755
--- a/play-services-core/src/main/res/values-it/strings.xml
+++ b/play-services-core/src/main/res/values-it/strings.xml
@@ -107,6 +107,8 @@ Questa operazione può richiedere alcuni minuti."
Chiedi conferma all\'utente prima di registrare una nuova applicazione per le notifiche push.
A proposito di microG
+ Correzione Cast duplicato
+ Attiva questa opzione in caso di voci duplicate nel menù di cast
Automatico
Manuale
diff --git a/play-services-core/src/main/res/values/strings.xml b/play-services-core/src/main/res/values/strings.xml
index 9c99e8a2..912dcc53 100755
--- a/play-services-core/src/main/res/values/strings.xml
+++ b/play-services-core/src/main/res/values/strings.xml
@@ -102,6 +102,7 @@ This can take a couple of minutes."
Ask before registering a new app to receive push notifications
About Vanced microG
+ Cast duplication fix
Register device
Registers your device to Google services and creates a unique device identifier. Vanced microG strips identifying bits other than your Google account name from registration data.
@@ -132,5 +133,5 @@ This can take a couple of minutes."
Registered apps
Unregistered apps
Networks to use for push notifications
-
+ Enable this if you see duplicates in your casting menu
diff --git a/play-services-core/src/main/res/xml/preferences_start.xml b/play-services-core/src/main/res/xml/preferences_start.xml
index 9501282c..ee780e76 100755
--- a/play-services-core/src/main/res/xml/preferences_start.xml
+++ b/play-services-core/src/main/res/xml/preferences_start.xml
@@ -42,6 +42,12 @@
android:targetClass="org.microg.gms.ui.GoogleMoreFragment$AsActivity"
android:targetPackage="com.mgoogle.android.gms" />
+