Some changes

This commit is contained in:
tom79 2019-11-11 15:19:02 +01:00
parent e388c70ec8
commit cba292d3d3
6 changed files with 24 additions and 42 deletions

View File

@ -102,7 +102,10 @@ public class MainApplication extends MultiDexApplication {
Cyanea.getInstance().edit().accent(accent).apply(); Cyanea.getInstance().edit().accent(accent).apply();
} }
if( pref_color_background != -1){ if( pref_color_background != -1){
Cyanea.getInstance().edit().background(pref_color_background).apply(); Cyanea.getInstance().edit()
.background(pref_color_background)
.backgroundLight(pref_color_background)
.backgroundDark(pref_color_background).apply();
} }
Cyanea.getInstance().edit().shouldTintNavBar(pref_color_navigation_bar).apply(); Cyanea.getInstance().edit().shouldTintNavBar(pref_color_navigation_bar).apply();

View File

@ -340,13 +340,13 @@ public class PixelfedComposeActivity extends BaseActivity implements UploadStatu
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
int iconColor = prefs.getInt("theme_icons_color", -1); int iconColor = prefs.getInt("theme_icons_color", -1);
if( iconColor == -1){ if( iconColor != -1){
iconColor = ThemeHelper.getAttColor(getApplicationContext(), R.attr.iconColor); Helper.changeDrawableColor(getApplicationContext(), toot_visibility, iconColor);
Helper.changeDrawableColor(getApplicationContext(), toot_emoji, iconColor);
toot_sensitive.setButtonTintList(ColorStateList.valueOf(iconColor));
toot_sensitive.setTextColor(iconColor);
} }
Helper.changeDrawableColor(getApplicationContext(), toot_visibility, iconColor);
Helper.changeDrawableColor(getApplicationContext(), toot_emoji, iconColor);
toot_sensitive.setButtonTintList(ColorStateList.valueOf(iconColor));
toot_sensitive.setTextColor(iconColor);
} }
Bundle b = getIntent().getExtras(); Bundle b = getIntent().getExtras();
ArrayList<Uri> sharedUri = new ArrayList<>(); ArrayList<Uri> sharedUri = new ArrayList<>();

View File

