- Remove unused import and code

This commit is contained in:
moreoronce 2024-10-06 21:21:11 +08:00
parent aea98ecf6f
commit 80fccdd2d6
4 changed files with 9 additions and 47 deletions

View file

@ -3,11 +3,12 @@ package com.example.lobchat
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.webkit.* import android.webkit.WebSettings
import androidx.appcompat.app.AppCompatActivity import android.webkit.WebView
import android.widget.Toast
import android.widget.EditText
import android.widget.Button import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
@ -44,20 +45,6 @@ class MainActivity : AppCompatActivity() {
webSettings.javaScriptEnabled = true webSettings.javaScriptEnabled = true
webSettings.domStorageEnabled = true webSettings.domStorageEnabled = true
// // 初始化文件选择器启动器
// fileChooserLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
// if (result.resultCode == Activity.RESULT_OK && result.data != null) {
// val resultUri = result.data?.data
// if (filePathCallback != null) {
// filePathCallback?.onReceiveValue(resultUri?.let { arrayOf(it) })
// filePathCallback = null
// }
// } else {
// filePathCallback?.onReceiveValue(null)
// filePathCallback = null
// }
// }
// 点击按钮后加载用户输入的 URL // 点击按钮后加载用户输入的 URL
loadUrlButton.setOnClickListener { loadUrlButton.setOnClickListener {
val url = urlInput.text.toString().trim() val url = urlInput.text.toString().trim()

View file

@ -59,7 +59,8 @@ class WebViewActivity : AppCompatActivity() {
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean { override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
// 当 URL 变化时重置 isFinalUrlLoaded 标志 // 当 URL 变化时重置 isFinalUrlLoaded 标志
isFinalUrlLoaded = false isFinalUrlLoaded = false
return false // 返回 false 表示允许 WebView 处理请求 // 返回 false 表示允许 WebView 处理请求
return false
} }
override fun onPageFinished(view: WebView?, url: String?) { override fun onPageFinished(view: WebView?, url: String?) {
@ -75,7 +76,8 @@ class WebViewActivity : AppCompatActivity() {
""".trimIndent() """.trimIndent()
) { result -> ) { result ->
if (result == "true") { if (result == "true") {
isLobeChatVerified = true // 验证通过,不再继续验证 // 验证通过,不再继续验证
isLobeChatVerified = true
Toast.makeText(this@WebViewActivity, "LobeChat validation passed", Toast.LENGTH_SHORT).show() Toast.makeText(this@WebViewActivity, "LobeChat validation passed", Toast.LENGTH_SHORT).show()
} else { } else {
Toast.makeText(this@WebViewActivity, "The webpage does not contain the required LobeChat text in the header.", Toast.LENGTH_LONG).show() Toast.makeText(this@WebViewActivity, "The webpage does not contain the required LobeChat text in the header.", Toast.LENGTH_LONG).show()

View file

@ -1,6 +1,5 @@
package com.example.lobchat.ui.theme package com.example.lobchat.ui.theme
import android.app.Activity
import android.os.Build import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@ -21,16 +20,6 @@ private val LightColorScheme = lightColorScheme(
primary = Purple40, primary = Purple40,
secondary = PurpleGrey40, secondary = PurpleGrey40,
tertiary = Pink40 tertiary = Pink40
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
) )
@Composable @Composable

View file

@ -15,20 +15,4 @@ val Typography = Typography(
lineHeight = 24.sp, lineHeight = 24.sp,
letterSpacing = 0.5.sp letterSpacing = 0.5.sp
) )
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
) )