From 4f2f2c4f7ee25e55b6d545846e6fc07359f2dedc Mon Sep 17 00:00:00 2001 From: muqing <1966944300@qq.com> Date: Sat, 17 Feb 2024 19:52:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9C=80=E6=96=B0=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E7=BC=96=E8=BE=91=E5=99=A8=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 5 ++- .../coldmint/rust/pro/CodeTableActivity.kt | 2 +- .../com/coldmint/rust/pro/EditActivity.kt | 2 +- .../com/coldmint/rust/pro/RustApplication.kt | 2 +- .../coldmint/rust/pro/edit/RustLanguage.kt | 7 ++-- .../rust/pro/fragments/WarehouseFragment.kt | 7 ---- .../main/java/com/muqing/{muqing => }/gj.java | 2 +- .../main/java/com/muqing/{muqing => }/wj.java | 2 +- .../rosemoe/sora/widget/CodeEditor.java | 38 +---------------- .../component/EditorTextActionWindow.java | 3 +- .../main/res/layout/text_compose_panel.xml | 42 +++---------------- 11 files changed, 20 insertions(+), 92 deletions(-) rename app/src/main/java/com/muqing/{muqing => }/gj.java (99%) rename app/src/main/java/com/muqing/{muqing => }/wj.java (99%) diff --git a/app/build.gradle b/app/build.gradle index ebcaf8f..f21a67f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' // 这个依赖项提供了一个有趣的功能, diff --git a/app/src/main/java/com/coldmint/rust/pro/CodeTableActivity.kt b/app/src/main/java/com/coldmint/rust/pro/CodeTableActivity.kt index 23975a5..70bf7c0 100644 --- a/app/src/main/java/com/coldmint/rust/pro/CodeTableActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/CodeTableActivity.kt @@ -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() { diff --git a/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt b/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt index 3aaa5a6..6a7d39f 100644 --- a/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt +++ b/app/src/main/java/com/coldmint/rust/pro/EditActivity.kt @@ -1072,7 +1072,7 @@ class EditActivity : BaseActivity() { 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( diff --git a/app/src/main/java/com/coldmint/rust/pro/RustApplication.kt b/app/src/main/java/com/coldmint/rust/pro/RustApplication.kt index 786a6c8..6cebc32 100644 --- a/app/src/main/java/com/coldmint/rust/pro/RustApplication.kt +++ b/app/src/main/java/com/coldmint/rust/pro/RustApplication.kt @@ -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 diff --git a/app/src/main/java/com/coldmint/rust/pro/edit/RustLanguage.kt b/app/src/main/java/com/coldmint/rust/pro/edit/RustLanguage.kt index bf410f1..fcb5454 100644 --- a/app/src/main/java/com/coldmint/rust/pro/edit/RustLanguage.kt +++ b/app/src/main/java/com/coldmint/rust/pro/edit/RustLanguage.kt @@ -29,7 +29,7 @@ class RustLanguage() : Language, EnglishMode { private val codeAutoCompleteJob: CodeAutoCompleteJob by lazy { CodeAutoCompleteJob() } - private val newlineHandler: Array by lazy { +/* private val newlineHandler: Array 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 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) } }) - }*/ + } diff --git a/app/src/main/java/com/coldmint/rust/pro/fragments/WarehouseFragment.kt b/app/src/main/java/com/coldmint/rust/pro/fragments/WarehouseFragment.kt index f4f95c8..a97d814 100644 --- a/app/src/main/java/com/coldmint/rust/pro/fragments/WarehouseFragment.kt +++ b/app/src/main/java/com/coldmint/rust/pro/fragments/WarehouseFragment.kt @@ -46,13 +46,6 @@ class WarehouseFragment : BaseFragment() { .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 diff --git a/app/src/main/java/com/muqing/muqing/gj.java b/app/src/main/java/com/muqing/gj.java similarity index 99% rename from app/src/main/java/com/muqing/muqing/gj.java rename to app/src/main/java/com/muqing/gj.java index a9073cb..3778df3 100644 --- a/app/src/main/java/com/muqing/muqing/gj.java +++ b/app/src/main/java/com/muqing/gj.java @@ -1,4 +1,4 @@ -package com.muqing.muqing; +package com.muqing; import android.annotation.SuppressLint; import android.content.ClipData; diff --git a/app/src/main/java/com/muqing/muqing/wj.java b/app/src/main/java/com/muqing/wj.java similarity index 99% rename from app/src/main/java/com/muqing/muqing/wj.java rename to app/src/main/java/com/muqing/wj.java index 8d9514d..a8ef779 100644 --- a/app/src/main/java/com/muqing/muqing/wj.java +++ b/app/src/main/java/com/muqing/wj.java @@ -1,4 +1,4 @@ -package com.muqing.muqing; +package com.muqing; import android.content.Context; import android.os.Build; diff --git a/editor/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java b/editor/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java index c45832e..46775a2 100644 --- a/editor/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java +++ b/editor/src/main/java/io/github/rosemoe/sora/widget/CodeEditor.java @@ -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 GitHub - *

- * 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. */ diff --git a/editor/src/main/java/io/github/rosemoe/sora/widget/component/EditorTextActionWindow.java b/editor/src/main/java/io/github/rosemoe/sora/widget/component/EditorTextActionWindow.java index a54d903..9b082fe 100644 --- a/editor/src/main/java/io/github/rosemoe/sora/widget/component/EditorTextActionWindow.java +++ b/editor/src/main/java/io/github/rosemoe/sora/widget/component/EditorTextActionWindow.java @@ -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); diff --git a/editor/src/main/res/layout/text_compose_panel.xml b/editor/src/main/res/layout/text_compose_panel.xml index a708451..74d1f90 100644 --- a/editor/src/main/res/layout/text_compose_panel.xml +++ b/editor/src/main/res/layout/text_compose_panel.xml @@ -1,86 +1,56 @@ - - - - - + android:background="?selectableItemBackground" /> + android:background="?selectableItemBackground" /> + android:background="?selectableItemBackground" /> + android:background="?selectableItemBackground" /> - + android:background="?selectableItemBackground" /> - -