diff --git a/app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java b/app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java index a4ccc119..44b649a9 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java +++ b/app/src/main/java/gr/thmmy/mthmmy/editorview/EditorView.java @@ -1,5 +1,6 @@ package gr.thmmy.mthmmy.editorview; +import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; @@ -20,6 +21,7 @@ import android.view.inputmethod.InputMethodManager; import android.widget.LinearLayout; import android.widget.PopupWindow; import android.widget.ScrollView; +import android.widget.TextView; import java.util.Objects; @@ -50,6 +52,7 @@ public class EditorView extends LinearLayout { init(context, attrs); } + @SuppressLint("SetTextI18n") private void init(Context context, AttributeSet attrs) { LayoutInflater.from(context).inflate(R.layout.editor_view, this, true); setOrientation(VERTICAL); @@ -142,7 +145,8 @@ public class EditorView extends LinearLayout { LinearLayout colorPicker = (LinearLayout) colorPickerScrollview.getChildAt(0); popupWindow.setContentView(colorPickerScrollview); for (int i = 0; i < colorPicker.getChildCount(); i++) { - colorPicker.getChildAt(i).setOnClickListener(v -> { + TextView child = (TextView) colorPicker.getChildAt(i); + child.setOnClickListener(v -> { boolean hadTextSelection = editText.hasSelection(); getText().insert(editText.getSelectionStart(), "[color=" + colors.get(v.getId()) + "]"); getText().insert(editText.getSelectionEnd(), "[/color]"); diff --git a/app/src/main/res/layout/editor_view_color_picker.xml b/app/src/main/res/layout/editor_view_color_picker.xml index 0ac2d71b..b71214e1 100644 --- a/app/src/main/res/layout/editor_view_color_picker.xml +++ b/app/src/main/res/layout/editor_view_color_picker.xml @@ -13,71 +13,85 @@ + android:text="@string/black" + android:textColor="@color/black"/> + android:text="@string/red" + android:textColor="@color/red"/> + android:text="@string/yellow" + android:textColor="@color/yellow"/> + android:text="@string/pink" + android:textColor="@color/pink"/> + android:text="@string/green" + android:textColor="@color/green"/> + android:text="@string/orange" + android:textColor="@color/orange"/> + android:text="@string/purple" + android:textColor="@color/purple"/> + android:text="@string/blue" + android:textColor="@color/blue"/> + android:text="@string/beige" + android:textColor="@color/beige"/> + android:text="@string/brown" + android:textColor="@color/brown"/> + android:text="@string/teal" + android:textColor="@color/teal"/> + android:text="@string/navy" + android:textColor="@color/navy"/> + android:text="@string/maroon" + android:textColor="@color/maroon"/> + android:text="@string/lime_green" + android:textColor="@color/lime_green"/> \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index c3bdac7a..f2209027 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -26,4 +26,25 @@ #D92B2B2B #E91E63 @color/primary_text + + #FF0000 + #800000 + #A52A2A + #FFA500 + #FFFF00 + #808000 + #008000 + #800080 + #FF00FF + #FFC0CB + #F5F5DC + #00FF00 + #32CD32 + #008080 + #00FFFF + #0000FF + #000080 + #000000 + #808080 + #C0C0C0