Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui优化 #688

Merged
merged 1 commit into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.*
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/org/autojs/autojs/ui/main/components/main_ui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

//主界面日志按钮
Expand Down Expand Up @@ -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 {
Expand All @@ -63,6 +72,7 @@ fun DocumentPageMenuButton(getWebView:()-> WebView) {
}
DropdownMenuItem(onClick = {
dismissMenu()
getWebView().clearCache(false)
getWebView().reload()
}) {
Icon(Icons.Default.Refresh, contentDescription = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -60,6 +60,7 @@ class ScriptListFragment : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
explorerView.setUpViews()
return ComposeView(requireContext()).apply {
setContent {
Scaffold(
Expand All @@ -70,7 +71,7 @@ class ScriptListFragment : Fragment() {
) {
AndroidView(
modifier = Modifier.padding(it),
factory = { explorerView.apply { setUpViews() } }
factory = { explorerView }
)
}
}
Expand Down
Loading