更新最新版本的编辑器库

This commit is contained in:
muqing 2024-02-17 19:52:54 +08:00
parent 79207f7c5b
commit 4f2f2c4f7e
11 changed files with 20 additions and 92 deletions

View File

@ -103,8 +103,9 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
implementation project(path: ':library')
implementation project(':imageactivity')
// implementation project(':editor')
implementation 'io.github.Rosemoe.sora-editor:editor:0.16.5'
implementation project(':editor')
// implementation 'io.github.Rosemoe.sora-editor:editor:0.16.5'
//

View File

@ -20,7 +20,7 @@ import com.coldmint.rust.core.database.code.SectionInfo
import com.coldmint.rust.pro.adapters.CodeTableAdapter
import com.coldmint.rust.pro.base.BaseActivity
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
import com.muqing.muqing.gj
import com.muqing.gj
import java.util.concurrent.Executors
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {

View File

@ -1072,7 +1072,7 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
AppSettings.getValue(AppSettings.Setting.CodeEditBackGroundEnable, false)
val rustCompletionAdapter = RustCompletionAdapter()
rustCompletionAdapter.setEditBackground(codeEditBackGroundEnable)
viewBinding.codeEditor.setAutoCompletionItemAdapter(rustCompletionAdapter)
// viewBinding.codeEditor.setAutoCompletionItemAdapter(rustCompletionAdapter)
viewBinding.codeEditor.isVerticalScrollBarEnabled = false
val path = viewModel.modClass?.modFile?.absolutePath ?: ""
CompletionItemConverter.configurationFileConversion(

View File

@ -9,7 +9,7 @@ import android.os.Bundle
import cat.ereza.customactivityoncrash.config.CaocConfig
import com.coldmint.rust.core.debug.LogCat
import com.coldmint.rust.core.debug.LogCatObserver
import com.muqing.muqing.wj
import com.muqing.wj
import com.coldmint.rust.pro.tool.AppSettings
import com.google.android.material.color.DynamicColors
import com.google.android.material.color.DynamicColorsOptions

View File

@ -29,7 +29,7 @@ class RustLanguage() : Language, EnglishMode {
private val codeAutoCompleteJob: CodeAutoCompleteJob by lazy {
CodeAutoCompleteJob()
}
private val newlineHandler: Array<NewlineHandler> by lazy {
/* private val newlineHandler: Array<NewlineHandler> by lazy {
arrayOf(object : NewlineHandler {
override fun matchesRequirement(beforeText: String?, afterText: String?): Boolean {
return true
@ -53,8 +53,7 @@ class RustLanguage() : Language, EnglishMode {
}
})
}
/*
}*/
private val newlineHandler: Array<NewlineHandler> by lazy {
arrayOf(object : NewlineHandler {
override fun matchesRequirement(text: Content, position: CharPosition, style: Styles?): Boolean {
@ -75,7 +74,7 @@ class RustLanguage() : Language, EnglishMode {
return NewlineHandleResult(newText, 0)
}
})
}*/
}

View File

@ -46,13 +46,6 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
.onForwardToSettings { scope, deniedList ->
scope.showForwardToSettingsDialog(deniedList, "您需要手动允许设置中的必要权限", "授权", "取消")
}
.request { allGranted, _, _ ->
if (allGranted) {
// Toast.makeText(this, "All permissions are granted", Toast.LENGTH_LONG).show()
} else {
// Toast.makeText(this, "These permissions are denied: $deniedList", Toast.LENGTH_LONG).show()
}
}
if (isAdded) {
val mainActivity = activity as MainActivity

View File

@ -1,4 +1,4 @@
package com.muqing.muqing;
package com.muqing;
import android.annotation.SuppressLint;
import android.content.ClipData;

View File

@ -1,4 +1,4 @@
package com.muqing.muqing;
package com.muqing;
import android.content.Context;
import android.os.Build;

View File

@ -1,28 +1,5 @@
/*
* sora-editor - the awesome code editor for Android
* https://github.com/Rosemoe/sora-editor
* Copyright (C) 2020-2024 Rosemoe
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
* Please contact Rosemoe by email 2073412493@qq.com if you need
* additional information or have any questions
*/
package io.github.rosemoe.sora.widget;
package io.github.rosemoe.sora.widget;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.ClipData;
@ -154,21 +131,8 @@ import io.github.rosemoe.sora.widget.style.builtin.HandleStyleDrop;
import io.github.rosemoe.sora.widget.style.builtin.HandleStyleSideDrop;
import io.github.rosemoe.sora.widget.style.builtin.MoveCursorAnimator;
import kotlin.text.StringsKt;
/**
* CodeEditor is an editor that can highlight text regions by doing basic syntax analyzing
* This project in <a href="https://github.com/Rosemoe/sora-editor">GitHub</a>
* <p>
* Note:
* Row and line are different in this editor
* When we say 'row', it means a line displayed on screen. It can be a part of a line in the text object.
* When we say 'line', it means a real line in the original text.
*
* @author Rosemoe
*/
@SuppressWarnings("unused")
public class CodeEditor extends View implements ContentListener, Formatter.FormatResultReceiver, LineRemoveListener {
/**
* The default text size when creating the editor object. Unit is sp.
*/

View File

@ -80,7 +80,8 @@ public class EditorTextActionWindow extends EditorPopupWindow implements View.On
// Since popup window does provide decor view, we have to pass null to this method
@SuppressLint("InflateParams")
View root = this.rootView = LayoutInflater.from(editor.getContext()).inflate(R.layout.text_compose_panel, null);
View root = this.rootView = LayoutInflater.from(editor.getContext()).
inflate(R.layout.text_compose_panel, null);
ImageButton selectAll = root.findViewById(R.id.panel_btn_select_all);
cutBtn = root.findViewById(R.id.panel_btn_cut);
copyBtn = root.findViewById(R.id.panel_btn_copy);

View File

@ -1,86 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ sora-editor - the awesome code editor for Android
~ https://github.com/Rosemoe/sora-editor
~ Copyright (C) 2020-2024 Rosemoe
~
~ This library is free software; you can redistribute it and/or
~ modify it under the terms of the GNU Lesser General Public
~ License as published by the Free Software Foundation; either
~ version 2.1 of the License, or (at your option) any later version.
~
~ This library is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
~ Lesser General Public License for more details.
~
~ You should have received a copy of the GNU Lesser General Public
~ License along with this library; if not, write to the Free Software
~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
~ USA
~
~ Please contact Rosemoe by email 2073412493@qq.com if you need
~ additional information or have any questions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@drawable/magnifier_background"
android:id="@+id/panel_root">
<HorizontalScrollView
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:id="@+id/panel_hv">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageButton
android:id="@+id/panel_btn_select_all"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/round_select_all_20"
android:background="#00000000" />
android:background="?selectableItemBackground" />
<ImageButton
android:id="@+id/panel_btn_copy"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/round_content_copy_20"
android:background="#00000000" />
android:background="?selectableItemBackground" />
<ImageButton
android:id="@+id/panel_btn_paste"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/round_content_paste_20"
android:background="#00000000" />
android:background="?selectableItemBackground" />
<ImageButton
android:id="@+id/panel_btn_long_select"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/editor_text_select_start"
android:background="#00000000" />
android:background="?selectableItemBackground" />
<ImageButton
android:id="@+id/panel_btn_cut"
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/round_content_cut_20"
android:background="#00000000" />
android:background="?selectableItemBackground" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>