6.7.0 - Alpha23 - Fine tuning
This commit is contained in:
@@ -39,6 +39,7 @@ import android.view.accessibility.AccessibilityEvent
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputConnection
|
||||
import android.view.inputmethod.InputConnectionWrapper
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.TextViewHelper
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import androidx.core.graphics.withTranslation
|
||||
@@ -56,6 +57,7 @@ import java.util.concurrent.CopyOnWriteArrayList
|
||||
* Created by Administrator on Feb 11, 2018.
|
||||
* Modified by SuperMonster003 as of May 1, 2023.
|
||||
* Modified by JetBrains AI Assistant (GPT-5.2) as of Feb 8, 2026.
|
||||
* Modified by JetBrains AI Assistant (GPT-5.3-Codex (xhigh)) as of Mar 8, 2026.
|
||||
*/
|
||||
class CodeEditText : AppCompatEditText {
|
||||
|
||||
@@ -717,6 +719,9 @@ class CodeEditText : AppCompatEditText {
|
||||
// zh-CN: 当用户触摸文本区域 (非行号区域) 时尽早通知外层.
|
||||
if (event.action == MotionEvent.ACTION_DOWN && event.x >= paddingLeft) {
|
||||
onUserTouchInTextArea?.invoke()
|
||||
// Best-effort IME wake-up for devices/ROMs where tap-to-show may be missed.
|
||||
// zh-CN: 兜底唤起输入法, 兼容部分设备/ROM 点按后未自动弹出软键盘的情况.
|
||||
requestSoftInputIfEditable()
|
||||
}
|
||||
|
||||
// 如果行号区域被按下
|
||||
@@ -749,6 +754,20 @@ class CodeEditText : AppCompatEditText {
|
||||
return super.onTouchEvent(event)
|
||||
}
|
||||
|
||||
private fun requestSoftInputIfEditable() {
|
||||
if (mReadOnly || !showSoftInputOnFocus) return
|
||||
if (!isFocusable || !isFocusableInTouchMode) return
|
||||
|
||||
post {
|
||||
if (mReadOnly || !showSoftInputOnFocus) return@post
|
||||
if (!hasFocus()) {
|
||||
requestFocus()
|
||||
}
|
||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager ?: return@post
|
||||
imm.showSoftInput(this@CodeEditText, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeBreakpoint(line: Int): Boolean {
|
||||
breakpoints.remove(line) ?: return false
|
||||
breakpointChangeListener?.onBreakpointChange(line, false)
|
||||
@@ -793,4 +812,4 @@ class CodeEditText : AppCompatEditText {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.lang.ref.WeakReference;
|
||||
* Created by Stardust on Dec 9, 2017.
|
||||
* <a href="https://github.com/dss886/Android-FunctionsInputDetector">Android-FunctionsInputDetector</a>
|
||||
* Modified by JetBrains AI Assistant (GPT-5.2) as of Feb 11, 2026.
|
||||
* Modified by JetBrains AI Assistant (GPT-5.3-Codex (xhigh)) as of Mar 8, 2026.
|
||||
*/
|
||||
public class FunctionsKeyboardHelper implements BackPressedHandler {
|
||||
|
||||
@@ -97,7 +98,7 @@ public class FunctionsKeyboardHelper implements BackPressedHandler {
|
||||
}
|
||||
|
||||
public FunctionsKeyboardHelper build() {
|
||||
mActivityRef.get().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN |
|
||||
mActivityRef.get().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN |
|
||||
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
hideSoftInput();
|
||||
return this;
|
||||
@@ -229,4 +230,4 @@ public class FunctionsKeyboardHelper implements BackPressedHandler {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.view.View;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.DimenRes;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -19,6 +20,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
/**
|
||||
* Created by yqritc on 2015/01/08.
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unused"})
|
||||
public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private static final int DEFAULT_SIZE = 2;
|
||||
@@ -30,7 +32,7 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
DRAWABLE, PAINT, COLOR
|
||||
}
|
||||
|
||||
protected DividerType mDividerType = DividerType.DRAWABLE;
|
||||
protected DividerType mDividerType;
|
||||
protected VisibilityProvider mVisibilityProvider;
|
||||
protected PaintProvider mPaintProvider;
|
||||
protected ColorProvider mColorProvider;
|
||||
@@ -52,15 +54,14 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
} else {
|
||||
mDividerType = DividerType.DRAWABLE;
|
||||
if (builder.mDrawableProvider == null) {
|
||||
TypedArray a = builder.mContext.obtainStyledAttributes(ATTRS);
|
||||
final Drawable divider = a.getDrawable(0);
|
||||
a.recycle();
|
||||
mDrawableProvider = new DrawableProvider() {
|
||||
@Override
|
||||
public Drawable drawableProvider(int position, RecyclerView parent) {
|
||||
return divider;
|
||||
}
|
||||
};
|
||||
Drawable divider;
|
||||
try (TypedArray a = builder.mContext.obtainStyledAttributes(ATTRS)) {
|
||||
divider = a.getDrawable(0);
|
||||
} catch (Exception e) {
|
||||
divider = null;
|
||||
}
|
||||
Drawable finalDivider = divider;
|
||||
mDrawableProvider = (position, parent) -> finalDivider;
|
||||
} else {
|
||||
mDrawableProvider = builder.mDrawableProvider;
|
||||
}
|
||||
@@ -75,17 +76,12 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
private void setSizeProvider(Builder builder) {
|
||||
mSizeProvider = builder.mSizeProvider;
|
||||
if (mSizeProvider == null) {
|
||||
mSizeProvider = new SizeProvider() {
|
||||
@Override
|
||||
public int dividerSize(int position, RecyclerView parent) {
|
||||
return DEFAULT_SIZE;
|
||||
}
|
||||
};
|
||||
mSizeProvider = (position, parent) -> DEFAULT_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
|
||||
public void onDraw(@NonNull Canvas c, RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
RecyclerView.Adapter adapter = parent.getAdapter();
|
||||
if (adapter == null) {
|
||||
return;
|
||||
@@ -141,9 +137,12 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect rect, View v, RecyclerView parent, RecyclerView.State state) {
|
||||
public void getItemOffsets(@NonNull Rect rect, @NonNull View v, RecyclerView parent, @NonNull RecyclerView.State state) {
|
||||
int position = parent.getChildAdapterPosition(v);
|
||||
int itemCount = parent.getAdapter().getItemCount();
|
||||
int itemCount = 0;
|
||||
if (parent.getAdapter() != null) {
|
||||
itemCount = parent.getAdapter().getItemCount();
|
||||
}
|
||||
int lastDividerOffset = getLastDividerOffset(parent);
|
||||
if (!mShowLastDivider && position >= itemCount - lastDividerOffset) {
|
||||
// Don't set item offset for last line if mShowLastDivider = false
|
||||
@@ -185,11 +184,13 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
* LinearLayoutManager
|
||||
*/
|
||||
private int getLastDividerOffset(RecyclerView parent) {
|
||||
if (parent.getLayoutManager() instanceof GridLayoutManager) {
|
||||
GridLayoutManager layoutManager = (GridLayoutManager) parent.getLayoutManager();
|
||||
if (parent.getLayoutManager() instanceof GridLayoutManager layoutManager) {
|
||||
GridLayoutManager.SpanSizeLookup spanSizeLookup = layoutManager.getSpanSizeLookup();
|
||||
int spanCount = layoutManager.getSpanCount();
|
||||
int itemCount = parent.getAdapter().getItemCount();
|
||||
int itemCount = 0;
|
||||
if (parent.getAdapter() != null) {
|
||||
itemCount = parent.getAdapter().getItemCount();
|
||||
}
|
||||
for (int i = itemCount - 1; i >= 0; i--) {
|
||||
if (spanSizeLookup.getSpanIndex(i, spanCount) == 0) {
|
||||
return itemCount - i;
|
||||
@@ -209,8 +210,7 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
* @return true if the divider can be skipped as it is in the same row as the previous one.
|
||||
*/
|
||||
private boolean wasDividerAlreadyDrawn(int position, RecyclerView parent) {
|
||||
if (parent.getLayoutManager() instanceof GridLayoutManager) {
|
||||
GridLayoutManager layoutManager = (GridLayoutManager) parent.getLayoutManager();
|
||||
if (parent.getLayoutManager() instanceof GridLayoutManager layoutManager) {
|
||||
GridLayoutManager.SpanSizeLookup spanSizeLookup = layoutManager.getSpanSizeLookup();
|
||||
int spanCount = layoutManager.getSpanCount();
|
||||
return spanSizeLookup.getSpanIndex(position, spanCount) > 0;
|
||||
@@ -228,8 +228,7 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
* @return group index of items
|
||||
*/
|
||||
private int getGroupIndex(int position, RecyclerView parent) {
|
||||
if (parent.getLayoutManager() instanceof GridLayoutManager) {
|
||||
GridLayoutManager layoutManager = (GridLayoutManager) parent.getLayoutManager();
|
||||
if (parent.getLayoutManager() instanceof GridLayoutManager layoutManager) {
|
||||
GridLayoutManager.SpanSizeLookup spanSizeLookup = layoutManager.getSpanSizeLookup();
|
||||
int spanCount = layoutManager.getSpanCount();
|
||||
return spanSizeLookup.getSpanGroupIndex(position, spanCount);
|
||||
@@ -318,20 +317,16 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
int dividerSize(int position, RecyclerView parent);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static class Builder<T extends Builder> {
|
||||
|
||||
private Context mContext;
|
||||
private final Context mContext;
|
||||
protected Resources mResources;
|
||||
private PaintProvider mPaintProvider;
|
||||
private ColorProvider mColorProvider;
|
||||
private DrawableProvider mDrawableProvider;
|
||||
private SizeProvider mSizeProvider;
|
||||
private VisibilityProvider mVisibilityProvider = new VisibilityProvider() {
|
||||
@Override
|
||||
public boolean shouldHideDivider(int position, RecyclerView parent) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
private VisibilityProvider mVisibilityProvider = (position, parent) -> false;
|
||||
private boolean mShowLastDivider = false;
|
||||
private boolean mPositionInsideItem = false;
|
||||
|
||||
@@ -341,12 +336,7 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
}
|
||||
|
||||
public T paint(final Paint paint) {
|
||||
return paintProvider(new PaintProvider() {
|
||||
@Override
|
||||
public Paint dividerPaint(int position, RecyclerView parent) {
|
||||
return paint;
|
||||
}
|
||||
});
|
||||
return paintProvider((position, parent) -> paint);
|
||||
}
|
||||
|
||||
public T paintProvider(PaintProvider provider) {
|
||||
@@ -355,12 +345,7 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
}
|
||||
|
||||
public T color(final int color) {
|
||||
return colorProvider(new ColorProvider() {
|
||||
@Override
|
||||
public int dividerColor(int position, RecyclerView parent) {
|
||||
return color;
|
||||
}
|
||||
});
|
||||
return colorProvider((position, parent) -> color);
|
||||
}
|
||||
|
||||
public T colorResId(@ColorRes int colorId) {
|
||||
@@ -377,12 +362,7 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
}
|
||||
|
||||
public T drawable(final Drawable drawable) {
|
||||
return drawableProvider(new DrawableProvider() {
|
||||
@Override
|
||||
public Drawable drawableProvider(int position, RecyclerView parent) {
|
||||
return drawable;
|
||||
}
|
||||
});
|
||||
return drawableProvider((position, parent) -> drawable);
|
||||
}
|
||||
|
||||
public T drawableProvider(DrawableProvider provider) {
|
||||
@@ -391,12 +371,7 @@ public abstract class FlexibleDividerDecoration extends RecyclerView.ItemDecorat
|
||||
}
|
||||
|
||||
public T size(final int size) {
|
||||
return sizeProvider(new SizeProvider() {
|
||||
@Override
|
||||
public int dividerSize(int position, RecyclerView parent) {
|
||||
return size;
|
||||
}
|
||||
});
|
||||
return sizeProvider((position, parent) -> size);
|
||||
}
|
||||
|
||||
public T sizeResId(@DimenRes int sizeId) {
|
||||
|
||||
@@ -13,13 +13,14 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
*/
|
||||
public class HorizontalDividerItemDecoration extends FlexibleDividerDecoration {
|
||||
|
||||
private MarginProvider mMarginProvider;
|
||||
private final MarginProvider mMarginProvider;
|
||||
|
||||
protected HorizontalDividerItemDecoration(Builder builder) {
|
||||
super(builder);
|
||||
mMarginProvider = builder.mMarginProvider;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected Rect getDividerBound(int position, RecyclerView parent, View child) {
|
||||
Rect bounds = new Rect(0, 0, 0, 0);
|
||||
@@ -116,6 +117,7 @@ public class HorizontalDividerItemDecoration extends FlexibleDividerDecoration {
|
||||
int dividerRightMargin(int position, RecyclerView parent);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static class Builder extends FlexibleDividerDecoration.Builder<Builder> {
|
||||
|
||||
private MarginProvider mMarginProvider = new MarginProvider() {
|
||||
|
||||
@@ -13,13 +13,14 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
*/
|
||||
public class VerticalDividerItemDecoration extends FlexibleDividerDecoration {
|
||||
|
||||
private MarginProvider mMarginProvider;
|
||||
private final MarginProvider mMarginProvider;
|
||||
|
||||
protected VerticalDividerItemDecoration(Builder builder) {
|
||||
super(builder);
|
||||
mMarginProvider = builder.mMarginProvider;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected Rect getDividerBound(int position, RecyclerView parent, View child) {
|
||||
Rect bounds = new Rect(0, 0, 0, 0);
|
||||
@@ -116,6 +117,7 @@ public class VerticalDividerItemDecoration extends FlexibleDividerDecoration {
|
||||
int dividerBottomMargin(int position, RecyclerView parent);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public static class Builder extends FlexibleDividerDecoration.Builder<Builder> {
|
||||
|
||||
private MarginProvider mMarginProvider = new MarginProvider() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#Sun Mar 08 15:18:59 CST 2026
|
||||
BUILD_TIME=1772954339154
|
||||
#Sun Mar 08 15:56:02 CST 2026
|
||||
BUILD_TIME=1772956562907
|
||||
COMPILE_SDK_VERSION=36
|
||||
IMAGE_QUANT_CMAKE_VERSION=3.22.1
|
||||
IMAGE_QUANT_NDK_VERSION=26.1.10909125
|
||||
|
||||
Reference in New Issue
Block a user