mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-11-19 02:29:25 +01:00
Update upstream
This commit is contained in:
parent
07ac289d5c
commit
0846c9c29a
@ -237,7 +237,7 @@
|
||||
android:name="org.microg.gms.auth.login.LoginActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:exported="true"
|
||||
android:theme="@style/LoginBlueTheme">
|
||||
android:theme="@style/Theme.LoginBlue">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.gms.auth.login.LOGIN" />
|
||||
|
||||
|
@ -5,6 +5,7 @@ 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;
|
||||
@ -22,8 +23,6 @@ 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_SNET = "pref_snet";
|
||||
public static final String PREF_UNIFIEDNLP = "pref_unifiednlp";
|
||||
public static final String PREF_CHECKIN = "pref_checkin";
|
||||
public static final String PREF_CAST_DOUBLE_FIX_ENABLED = "pref_cast_double_fix_enabled";
|
||||
|
||||
@ -50,7 +49,7 @@ public class SettingsFragment extends ResourceSettingsFragment
|
||||
{
|
||||
findPreference(PREF_ABOUT).setSummary(getString(R.string.about_version_str, AboutFragment.getSelfVersion(getContext())));
|
||||
findPreference(PREF_ABOUT).setOnPreferenceClickListener(preference -> {
|
||||
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openAbout);
|
||||
UtilsKt.navigate(NavHostFragment.findNavController(SettingsFragment.this), getContext(), R.id.openAbout, null);
|
||||
return true;
|
||||
});
|
||||
findPreference(PREF_CAST_DOUBLE_FIX_ENABLED).setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
@ -72,14 +71,14 @@ public class SettingsFragment extends ResourceSettingsFragment
|
||||
findPreference(PREF_GCM).setSummary(R.string.service_status_disabled_short);
|
||||
}
|
||||
findPreference(PREF_GCM).setOnPreferenceClickListener(preference -> {
|
||||
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openGcmSettings);
|
||||
UtilsKt.navigate(NavHostFragment.findNavController(SettingsFragment.this), getContext(), R.id.openGcmSettings, null);
|
||||
return true;
|
||||
});
|
||||
|
||||
boolean checkinEnabled = CheckinPrefs.get(getContext()).isEnabled();
|
||||
findPreference(PREF_CHECKIN).setSummary(checkinEnabled ? R.string.service_status_enabled_short : R.string.service_status_disabled_short);
|
||||
findPreference(PREF_CHECKIN).setOnPreferenceClickListener(preference -> {
|
||||
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openCheckinSettings);
|
||||
UtilsKt.navigate(NavHostFragment.findNavController(SettingsFragment.this), getContext(), R.id.openCheckinSettings, null);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class PushNotificationAllAppsFragment : PreferenceFragmentCompat() {
|
||||
pref.icon = applicationInfo?.loadIcon(context.packageManager)
|
||||
?: AppCompatResources.getDrawable(context, android.R.mipmap.sym_def_app_icon)
|
||||
pref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
findNavController().navigate(R.id.openGcmAppDetailsFromAll, bundleOf(
|
||||
findNavController().navigate(requireContext(), R.id.openGcmAppDetailsFromAll, bundleOf(
|
||||
"package" to app.packageName
|
||||
))
|
||||
true
|
||||
|
@ -49,7 +49,7 @@ class PushNotificationFragment : Fragment(R.layout.push_notification_fragment) {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
MENU_ADVANCED -> {
|
||||
findNavController().navigate(R.id.openGcmAdvancedSettings)
|
||||
findNavController().navigate(requireContext(), R.id.openGcmAdvancedSettings)
|
||||
true
|
||||
}
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
|
@ -47,7 +47,7 @@ class PushNotificationPreferencesFragment : PreferenceFragmentCompat() {
|
||||
pushAppsAll = preferenceScreen.findPreference("pref_push_apps_all") ?: pushAppsAll
|
||||
pushAppsNone = preferenceScreen.findPreference("pref_push_apps_none") ?: pushAppsNone
|
||||
pushAppsAll.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
findNavController().navigate(R.id.openAllGcmApps)
|
||||
findNavController().navigate(requireContext(), R.id.openAllGcmApps)
|
||||
true
|
||||
}
|
||||
}
|
||||
@ -89,7 +89,7 @@ class PushNotificationPreferencesFragment : PreferenceFragmentCompat() {
|
||||
pref.title = applicationInfo.loadLabel(context.packageManager)
|
||||
pref.icon = applicationInfo.loadIcon(context.packageManager)
|
||||
pref.onPreferenceClickListener = Preference.OnPreferenceClickListener {
|
||||
findNavController().navigate(R.id.openGcmAppDetails, bundleOf(
|
||||
findNavController().navigate(requireContext(), R.id.openGcmAppDetails, bundleOf(
|
||||
"package" to app.packageName
|
||||
))
|
||||
true
|
||||
|
@ -5,15 +5,48 @@
|
||||
|
||||
package org.microg.gms.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.navOptions
|
||||
import androidx.navigation.ui.R
|
||||
|
||||
fun PackageManager.getApplicationInfoIfExists(packageName: String?, flags: Int = 0): ApplicationInfo? = packageName?.let {
|
||||
try {
|
||||
getApplicationInfo(it, flags)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Package does not exist", e)
|
||||
Log.w(TAG, "Package $packageName not installed.")
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun NavController.navigate(context: Context, @IdRes resId: Int, args: Bundle? = null) {
|
||||
navigate(resId, args, if (context.systemAnimationsEnabled) navOptions {
|
||||
anim {
|
||||
enter = R.anim.nav_default_enter_anim
|
||||
exit = R.anim.nav_default_exit_anim
|
||||
popEnter = R.anim.nav_default_pop_enter_anim
|
||||
popExit = R.anim.nav_default_pop_exit_anim
|
||||
}
|
||||
} else null)
|
||||
}
|
||||
|
||||
val Context.systemAnimationsEnabled: Boolean
|
||||
get() {
|
||||
val duration: Float
|
||||
val transition: Float
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
duration = Settings.Global.getFloat(contentResolver, Settings.Global.ANIMATOR_DURATION_SCALE, 1f)
|
||||
transition = Settings.Global.getFloat(contentResolver, Settings.Global.TRANSITION_ANIMATION_SCALE, 1f)
|
||||
} else {
|
||||
duration = Settings.System.getFloat(contentResolver, Settings.System.ANIMATOR_DURATION_SCALE, 1f)
|
||||
transition = Settings.System.getFloat(contentResolver, Settings.System.TRANSITION_ANIMATION_SCALE, 1f)
|
||||
}
|
||||
return duration != 0f && transition != 0f
|
||||
}
|
@ -9,27 +9,9 @@
|
||||
android:id="@+id/settingsFragment"
|
||||
android:name="org.microg.gms.ui.SettingsFragment"
|
||||
android:label="@string/gms_settings_name">
|
||||
<action
|
||||
android:id="@+id/openCheckinSettings"
|
||||
app:destination="@id/checkinFragment"
|
||||
app:enterAnim="@anim/fragment_open_enter"
|
||||
app:exitAnim="@anim/fragment_open_exit"
|
||||
app:popEnterAnim="@anim/fragment_close_enter"
|
||||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
<action
|
||||
android:id="@+id/openGcmSettings"
|
||||
app:destination="@id/gcmFragment"
|
||||
app:enterAnim="@anim/fragment_open_enter"
|
||||
app:exitAnim="@anim/fragment_open_exit"
|
||||
app:popEnterAnim="@anim/fragment_close_enter"
|
||||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
<action
|
||||
android:id="@+id/openAbout"
|
||||
app:destination="@id/aboutFragment"
|
||||
app:enterAnim="@anim/fragment_open_enter"
|
||||
app:exitAnim="@anim/fragment_open_exit"
|
||||
app:popEnterAnim="@anim/fragment_close_enter"
|
||||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
<action android:id="@+id/openCheckinSettings" app:destination="@id/checkinFragment" />
|
||||
<action android:id="@+id/openGcmSettings" app:destination="@id/gcmFragment" />
|
||||
<action android:id="@+id/openAbout" app:destination="@id/aboutFragment" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
@ -44,25 +26,13 @@
|
||||
tools:layout="@layout/push_notification_fragment">
|
||||
<action
|
||||
android:id="@+id/openGcmAppDetails"
|
||||
app:destination="@id/gcmAppFragment"
|
||||
app:enterAnim="@anim/fragment_open_enter"
|
||||
app:exitAnim="@anim/fragment_open_exit"
|
||||
app:popEnterAnim="@anim/fragment_close_enter"
|
||||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
app:destination="@id/gcmAppFragment" />
|
||||
<action
|
||||
android:id="@+id/openAllGcmApps"
|
||||
app:destination="@id/gcmAllAppsFragment"
|
||||
app:enterAnim="@anim/fragment_open_enter"
|
||||
app:exitAnim="@anim/fragment_open_exit"
|
||||
app:popEnterAnim="@anim/fragment_close_enter"
|
||||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
app:destination="@id/gcmAllAppsFragment" />
|
||||
<action
|
||||
android:id="@+id/openGcmAdvancedSettings"
|
||||
app:destination="@id/gcmAdvancedFragment"
|
||||
app:enterAnim="@anim/fragment_open_enter"
|
||||
app:exitAnim="@anim/fragment_open_exit"
|
||||
app:popEnterAnim="@anim/fragment_close_enter"
|
||||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
app:destination="@id/gcmAdvancedFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/gcmAllAppsFragment"
|
||||
@ -70,11 +40,7 @@
|
||||
android:label="Apps using push notifications">
|
||||
<action
|
||||
android:id="@+id/openGcmAppDetailsFromAll"
|
||||
app:destination="@id/gcmAppFragment"
|
||||
app:enterAnim="@anim/fragment_open_enter"
|
||||
app:exitAnim="@anim/fragment_open_exit"
|
||||
app:popEnterAnim="@anim/fragment_close_enter"
|
||||
app:popExitAnim="@anim/fragment_close_exit" />
|
||||
app:destination="@id/gcmAppFragment" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/gcmAppFragment"
|
||||
|
@ -99,6 +99,8 @@ Questa operazione può richiedere alcuni minuti."</string>
|
||||
<string name="pref_gcm_confirm_new_apps_summary">Chiedi conferma all\'utente prima di registrare una nuova applicazione per le notifiche push.</string>
|
||||
|
||||
<string name="pref_about_title">A proposito di microG</string>
|
||||
<string name="pref_cast_double_fix">Correzione Cast duplicato</string>
|
||||
<string name="pref_cast_double_fix_summary">Attiva questa opzione in caso di voci duplicate nel menù di cast</string>
|
||||
|
||||
<string name="gcm_unregister_app">Annulla la registrazione</string>
|
||||
<string name="gcm_not_registered">Non registrata</string>
|
||||
|
@ -16,9 +16,9 @@
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="LoginBlueTheme" parent="LoginBlueTheme.Base" />
|
||||
<style name="Theme.LoginBlue" parent="Theme.LoginBlue.Base" />
|
||||
|
||||
<style name="LoginBlueTheme.Base" parent="Theme.AppCompat.Light">
|
||||
<style name="Theme.LoginBlue.Base" parent="Theme.AppCompat.Light">
|
||||
<item name="colorPrimary">@color/login_blue_theme_primary</item>
|
||||
<item name="colorPrimaryDark">@color/login_blue_theme_primary_dark</item>
|
||||
<item name="colorAccent">@color/login_blue_theme_accent</item>
|
||||
|
Loading…
Reference in New Issue
Block a user