Squircle-CE
Squircle-CE copied to clipboard
With tens of thousands of lines of code, the editor can get very jammed. How do you optimize it
In my case, parsing tens of thousands of lines of code is slow, and I need to nest two layers of ScrollView for some purpose, which leads to a particular lag. How can I optimize
Could you try adding a line-loading and highlighting API similar to AppCompatTextView's setTextFeature method
The method you looking for is already exists LineNumbersEditText.kt#L86, it takes PrecomputedTextCompat as a parameter. Nesting the editor in ScrollView
causes it to be measured every time a new line added, which is not good. I would recommend not to use wrap_content
as the editor height and find a way to get rid of ScrollView
When I use TextProcessor alone (without any scrollViews nested), I swipe down and the view returns my current cursor position, causing the slide down to fail
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/mConstraint" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true">
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mCoordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/barLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/bar_height"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/editor_menu" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/mProgressBar"
style="?android:attr/progressBarStyleSmall"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center"
android:color="?android:attr/colorPrimary"
android:indeterminate="true"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!--让HorizontalScrollView自然的左滑右滑,套两个ScrollView android:paddingTop="@dimen/bar_height"-->
<!-- <me.zhanghai.android.fastscroll.FastScrollNestedScrollView-->
<!-- android:id="@+id/scrollView"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:clipToPadding="false"-->
<!-- android:fillViewport="true"-->
<!-- app:layout_behavior="@string/appbar_scrolling_view_behavior"-->
<!-- app:layout_constraintBottom_toBottomOf="@+id/barLayout">-->
<!-- <HorizontalScrollView-->
<!-- android:id="@+id/mHorizontalScroller"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent">-->
<com.blacksquircle.ui.editorkit.widget.TextProcessor
android:id="@+id/codeView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"
android:gravity="top|start"
android:scrollbars="vertical"
android:textSize="15sp" />
<!-- <requestFocus />-->
<!-- </HorizontalScrollView>-->
<!-- </me.zhanghai.android.fastscroll.FastScrollNestedScrollView>-->
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
I want you can add a function parameters value, it is "softWrap:Boolean"
softWrap可以设置编辑器在TextOverflow时可以设置是否软换行,这在Jetpack compose 的Text函数中存在
这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。