diff --git a/play-services-base/core/src/main/kotlin/org/microg/gms/ui/SwitchBarPreference.kt b/play-services-base/core/src/main/kotlin/org/microg/gms/ui/SwitchBarPreference.kt new file mode 100644 index 00000000..446be354 --- /dev/null +++ b/play-services-base/core/src/main/kotlin/org/microg/gms/ui/SwitchBarPreference.kt @@ -0,0 +1,62 @@ +/* + * SPDX-FileCopyrightText: 2023 microG Project Team + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.microg.gms.ui + +import android.content.Context +import android.graphics.drawable.Drawable +import android.util.AttributeSet +import androidx.appcompat.widget.SwitchCompat +import androidx.core.content.res.TypedArrayUtils +import androidx.preference.PreferenceViewHolder +import androidx.preference.TwoStatePreference +import org.microg.gms.base.core.R + +// TODO +class SwitchBarPreference : TwoStatePreference { + private val frameId: Int + private val backgroundOn: Drawable? + private val backgroundOff: Drawable? + private val backgroundDisabled: Drawable? + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) { + val a = context.obtainStyledAttributes(attrs, R.styleable.SwitchBarPreference, defStyleAttr, defStyleRes) + frameId = a.getResourceId(R.styleable.SwitchBarPreference_switchBarFrameId, 0) + backgroundOn = a.getDrawable(R.styleable.SwitchBarPreference_switchBarFrameBackgroundOn) + backgroundOff = a.getDrawable(R.styleable.SwitchBarPreference_switchBarFrameBackgroundOff) + backgroundDisabled = a.getDrawable(R.styleable.SwitchBarPreference_switchBarFrameBackgroundDisabled) + } + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : this(context, attrs, defStyleAttr, R.style.Preference_SwitchBar) + constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, R.attr.switchBarPreferenceStyle) + constructor(context: Context) : this(context, null) + + override fun onBindViewHolder(holder: PreferenceViewHolder) { + super.onBindViewHolder(holder) + holder.isDividerAllowedBelow = false + holder.isDividerAllowedAbove = false + val switch = holder.findViewById(R.id.switch_widget) as SwitchCompat + switch.setOnCheckedChangeListener(null) + switch.isChecked = isChecked + switch.setOnCheckedChangeListener { view, isChecked -> + if (!callChangeListener(isChecked)) { + view.isChecked = !isChecked + return@setOnCheckedChangeListener + } + this.isChecked = isChecked + } + val frame = if (frameId == 0) null else holder.findViewById(frameId) + val backgroundView = frame ?: holder.itemView + val (backgroundDrawable, backgroundColorAttribute) = when { + !isEnabled -> Pair(backgroundDisabled, androidx.appcompat.R.attr.colorControlHighlight) + isChecked -> Pair(backgroundOn, androidx.appcompat.R.attr.colorControlActivated) + else -> Pair(backgroundOff, androidx.appcompat.R.attr.colorButtonNormal) + } + if (backgroundDrawable != null) { + backgroundView.setBackgroundDrawable(backgroundDrawable) + } else { + backgroundView.setBackgroundColorAttribute(backgroundColorAttribute) + } + } +} \ No newline at end of file diff --git a/play-services-base/core/src/main/res/layout/preference_app_heading.xml b/play-services-base/core/src/main/res/layout/preference_app_heading.xml new file mode 100644 index 00000000..1a229987 --- /dev/null +++ b/play-services-base/core/src/main/res/layout/preference_app_heading.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/play-services-base/core/src/main/res/values/themes.xml b/play-services-base/core/src/main/res/values/themes.xml new file mode 100644 index 00000000..be7e8ff4 --- /dev/null +++ b/play-services-base/core/src/main/res/values/themes.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/play-services-core/src/main/java/org/microg/gms/ui/SettingsActivity.java b/play-services-core/src/main/java/org/microg/gms/ui/SettingsActivity.java index 32230055..3f129006 100755 --- a/play-services-core/src/main/java/org/microg/gms/ui/SettingsActivity.java +++ b/play-services-core/src/main/java/org/microg/gms/ui/SettingsActivity.java @@ -10,8 +10,14 @@ import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.ui.AppBarConfiguration; import androidx.navigation.ui.NavigationUI; +<<<<<<< HEAD:play-services-core/src/main/java/org/microg/gms/ui/SettingsActivity.java import com.google.android.material.color.DynamicColors; import com.mgoogle.android.gms.R; +======= +import com.google.android.gms.R; +import com.google.android.material.appbar.CollapsingToolbarLayout; +import org.microg.gms.ui.settings.SettingsProvider; +>>>>>>> 566215bd (UI: Port more to Material 3):play-services-core/src/main/java/org/microg/gms/ui/MainSettingsActivity.java import java.util.Objects; @@ -26,11 +32,21 @@ public class SettingsActivity extends AppCompatActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings_root_activity); +<<<<<<< HEAD:play-services-core/src/main/java/org/microg/gms/ui/SettingsActivity.java if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { DynamicColors.applyToActivityIfAvailable(this); +======= + + Toolbar toolbar = findViewById(R.id.toolbar); + CollapsingToolbarLayout toolbarLayout = findViewById(R.id.collapsing_toolbar); + setSupportActionBar(toolbar); + + for (SettingsProvider settingsProvider : getAllSettingsProviders(this)) { + settingsProvider.extendNavigation(getNavController()); +>>>>>>> 566215bd (UI: Port more to Material 3):play-services-core/src/main/java/org/microg/gms/ui/MainSettingsActivity.java } appBarConfiguration = new AppBarConfiguration.Builder(getNavController().getGraph()).build(); - NavigationUI.setupActionBarWithNavController(this, getNavController(), appBarConfiguration); + NavigationUI.setupWithNavController(toolbarLayout, toolbar, getNavController(), appBarConfiguration); } @Override diff --git a/play-services-core/src/main/kotlin/org/microg/gms/ui/SafetyNetFragment.kt b/play-services-core/src/main/kotlin/org/microg/gms/ui/SafetyNetFragment.kt index d9339a55..e2a0090d 100644 --- a/play-services-core/src/main/kotlin/org/microg/gms/ui/SafetyNetFragment.kt +++ b/play-services-core/src/main/kotlin/org/microg/gms/ui/SafetyNetFragment.kt @@ -78,7 +78,7 @@ class SafetyNetFragment : PreferenceFragmentCompat() { val newStatus = newValue as Boolean SafetyNetPreferences.setEnabled(requireContext(), newStatus) DroidGuardPreferences.setEnabled(requireContext(), newStatus) - droidguardUnsupported.isVisible = switchBarPreference.isChecked && !DroidGuardPreferences.isAvailable(requireContext()) + droidguardUnsupported.isVisible = newStatus && !DroidGuardPreferences.isAvailable(requireContext()) true } } diff --git a/play-services-core/src/main/res/color/material_switch_bar_text_color.xml b/play-services-core/src/main/res/color/material_switch_bar_text_color.xml new file mode 100644 index 00000000..9f2dc812 --- /dev/null +++ b/play-services-core/src/main/res/color/material_switch_bar_text_color.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/drawable-v21/material_switch_bar_background.xml b/play-services-core/src/main/res/drawable-v21/material_switch_bar_background.xml new file mode 100644 index 00000000..6c98b244 --- /dev/null +++ b/play-services-core/src/main/res/drawable-v21/material_switch_bar_background.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/drawable-v21/material_switch_bar_background_disabled.xml b/play-services-core/src/main/res/drawable-v21/material_switch_bar_background_disabled.xml new file mode 100644 index 00000000..15613e79 --- /dev/null +++ b/play-services-core/src/main/res/drawable-v21/material_switch_bar_background_disabled.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/drawable/material_switch_bar_background.xml b/play-services-core/src/main/res/drawable/material_switch_bar_background.xml new file mode 100644 index 00000000..f86ccede --- /dev/null +++ b/play-services-core/src/main/res/drawable/material_switch_bar_background.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/drawable/material_switch_bar_background_disabled.xml b/play-services-core/src/main/res/drawable/material_switch_bar_background_disabled.xml new file mode 100644 index 00000000..3704056d --- /dev/null +++ b/play-services-core/src/main/res/drawable/material_switch_bar_background_disabled.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/layout/preference_material_switch.xml b/play-services-core/src/main/res/layout/preference_material_switch.xml new file mode 100644 index 00000000..1c731b85 --- /dev/null +++ b/play-services-core/src/main/res/layout/preference_material_switch.xml @@ -0,0 +1,10 @@ + + + diff --git a/play-services-core/src/main/res/layout/preference_material_switch_bar.xml b/play-services-core/src/main/res/layout/preference_material_switch_bar.xml new file mode 100644 index 00000000..fc5ee795 --- /dev/null +++ b/play-services-core/src/main/res/layout/preference_material_switch_bar.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + diff --git a/play-services-core/src/main/res/layout/settings_root_activity.xml b/play-services-core/src/main/res/layout/settings_root_activity.xml index d854b3a3..05da4223 100755 --- a/play-services-core/src/main/res/layout/settings_root_activity.xml +++ b/play-services-core/src/main/res/layout/settings_root_activity.xml @@ -1,19 +1,54 @@ - - - + android:orientation="vertical" + android:fitsSystemWindows="true"> +<<<<<<< HEAD + + + + + + + + + + >>>>>> 566215bd (UI: Port more to Material 3) android:layout_width="match_parent" android:layout_height="match_parent" - app:defaultNavHost="true" - app:navGraph="@navigation/nav_settings" /> - + android:fillViewport="true" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> + + + + diff --git a/play-services-core/src/main/res/values-night-v8/themes.xml b/play-services-core/src/main/res/values-night-v8/themes.xml new file mode 100644 index 00000000..3ed65363 --- /dev/null +++ b/play-services-core/src/main/res/values-night-v8/themes.xml @@ -0,0 +1,59 @@ + + + + + \ No newline at end of file diff --git a/play-services-core/src/main/res/values-v23/themes.xml b/play-services-core/src/main/res/values-v23/themes.xml new file mode 100644 index 00000000..236d4087 --- /dev/null +++ b/play-services-core/src/main/res/values-v23/themes.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/play-services-core/src/main/res/values-v27/themes.xml b/play-services-core/src/main/res/values-v27/themes.xml new file mode 100644 index 00000000..045e125f --- /dev/null +++ b/play-services-core/src/main/res/values-v27/themes.xml @@ -0,0 +1,3 @@ + + + diff --git a/play-services-core/src/main/res/values-v31/themes.xml b/play-services-core/src/main/res/values-v31/themes.xml index 1719a989..009a86db 100644 --- a/play-services-core/src/main/res/values-v31/themes.xml +++ b/play-services-core/src/main/res/values-v31/themes.xml @@ -1,4 +1,5 @@ +<<<<<<< HEAD diff --git a/play-services-core/src/main/res/values/colors.xml b/play-services-core/src/main/res/values/colors.xml index 12402999..79d019ed 100755 --- a/play-services-core/src/main/res/values/colors.xml +++ b/play-services-core/src/main/res/values/colors.xml @@ -16,9 +16,63 @@ +<<<<<<< HEAD #ff9a82db #ff9a82db #ff9a82db #ff9a82db +======= + #88CCCCCC + #fff44336 + + #ff410e0b + #ffffffff + #ff601410 + #ff8c1d18 + #ffb3261e + #ffe46962 + #fff2b8b5 + #fff9dedc + #ff474747 + #ff757575 + #ff1f1f1f + #ffffffff + #ff303030 + #ff131314 + #ffe3e3e3 + #fff2f2f2 + #ff2d312f + #ff444746 + #ff5c5f5e + #ff747775 + #ff8e918f + #ffa9acaa + #ffc4c7c5 + #ffe1e3e1 + #ff041e49 + #ffffffff + #ff062e6f + #ff0842a0 + #ff0b57d0 + #ff7cacf8 + #ffa8c7fa + #ffd3e3fd + #ff001d35 + #ffffffff + #ff003355 + #ff004a77 + #ff00639b + #ff5ab3f0 + #ff7fcfff + #ffc2e7ff + #ff072711 + #ffffffff + #ff0a3818 + #ff0f5223 + #ff146c2e + #ff6dd58c + #ffc4eed0 + #ffffffff +>>>>>>> 566215bd (UI: Port more to Material 3) diff --git a/play-services-core/src/main/res/values/themes.xml b/play-services-core/src/main/res/values/themes.xml index d5cb5705..c8ce1496 100755 --- a/play-services-core/src/main/res/values/themes.xml +++ b/play-services-core/src/main/res/values/themes.xml @@ -1,34 +1,122 @@ +<<<<<<< HEAD +======= + + + + + + + + + + + + + + + + + +>>>>>>> 566215bd (UI: Port more to Material 3) +<<<<<<< HEAD +======= +>>>>>>> 566215bd (UI: Port more to Material 3) diff --git a/play-services-core/src/main/res/xml/preferences_account.xml b/play-services-core/src/main/res/xml/preferences_account.xml index c952b6e0..4b564524 100755 --- a/play-services-core/src/main/res/xml/preferences_account.xml +++ b/play-services-core/src/main/res/xml/preferences_account.xml @@ -11,6 +11,7 @@ android:targetPackage="com.android.settings" /> +<<<<<<< HEAD +======= + + + + +>>>>>>> 566215bd (UI: Port more to Material 3) +<<<<<<< HEAD +======= + + +>>>>>>> 566215bd (UI: Port more to Material 3) diff --git a/play-services-core/src/main/res/xml/preferences_google_more.xml b/play-services-core/src/main/res/xml/preferences_google_more.xml index 879f0a18..ee6d2e74 100755 --- a/play-services-core/src/main/res/xml/preferences_google_more.xml +++ b/play-services-core/src/main/res/xml/preferences_google_more.xml @@ -16,6 +16,7 @@ --> +<<<<<<< HEAD +======= +>>>>>>> 566215bd (UI: Port more to Material 3) +======= + android:summary="If disabled, all connections to Google servers usually done by microG will be denied. This overrides service specific settings." + android:title="Allow connecting to Google servers"/> + + +>>>>>>> 566215bd (UI: Port more to Material 3) diff --git a/play-services-core/src/main/res/xml/preferences_push_notifications_app.xml b/play-services-core/src/main/res/xml/preferences_push_notifications_app.xml index 01d83e52..3ee717f7 100755 --- a/play-services-core/src/main/res/xml/preferences_push_notifications_app.xml +++ b/play-services-core/src/main/res/xml/preferences_push_notifications_app.xml @@ -4,8 +4,18 @@ ~ SPDX-License-Identifier: Apache-2.0 --> + xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto"> +<<<<<<< HEAD +======= + + +>>>>>>> 566215bd (UI: Port more to Material 3) diff --git a/play-services-core/src/main/res/xml/preferences_safetynet_app.xml b/play-services-core/src/main/res/xml/preferences_safetynet_app.xml new file mode 100644 index 00000000..7b3a6a9a --- /dev/null +++ b/play-services-core/src/main/res/xml/preferences_safetynet_app.xml @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/play-services-core/src/main/res/xml/preferences_vending.xml b/play-services-core/src/main/res/xml/preferences_vending.xml new file mode 100644 index 00000000..2d7d0f03 --- /dev/null +++ b/play-services-core/src/main/res/xml/preferences_vending.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + diff --git a/play-services-location/core/src/main/res/xml/preferences_location_app_details.xml b/play-services-location/core/src/main/res/xml/preferences_location_app_details.xml new file mode 100644 index 00000000..a6a52745 --- /dev/null +++ b/play-services-location/core/src/main/res/xml/preferences_location_app_details.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + \ No newline at end of file