更新最新版本的编辑器库
This commit is contained in:
parent
79207f7c5b
commit
4f2f2c4f7e
|
@ -103,8 +103,9 @@ dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
|
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
|
||||||
implementation project(path: ':library')
|
implementation project(path: ':library')
|
||||||
implementation project(':imageactivity')
|
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'
|
||||||
|
|
||||||
|
|
||||||
// 这个依赖项提供了一个有趣的功能,
|
// 这个依赖项提供了一个有趣的功能,
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.coldmint.rust.core.database.code.SectionInfo
|
||||||
import com.coldmint.rust.pro.adapters.CodeTableAdapter
|
import com.coldmint.rust.pro.adapters.CodeTableAdapter
|
||||||
import com.coldmint.rust.pro.base.BaseActivity
|
import com.coldmint.rust.pro.base.BaseActivity
|
||||||
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
import com.coldmint.rust.pro.databinding.ActivityCodeTableBinding
|
||||||
import com.muqing.muqing.gj
|
import com.muqing.gj
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
class CodeTableActivity : BaseActivity<ActivityCodeTableBinding>() {
|
||||||
|
|
|
@ -1072,7 +1072,7 @@ class EditActivity : BaseActivity<ActivityEditBinding>() {
|
||||||
AppSettings.getValue(AppSettings.Setting.CodeEditBackGroundEnable, false)
|
AppSettings.getValue(AppSettings.Setting.CodeEditBackGroundEnable, false)
|
||||||
val rustCompletionAdapter = RustCompletionAdapter()
|
val rustCompletionAdapter = RustCompletionAdapter()
|
||||||
rustCompletionAdapter.setEditBackground(codeEditBackGroundEnable)
|
rustCompletionAdapter.setEditBackground(codeEditBackGroundEnable)
|
||||||
viewBinding.codeEditor.setAutoCompletionItemAdapter(rustCompletionAdapter)
|
// viewBinding.codeEditor.setAutoCompletionItemAdapter(rustCompletionAdapter)
|
||||||
viewBinding.codeEditor.isVerticalScrollBarEnabled = false
|
viewBinding.codeEditor.isVerticalScrollBarEnabled = false
|
||||||
val path = viewModel.modClass?.modFile?.absolutePath ?: ""
|
val path = viewModel.modClass?.modFile?.absolutePath ?: ""
|
||||||
CompletionItemConverter.configurationFileConversion(
|
CompletionItemConverter.configurationFileConversion(
|
||||||
|
|
|
@ -9,7 +9,7 @@ import android.os.Bundle
|
||||||
import cat.ereza.customactivityoncrash.config.CaocConfig
|
import cat.ereza.customactivityoncrash.config.CaocConfig
|
||||||
import com.coldmint.rust.core.debug.LogCat
|
import com.coldmint.rust.core.debug.LogCat
|
||||||
import com.coldmint.rust.core.debug.LogCatObserver
|
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.coldmint.rust.pro.tool.AppSettings
|
||||||
import com.google.android.material.color.DynamicColors
|
import com.google.android.material.color.DynamicColors
|
||||||
import com.google.android.material.color.DynamicColorsOptions
|
import com.google.android.material.color.DynamicColorsOptions
|
||||||
|
|
|
@ -29,7 +29,7 @@ class RustLanguage() : Language, EnglishMode {
|
||||||
private val codeAutoCompleteJob: CodeAutoCompleteJob by lazy {
|
private val codeAutoCompleteJob: CodeAutoCompleteJob by lazy {
|
||||||
CodeAutoCompleteJob()
|
CodeAutoCompleteJob()
|
||||||
}
|
}
|
||||||
private val newlineHandler: Array<NewlineHandler> by lazy {
|
/* private val newlineHandler: Array<NewlineHandler> by lazy {
|
||||||
arrayOf(object : NewlineHandler {
|
arrayOf(object : NewlineHandler {
|
||||||
override fun matchesRequirement(beforeText: String?, afterText: String?): Boolean {
|
override fun matchesRequirement(beforeText: String?, afterText: String?): Boolean {
|
||||||
return true
|
return true
|
||||||
|
@ -53,8 +53,7 @@ class RustLanguage() : Language, EnglishMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}*/
|
||||||
/*
|
|
||||||
private val newlineHandler: Array<NewlineHandler> by lazy {
|
private val newlineHandler: Array<NewlineHandler> by lazy {
|
||||||
arrayOf(object : NewlineHandler {
|
arrayOf(object : NewlineHandler {
|
||||||
override fun matchesRequirement(text: Content, position: CharPosition, style: Styles?): Boolean {
|
override fun matchesRequirement(text: Content, position: CharPosition, style: Styles?): Boolean {
|
||||||
|
@ -75,7 +74,7 @@ class RustLanguage() : Language, EnglishMode {
|
||||||
return NewlineHandleResult(newText, 0)
|
return NewlineHandleResult(newText, 0)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,6 @@ class WarehouseFragment : BaseFragment<FragmentWarehouseBinding>() {
|
||||||
.onForwardToSettings { scope, deniedList ->
|
.onForwardToSettings { scope, deniedList ->
|
||||||
scope.showForwardToSettingsDialog(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) {
|
if (isAdded) {
|
||||||
val mainActivity = activity as MainActivity
|
val mainActivity = activity as MainActivity
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muqing.muqing;
|
package com.muqing;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.muqing.muqing;
|
package com.muqing;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
|
@ -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.annotation.SuppressLint;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.ClipData;
|
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.HandleStyleSideDrop;
|
||||||
import io.github.rosemoe.sora.widget.style.builtin.MoveCursorAnimator;
|
import io.github.rosemoe.sora.widget.style.builtin.MoveCursorAnimator;
|
||||||
import kotlin.text.StringsKt;
|
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")
|
@SuppressWarnings("unused")
|
||||||
public class CodeEditor extends View implements ContentListener, Formatter.FormatResultReceiver, LineRemoveListener {
|
public class CodeEditor extends View implements ContentListener, Formatter.FormatResultReceiver, LineRemoveListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default text size when creating the editor object. Unit is sp.
|
* The default text size when creating the editor object. Unit is sp.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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
|
// Since popup window does provide decor view, we have to pass null to this method
|
||||||
@SuppressLint("InflateParams")
|
@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);
|
ImageButton selectAll = root.findViewById(R.id.panel_btn_select_all);
|
||||||
cutBtn = root.findViewById(R.id.panel_btn_cut);
|
cutBtn = root.findViewById(R.id.panel_btn_cut);
|
||||||
copyBtn = root.findViewById(R.id.panel_btn_copy);
|
copyBtn = root.findViewById(R.id.panel_btn_copy);
|
||||||
|
|
|
@ -1,86 +1,56 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="@drawable/magnifier_background"
|
android:background="@drawable/magnifier_background"
|
||||||
android:id="@+id/panel_root">
|
android:id="@+id/panel_root">
|
||||||
|
|
||||||
<HorizontalScrollView
|
<HorizontalScrollView
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:id="@+id/panel_hv">
|
android:id="@+id/panel_hv">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:gravity="center_vertical">
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/panel_btn_select_all"
|
android:id="@+id/panel_btn_select_all"
|
||||||
android:layout_width="45dp"
|
android:layout_width="45dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:src="@drawable/round_select_all_20"
|
android:src="@drawable/round_select_all_20"
|
||||||
android:background="#00000000" />
|
android:background="?selectableItemBackground" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/panel_btn_copy"
|
android:id="@+id/panel_btn_copy"
|
||||||
android:layout_width="45dp"
|
android:layout_width="45dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:src="@drawable/round_content_copy_20"
|
android:src="@drawable/round_content_copy_20"
|
||||||
android:background="#00000000" />
|
android:background="?selectableItemBackground" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/panel_btn_paste"
|
android:id="@+id/panel_btn_paste"
|
||||||
android:layout_width="45dp"
|
android:layout_width="45dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:src="@drawable/round_content_paste_20"
|
android:src="@drawable/round_content_paste_20"
|
||||||
android:background="#00000000" />
|
android:background="?selectableItemBackground" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/panel_btn_long_select"
|
android:id="@+id/panel_btn_long_select"
|
||||||
android:layout_width="45dp"
|
android:layout_width="45dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:src="@drawable/editor_text_select_start"
|
android:src="@drawable/editor_text_select_start"
|
||||||
android:background="#00000000" />
|
android:background="?selectableItemBackground" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/panel_btn_cut"
|
android:id="@+id/panel_btn_cut"
|
||||||
android:layout_width="45dp"
|
android:layout_width="45dp"
|
||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:src="@drawable/round_content_cut_20"
|
android:src="@drawable/round_content_cut_20"
|
||||||
android:background="#00000000" />
|
android:background="?selectableItemBackground" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user