Display/Editor colors fixed
This commit is contained in:
parent
70f4ec953a
commit
880343bba4
@ -155,7 +155,7 @@ public final class Preferences {
|
|||||||
TextColor textColor = textColors.get(themeId);
|
TextColor textColor = textColors.get(themeId);
|
||||||
if (textColor == null) {
|
if (textColor == null) {
|
||||||
final ContextThemeWrapper themeContext = new ContextThemeWrapper(context, themeId);
|
final ContextThemeWrapper themeContext = new ContextThemeWrapper(context, themeId);
|
||||||
final TypedArray a = themeContext.obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary, android.R.attr.textColorPrimaryInverse});
|
final TypedArray a = themeContext.obtainStyledAttributes(themeId, new int[]{R.attr.cpp_text_color, R.attr.cpp_text_color_error});
|
||||||
final int normal = a.getColor(0, Color.BLACK);
|
final int normal = a.getColor(0, Color.BLACK);
|
||||||
final int error = a.getColor(1, Color.WHITE);
|
final int error = a.getColor(1, Color.WHITE);
|
||||||
a.recycle();
|
a.recycle();
|
||||||
|
@ -30,7 +30,6 @@ import org.solovyev.common.MutableObject;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,14 +39,6 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class TextHighlighter implements TextProcessor<TextProcessorEditorResult, String> {
|
public class TextHighlighter implements TextProcessor<TextProcessorEditorResult, String> {
|
||||||
|
|
||||||
public static final int WHITE = -1;
|
|
||||||
|
|
||||||
private static final Map<String, String> nbFontAttributes = new HashMap<String, String>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
nbFontAttributes.put("color", "#008000");
|
|
||||||
}
|
|
||||||
|
|
||||||
private final int red;
|
private final int red;
|
||||||
private final int green;
|
private final int green;
|
||||||
private final int blue;
|
private final int blue;
|
||||||
@ -108,7 +99,7 @@ public class TextHighlighter implements TextProcessor<TextProcessorEditorResult,
|
|||||||
MathType.Result mathType = MathType.getType(text, i, numberBuilder.isHexMode());
|
MathType.Result mathType = MathType.getType(text, i, numberBuilder.isHexMode());
|
||||||
|
|
||||||
if (numberBuilder instanceof NumberBuilder) {
|
if (numberBuilder instanceof NumberBuilder) {
|
||||||
final MutableObject<Integer> numberOffset = new MutableObject<Integer>(0);
|
final MutableObject<Integer> numberOffset = new MutableObject<>(0);
|
||||||
((NumberBuilder) numberBuilder).process(text1, mathType, numberOffset);
|
((NumberBuilder) numberBuilder).process(text1, mathType, numberOffset);
|
||||||
resultOffset += numberOffset.getObject();
|
resultOffset += numberOffset.getObject();
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<TextView a:id="@+id/calculator_display"
|
<TextView a:id="@+id/calculator_display"
|
||||||
style="@style/cpp_widget_display_style"
|
style="@style/CppText.Display.Widget"
|
||||||
xmlns:a="http://schemas.android.com/apk/res/android"
|
xmlns:a="http://schemas.android.com/apk/res/android"
|
||||||
a:padding="@dimen/cpp_display_padding"
|
a:padding="@dimen/cpp_display_padding"
|
||||||
a:scrollbars="vertical"
|
a:scrollbars="vertical"
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
a:id="@+id/calculator_editor"
|
a:id="@+id/calculator_editor"
|
||||||
style="@style/cpp_widget_editor_style"
|
style="@style/CppText.Editor.Widget"
|
||||||
a:hint="@string/c_calc_editor_hint"
|
a:hint="@string/c_calc_editor_hint"
|
||||||
a:scrollbars="vertical"
|
a:scrollbars="vertical"
|
||||||
a:singleLine="false"
|
a:singleLine="false"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
a:id="@+id/calculator_editor"
|
a:id="@+id/calculator_editor"
|
||||||
style="@style/cpp_widget_editor_style"
|
style="@style/CppText.Editor.Widget"
|
||||||
a:layout_width="0dp"
|
a:layout_width="0dp"
|
||||||
a:layout_weight="3"
|
a:layout_weight="3"
|
||||||
a:gravity="center_vertical|left"
|
a:gravity="center_vertical|left"
|
||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
a:id="@+id/calculator_display"
|
a:id="@+id/calculator_display"
|
||||||
style="@style/cpp_widget_display_style"
|
style="@style/CppText.Display.Widget"
|
||||||
a:layout_width="0dp"
|
a:layout_width="0dp"
|
||||||
a:layout_height="wrap_content"
|
a:layout_height="wrap_content"
|
||||||
a:layout_weight="2"
|
a:layout_weight="2"
|
||||||
|
@ -33,6 +33,6 @@
|
|||||||
<attr name="cpp_wizard_button_bg" format="reference"/>
|
<attr name="cpp_wizard_button_bg" format="reference"/>
|
||||||
|
|
||||||
<attr name="cpp_text_color" format="reference"/>
|
<attr name="cpp_text_color" format="reference"/>
|
||||||
<attr name="cpp_text_error_color" format="reference"/>
|
<attr name="cpp_text_color_error" format="reference"/>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
<color name="cpp_list_divider">#ff2e2e2e</color>
|
<color name="cpp_list_divider">#ff2e2e2e</color>
|
||||||
|
|
||||||
<color name="cpp_text">#ffe6e6e6</color>
|
<color name="cpp_text">#ffe6e6e6</color>
|
||||||
<color name="cpp_text_inverse">#424242</color>
|
|
||||||
<color name="cpp_text_error">@color/cpp_text_inverse</color>
|
<color name="cpp_text_error">@color/cpp_text_inverse</color>
|
||||||
<color name="cpp_text_error_inverse">@color/cpp_text</color>
|
<color name="cpp_text_inverse">#424242</color>
|
||||||
|
<color name="cpp_text_inverse_error">@color/cpp_text</color>
|
||||||
|
|
||||||
<color name="cpp_button_text">#ffffffff</color>
|
<color name="cpp_button_text">#ffffffff</color>
|
||||||
<color name="cpp_button_text_operator">#ffffff99</color>
|
<color name="cpp_button_text_operator">#ffffff99</color>
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
<item name="android:layout_width">fill_parent</item>
|
<item name="android:layout_width">fill_parent</item>
|
||||||
<item name="android:layout_height">fill_parent</item>
|
<item name="android:layout_height">fill_parent</item>
|
||||||
<item name="android:textSize">@dimen/cpp_editor_text_size</item>
|
<item name="android:textSize">@dimen/cpp_editor_text_size</item>
|
||||||
|
<item name="android:textColor">?attr/cpp_text_color</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="CppText.Editor.Mobile" parent="CppText.Editor">
|
<style name="CppText.Editor.Mobile" parent="CppText.Editor">
|
||||||
@ -112,12 +113,14 @@
|
|||||||
<item name="android:layout_margin">@dimen/cpp_widget_margin</item>
|
<item name="android:layout_margin">@dimen/cpp_widget_margin</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_widget_editor_style" parent="CppText.Editor">
|
<style name="CppText.Editor.Widget" parent="CppText.Editor">
|
||||||
<item name="android:textSize">@dimen/cpp_widget_editor_text_size</item>
|
<item name="android:textSize">@dimen/cpp_widget_editor_text_size</item>
|
||||||
|
<item name="android:textColor">@color/cpp_text</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="cpp_widget_display_style" parent="CppText.Display">
|
<style name="CppText.Display.Widget" parent="CppText.Display">
|
||||||
<item name="android:textSize">@dimen/cpp_widget_display_text_size</item>
|
<item name="android:textSize">@dimen/cpp_widget_display_text_size</item>
|
||||||
|
<item name="android:textColor">@color/cpp_text</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="CppMain.Onscreen" parent="CppMain">
|
<style name="CppMain.Onscreen" parent="CppMain">
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
<item name="cpp_main_bg">@color/cpp_main_bg</item>
|
<item name="cpp_main_bg">@color/cpp_main_bg</item>
|
||||||
<item name="cpp_pane_bg">@drawable/pane</item>
|
<item name="cpp_pane_bg">@drawable/pane</item>
|
||||||
<item name="cpp_fab_bg">@color/cpp_material_grey</item>
|
<item name="cpp_fab_bg">@color/cpp_material_grey</item>
|
||||||
|
<item name="cpp_text_color">@color/cpp_text</item>
|
||||||
|
<item name="cpp_text_color_error">@color/cpp_text_error</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Cpp.Theme.Dialog" parent="@style/Theme.AppCompat.Dialog">
|
<style name="Cpp.Theme.Dialog" parent="@style/Theme.AppCompat.Dialog">
|
||||||
@ -60,6 +62,8 @@
|
|||||||
<item name="cpp_main_bg">@color/cpp_main_bg</item>
|
<item name="cpp_main_bg">@color/cpp_main_bg</item>
|
||||||
<item name="cpp_pane_bg">@drawable/pane</item>
|
<item name="cpp_pane_bg">@drawable/pane</item>
|
||||||
<item name="cpp_fab_bg">@color/cpp_material_grey</item>
|
<item name="cpp_fab_bg">@color/cpp_material_grey</item>
|
||||||
|
<item name="cpp_text_color">@color/cpp_text</item>
|
||||||
|
<item name="cpp_text_color_error">@color/cpp_text_error</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Cpp.Theme.Light" parent="@style/Theme.AppCompat.Light.DarkActionBar">
|
<style name="Cpp.Theme.Light" parent="@style/Theme.AppCompat.Light.DarkActionBar">
|
||||||
@ -79,6 +83,8 @@
|
|||||||
<item name="cpp_main_bg">@color/cpp_main_bg_light</item>
|
<item name="cpp_main_bg">@color/cpp_main_bg_light</item>
|
||||||
<item name="cpp_pane_bg">@drawable/pane_light</item>
|
<item name="cpp_pane_bg">@drawable/pane_light</item>
|
||||||
<item name="cpp_fab_bg">@color/cpp_material_light</item>
|
<item name="cpp_fab_bg">@color/cpp_material_light</item>
|
||||||
|
<item name="cpp_text_color">@color/cpp_text_inverse</item>
|
||||||
|
<item name="cpp_text_color_error">@color/cpp_text_inverse_error</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Cpp.Theme.Light.Dialog" parent="@style/Theme.AppCompat.Light.Dialog">
|
<style name="Cpp.Theme.Light.Dialog" parent="@style/Theme.AppCompat.Light.Dialog">
|
||||||
@ -98,6 +104,8 @@
|
|||||||
<item name="cpp_main_bg">@color/cpp_main_bg_light</item>
|
<item name="cpp_main_bg">@color/cpp_main_bg_light</item>
|
||||||
<item name="cpp_pane_bg">@drawable/pane_light</item>
|
<item name="cpp_pane_bg">@drawable/pane_light</item>
|
||||||
<item name="cpp_fab_bg">@color/cpp_material_light</item>
|
<item name="cpp_fab_bg">@color/cpp_material_light</item>
|
||||||
|
<item name="cpp_text_color">@color/cpp_text_inverse</item>
|
||||||
|
<item name="cpp_text_color_error">@color/cpp_text_inverse_error</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Cpp.Theme.Wizard" parent="Cpp.Theme.Material">
|
<style name="Cpp.Theme.Wizard" parent="Cpp.Theme.Material">
|
||||||
|
Loading…
Reference in New Issue
Block a user