diff options
author | 0xd9a <0xd9a@noreply.codeberg.org> | 2022-08-20 16:20:22 +0530 |
---|---|---|
committer | 0xd9a <0xd9a@noreply.codeberg.org> | 2022-08-20 16:20:22 +0530 |
commit | 9e71d9d3b0a57d7dd85d8e15e20ead90d4259b8d (patch) | |
tree | 57e19553f1432bbf31d351e720487540f71c95ee | |
parent | 5ed1fc7a02b969c03bb0c3c6a287242ee436d2fe (diff) |
Update settings page
22 files changed, 395 insertions, 392 deletions
diff --git a/app/build.gradle b/app/build.gradle index bbe373d1c..0db6e6c2f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,7 @@ plugins { id 'com.android.application' id 'kotlin-android' + id 'androidx.navigation.safeargs.kotlin' } def flavor android { @@ -122,8 +123,8 @@ dependencies { implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' implementation 'androidx.lifecycle:lifecycle-livedata:2.4.1' implementation 'androidx.lifecycle:lifecycle-viewmodel:2.4.1' - implementation 'androidx.navigation:navigation-fragment:2.4.2' - implementation 'androidx.navigation:navigation-ui:2.4.2' + implementation 'androidx.navigation:navigation-fragment:2.5.1' + implementation 'androidx.navigation:navigation-ui:2.5.1' testImplementation 'junit:junit:' androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' diff --git a/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java b/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java deleted file mode 100644 index 44f24efea..000000000 --- a/app/src/main/java/app/fedilab/android/activities/SettingsActivity.java +++ /dev/null @@ -1,208 +0,0 @@ -package app.fedilab.android.activities; -/* Copyright 2022 Thomas Schneider - * - * This file is a part of Fedilab - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. - * - * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - * Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Fedilab; if not, - * see <http://www.gnu.org/licenses>. */ - -import static app.fedilab.android.BaseMainActivity.currentAccount; - -import android.content.Intent; -import android.graphics.drawable.ColorDrawable; -import android.os.Bundle; -import android.view.MenuItem; -import android.view.View; - -import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; -import androidx.fragment.app.FragmentTransaction; - -import com.google.gson.annotations.SerializedName; - -import java.util.Locale; - -import app.fedilab.android.R; -import app.fedilab.android.databinding.ActivitySettingsBinding; -import app.fedilab.android.helper.ThemeHelper; -import app.fedilab.android.ui.fragment.settings.FragmentComposeSettings; -import app.fedilab.android.ui.fragment.settings.FragmentInterfaceSettings; -import app.fedilab.android.ui.fragment.settings.FragmentLanguageSettings; -import app.fedilab.android.ui.fragment.settings.FragmentNotificationsSettings; -import app.fedilab.android.ui.fragment.settings.FragmentPrivacySettings; -import app.fedilab.android.ui.fragment.settings.FragmentThemingSettings; -import app.fedilab.android.ui.fragment.settings.FragmentTimelinesSettings; - - -public class SettingsActivity extends BaseActivity { - - private ActivitySettingsBinding binding; - private boolean canGoBack; - private Fragment currentFragment; - - @Override - protected void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - ThemeHelper.applyThemeBar(this); - binding = ActivitySettingsBinding.inflate(getLayoutInflater()); - setContentView(binding.getRoot()); - - if (getSupportActionBar() != null) { - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.cyanea_primary))); - } - canGoBack = false; - - binding.setAccount.setOnClickListener(v -> displaySettings(SettingsEnum.ACCOUNT)); - binding.setTimelines.setOnClickListener(v -> displaySettings(SettingsEnum.TIMELINES)); - binding.setNotifications.setOnClickListener(v -> displaySettings(SettingsEnum.NOTIFICATIONS)); - binding.setInterface.setOnClickListener(v -> displaySettings(SettingsEnum.INTERFACE)); - binding.setCompose.setOnClickListener(v -> displaySettings(SettingsEnum.COMPOSE)); - binding.setPrivacy.setOnClickListener(v -> displaySettings(SettingsEnum.PRIVACY)); - binding.setTheming.setOnClickListener(v -> displaySettings(SettingsEnum.THEMING)); - binding.setAdministration.setOnClickListener(v -> displaySettings(SettingsEnum.ADMINISTRATION)); - binding.setLanguage.setOnClickListener(v -> displaySettings(SettingsEnum.LANGUAGE)); - if (currentAccount.admin) { - binding.setAdministration.setVisibility(View.VISIBLE); - } else { - binding.setAdministration.setVisibility(View.GONE); - } - } - - public void displaySettings(SettingsEnum settingsEnum) { - - if (settingsEnum == SettingsEnum.ACCOUNT) { - Intent intent = new Intent(SettingsActivity.this, EditProfileActivity.class); - startActivity(intent); - } else { - ThemeHelper.slideViewsToLeft(binding.buttonContainer, binding.fragmentContainer, () -> { - FragmentManager fragmentManager = getSupportFragmentManager(); - FragmentTransaction fragmentTransaction = - fragmentManager.beginTransaction(); - String category = ""; - switch (settingsEnum) { - case TIMELINES: - FragmentTimelinesSettings fragmentTimelinesSettings = new FragmentTimelinesSettings(); - fragmentTransaction.replace(R.id.fragment_container, fragmentTimelinesSettings); - currentFragment = fragmentTimelinesSettings; - category = getString(R.string.settings_category_label_timelines); - break; - case NOTIFICATIONS: - FragmentNotificationsSettings fragmentNotificationsSettings = new FragmentNotificationsSettings(); - fragmentTransaction.replace(R.id.fragment_container, fragmentNotificationsSettings); - currentFragment = fragmentNotificationsSettings; - category = getString(R.string.notifications); - break; - case INTERFACE: - FragmentInterfaceSettings fragmentInterfaceSettings = new FragmentInterfaceSettings(); - fragmentTransaction.replace(R.id.fragment_container, fragmentInterfaceSettings); - currentFragment = fragmentInterfaceSettings; - category = getString(R.string.settings_category_label_interface); - break; - case COMPOSE: - FragmentComposeSettings fragmentComposeSettings = new FragmentComposeSettings(); - fragmentTransaction.replace(R.id.fragment_container, fragmentComposeSettings); - currentFragment = fragmentComposeSettings; - category = getString(R.string.compose); - break; - case PRIVACY: - FragmentPrivacySettings fragmentPrivacySettings = new FragmentPrivacySettings(); - fragmentTransaction.replace(R.id.fragment_container, fragmentPrivacySettings); - currentFragment = fragmentPrivacySettings; - category = getString(R.string.action_privacy); - break; - case THEMING: - FragmentThemingSettings fragmentThemingSettings = new FragmentThemingSettings(); - fragmentTransaction.replace(R.id.fragment_container, fragmentThemingSettings); - currentFragment = fragmentThemingSettings; - category = getString(R.string.theming); - break; - case LANGUAGE: - FragmentLanguageSettings fragmentLanguageSettings = new FragmentLanguageSettings(); - fragmentTransaction.replace(R.id.fragment_container, fragmentLanguageSettings); - currentFragment = fragmentLanguageSettings; - category = getString(R.string.languages); - break; - - } - String title = String.format(Locale.getDefault(), "%s - %s", getString(R.string.settings), category); - setTitle(title); - canGoBack = true; - fragmentTransaction.commit(); - }); - } - } - - - @Override - public void onBackPressed() { - if (canGoBack) { - canGoBack = false; - ThemeHelper.slideViewsToRight(binding.fragmentContainer, binding.buttonContainer, () -> { - if (currentFragment != null) { - FragmentManager fragmentManager = getSupportFragmentManager(); - FragmentTransaction fragmentTransaction = - fragmentManager.beginTransaction(); - fragmentTransaction.remove(currentFragment).commit(); - } - }); - setTitle(R.string.settings); - } else { - super.onBackPressed(); - } - - } - - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - if (item.getItemId() == android.R.id.home) { - onBackPressed(); - return true; - } - return super.onOptionsItemSelected(item); - } - - - public enum SettingsEnum { - @SerializedName("ACCOUNT") - ACCOUNT("ACCOUNT"), - @SerializedName("TIMELINES") - TIMELINES("TIMELINES"), - @SerializedName("NOTIFICATIONS") - NOTIFICATIONS("NOTIFICATIONS"), - @SerializedName("INTERFACE") - INTERFACE("INTERFACE"), - @SerializedName("COMPOSE") - COMPOSE("COMPOSE"), - @SerializedName("PRIVACY") - PRIVACY("PRIVACY"), - @SerializedName("THEMING") - THEMING("THEMING"), - @SerializedName("ADMINISTRATION") - ADMINISTRATION("ADMINISTRATION"), - @SerializedName("LANGUAGE") - LANGUAGE("LANGUAGE"); - - private final String value; - - SettingsEnum(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - } - -} diff --git a/app/src/main/java/app/fedilab/android/activities/SettingsActivity.kt b/app/src/main/java/app/fedilab/android/activities/SettingsActivity.kt new file mode 100644 index 000000000..eb972cca7 --- /dev/null +++ b/app/src/main/java/app/fedilab/android/activities/SettingsActivity.kt @@ -0,0 +1,46 @@ +package app.fedilab.android.activities +/* Copyright 2022 Thomas Schneider + * + * This file is a part of Fedilab + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Fedilab; if not, + * see <http://www.gnu.org/licenses>. */ + +import android.os.Bundle +import androidx.navigation.findNavController +import androidx.navigation.ui.AppBarConfiguration +import androidx.navigation.ui.navigateUp +import androidx.navigation.ui.setupActionBarWithNavController +import app.fedilab.android.R +import app.fedilab.android.databinding.ActivitySettingsBinding +import app.fedilab.android.helper.ThemeHelper + +class SettingsActivity : BaseActivity() { + private lateinit var binding: ActivitySettingsBinding + private lateinit var appBarConfiguration: AppBarConfiguration + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + ThemeHelper.applyThemeBar(this) + + binding = ActivitySettingsBinding.inflate(layoutInflater) + setContentView(binding.root) + + val navController = findNavController(R.id.fragment_container) + appBarConfiguration = AppBarConfiguration(navController.graph) + setupActionBarWithNavController(navController, appBarConfiguration) + } + + override fun onSupportNavigateUp(): Boolean { + val navController = findNavController(R.id.fragment_container) + return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() + } +} diff --git a/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentSettingsCategories.kt b/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentSettingsCategories.kt new file mode 100644 index 000000000..4205449a0 --- /dev/null +++ b/app/src/main/java/app/fedilab/android/ui/fragment/settings/FragmentSettingsCategories.kt @@ -0,0 +1,73 @@ +package app.fedilab.android.ui.fragment.settings +/* Copyright 2022 Thomas Schneider + * + * This file is a part of Fedilab + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even + * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Fedilab; if not, + * see <http://www.gnu.org/licenses>. */ + +import android.os.Bundle +import androidx.navigation.fragment.findNavController +import androidx.preference.Preference +import androidx.preference.PreferenceFragmentCompat +import app.fedilab.android.BaseMainActivity.currentAccount +import app.fedilab.android.R + +class FragmentSettingsCategories : PreferenceFragmentCompat() { + + override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { + setPreferencesFromResource(R.xml.pref_categories, rootKey) + + findPreference<Preference>(getString(R.string.pref_category_key_account))?.setOnPreferenceClickListener { + findNavController().navigate(FragmentSettingsCategoriesDirections.categoriesToAccount()) + false + } + + findPreference<Preference>(getString(R.string.pref_category_key_timeline))?.setOnPreferenceClickListener { + findNavController().navigate(FragmentSettingsCategoriesDirections.categoriesToTimelines()) + false + } + + findPreference<Preference>(getString(R.string.pref_category_key_notifications))?.setOnPreferenceClickListener { + findNavController().navigate(FragmentSettingsCategoriesDirections.categoriesToNotifications()) + false + } + + findPreference<Preference>(getString(R.string.pref_category_key_interface))?.setOnPreferenceClickListener { + findNavController().navigate(FragmentSettingsCategoriesDirections.categoriesToInterface()) + false + } + + findPreference<Preference>(getString(R.string.pref_category_key_compose))?.setOnPreferenceClickListener { + findNavController().navigate(FragmentSettingsCategoriesDirections.categoriesToCompose()) + false + } + + findPreference<Preference>(getString(R.string.pref_category_key_privacy))?.setOnPreferenceClickListener { + findNavController().navigate(FragmentSettingsCategoriesDirections.categoriesToPrivacy()) + false + } + + findPreference<Preference>(getString(R.string.pref_category_key_theming))?.setOnPreferenceClickListener { + findNavController().navigate(FragmentSettingsCategoriesDirections.categoriesToTheming()) + false + } + + val adminPreference = findPreference<Preference>(getString(R.string.pref_category_key_administration)) + adminPreference?.isVisible = currentAccount.admin + adminPreference?.setOnPreferenceClickListener { false } + + findPreference<Preference>(getString(R.string.pref_category_key_languages))?.setOnPreferenceClickListener { + findNavController().navigate(FragmentSettingsCategoriesDirections.categoriesToLanguage()) + false + } + } +} diff --git a/app/src/main/res/anim/enter.xml b/app/src/main/res/anim/enter.xml index 76bfc44c3..504462f05 100644 --- a/app/src/main/res/anim/enter.xml +++ b/app/src/main/res/anim/enter.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="150" - android:interpolator="@android:anim/linear_interpolator"> + android:duration="?attr/motionDurationLong1"> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" /> <translate - android:fromXDelta="25%" + android:fromXDelta="50%" android:toXDelta="0" /> </set> diff --git a/app/src/main/res/anim/exit.xml b/app/src/main/res/anim/exit.xml index 94a8bc808..7733374b8 100644 --- a/app/src/main/res/anim/exit.xml +++ b/app/src/main/res/anim/exit.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="150" - android:interpolator="@android:anim/linear_interpolator"> + android:duration="?attr/motionDurationLong1"> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" /> <translate android:fromXDelta="0" - android:toXDelta="-25%" /> + android:toXDelta="-50%" /> </set> diff --git a/app/src/main/res/anim/pop_enter.xml b/app/src/main/res/anim/pop_enter.xml index 136c23d57..0d04e6879 100644 --- a/app/src/main/res/anim/pop_enter.xml +++ b/app/src/main/res/anim/pop_enter.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="150" - android:interpolator="@android:anim/linear_interpolator"> + android:duration="?attr/motionDurationLong1"> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" /> <translate - android:fromXDelta="-25%" + android:fromXDelta="-50%" android:toXDelta="0" /> </set> diff --git a/app/src/main/res/anim/pop_exit.xml b/app/src/main/res/anim/pop_exit.xml index 1154aa610..418a0ab70 100644 --- a/app/src/main/res/anim/pop_exit.xml +++ b/app/src/main/res/anim/pop_exit.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" - android:duration="150" - android:interpolator="@android:anim/linear_interpolator"> + android:duration="?attr/motionDurationLong1"> <alpha android:fromAlpha="1.0" android:toAlpha="0.0" /> <translate android:fromXDelta="0" - android:toXDelta="25%" /> + android:toXDelta="50%" /> </set> diff --git a/app/src/main/res/drawable/ic_baseline_admin_panel_settings_24.xml b/app/src/main/res/drawable/ic_admin.xml index 6542cf6b1..9ffcfc0c4 100644 --- a/app/src/main/res/drawable/ic_baseline_admin_panel_settings_24.xml +++ b/app/src/main/res/drawable/ic_admin.xml @@ -5,9 +5,9 @@ android:viewportWidth="24" android:viewportHeight="24"> <path - android:fillColor="@android:color/white" - android:pathData="M17,11c0.34,0 0.67,0.04 1,0.09V6.27L10.5,3L3,6.27v4.91c0,4.54 3.2,8.79 7.5,9.82c0.55,-0.13 1.08,-0.32 1.6,-0.55C11.41,19.47 11,18.28 11,17C11,13.69 13.69,11 17,11z" /> + android:fillColor="#000" + android:pathData="M17,11c0.34,0 0.67,0.04 1,0.09V7.58c0,-0.8 -0.47,-1.52 -1.2,-1.83l-5.5,-2.4c-0.51,-0.22 -1.09,-0.22 -1.6,0l-5.5,2.4C3.47,6.07 3,6.79 3,7.58v3.6c0,4.54 3.2,8.79 7.5,9.82c0.55,-0.13 1.08,-0.32 1.6,-0.55C11.41,19.47 11,18.28 11,17C11,13.69 13.69,11 17,11z" /> <path - android:fillColor="@android:color/white" + android:fillColor="#000" android:pathData="M17,13c-2.21,0 -4,1.79 -4,4c0,2.21 1.79,4 4,4s4,-1.79 4,-4C21,14.79 19.21,13 17,13zM17,14.38c0.62,0 1.12,0.51 1.12,1.12s-0.51,1.12 -1.12,1.12s-1.12,-0.51 -1.12,-1.12S16.38,14.38 17,14.38zM17,19.75c-0.93,0 -1.74,-0.46 -2.24,-1.17c0.05,-0.72 1.51,-1.08 2.24,-1.08s2.19,0.36 2.24,1.08C18.74,19.29 17.93,19.75 17,19.75z" /> </vector> diff --git a/app/src/main/res/drawable/ic_baseline_language_24.xml b/app/src/main/res/drawable/ic_baseline_language_24.xml deleted file mode 100644 index b0fd1af38..000000000 --- a/app/src/main/res/drawable/ic_baseline_language_24.xml +++ /dev/null @@ -1,10 +0,0 @@ -<vector xmlns:android="http://schemas.android.com/apk/res/android" - android:width="24dp" - android:height="24dp" - android:tint="#FFFFFF" - android:viewportWidth="24" - android:viewportHeight="24"> - <path - android:fillColor="@android:color/white" - android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.91 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2 0,0.68 0.06,1.34 0.14,2L4.26,14zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8L5.08,8c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14L9.66,14c-0.09,-0.66 -0.16,-1.32 -0.16,-2 0,-0.68 0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2 0,0.68 -0.07,1.34 -0.16,2zM14.59,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2 0,-0.68 -0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z" /> -</vector> diff --git a/app/src/main/res/drawable/ic_language.xml b/app/src/main/res/drawable/ic_language.xml new file mode 100644 index 000000000..87613d22d --- /dev/null +++ b/app/src/main/res/drawable/ic_language.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000" + android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56 1.84,0.63 3.37,1.91 4.33,3.56zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82c0.43,-1.43 1.08,-2.76 1.91,-3.96zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2s0.06,1.34 0.14,2L4.26,14zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56 -1.84,-0.63 -3.37,-1.9 -4.33,-3.56zM8.03,8L5.08,8c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8zM12,19.96c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96h3.82c-0.43,1.43 -1.08,2.76 -1.91,3.96zM14.34,14L9.66,14c-0.09,-0.66 -0.16,-1.32 -0.16,-2s0.07,-1.35 0.16,-2h4.68c0.09,0.65 0.16,1.32 0.16,2s-0.07,1.34 -0.16,2zM14.59,19.56c0.6,-1.11 1.06,-2.31 1.38,-3.56h2.95c-0.96,1.65 -2.49,2.93 -4.33,3.56zM16.36,14c0.08,-0.66 0.14,-1.32 0.14,-2s-0.06,-1.34 -0.14,-2h3.38c0.16,0.64 0.26,1.31 0.26,2s-0.1,1.36 -0.26,2h-3.38z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_shield.xml b/app/src/main/res/drawable/ic_shield.xml new file mode 100644 index 000000000..f877fd2a9 --- /dev/null +++ b/app/src/main/res/drawable/ic_shield.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000" + android:pathData="M11.3,2.26l-6,2.25C4.52,4.81 4,5.55 4,6.39v4.7c0,4.83 3.13,9.37 7.43,10.75c0.37,0.12 0.77,0.12 1.14,0c4.3,-1.38 7.43,-5.91 7.43,-10.75v-4.7c0,-0.83 -0.52,-1.58 -1.3,-1.87l-6,-2.25C12.25,2.09 11.75,2.09 11.3,2.26z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_style.xml b/app/src/main/res/drawable/ic_style.xml new file mode 100644 index 000000000..34e4e31e2 --- /dev/null +++ b/app/src/main/res/drawable/ic_style.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000" + android:pathData="M2.53,19.65l1.34,0.56v-9.03l-2.43,5.86c-0.41,1.02 0.08,2.19 1.09,2.61zM22.03,15.95L17.07,3.98c-0.31,-0.75 -1.04,-1.21 -1.81,-1.23 -0.26,0 -0.53,0.04 -0.79,0.15L7.1,5.95c-0.75,0.31 -1.21,1.03 -1.23,1.8 -0.01,0.27 0.04,0.54 0.15,0.8l4.96,11.97c0.31,0.76 1.05,1.22 1.83,1.23 0.26,0 0.52,-0.05 0.77,-0.15l7.36,-3.05c1.02,-0.42 1.51,-1.59 1.09,-2.6zM7.88,8.75c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM5.88,19.75c0,1.1 0.9,2 2,2h1.45l-3.45,-8.34v6.34z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_theming.xml b/app/src/main/res/drawable/ic_theming.xml new file mode 100644 index 000000000..0da021a27 --- /dev/null +++ b/app/src/main/res/drawable/ic_theming.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000" + android:pathData="M12,3c-4.97,0 -9,4.03 -9,9s4.03,9 9,9c0.83,0 1.5,-0.67 1.5,-1.5 0,-0.39 -0.15,-0.74 -0.39,-1.01 -0.23,-0.26 -0.38,-0.61 -0.38,-0.99 0,-0.83 0.67,-1.5 1.5,-1.5L16,16c2.76,0 5,-2.24 5,-5 0,-4.42 -4.03,-8 -9,-8zM6.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S5.67,9 6.5,9 8,9.67 8,10.5 7.33,12 6.5,12zM9.5,8C8.67,8 8,7.33 8,6.5S8.67,5 9.5,5s1.5,0.67 1.5,1.5S10.33,8 9.5,8zM14.5,8c-0.83,0 -1.5,-0.67 -1.5,-1.5S13.67,5 14.5,5s1.5,0.67 1.5,1.5S15.33,8 14.5,8zM17.5,12c-0.83,0 -1.5,-0.67 -1.5,-1.5S16.67,9 17.5,9s1.5,0.67 1.5,1.5 -0.67,1.5 -1.5,1.5z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_timeline.xml b/app/src/main/res/drawable/ic_timeline.xml new file mode 100644 index 000000000..83b793a51 --- /dev/null +++ b/app/src/main/res/drawable/ic_timeline.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:tint="?attr/colorControlNormal" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:fillColor="#000" + android:pathData="M23,8c0,1.1 -0.9,2 -2,2c-0.18,0 -0.35,-0.02 -0.51,-0.07l-3.56,3.55C16.98,13.64 17,13.82 17,14c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2c0,-0.18 0.02,-0.36 0.07,-0.52l-2.55,-2.55C10.36,10.98 10.18,11 10,11c-0.18,0 -0.36,-0.02 -0.52,-0.07l-4.55,4.56C4.98,15.65 5,15.82 5,16c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2s0.9,-2 2,-2c0.18,0 0.35,0.02 0.51,0.07l4.56,-4.55C8.02,9.36 8,9.18 8,9c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,0.18 -0.02,0.36 -0.07,0.52l2.55,2.55C14.64,12.02 14.82,12 15,12c0.18,0 0.36,0.02 0.52,0.07l3.55,-3.56C19.02,8.35 19,8.18 19,8c0,-1.1 0.9,-2 2,-2S23,6.9 23,8zM23,8c0,1.1 -0.9,2 -2,2c-0.18,0 -0.35,-0.02 -0.51,-0.07l-3.56,3.55C16.98,13.64 17,13.82 17,14c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2c0,-0.18 0.02,-0.36 0.07,-0.52l-2.55,-2.55C10.36,10.98 10.18,11 10,11c-0.18,0 -0.36,-0.02 -0.52,-0.07l-4.55,4.56C4.98,15.65 5,15.82 5,16c0,1.1 -0.9,2 -2,2s-2,-0.9 -2,-2s0.9,-2 2,-2c0.18,0 0.35,0.02 0.51,0.07l4.56,-4.55C8.02,9.36 8,9.18 8,9c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,0.18 -0.02,0.36 -0.07,0.52l2.55,2.55C14.64,12.02 14.82,12 15,12c0.18,0 0.36,0.02 0.52,0.07l3.55,-3.56C19.02,8.35 19,8.18 19,8c0,-1.1 0.9,-2 2,-2S23,6.9 23,8z" /> +</vector> diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 117b1cf75..a084f20bc 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -1,161 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical"> + tools:context=".activities.SettingsActivity" + tools:ignore="FragmentTagUsage"> - <ScrollView - android:id="@+id/button_container" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <androidx.appcompat.widget.LinearLayoutCompat - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - android:padding="24dp"> - - <com.google.android.material.button.MaterialButton - android:id="@+id/set_account" - style="@style/Widget.MaterialComponents.Button.OutlinedButton" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingVertical="12dp" - android:text="@string/account" - android:textAlignment="textStart" - android:textColor="@color/cyanea_accent_dark_reference" - app:icon="@drawable/ic_baseline_navigate_next_24" - app:iconGravity="end" - app:iconTint="@color/cyanea_accent_dark_reference" - app:strokeColor="@color/cyanea_accent_dark_reference" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/set_timelines" - style="@style/Widget.MaterialComponents.Button.OutlinedButton" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingVertical="12dp" - android:layout_marginTop="24dp" - android:text="@string/settings_category_label_timelines" - android:textAlignment="textStart" - android:textColor="@color/cyanea_accent_dark_reference" - app:iconTint="@color/cyanea_accent_dark_reference" - app:icon="@drawable/ic_baseline_navigate_next_24" - app:iconGravity="end" - app:strokeColor="@color/cyanea_accent_dark_reference" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/set_notifications" - style="@style/Widget.MaterialComponents.Button.OutlinedButton" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="24dp" - android:paddingVertical="12dp" - android:text="@string/notifications" - android:textAlignment="textStart" - android:textColor="@color/cyanea_accent_dark_reference" - app:iconTint="@color/cyanea_accent_dark_reference" - app:icon="@drawable/ic_baseline_navigate_next_24" - app:iconGravity="end" - app:strokeColor="@color/cyanea_accent_dark_reference" /> - - <com.google.android.material.button.MaterialButton - android:id="@+id/set_interface" - style="@style/Widget.MaterialComponents.Button.OutlinedButton" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="24dp" - android:paddingVertical="12dp" - android:text="@string/settings_category_label_interface" - android:textAlignment="textStart" - android:textColor="@color/cyanea_accent_dark_reference" - app:iconTint="@color/cyanea_accent_dark_reference" - |