修复编辑器弹窗颜色问题

This commit is contained in:
muqing 2024-07-27 09:28:37 +08:00
parent 7c052f0f7a
commit 3fc7bbc769
6 changed files with 18 additions and 6 deletions

View File

@ -1,7 +1,6 @@
package com.coldmint.rust.pro.edit.autoComplete package com.coldmint.rust.pro.edit.autoComplete
import android.os.Bundle import android.os.Bundle
import com.coldmint.rust.pro.edit.RustAutoComplete
import com.coldmint.rust.pro.edit.RustCompletionItem import com.coldmint.rust.pro.edit.RustCompletionItem
import io.github.rosemoe.sora.lang.completion.CompletionPublisher import io.github.rosemoe.sora.lang.completion.CompletionPublisher
import io.github.rosemoe.sora.text.CharPosition import io.github.rosemoe.sora.text.CharPosition

View File

@ -27,6 +27,7 @@ import android.content.Context;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.widget.Button; import android.widget.Button;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -95,6 +96,8 @@ public class SymbolInputView extends LinearLayout {
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {
((Button) getChildAt(i)).setTextColor(color); ((Button) getChildAt(i)).setTextColor(color);
} }
Log.i("SymbolInputView", "Set text color to " + color);
textColor = color; textColor = color;
} }

View File

@ -23,6 +23,7 @@
*/ */
package io.github.rosemoe.sora.widget.base; package io.github.rosemoe.sora.widget.base;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.widget.PopupWindow; import android.widget.PopupWindow;
@ -271,6 +272,7 @@ public class EditorPopupWindow {
if (isShowing()) { if (isShowing()) {
return; return;
} }
Log.i("EditorPopupWindow", "Created a new window for editor");
applyWindowAttributes(true); applyWindowAttributes(true);
} }

View File

@ -23,6 +23,7 @@
*/ */
package io.github.rosemoe.sora.widget.component; package io.github.rosemoe.sora.widget.component;
import android.graphics.Color;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -30,6 +31,8 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat;
import io.github.rosemoe.sora.R; import io.github.rosemoe.sora.R;
import io.github.rosemoe.sora.widget.schemes.EditorColorScheme; import io.github.rosemoe.sora.widget.schemes.EditorColorScheme;
@ -53,13 +56,18 @@ public final class DefaultCompletionItemAdapter extends EditorCompletionAdapter
} }
var item = getItem(pos); var item = getItem(pos);
//编辑器代码提示文本渲染
TextView tv = view.findViewById(R.id.result_item_label); TextView tv = view.findViewById(R.id.result_item_label);
tv.setText(item.label); tv.setText(item.label);
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY)); // tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_PRIMARY));
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
tv = view.findViewById(R.id.result_item_desc); tv = view.findViewById(R.id.result_item_desc);
tv.setText(item.desc); tv.setText(item.desc);
tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY)); // tv.setTextColor(getThemeColor(EditorColorScheme.COMPLETION_WND_TEXT_SECONDARY));
tv.setTextColor(ContextCompat.getColor(getContext(),R.color.defaultSymbolInputTextColor));
view.setTag(pos); view.setTag(pos);
if (isCurrentCursorPosition) { if (isCurrentCursorPosition) {

View File

@ -25,6 +25,7 @@
package io.github.rosemoe.sora.widget.component package io.github.rosemoe.sora.widget.component
import android.graphics.drawable.GradientDrawable import android.graphics.drawable.GradientDrawable
import android.util.Log
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View

View File

@ -52,9 +52,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Medium Text" android:text="Medium Text"
android:textColor="#FF000000" style="@style/TextAppearance.Material3.TitleSmall"
android:id="@+id/result_item_label" android:id="@+id/result_item_label" />
android:textSize="15sp"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"