mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-12-25 08:10:19 +02:00
Prepare settings for coloring depending of the visibility when composing
This commit is contained in:
parent
2228309212
commit
c1cd4ef120
5 changed files with 134 additions and 0 deletions
|
|
@ -18,9 +18,12 @@ import android.annotation.SuppressLint;
|
|||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.navigation.NavOptions;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.preference.EditTextPreference;
|
||||
import androidx.preference.ListPreference;
|
||||
import androidx.preference.MultiSelectListPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.preference.SwitchPreferenceCompat;
|
||||
|
|
@ -67,6 +70,17 @@ public class FragmentComposeSettings extends PreferenceFragmentCompat implements
|
|||
}
|
||||
|
||||
|
||||
Preference SET_CUSTOMIZE_COLORS_VISIBILITY = findPreference(getString(R.string.SET_CUSTOMIZE_COLORS_VISIBILITY));
|
||||
if (SET_CUSTOMIZE_COLORS_VISIBILITY != null) {
|
||||
SET_CUSTOMIZE_COLORS_VISIBILITY.setOnPreferenceClickListener(preference -> {
|
||||
NavOptions.Builder navBuilder = new NavOptions.Builder();
|
||||
navBuilder.setEnterAnim(R.anim.enter).setExitAnim(R.anim.exit).setPopEnterAnim(R.anim.pop_enter).setPopExitAnim(R.anim.pop_exit);
|
||||
|
||||
Navigation.findNavController(requireActivity(), R.id.fragment_container).navigate(R.id.FragmentCustomLightSettings, null, navBuilder.build());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
MultiSelectListPreference SET_SELECTED_LANGUAGE = findPreference(getString(R.string.SET_SELECTED_LANGUAGE));
|
||||
if (SET_SELECTED_LANGUAGE != null) {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package app.fedilab.android.mastodon.ui.fragment.settings;
|
||||
/* Copyright 2025 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.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
|
||||
import app.fedilab.android.R;
|
||||
|
||||
public class FragmentCustomVisibilityColorsSettings extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
addPreferencesFromResource(R.xml.pref_custom_visibility_colors);
|
||||
createPref();
|
||||
}
|
||||
|
||||
private void createPref() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
getPreferenceScreen().getSharedPreferences()
|
||||
.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
getPreferenceScreen().getSharedPreferences()
|
||||
.unregisterOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1194,6 +1194,7 @@
|
|||
<string name="SET_CUSTOMIZE_LIGHT_COLORS" translatable="false">SET_CUSTOMIZE_LIGHT_COLORS</string>
|
||||
<string name="SET_CHAT_FOR_CONVERSATION" translatable="false">SET_CHAT_FOR_CONVERSATION</string>
|
||||
|
||||
<string name="SET_CUSTOMIZE_COLORS_VISIBILITY" translatable="false">SET_CUSTOMIZE_COLORS_VISIBILITY</string>
|
||||
<string name="SET_CUSTOMIZE_LIGHT_COLORS_ACTION" translatable="false">SET_CUSTOMIZE_LIGHT_COLORS_ACTION</string>
|
||||
<string name="SET_CUSTOMIZE_DARK_COLORS" translatable="false">SET_CUSTOMIZE_DARK_COLORS</string>
|
||||
<string name="SET_CUSTOMIZE_DARK_COLORS_ACTION" translatable="false">SET_CUSTOMIZE_DARK_COLORS_ACTION</string>
|
||||
|
|
@ -1219,6 +1220,10 @@
|
|||
<string name="SET_LIGHT_LINK" translatable="false">SET_LIGHT_LINK</string>
|
||||
<string name="SET_LIGHT_ICON" translatable="false">SET_LIGHT_ICON</string>
|
||||
|
||||
<string name="SET_COLOR_VISIBILITY_PUBLIC">SET_COLOR_VISIBILITY_PUBLIC</string>
|
||||
<string name="SET_COLOR_VISIBILITY_UNLISTED">SET_COLOR_VISIBILITY_UNLISTED</string>
|
||||
<string name="SET_COLOR_VISIBILITY_PRIVATE">SET_COLOR_VISIBILITY_PRIVATE</string>
|
||||
<string name="SET_COLOR_VISIBILITY_DIRECT">SET_COLOR_VISIBILITY_DIRECT</string>
|
||||
|
||||
<string name="SET_DEFAULT_THEME" translatable="false">SYSTEM</string>
|
||||
<string name="SET_AUTO_PLAY_GIG_MEDIA" translatable="false">SET_AUTO_PLAY_GIG_MEDIA</string>
|
||||
|
|
@ -1312,6 +1317,7 @@
|
|||
<string name="SET_VIDEO_CACHE" translatable="false">SET_VIDEO_CACHE</string>
|
||||
<string name="SET_WATERMARK" translatable="false">SET_WATERMARK</string>
|
||||
<string name="SET_UNLISTED_REPLIES" translatable="false">SET_UNLISTED_REPLIES</string>
|
||||
<string name="SET_COLORIZE_FOR_VISIBILITY" translatable="false">SET_COLORIZE_FOR_VISIBILITY</string>
|
||||
<string name="SET_SELECTED_LANGUAGE" translatable="false">SET_SELECTED_LANGUAGE</string>
|
||||
<string name="SET_WATERMARK_TEXT" translatable="false">SET_WATERMARK_TEXT</string>
|
||||
<string name="SET_MATHS_COMPOSER" translatable="false">SET_MATHS_COMPOSER</string>
|
||||
|
|
@ -1351,6 +1357,12 @@
|
|||
<string name="notification_sounds">Notification sounds</string>
|
||||
<string name="disable_notifications">Disable notifications</string>
|
||||
<string name="notifications_are">During this time slot</string>
|
||||
|
||||
<string name="visibility_color_public">Color for the public visibility</string>
|
||||
<string name="visibility_color_unlisted">Color for the unlisted visibility</string>
|
||||
<string name="visibility_color_private">Color for the private visibility</string>
|
||||
<string name="visibility_color_direct">Color for the direct visibility</string>
|
||||
|
||||
<string name="pref_theme_base">Base of the theme</string>
|
||||
<string name="pref_theme_base_summary">Choose if the base of the theme should be dark or light</string>
|
||||
<string name="pref_custom_theme_new_summary">Allow to create your custom theme</string>
|
||||
|
|
@ -1889,6 +1901,8 @@
|
|||
<string name="edited_message_at">Edited at %1$s</string>
|
||||
<string name="created_message_at">Created at %1$s</string>
|
||||
<string name="max_indentation_thread">Max indentation in threads</string>
|
||||
<string name="set_colorize_visibility">Underline visibility</string>
|
||||
<string name="set_colorize_visibility_indication">The visibility button and the bottom of the compose area will have different colors depending of the visibility selected when composing.</string>
|
||||
<string name="set_unlisted_replies">Unlisted replies</string>
|
||||
<string name="set_unlisted_replies_indication">It only concerns \"public\" replies. When enabled, your replies will automatically have the visibility \"unlisted\" instead of \"public\"</string>
|
||||
<string name="notification_remove_from_cache">Notifications have been removed from cache.</string>
|
||||
|
|
@ -2019,6 +2033,8 @@
|
|||
<string name="set_customize_dark">Customize Dark Theme</string>
|
||||
<string name="set_customize_dark_indication">Allows to customize some elements in messages for the dark theme.</string>
|
||||
<string name="set_custom_colors">Set custom colors</string>
|
||||
<string name="set_custom_colors_visibility">Set custom colors for the visibility</string>
|
||||
|
||||
<string name="light_custom_colors">Light - Custom colors</string>
|
||||
<string name="cark_custom_colors">Dark - Custom colors</string>
|
||||
<string name="display_remote_conversation">Display remote conversation</string>
|
||||
|
|
|
|||
|
|
@ -66,6 +66,22 @@
|
|||
app:summary="@string/set_unlisted_replies_indication"
|
||||
app:title="@string/set_unlisted_replies" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="true"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/SET_COLORIZE_FOR_VISIBILITY"
|
||||
app:singleLineTitle="false"
|
||||
app:summary="@string/set_colorize_visibility_indication"
|
||||
app:title="@string/set_colorize_visibility" />
|
||||
|
||||
<Preference
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:title="@string/set_custom_colors_visibility"
|
||||
app:dependency="@string/SET_COLORIZE_FOR_VISIBILITY"
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/SET_CUSTOMIZE_COLORS_VISIBILITY" />
|
||||
|
||||
<MultiSelectListPreference
|
||||
app:iconSpaceReserved="false"
|
||||
app:key="@string/SET_SELECTED_LANGUAGE"
|
||||
|
|
|
|||
31
app/src/main/res/xml/pref_custom_visibility_colors.xml
Normal file
31
app/src/main/res/xml/pref_custom_visibility_colors.xml
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
|
||||
android:key="@string/SET_COLOR_VISIBILITY_PUBLIC"
|
||||
app:iconSpaceReserved="false"
|
||||
app:summary="@string/visibility_color_public"
|
||||
app:title="@string/v_public" />
|
||||
|
||||
<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
|
||||
android:key="@string/SET_COLOR_VISIBILITY_UNLISTED"
|
||||
app:iconSpaceReserved="false"
|
||||
app:summary="@string/visibility_color_unlisted"
|
||||
app:title="@string/v_unlisted" />
|
||||
|
||||
<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
|
||||
android:key="@string/SET_COLOR_VISIBILITY_PRIVATE"
|
||||
app:iconSpaceReserved="false"
|
||||
app:summary="@string/visibility_color_private"
|
||||
app:title="@string/v_private" />
|
||||
|
||||
<com.jaredrummler.android.colorpicker.ColorPreferenceCompat
|
||||
android:key="@string/SET_COLOR_VISIBILITY_DIRECT"
|
||||
app:iconSpaceReserved="false"
|
||||
app:summary="@string/visibility_color_direct"
|
||||
app:title="@string/v_direct" />
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
||||
Loading…
Reference in a new issue