mirror of
https://github.com/fcitx5-android/fcitx5-android.git
synced 2026-08-02 04:44:35 +08:00
Minor cleanups
- tidy fdroid actions workflow - remove unused fields in WrappedRunnable - remove unused components from manifest; also comment about intent-filter path - cleanup pluign AboutActivity
This commit is contained in:
parent
c68c4578b1
commit
e36100c448
5
.github/workflows/fdroid.yml
vendored
5
.github/workflows/fdroid.yml
vendored
@ -90,11 +90,6 @@ jobs:
|
||||
(.versionCode = $versionCode) |=
|
||||
(.commit = \"$commitHash\")
|
||||
" $metadata
|
||||
# TODO: remove this afterwards
|
||||
# https://github.com/orgs/community/discussions/26676
|
||||
yq -i ".Builds[0] |=
|
||||
(.commit = \"${{ github.event.pull_request.head.sha }}\")
|
||||
" $metadata
|
||||
prebuiltTreeURL=$(curl -L \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Authorization: Bearer ${{ github.token }}" \
|
||||
|
||||
@ -87,6 +87,10 @@
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:host="*" />
|
||||
<!--
|
||||
there has to be so many segments:
|
||||
https://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension/8599921#8599921
|
||||
-->
|
||||
<data android:pathPattern=".*\\.dict" />
|
||||
<data android:pathPattern=".*\\..*\\.dict" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.dict" />
|
||||
@ -99,6 +103,10 @@
|
||||
<data android:pathPattern=".*\\..*\\.txt" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.txt" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\.txt" />
|
||||
<!-- pathSuffix works on API 31+ -->
|
||||
<data android:pathSuffix=".dict" />
|
||||
<data android:pathSuffix=".scel" />
|
||||
<data android:pathSuffix=".txt" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
@ -149,12 +157,22 @@
|
||||
</intent-filter>
|
||||
</provider>
|
||||
|
||||
<!-- remove unneeded components from com.canhub.cropper -->
|
||||
<!--suppress DeprecatedClassUsageInspection -->
|
||||
<activity
|
||||
android:name="com.canhub.cropper.CropImageActivity"
|
||||
tools:node="remove" />
|
||||
|
||||
<provider
|
||||
android:name="com.canhub.cropper.CropFileProvider"
|
||||
android:authorities="${applicationId}.cropper.fileprovider"
|
||||
tools:node="remove" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.startup.InitializationProvider"
|
||||
android:authorities="${applicationId}.androidx-startup"
|
||||
android:directBootAware="true"
|
||||
android:exported="false"
|
||||
tools:ignore="MissingClass"
|
||||
tools:node="merge">
|
||||
<!-- do not inject splitties AppCompat -->
|
||||
<meta-data
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
* SPDX-FileCopyrightText: Copyright 2021-2023 Fcitx5 for Android Contributors
|
||||
* SPDX-FileCopyrightText: Copyright 2021-2025 Fcitx5 for Android Contributors
|
||||
*/
|
||||
package org.fcitx.fcitx5.android.core
|
||||
|
||||
@ -21,23 +21,18 @@ import kotlin.coroutines.CoroutineContext
|
||||
|
||||
class FcitxDispatcher(private val controller: FcitxController) : CoroutineDispatcher() {
|
||||
|
||||
class WrappedRunnable(private val runnable: Runnable, private val name: String? = null) :
|
||||
Runnable by runnable {
|
||||
class WrappedRunnable(private val runnable: Runnable) : Runnable by runnable {
|
||||
private val time = System.currentTimeMillis()
|
||||
var started = false
|
||||
private set
|
||||
|
||||
private val delta
|
||||
get() = System.currentTimeMillis() - time
|
||||
|
||||
override fun run() {
|
||||
if (delta > JOB_WAITING_LIMIT)
|
||||
Timber.w("${toString()} has waited $delta ms to get run since created!")
|
||||
started = true
|
||||
val delta = System.currentTimeMillis() - time
|
||||
if (delta > JOB_WAITING_LIMIT) {
|
||||
Timber.w("$this has waited $delta ms to get run since created!")
|
||||
}
|
||||
runnable.run()
|
||||
}
|
||||
|
||||
override fun toString(): String = "WrappedRunnable[${name ?: hashCode()}]"
|
||||
override fun toString(): String = "WrappedRunnable[${hashCode()}]"
|
||||
}
|
||||
|
||||
// this is fcitx main thread
|
||||
|
||||
@ -11,7 +11,6 @@ import android.annotation.SuppressLint
|
||||
import android.app.AlertDialog
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
@ -67,7 +66,7 @@ class AboutActivity : PreferenceActivity() {
|
||||
class AboutContentFragment : PreferenceFragment() {
|
||||
|
||||
private val copyPreferenceSummaryListener = OnPreferenceClickListener {
|
||||
(context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)
|
||||
context.getSystemService(ClipboardManager::class.java)
|
||||
.setPrimaryClip(ClipData.newPlainText("", it.summary))
|
||||
Toast.makeText(context, R.string.copied, Toast.LENGTH_SHORT).show()
|
||||
true
|
||||
@ -117,7 +116,7 @@ class AboutActivity : PreferenceActivity() {
|
||||
if (pluginXmlRes == 0) return
|
||||
val parser = resources.getXml(pluginXmlRes)
|
||||
var eventType = parser.eventType
|
||||
var domain = ""
|
||||
var gettextDomain = ""
|
||||
var apiVersion = ""
|
||||
var description = ""
|
||||
var text = ""
|
||||
@ -127,7 +126,7 @@ class AboutActivity : PreferenceActivity() {
|
||||
XmlPullParser.TEXT -> text = parser.text
|
||||
XmlPullParser.END_TAG -> when (parser.name) {
|
||||
"apiVersion" -> apiVersion = text
|
||||
"domain" -> domain = text
|
||||
"domain" -> gettextDomain = text
|
||||
"description" -> description = text.let {
|
||||
if (it.startsWith("@string/")) {
|
||||
val resName = it.removePrefix("@string/")
|
||||
@ -143,7 +142,9 @@ class AboutActivity : PreferenceActivity() {
|
||||
screen.addCategory(R.string.plugin_info) {
|
||||
addPreference(R.string.pkg_name, pkg)
|
||||
addPreference(R.string.api_version, apiVersion)
|
||||
addPreference(R.string.gettext_domain, domain)
|
||||
if (gettextDomain.isNotBlank()) {
|
||||
addPreference(R.string.gettext_domain, gettextDomain)
|
||||
}
|
||||
addPreference(R.string.plugin_description, description)
|
||||
addPreference(R.string.has_service, hasService.toString())
|
||||
}
|
||||
@ -220,6 +221,7 @@ class AboutActivity : PreferenceActivity() {
|
||||
|
||||
private fun showLicenseContent(license: License) {
|
||||
if (license.url?.isNotBlank() == true) {
|
||||
@SuppressLint("UseKtx")
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(license.url)))
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user