Display/Editor colors fixed

This commit is contained in:
serso 2015-02-16 22:30:56 +01:00
parent 70f4ec953a
commit 880343bba4
9 changed files with 22 additions and 20 deletions

View File

@ -155,7 +155,7 @@ public final class Preferences {
TextColor textColor = textColors.get(themeId);
if (textColor == null) {
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 error = a.getColor(1, Color.WHITE);
a.recycle();

View File

@ -30,7 +30,6 @@ import org.solovyev.common.MutableObject;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
/**
@ -40,14 +39,6 @@ import java.util.Map;
*/
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 green;
private final int blue;
@ -108,7 +99,7 @@ public class TextHighlighter implements TextProcessor<TextProcessorEditorResult,
MathType.Result mathType = MathType.getType(text, i, numberBuilder.isHexMode());
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);
resultOffset += numberOffset.getObject();
} else {

View File

@ -7,7 +7,7 @@
-->
<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"
a:padding="@dimen/cpp_display_padding"
a:scrollbars="vertical"

View File

@ -15,7 +15,7 @@
<TextView
a:id="@+id/calculator_editor"
style="@style/cpp_widget_editor_style"
style="@style/CppText.Editor.Widget"
a:hint="@string/c_calc_editor_hint"
a:scrollbars="vertical"
a:singleLine="false"

View File

@ -17,7 +17,7 @@
<TextView
a:id="@+id/calculator_editor"
style="@style/cpp_widget_editor_style"
style="@style/CppText.Editor.Widget"
a:layout_width="0dp"
a:layout_weight="3"
a:gravity="center_vertical|left"
@ -36,7 +36,7 @@
<TextView
a:id="@+id/calculator_display"
style="@style/cpp_widget_display_style"
style="@style/CppText.Display.Widget"
a:layout_width="0dp"
a:layout_height="wrap_content"
a:layout_weight="2"

View File

@ -33,6 +33,6 @@
<attr name="cpp_wizard_button_bg" 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>

View File

@ -24,9 +24,9 @@
<color name="cpp_list_divider">#ff2e2e2e</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_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_operator">#ffffff99</color>

View File

@ -56,6 +56,7 @@
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:textSize">@dimen/cpp_editor_text_size</item>
<item name="android:textColor">?attr/cpp_text_color</item>
</style>
<style name="CppText.Editor.Mobile" parent="CppText.Editor">
@ -112,12 +113,14 @@
<item name="android:layout_margin">@dimen/cpp_widget_margin</item>
</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:textColor">@color/cpp_text</item>
</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:textColor">@color/cpp_text</item>
</style>
<style name="CppMain.Onscreen" parent="CppMain">

View File

@ -40,6 +40,8 @@
<item name="cpp_main_bg">@color/cpp_main_bg</item>
<item name="cpp_pane_bg">@drawable/pane</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 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_pane_bg">@drawable/pane</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 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_pane_bg">@drawable/pane_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 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_pane_bg">@drawable/pane_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 name="Cpp.Theme.Wizard" parent="Cpp.Theme.Material">