6.6.3 - Alpha2 - 优化主页抽屉在横向屏幕或超宽屏幕的宽度适应性
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
"README.md 中部分语言日期格式不正确的问题"
|
||||
],
|
||||
"improvement": [
|
||||
"主页抽屉在横向屏幕或超宽屏幕的宽度适应性",
|
||||
"关于应用与开发者页面增加水平布局及小屏布局适配",
|
||||
"文件管理器浮动按钮展开后点击其他区域可自动隐藏",
|
||||
"打包单文件时自动读取并勾选已安装应用的声明权限 _[`issue #362`](http://issues.autojs6.com/362)_",
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.autojs.autojs.ui.fragment.BindingDelegates.viewBinding
|
||||
import org.autojs.autojs.ui.main.MainActivity
|
||||
import org.autojs.autojs.ui.settings.AboutActivity
|
||||
import org.autojs.autojs.ui.settings.PreferencesActivity
|
||||
import org.autojs.autojs.util.DisplayUtils
|
||||
import org.autojs.autojs.util.NetworkUtils
|
||||
import org.autojs.autojs.util.ViewUtils
|
||||
import org.autojs.autojs.util.ViewUtils.MODE
|
||||
@@ -47,6 +48,7 @@ import org.autojs.autojs6.databinding.FragmentDrawerBinding
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import java.lang.ref.WeakReference
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
* Created by Stardust on Jan 30, 2017.
|
||||
@@ -390,11 +392,21 @@ open class DrawerFragment : Fragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
mDrawerMenu = binding.drawerMenu
|
||||
configureDrawerWidth()
|
||||
initMenuItems()
|
||||
initMenuItemStates()
|
||||
setupListeners()
|
||||
}
|
||||
|
||||
private fun configureDrawerWidth() {
|
||||
val screenWidthDp = resources.configuration.screenWidthDp
|
||||
val targetWidthPx = 288f.coerceIn(
|
||||
screenWidthDp * 0.4f,
|
||||
screenWidthDp * 0.9f,
|
||||
).let { DisplayUtils.dpToPx(it) }.roundToInt()
|
||||
binding.drawerMenuContainer.layoutParams.width = targetWidthPx
|
||||
}
|
||||
|
||||
private fun setupListeners() {
|
||||
binding.settings.setOnClickListener { view ->
|
||||
startActivity(
|
||||
|
||||
@@ -1,119 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="288dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:windowBackground"
|
||||
android:clickable="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:importantForAccessibility="no"
|
||||
android:orientation="vertical"
|
||||
android:focusable="true">
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_menu_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?android:windowBackground"
|
||||
android:clickable="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:focusable="true"
|
||||
android:importantForAccessibility="no"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/drawer_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
android:id="@+id/drawer_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:divider" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?android:divider" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="41dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:baselineAligned="false">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="41dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
android:id="@+id/settings"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_ali_settings"
|
||||
app:tint="?android:textColorPrimary"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_ali_settings"
|
||||
app:tint="?android:textColorPrimary"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_settings"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="15sp" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_settings"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/restart"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
android:id="@+id/restart"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_refresh_white_24dp"
|
||||
app:tint="?android:textColorPrimary"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_refresh_white_24dp"
|
||||
app:tint="?android:textColorPrimary"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_restart_app"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="15sp" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_restart_app"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="15sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/exit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
android:id="@+id/exit"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_ali_exit"
|
||||
app:tint="?android:textColorPrimary"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:src="@drawable/ic_ali_exit"
|
||||
app:tint="?android:textColorPrimary"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_exit"
|
||||
android:textSize="15sp" />
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:gravity="center"
|
||||
android:text="@string/text_exit"
|
||||
android:textSize="15sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user