mirror of
https://github.com/YTVanced/VancedMicroG
synced 2024-11-28 14:13:00 +00:00
Merge pull request #32 from YTVanced/revert-28-cast_fix
Revert "Fix device duplication in casting menu"
This commit is contained in:
commit
0e9f6f6951
4 changed files with 7 additions and 46 deletions
|
@ -1,16 +1,11 @@
|
|||
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;
|
||||
|
||||
import org.microg.gms.checkin.CheckinPrefs;
|
||||
|
@ -18,56 +13,40 @@ import org.microg.gms.gcm.GcmDatabase;
|
|||
import org.microg.gms.gcm.GcmPrefs;
|
||||
import org.microg.tools.ui.ResourceSettingsFragment;
|
||||
|
||||
public class SettingsFragment extends ResourceSettingsFragment
|
||||
{
|
||||
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()
|
||||
{
|
||||
public SettingsFragment() {
|
||||
preferencesResource = R.xml.preferences_start;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey)
|
||||
{
|
||||
public void onCreatePreferences(@Nullable Bundle savedInstanceState, String rootKey) {
|
||||
super.onCreatePreferences(savedInstanceState, rootKey);
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume()
|
||||
{
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
private void updateDetails()
|
||||
{
|
||||
private void updateDetails() {
|
||||
findPreference(PREF_ABOUT).setSummary(getString(R.string.about_version_str, AboutFragment.getSelfVersion(getContext())));
|
||||
findPreference(PREF_ABOUT).setOnPreferenceClickListener(preference -> {
|
||||
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())
|
||||
{
|
||||
if (GcmPrefs.get(getContext()).isEnabled()) {
|
||||
GcmDatabase database = new GcmDatabase(getContext());
|
||||
int regCount = database.getRegistrationList().size();
|
||||
database.close();
|
||||
findPreference(PREF_GCM).setSummary(getString(R.string.service_status_enabled_short) + " - " + getResources().getQuantityString(R.plurals.gcm_registered_apps_counter, regCount, regCount));
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
findPreference(PREF_GCM).setSummary(R.string.service_status_disabled_short);
|
||||
}
|
||||
findPreference(PREF_GCM).setOnPreferenceClickListener(preference -> {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorAccent"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M21,3L3,3c-1.1,0 -2,0.9 -2,2v3h2L3,5h18v14h-7v2h7c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM1,18v3h3c0,-1.66 -1.34,-3 -3,-3zM1,14v2c2.76,0 5,2.24 5,5h2c0,-3.87 -3.13,-7 -7,-7zM1,10v2c4.97,0 9,4.03 9,9h2c0,-6.08 -4.93,-11 -11,-11z"
|
||||
android:fillColor="#000000"/>
|
||||
</vector>
|
|
@ -106,7 +106,6 @@ This can take a couple of minutes."</string>
|
|||
<string name="pref_gcm_confirm_new_apps_summary">Ask before registering a new app to receive push notifications</string>
|
||||
|
||||
<string name="pref_about_title">About Vanced microG</string>
|
||||
<string name="pref_cast_double_fix">Cast duplication fix</string>
|
||||
|
||||
<string name="pref_checkin_enable_summary">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.</string>
|
||||
<string name="pref_info_status">Status</string>
|
||||
|
@ -136,6 +135,5 @@ This can take a couple of minutes."</string>
|
|||
<string name="pref_snet_status_official_info">official server</string>
|
||||
<string name="pref_snet_status_third_party_info">third-party server</string>
|
||||
<string name="pref_snet_status_self_signed_info">self-signed certificate</string>
|
||||
<string name="pref_cast_double_fix_summary">Enable this if you see duplicates in your casting menu</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -42,12 +42,6 @@
|
|||
android:targetClass="org.microg.gms.ui.GoogleMoreFragment$AsActivity"
|
||||
android:targetPackage="com.mgoogle.android.gms" />
|
||||
</Preference>
|
||||
<SwitchPreferenceCompat
|
||||
android:key="pref_cast_double_fix_enabled"
|
||||
android:title="@string/pref_cast_double_fix"
|
||||
android:icon="@drawable/ic_cast_black"
|
||||
android:summary="@string/pref_cast_double_fix_summary"
|
||||
android:defaultValue="false"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:layout="@layout/preference_category_no_label">
|
||||
<Preference
|
||||
|
|
Loading…
Reference in a new issue