mirror of
https://github.com/Cateners/tiny_computer.git
synced 2026-05-20 16:35:47 +08:00
Update signal 9 page
This commit is contained in:
@@ -73,6 +73,7 @@ android {
|
||||
buildFeatures {
|
||||
aidl true
|
||||
dataBinding true
|
||||
viewBinding true
|
||||
buildConfig true
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,10 @@
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name="com.example.tiny_computer.Signal9Activity" />
|
||||
<activity
|
||||
android:name=".Signal9Activity"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
|
||||
<provider
|
||||
android:name="com.example.tiny_computer.filepicker.TinyDocumentsProvider"
|
||||
android:authorities="com.example.tiny_computer.documents"
|
||||
|
||||
@@ -1,129 +1,62 @@
|
||||
package com.example.tiny_computer
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.ScrollView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import android.widget.LinearLayout
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import com.example.tiny_computer.databinding.ActivitySignal9Binding
|
||||
|
||||
class Signal9Activity : AppCompatActivity() {
|
||||
|
||||
private val helperLink = "https://www.vmos.cn/zhushou.htm"
|
||||
private val helperLink2 = "https://www.cnblogs.com/yejiuluo/articles/18271904"
|
||||
private lateinit var binding: ActivitySignal9Binding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivitySignal9Binding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
val rootLayout = LinearLayout(this).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT
|
||||
)
|
||||
gravity = Gravity.CENTER
|
||||
orientation = LinearLayout.VERTICAL
|
||||
setPadding(16, 16, 16, 16)
|
||||
setBackgroundColor(Color.parseColor("#4A148C"))
|
||||
}
|
||||
// 设置状态栏和导航栏颜色匹配蓝屏背景
|
||||
window.statusBarColor = ContextCompat.getColor(this, R.color.tc_s9a_blue_screen_blue)
|
||||
window.navigationBarColor = ContextCompat.getColor(this, R.color.tc_s9a_blue_screen_blue)
|
||||
|
||||
val scrollView = ScrollView(this).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
}
|
||||
|
||||
val fullScreen = LinearLayout(this).apply {
|
||||
layoutParams = LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
orientation = LinearLayout.VERTICAL
|
||||
setBackgroundColor(Color.parseColor("#4A148C"))
|
||||
}
|
||||
|
||||
val text1 = TextView(this).apply {
|
||||
text = ":(\n发生了什么?"
|
||||
textSize = 32f
|
||||
setTextColor(Color.WHITE)
|
||||
textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
}
|
||||
|
||||
val text2 = TextView(this).apply {
|
||||
text = "终端异常退出, 返回错误码9\n此错误通常是高版本安卓系统(12+)限制进程造成的, \n可以使用以下工具修复:"
|
||||
textSize = 16f
|
||||
setTextColor(Color.WHITE)
|
||||
textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
setPadding(0, 16, 0, 0)
|
||||
}
|
||||
|
||||
val helperLinkText = TextView(this).apply {
|
||||
text = helperLink
|
||||
textSize = 16f
|
||||
setTextColor(Color.WHITE)
|
||||
textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
setPadding(0, 16, 0, 0)
|
||||
setOnClickListener { copyToClipboard(helperLink) }
|
||||
}
|
||||
|
||||
val copyHintText = TextView(this).apply {
|
||||
text = "(复制链接到浏览器查看)"
|
||||
textSize = 16f
|
||||
setTextColor(Color.WHITE)
|
||||
textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
setPadding(0, 8, 0, 0)
|
||||
}
|
||||
|
||||
val copyButton = Button(this).apply {
|
||||
text = "复制"
|
||||
textSize = 16f
|
||||
setOnClickListener { copyToClipboard(helperLink) }
|
||||
}
|
||||
|
||||
val tutorialText = TextView(this).apply {
|
||||
text = "如果你的设备版本大于等于安卓14,可以在开发者选项里开启“停止限制子进程”选项即可,无需额外修复。\n\n如果不能解决请参考此教程: "
|
||||
textSize = 16f
|
||||
setTextColor(Color.WHITE)
|
||||
textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
setPadding(0, 16, 0, 0)
|
||||
}
|
||||
|
||||
val viewButton = Button(this).apply {
|
||||
text = "查看"
|
||||
textSize = 16f
|
||||
setOnClickListener { copyToClipboard(helperLink2) }
|
||||
}
|
||||
|
||||
rootLayout.addView(text1)
|
||||
rootLayout.addView(text2)
|
||||
rootLayout.addView(helperLinkText)
|
||||
rootLayout.addView(copyHintText)
|
||||
rootLayout.addView(copyButton)
|
||||
rootLayout.addView(tutorialText)
|
||||
rootLayout.addView(viewButton)
|
||||
|
||||
scrollView.addView(rootLayout)
|
||||
fullScreen.addView(scrollView)
|
||||
|
||||
setContentView(fullScreen)
|
||||
setupContent()
|
||||
}
|
||||
|
||||
private fun copyToClipboard(text: String) {
|
||||
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
val clip = ClipData.newPlainText("Copied Text", text)
|
||||
clipboard.setPrimaryClip(clip)
|
||||
Toast.makeText(this, "已复制", Toast.LENGTH_SHORT).show()
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(text))
|
||||
startActivity(this, intent, null)
|
||||
private fun setupContent() {
|
||||
// 设置错误信息
|
||||
binding.errorDetails.text = getString(R.string.tc_s9a_error_message)
|
||||
|
||||
// 根据Android版本显示不同的解决方案
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
// Android 14以下版本
|
||||
binding.preAndroid14Layout.isVisible = true
|
||||
binding.solutionIntro.text = getString(R.string.tc_s9a_solution_intro)
|
||||
binding.solutionAlternative.text = getString(R.string.tc_s9a_solution_alternative)
|
||||
binding.toolButton.text = getString(R.string.tc_s9a_tool_button)
|
||||
binding.tutorialButton.text = getString(R.string.tc_s9a_tutorial_button)
|
||||
|
||||
binding.toolButton.setOnClickListener {
|
||||
openBrowserLink("https://www.vmos.cn/zhushou.htm")
|
||||
}
|
||||
|
||||
binding.tutorialButton.setOnClickListener {
|
||||
openBrowserLink("https://gitee.com/caten/tc-hints/blob/master/pool/signal9fix.md")
|
||||
}
|
||||
} else {
|
||||
// Android 14及以上版本
|
||||
binding.solutionAndroid14.isVisible = true
|
||||
binding.solutionAndroid14.text = getString(R.string.tc_s9a_solution_android14)
|
||||
}
|
||||
}
|
||||
|
||||
private fun openBrowserLink(url: String) {
|
||||
if (url.isNotEmpty()) {
|
||||
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
startActivity(intent)
|
||||
}
|
||||
// 如果URL为空,则不执行任何操作(等待后续补充链接)
|
||||
}
|
||||
}
|
||||
85
android/app/src/main/res/layout/activity_signal_9.xml
Normal file
85
android/app/src/main/res/layout/activity_signal_9.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/tc_s9a_blue_screen_blue"
|
||||
tools:context=".Signal9Activity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/kaomoji_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/tc_s9a_kaomoji"
|
||||
android:textColor="@color/tc_s9a_white"
|
||||
android:textSize="96sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/error_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textColor="@color/tc_s9a_white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<!-- Android 14以下版本的内容 -->
|
||||
<LinearLayout
|
||||
android:id="@+id/pre_android14_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/solution_intro"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:textColor="@color/tc_s9a_white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tool_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:backgroundTint="@color/tc_s9a_white"
|
||||
android:textColor="@color/tc_s9a_blue_screen_blue" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/solution_alternative"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:textColor="@color/tc_s9a_white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/tutorial_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:backgroundTint="@color/tc_s9a_white"
|
||||
android:textColor="@color/tc_s9a_blue_screen_blue" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Android 14及以上版本的内容 -->
|
||||
<TextView
|
||||
android:id="@+id/solution_android14"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:textColor="@color/tc_s9a_white"
|
||||
android:textSize="16sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="tc_app_name">小小电脑</string>
|
||||
|
||||
<string name="tc_s9a_error_message">终端异常终止,返回错误码9。此错误是安卓12+系统限制子进程数量造成的,需要手动关闭限制。</string>
|
||||
<string name="tc_s9a_kaomoji">:(</string>
|
||||
<string name="tc_s9a_solution_intro">可以使用以下工具修复:</string>
|
||||
<string name="tc_s9a_solution_alternative">如果以上工具无法修复,或者设备为鸿蒙设备,请按照以下教程解决(需要电脑和数据线):</string>
|
||||
<string name="tc_s9a_tool_button">修复工具</string>
|
||||
<string name="tc_s9a_tutorial_button">教程链接</string>
|
||||
<string name="tc_s9a_solution_android14">请在设置应用中启用开发者选项(通常步骤是找到关于设备->系统版本->连续点击系统版本5次),然后在开发者选项中找到\"停止限制子进程\",打开开关即可。不同机型开启开发者选项的步骤可能略有不同,具体方法可在网络搜索。</string>
|
||||
</resources>
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="tc_app_name">小小電腦</string>
|
||||
|
||||
<string name="tc_s9a_error_message">終端異常終止,返回錯誤碼9。此錯誤是安卓12+系統限制子進程數量造成的,需要手動關閉限制。</string>
|
||||
<string name="tc_s9a_kaomoji">:(</string>
|
||||
<string name="tc_s9a_solution_intro">可以使用以下工具修復:</string>
|
||||
<string name="tc_s9a_solution_alternative">如果以上工具無法修復,或者設備為鴻蒙設備,請按照以下教程解決(需要電腦和數據線):</string>
|
||||
<string name="tc_s9a_tool_button">修復工具</string>
|
||||
<string name="tc_s9a_tutorial_button">教程鏈接</string>
|
||||
<string name="tc_s9a_solution_android14">請在設置應用中啟用開發者選項(通常步驟是找到關於設備->系統版本->連續點擊系統版本5次),然後在開發者選項中找到\"停止限制子進程\",打開開關即可。不同機型開啟開發者選項的步驟可能略有不同,具體方法可在網絡搜尋。</string>
|
||||
</resources>
|
||||
|
||||
5
android/app/src/main/res/values/colors.xml
Normal file
5
android/app/src/main/res/values/colors.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="tc_s9a_blue_screen_blue">#FF6F43C0</color>
|
||||
<color name="tc_s9a_white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
@@ -1,4 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="tc_app_name">Tiny Computer</string>
|
||||
|
||||
<string name="tc_s9a_error_message">Terminal terminated abnormally with error code 9. This error is caused by Android 12+ system limiting the number of child processes and requires manual removal of the restriction.</string>
|
||||
<string name="tc_s9a_kaomoji">:(</string>
|
||||
<string name="tc_s9a_solution_intro">You can use the following tool to fix:</string>
|
||||
<string name="tc_s9a_solution_alternative">If the above tool cannot fix the issue, or if the device is a Harmony device, please follow the tutorial below (requires a computer and data cable):</string>
|
||||
<string name="tc_s9a_tool_button">Repair Tool</string>
|
||||
<string name="tc_s9a_tutorial_button">Tutorial Link</string>
|
||||
<string name="tc_s9a_solution_android14">Please enable developer options in the Settings app (usually by going to About device -> System version -> tap System version 5 times continuously), then find "Stop restricting child processes" in developer options and turn on the switch. The steps to enable Developer Options may vary slightly depending on the device model. For specific methods, you can search online.</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user