From 9118d9bbf1dd7f05571aed8fc06f5b5c3bdc1dc9 Mon Sep 17 00:00:00 2001 From: aiselp Date: Fri, 6 Oct 2023 21:57:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BA=95=E9=83=A8=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E5=88=87=E6=8D=A2=E6=97=B6=EF=BC=8C=E5=B7=B2=E6=89=93?= =?UTF-8?q?=E5=BC=80=E7=9A=84=E6=96=87=E4=BB=B6=E7=9B=AE=E5=BD=95=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E4=B8=8D=E5=8F=98=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E9=A1=B5=E9=9D=A2=E2=80=98=E5=9B=9E=E5=88=B0=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E2=80=99=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/autojs/autojs/ui/explorer/ExplorerViewKt.kt | 2 +- .../org/autojs/autojs/ui/main/components/main_ui.kt | 10 ++++++++++ .../autojs/ui/main/scripts/ScriptListFragment.kt | 7 ++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/autojs/autojs/ui/explorer/ExplorerViewKt.kt b/app/src/main/java/org/autojs/autojs/ui/explorer/ExplorerViewKt.kt index 630123f29..e12f70779 100644 --- a/app/src/main/java/org/autojs/autojs/ui/explorer/ExplorerViewKt.kt +++ b/app/src/main/java/org/autojs/autojs/ui/explorer/ExplorerViewKt.kt @@ -22,7 +22,6 @@ import com.stardust.pio.PFiles import io.reactivex.Observable import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.schedulers.Schedulers -import org.autojs.autoxjs.R import org.autojs.autojs.model.explorer.* import org.autojs.autojs.model.script.ScriptFile import org.autojs.autojs.model.script.Scripts.edit @@ -38,6 +37,7 @@ import org.autojs.autojs.ui.viewmodel.ExplorerItemList import org.autojs.autojs.ui.viewmodel.ExplorerItemList.SortConfig import org.autojs.autojs.ui.widget.BindableViewHolder import org.autojs.autojs.workground.WrapContentGridLayoutManger +import org.autojs.autoxjs.R import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode import java.util.* diff --git a/app/src/main/java/org/autojs/autojs/ui/main/components/main_ui.kt b/app/src/main/java/org/autojs/autojs/ui/main/components/main_ui.kt index 89ea441d0..806775ec5 100644 --- a/app/src/main/java/org/autojs/autojs/ui/main/components/main_ui.kt +++ b/app/src/main/java/org/autojs/autojs/ui/main/components/main_ui.kt @@ -8,6 +8,7 @@ import androidx.compose.material.Icon import androidx.compose.material.IconButton import androidx.compose.material.Text import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Home import androidx.compose.material.icons.filled.MoreVert import androidx.compose.material.icons.filled.Refresh import androidx.compose.runtime.Composable @@ -20,6 +21,7 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import com.stardust.util.IntentUtil import org.autojs.autojs.ui.log.LogActivityKt +import org.autojs.autojs.ui.widget.WebDataKt import org.autojs.autoxjs.R //主界面日志按钮 @@ -49,6 +51,13 @@ fun DocumentPageMenuButton(getWebView:()-> WebView) { DropdownMenu( expanded = expanded, onDismissRequest = { expanded = false }) { + DropdownMenuItem(onClick = { + dismissMenu() + getWebView().loadUrl(WebDataKt.homepage) + }) { + Icon(Icons.Default.Home, contentDescription = null) + Text(text = "回到主页") + } DropdownMenuItem(onClick = { dismissMenu() getWebView().url?.let { @@ -63,6 +72,7 @@ fun DocumentPageMenuButton(getWebView:()-> WebView) { } DropdownMenuItem(onClick = { dismissMenu() + getWebView().clearCache(false) getWebView().reload() }) { Icon(Icons.Default.Refresh, contentDescription = null) diff --git a/app/src/main/java/org/autojs/autojs/ui/main/scripts/ScriptListFragment.kt b/app/src/main/java/org/autojs/autojs/ui/main/scripts/ScriptListFragment.kt index 041c26451..734c230c9 100644 --- a/app/src/main/java/org/autojs/autojs/ui/main/scripts/ScriptListFragment.kt +++ b/app/src/main/java/org/autojs/autojs/ui/main/scripts/ScriptListFragment.kt @@ -37,12 +37,12 @@ import org.autojs.autojs.external.fileprovider.AppFileProvider import org.autojs.autojs.model.explorer.ExplorerDirPage import org.autojs.autojs.model.explorer.Explorers import org.autojs.autojs.model.script.Scripts.edit +import org.autojs.autojs.ui.build.ProjectConfigActivity +import org.autojs.autojs.ui.build.ProjectConfigActivity_ import org.autojs.autojs.ui.common.ScriptOperations import org.autojs.autojs.ui.explorer.ExplorerViewKt import org.autojs.autojs.ui.main.rememberExternalStoragePermissionsState import org.autojs.autojs.ui.main.showExternalStoragePermissionToast -import org.autojs.autojs.ui.build.ProjectConfigActivity -import org.autojs.autojs.ui.build.ProjectConfigActivity_ import org.autojs.autojs.ui.viewmodel.ExplorerItemList.SortConfig import org.autojs.autojs.ui.widget.fillMaxSize import org.autojs.autoxjs.R @@ -60,6 +60,7 @@ class ScriptListFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { + explorerView.setUpViews() return ComposeView(requireContext()).apply { setContent { Scaffold( @@ -70,7 +71,7 @@ class ScriptListFragment : Fragment() { ) { AndroidView( modifier = Modifier.padding(it), - factory = { explorerView.apply { setUpViews() } } + factory = { explorerView } ) } }