@ -31,16 +31,13 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter; import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.preference.PreferenceManager;
import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
import com.jaredrummler.cyanea.Cyanea;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import app.fedilab.android.R; import app.fedilab.android.R;
@ -169,9 +166,6 @@ public class SettingsActivity extends BaseActivity {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
ContentSettingsFragment.type typeOfSettings; ContentSettingsFragment.type typeOfSettings;
switch (position) { switch (position) {
case 0:
typeOfSettings = ContentSettingsFragment.type.TIMELINES;
break;
case 1: case 1:
typeOfSettings = ContentSettingsFragment.type.NOTIFICATIONS; typeOfSettings = ContentSettingsFragment.type.NOTIFICATIONS;
break; break;
@ -211,17 +205,7 @@ public class SettingsActivity extends BaseActivity {
private void showDialog(){ private void showDialog(){
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(SettingsActivity.this); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK) {
style = R.style.DialogBlack;
} else {
style = R.style.Dialog;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, style);
dialogBuilder.setMessage(R.string.restart_message); dialogBuilder.setMessage(R.string.restart_message);
dialogBuilder.setTitle(R.string.apply_changes); dialogBuilder.setTitle(R.string.apply_changes);
dialogBuilder.setPositiveButton(R.string.restart, new DialogInterface.OnClickListener() { dialogBuilder.setPositiveButton(R.string.restart, new DialogInterface.OnClickListener() {

View File

@ -57,6 +57,7 @@ import android.text.Html;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.InputType; import android.text.InputType;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log;
import android.util.Patterns; import android.util.Patterns;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -405,13 +406,13 @@ public class TootActivity extends BaseActivity implements UploadStatusDelegate,
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
int iconColor = prefs.getInt("theme_icons_color", -1); int iconColor = prefs.getInt("theme_icons_color", -1);
if( iconColor == -1){ if( iconColor != -1){
iconColor = ThemeHelper.getAttColor(getApplicationContext(), R.attr.iconColor); Helper.changeDrawableColor(getApplicationContext(), toot_emoji, iconColor);
Helper.changeDrawableColor(getApplicationContext(), toot_visibility, iconColor);
Helper.changeDrawableColor(getApplicationContext(), poll_action, iconColor);
Helper.changeDrawableColor(getApplicationContext(), toot_picture, iconColor);
} }
Helper.changeDrawableColor(getApplicationContext(), toot_emoji, iconColor);
Helper.changeDrawableColor(getApplicationContext(), toot_visibility, iconColor);
Helper.changeDrawableColor(getApplicationContext(), poll_action, iconColor);
Helper.changeDrawableColor(getApplicationContext(), toot_picture, iconColor);
isScheduled = false; isScheduled = false;
if (sharedpreferences.getBoolean(Helper.SET_DISPLAY_EMOJI, true)) { if (sharedpreferences.getBoolean(Helper.SET_DISPLAY_EMOJI, true)) {
final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(drawer_layout).build(toot_content); final EmojiPopup emojiPopup = EmojiPopup.Builder.fromRootView(drawer_layout).build(toot_content);

View File

@ -20,7 +20,6 @@ import app.fedilab.android.helper.Helper;
public class ColorSettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { public class ColorSettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
private HashMap<String, Object> initialPref;
@Override @Override
public void onCreatePreferences(Bundle bundle, String s) { public void onCreatePreferences(Bundle bundle, String s) {
@ -28,23 +27,14 @@ public class ColorSettingsFragment extends PreferenceFragmentCompat implements
Preference button = findPreference("reset_pref"); Preference button = findPreference("reset_pref");
FragmentActivity context = getActivity(); FragmentActivity context = getActivity();
int style; assert context != null;
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK) {
style = R.style.DialogBlack;
} else {
style = R.style.Dialog;
}
initialPref = new HashMap<>();
PreferenceFragmentCompat preferenceFragmentCompat = this; PreferenceFragmentCompat preferenceFragmentCompat = this;
button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override @Override
public boolean onPreferenceClick(Preference preference) { public boolean onPreferenceClick(Preference preference) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, style); AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
dialogBuilder.setMessage(R.string.reset_color); dialogBuilder.setMessage(R.string.reset_color);
dialogBuilder.setPositiveButton(R.string.reset, new DialogInterface.OnClickListener() { dialogBuilder.setPositiveButton(R.string.reset, new DialogInterface.OnClickListener() {
@Override @Override
@ -58,6 +48,7 @@ public class ColorSettingsFragment extends PreferenceFragmentCompat implements
editor.remove("pref_color_background"); editor.remove("pref_color_background");
editor.remove("pref_color_navigation_bar"); editor.remove("pref_color_navigation_bar");
editor.remove("theme_accent"); editor.remove("theme_accent");
editor.remove("theme_text_color");
editor.remove("theme_primary"); editor.remove("theme_primary");
editor.commit(); editor.commit();
dialog.dismiss(); dialog.dismiss();

View File

@ -84,11 +84,14 @@
<item name="android:layout_marginStart">5dp</item> <item name="android:layout_marginStart">5dp</item>
<item name="android:layout_marginEnd">5dp</item> <item name="android:layout_marginEnd">5dp</item>
</style> </style>
<style name="Dialog" parent="Cyanea.AlertDialog.Theme.Light"> <style name="Dialog" parent="Cyanea.AlertDialog.Theme.Light">
<item name="iconColor">@color/black</item> <item name="iconColor">@color/black</item>
<item name="textColor">@color/black</item>
<item name="android:textColor">@color/black</item> <item name="android:textColor">@color/black</item>
<item name="buttonBarButtonStyle">@style/DialogButton</item> <item name="buttonBarButtonStyle">@style/DialogButton</item>
</style> </style>
<style name="DialogDark" parent="Cyanea.AlertDialog.Theme.Dark"> <style name="DialogDark" parent="Cyanea.AlertDialog.Theme.Dark">
<item name="iconColor">@color/dark_icon_theme</item> <item name="iconColor">@color/dark_icon_theme</item>
<item name="android:textColor">@color/dark_text</item> <item name="android:textColor">@color/dark_text</item>