mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-23 09:30:53 +00:00
fix minor issues with user colors
This commit is contained in:
parent
7d9e918c7a
commit
b5f3639e9f
3 changed files with 34 additions and 40 deletions
|
@ -557,7 +557,11 @@ public class KeyboardView extends View {
|
||||||
else
|
else
|
||||||
icon.clearColorFilter();
|
icon.clearColorFilter();
|
||||||
} else if (key.isShift()) {
|
} else if (key.isShift()) {
|
||||||
if (keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED || keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED)
|
if (keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED
|
||||||
|
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED
|
||||||
|
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED
|
||||||
|
|| keyboard.mId.mElementId == KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED
|
||||||
|
)
|
||||||
icon.setColorFilter(accentColorFilter);
|
icon.setColorFilter(accentColorFilter);
|
||||||
else
|
else
|
||||||
icon.setColorFilter(keyTextColorFilter);
|
icon.setColorFilter(keyTextColorFilter);
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package org.dslul.openboard.inputmethod.latin.settings
|
package org.dslul.openboard.inputmethod.latin.settings
|
||||||
|
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
|
import android.graphics.Color
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.preference.ListPreference
|
import android.preference.ListPreference
|
||||||
|
@ -187,14 +188,14 @@ class AppearanceSettingsFragment : SubScreenFragment(), Preference.OnPreferenceC
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
.setTitle(R.string.select_color_to_adjust)
|
.setTitle(R.string.select_color_to_adjust)
|
||||||
.setItems(itemsArray) { _, i ->
|
.setItems(itemsArray) { _, i ->
|
||||||
val pref = when (i) {
|
val (pref, default) = when (i) {
|
||||||
0 -> Settings.PREF_THEME_USER_COLOR_BACKGROUND
|
0 -> Settings.PREF_THEME_USER_COLOR_BACKGROUND to Color.DKGRAY
|
||||||
1 -> Settings.PREF_THEME_USER_COLOR_TEXT
|
1 -> Settings.PREF_THEME_USER_COLOR_TEXT to Color.WHITE
|
||||||
2 -> Settings.PREF_THEME_USER_COLOR_HINT_TEXT
|
2 -> Settings.PREF_THEME_USER_COLOR_HINT_TEXT to Color.WHITE
|
||||||
3 -> Settings.PREF_THEME_USER_COLOR_ACCENT
|
3 -> Settings.PREF_THEME_USER_COLOR_ACCENT to Color.BLUE
|
||||||
else -> Settings.PREF_THEME_USER_COLOR_KEYS
|
else -> Settings.PREF_THEME_USER_COLOR_KEYS to Color.LTGRAY
|
||||||
}
|
}
|
||||||
val d = ColorPickerDialog(activity, items[i], sharedPreferences, pref) { needsReload = true}
|
val d = ColorPickerDialog(activity, items[i], sharedPreferences, pref, default) { needsReload = true}
|
||||||
d.show()
|
d.show()
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.dslul.openboard.inputmethod.latin.settings;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
@ -30,7 +29,8 @@ import android.widget.TextView;
|
||||||
import org.dslul.openboard.inputmethod.latin.R;
|
import org.dslul.openboard.inputmethod.latin.R;
|
||||||
|
|
||||||
public class ColorPickerDialog extends AlertDialog implements SeekBar.OnSeekBarChangeListener {
|
public class ColorPickerDialog extends AlertDialog implements SeekBar.OnSeekBarChangeListener {
|
||||||
protected ColorPickerDialog(Context context, String title, SharedPreferences prefs, String colorPref, Runnable onChanged) {
|
protected ColorPickerDialog(final Context context, final String title, final SharedPreferences prefs,
|
||||||
|
final String colorPref, final int defaultColor, Runnable onChanged) {
|
||||||
super(context);
|
super(context);
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
View view = getLayoutInflater().inflate(R.layout.color_dialog, null);
|
View view = getLayoutInflater().inflate(R.layout.color_dialog, null);
|
||||||
|
@ -54,42 +54,31 @@ public class ColorPickerDialog extends AlertDialog implements SeekBar.OnSeekBarC
|
||||||
|
|
||||||
// init with correct values
|
// init with correct values
|
||||||
// using onShowListener?
|
// using onShowListener?
|
||||||
setOnShowListener(new OnShowListener() {
|
setOnShowListener(dialogInterface -> {
|
||||||
@Override
|
int color = prefs.getInt(colorPref, defaultColor);
|
||||||
public void onShow(DialogInterface dialogInterface) {
|
mSeekBarRed.setProgress(Color.red(color));
|
||||||
int color = prefs.getInt(colorPref, 0);
|
mSeekBarGreen.setProgress(Color.green(color));
|
||||||
mSeekBarRed.setProgress(Color.red(color));
|
mSeekBarBlue.setProgress(Color.blue(color));
|
||||||
mSeekBarGreen.setProgress(Color.green(color));
|
setHeaderText(color);
|
||||||
mSeekBarBlue.setProgress(Color.blue(color));
|
|
||||||
setHeaderText(color);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// set on ok and on cancel listeners
|
// set on ok and on cancel listeners
|
||||||
setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel), new OnClickListener() {
|
setButton(BUTTON_NEGATIVE, context.getText(android.R.string.cancel), (dialogInterface, i) -> dismiss());
|
||||||
@Override
|
setButton(BUTTON_POSITIVE, context.getText(android.R.string.ok), (dialogInterface, i) -> {
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
final int value = Color.rgb(
|
||||||
dismiss();
|
mSeekBarRed.getProgress(),
|
||||||
}
|
mSeekBarGreen.getProgress(),
|
||||||
});
|
mSeekBarBlue.getProgress());
|
||||||
setButton(BUTTON_POSITIVE, context.getText(android.R.string.ok), new OnClickListener() {
|
prefs.edit().putInt(colorPref, value).apply();
|
||||||
@Override
|
onChanged.run();
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
dismiss();
|
||||||
final int value = Color.rgb(
|
|
||||||
mSeekBarRed.getProgress(),
|
|
||||||
mSeekBarGreen.getProgress(),
|
|
||||||
mSeekBarBlue.getProgress());
|
|
||||||
prefs.edit().putInt(colorPref, value).apply();
|
|
||||||
onChanged.run();
|
|
||||||
dismiss();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextView mValueView;
|
private final TextView mValueView;
|
||||||
private SeekBar mSeekBarRed;
|
private final SeekBar mSeekBarRed;
|
||||||
private SeekBar mSeekBarGreen;
|
private final SeekBar mSeekBarGreen;
|
||||||
private SeekBar mSeekBarBlue;
|
private final SeekBar mSeekBarBlue;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
|
public void onProgressChanged(final SeekBar seekBar, final int progress, final boolean fromUser) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue