6.7.0 - Alpha17 - 浮动按钮 "运行脚本" 对话框增加 "主页" 菜单项

This commit is contained in:
SuperMonster003
2026-01-22 15:48:22 +08:00
parent 54a6a36d36
commit bff716897e
19 changed files with 68 additions and 12 deletions

View File

@@ -135,6 +135,10 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
ColorStateList.valueOf(context.getColor(R.color.explorer_file_operation_button))
}
private val mChevronIconTint by lazy {
ColorStateList.valueOf(context.getColor(R.color.explorer_category_operation_button))
}
// Request host dialog to hide/show without losing state.
// zh-CN: 请求宿主对话框隐藏/显示且不丢失状态.
private var mRequestHostDialogHide: Runnable? = null
@@ -349,7 +353,7 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
// # mCurrentPageState.scrollY = layoutManager.findLastCompletelyVisibleItemPosition();
currentPageState.scrollY = layoutManager.findFirstCompletelyVisibleItemPosition()
}
mPageStateHistories.push(currentPageState)
saveCurrentPageIntoHistory()
setCurrentPageState(ExplorerPageState(childItemGroup))
refreshCurrentPage()
}
@@ -515,7 +519,7 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
}
fun goUp() {
mPageStateHistories.push(currentPageState)
saveCurrentPageIntoHistory()
val currentPagePath = currentPage.path
val nextPagePath = if (Explorers.Providers.workspace().isCurrentSampleDir(currentDirectory)) {
path
@@ -526,6 +530,10 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
refreshCurrentPage()
}
fun saveCurrentPageIntoHistory() {
mPageStateHistories.push(currentPageState)
}
fun setDirectorySpanSize(directorySpanSize: Int) {
mDirectorySpanSize = directorySpanSize
}
@@ -1078,6 +1086,8 @@ open class ExplorerView : ThemeColorSwipeRefreshLayout, SwipeRefreshLayout.OnRef
init {
setOnClickListeners()
ImageViewCompat.setImageTintList(binding.arrowIcon, mChevronIconTint)
}
private fun setOnClickListeners() {

View File

@@ -7,6 +7,7 @@ import android.os.RemoteException;
import android.text.TextUtils;
import android.view.ContextThemeWrapper;
import android.view.View;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import com.afollestad.materialdialogs.MaterialDialog;
import com.makeramen.roundedimageview.RoundedImageView;
@@ -23,6 +24,7 @@ import org.autojs.autojs.core.pref.Pref;
import org.autojs.autojs.core.record.GlobalActionRecorder;
import org.autojs.autojs.core.record.Recorder;
import org.autojs.autojs.model.explorer.ExplorerDirPage;
import org.autojs.autojs.model.explorer.ExplorerPage;
import org.autojs.autojs.model.explorer.Explorers;
import org.autojs.autojs.model.script.Scripts;
import org.autojs.autojs.runtime.api.WrappedShizuku;
@@ -47,6 +49,8 @@ import org.jdeferred.impl.DeferredObject;
import org.jetbrains.annotations.NotNull;
import java.text.MessageFormat;
import java.util.List;
import java.util.Objects;
/**
* Created by Stardust on Oct 18, 2017.
@@ -149,6 +153,18 @@ public class CircularMenu implements LayoutInspector.CaptureAvailableListener {
mScriptListDialog = new MaterialDialog.Builder(mContext)
.title(R.string.text_run_script)
.titleColorRes(R.color.day_night)
.options(List.of(
new MaterialDialog.OptionMenuItemSpec(mContext.getString(R.string.dialog_button_homepage), (d) -> {
String homepage = WorkingDirectoryUtils.getPath();
ExplorerPage currentPageStatePage = mScriptListDialogExplorerView.currentPageState.getPage();
if (currentPageStatePage != null) {
if (!Objects.equals(currentPageStatePage.getPath(), homepage)) {
mScriptListDialogExplorerView.saveCurrentPageIntoHistory();
}
}
mScriptListDialogExplorerView.setExplorer(Explorers.workspace(), ExplorerDirPage.createRoot(homepage));
})
))
.customView(mScriptListDialogExplorerView, false)
.backgroundColorRes(R.color.window_background)
.neutralText(R.string.dialog_button_minimize)
@@ -160,15 +176,22 @@ public class CircularMenu implements LayoutInspector.CaptureAvailableListener {
.positiveColorRes(R.color.dialog_button_default)
.onPositive((dialog, which) -> {
dialog.dismiss();
mScriptListDialog = null;
mScriptListDialogExplorerView = null;
})
.cancelable(false)
.autoDismiss(false)
.dismissListener((di) -> {
mScriptListDialog = null;
mScriptListDialogExplorerView = null;
})
.build();
var scriptListDialog = mScriptListDialog;
ImageView optionsView = scriptListDialog.getOptionsView();
if (optionsView != null) {
optionsView.setImageTintList(ColorStateList.valueOf(mContext.getColor(R.color.dialog_options_button_tint)));
}
// Hide host dialog before launching Activity or showing secondary dialogs.
// zh-CN: 在启动 Activity 或显示二级对话框之前隐藏宿主对话框.
mScriptListDialogExplorerView.setRequestHostDialogHide(scriptListDialog::hide);

View File

@@ -26,7 +26,7 @@
android:layout_marginEnd="6dp"
android:src="@drawable/ic_expanded"
android:translationY="1.2dp"
app:tint="#828384" />
app:tint="@color/explorer_category_operation_button" />
<TextView
android:id="@+id/title"
@@ -34,7 +34,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/text_directory"
android:textColor="#828384"
android:textColor="@color/explorer_category_operation_button"
android:textSize="13sp" />
</LinearLayout>
@@ -50,7 +50,7 @@
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_dir_up"
android:focusable="true"
app:tint="#828384" />
app:tint="@color/explorer_category_operation_button" />
<ImageView
android:id="@+id/sort_order"
@@ -63,7 +63,7 @@
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_ascending_order"
android:focusable="true"
app:tint="#828384" />
app:tint="@color/explorer_category_operation_button" />
<ImageView
android:id="@+id/sort_type"
@@ -76,6 +76,6 @@
android:layout_marginHorizontal="3dp"
android:src="@drawable/ic_sort"
android:focusable="true"
app:tint="#828384" />
app:tint="@color/explorer_category_operation_button" />
</LinearLayout>

View File

@@ -1197,5 +1197,6 @@
<string name="text_screen_capture_request_delay">تأخير طلب إذن التقاط الشاشة</string>
<string name="description_screen_capture_request_delay">عند طلب إذن التقاط الشاشة، قد تحتوي نافذة طلب الإذن المنبثقة على حركة تلاشي عند اختفائها. إذا تم استدعاء `images.captureScreen` مباشرةً، فقد تتضمن لقطة الشاشة الناتجة محتوى نافذة طلب الإذن مما يسبب حجبًا.\n\nتضيف قيمة هذا الخيار مدة تأخير (بالمللي ثانية) قبل التقاط الشاشة مباشرةً بعد الحصول على الإذن، وذلك لتجنب مشكلة الحجب المذكورة أعلاه.\n\nينطبق هذا الخيار فقط على أول عملية التقاط بعد الحصول على الإذن؛ أما عمليات الالتقاط اللاحقة فلن تتأثر بهذه القيمة.</string>
<string name="text_delay_time">مدة التأخير</string>
<string name="dialog_button_homepage">الصفحة الرئيسية</string>
</resources>

View File

@@ -1192,5 +1192,6 @@
<string name="text_screen_capture_request_delay">Screen capture permission request delay</string>
<string name="description_screen_capture_request_delay">When requesting screen capture permission, the permission request window may include a fade-out animation when it disappears. If `images.captureScreen` is called immediately, the captured screenshot may contain the permission request window content and be obstructed.\n\nThe current option value adds a delay (in milliseconds) before capturing the screen immediately after permission is granted, which can be used to avoid the obstruction issue described above.\n\nThis option only applies to the first screenshot after screen capture permission is granted; subsequent screenshots are not affected by this value.</string>
<string name="text_delay_time">Delay time</string>
<string name="dialog_button_homepage">Homepage</string>
</resources>

View File

@@ -1195,5 +1195,6 @@
<string name="text_screen_capture_request_delay">Retraso de solicitud del permiso de captura de pantalla</string>
<string name="description_screen_capture_request_delay">Al solicitar el permiso de captura de pantalla, la ventana de solicitud de permiso mostrada puede tener una animación de desvanecimiento al desaparecer. Si se llama a `images.captureScreen` inmediatamente, la captura obtenida puede incluir el contenido de dicha ventana y quedar obstruida.\n\nEl valor de esta opción añade un tiempo de espera (en milisegundos) antes de capturar la pantalla inmediatamente después de obtener el permiso, para evitar el problema de obstrucción descrito.\n\nEsta opción solo se aplica a la primera captura tras obtener el permiso; las capturas posteriores no se verán afectadas por este valor.</string>
<string name="text_delay_time">Tiempo de retraso</string>
<string name="dialog_button_homepage">Inicio</string>
</resources>

View File

@@ -1195,5 +1195,6 @@
<string name="text_screen_capture_request_delay">Délai de demande d\'autorisation de capture d\'écran</string>
<string name="description_screen_capture_request_delay">Lors de la demande d\'autorisation de capture d\'écran, la fenêtre de demande affichée peut comporter une animation de fondu lors de sa disparition. Si `images.captureScreen` est appelé immédiatement, la capture obtenue peut contenir le contenu de cette fenêtre et être partiellement masquée.\n\nLa valeur de cette option ajoute un délai (en millisecondes) avant d\'effectuer la capture juste après l\'obtention de l\'autorisation, afin d\'éviter le problème de masquage ci-dessus.\n\nCette option ne s\'applique qu\'à la première capture après l\'obtention de l\'autorisation ; les captures suivantes ne seront plus affectées par cette valeur.</string>
<string name="text_delay_time">Délai</string>
<string name="dialog_button_homepage">Accueil</string>
</resources>

View File

@@ -1196,5 +1196,6 @@
<string name="text_screen_capture_request_delay">画面キャプチャ権限リクエスト遅延</string>
<string name="description_screen_capture_request_delay">画面キャプチャ権限を要求する際, 表示される権限リクエスト画面が閉じるときにフェード等のアニメーションが発生する場合があります. この直後に `images.captureScreen` を呼び出すと, 取得したスクリーンショットに権限リクエスト画面の内容が写り込み, 遮蔽が発生することがあります. \n\nこの設定値は, 権限取得直後に最初のスクリーンショットを取得する前に遅延時間(ミリ秒)を追加し, 上記の遮蔽問題を回避するために使用します. \n\nこの設定は権限取得後の最初のスクリーンショットにのみ適用され, 以降のスクリーンショットには影響しません.</string>
<string name="text_delay_time">遅延時間</string>
<string name="dialog_button_homepage">ホームページ</string>
</resources>

View File

@@ -1197,5 +1197,6 @@
<string name="text_screen_capture_request_delay">화면 캡처 권한 요청 지연</string>
<string name="description_screen_capture_request_delay">화면 캡처 권한을 요청할 때 표시되는 권한 요청 창은 사라질 때 페이드 등의 전환 애니메이션이 있을 수 있습니다. 이때 `images.captureScreen` 메서드를 즉시 호출하면, 얻은 스크린샷에 권한 요청 창의 내용이 포함되어 화면이 가려질 수 있습니다.\n\n이 설정 값은 권한을 획득한 직후 첫 스크린샷을 캡처하기 전에 지연 시간(밀리초)을 추가하여, 위와 같은 가림 문제를 방지하는 데 사용할 수 있습니다.\n\n이 설정은 권한 획득 후 첫 번째 캡처에만 적용되며, 이후 캡처에는 더 이상 영향을 주지 않습니다.</string>
<string name="text_delay_time">지연 시간</string>
<string name="dialog_button_homepage">홈페이지</string>
</resources>

View File

@@ -42,6 +42,8 @@
<color name="dialog_button_error">#4FC3F7</color>
<color name="dialog_button_failure">@color/dialog_button_error</color>
<color name="dialog_options_button_tint">#DEA9A9A9</color>
<color name="item_background">#333333</color>
<color name="item_background_dark">@color/dawn_full</color>
@@ -73,6 +75,7 @@
<color name="prefTextColorSecondary">#808080</color>
<color name="explorer_file_operation_button">@color/md_gray_600</color>
<color name="explorer_category_operation_button">@color/md_gray_500</color>
<color name="project_toolbar_button">#A9AAAB</color>
<color name="project_toolbar_title">#A9AAAB</color>

View File

@@ -1195,5 +1195,6 @@
<string name="text_screen_capture_request_delay">Задержка запроса разрешения на захват экрана</string>
<string name="description_screen_capture_request_delay">При запросе разрешения на захват экрана отображаемое окно запроса может иметь анимацию затухания при исчезновении. Если сразу вызвать `images.captureScreen`, полученный снимок может содержать содержимое этого окна и быть частично перекрыт.\n\nЗначение этой опции добавляет задержку (в миллисекундах) перед выполнением снимка экрана сразу после получения разрешения, что позволяет избежать описанной выше проблемы перекрытия.\n\nЭта опция применяется только к первому снимку после получения разрешения; последующие снимки не будут зависеть от этого значения.</string>
<string name="text_delay_time">Время задержки</string>
<string name="dialog_button_homepage">Главная</string>
</resources>

View File

@@ -1193,5 +1193,6 @@
<string name="text_screen_capture_request_delay">屏幕捕獲權限申請延遲</string>
<string name="description_screen_capture_request_delay">申請屏幕捕獲權限時, 彈出的權限申請窗口消失時可能存在漸變動畫, 此時如果立即調用 `images.captureScreen` 方法, 獲取的屏幕截圖中會出現權限申請的窗口內容而造成遮擋.\n\n當前設置選項值用於在截圖權限申請後立即獲取屏幕截圖前增加一個延遲時間 (單位為毫秒), 可用於避免上述遮擋問題.\n\n當前設置選項僅適用於獲取截圖權限後的首次截圖操作, 後續截圖操作不再受此設置值影響.</string>
<string name="text_delay_time">延遲時間</string>
<string name="dialog_button_homepage">主頁</string>
</resources>

View File

@@ -1193,5 +1193,6 @@
<string name="text_screen_capture_request_delay">螢幕捕獲許可權申請延遲</string>
<string name="description_screen_capture_request_delay">申請螢幕捕獲許可權時, 彈出的許可權申請視窗消失時可能存在漸變動畫, 此時如果立即呼叫 `images.captureScreen` 方法, 獲取的螢幕截圖中會出現許可權申請的視窗內容而造成遮擋.\n\n當前設定選項值用於在截圖許可權申請後立即獲取螢幕截圖前增加一個延遲時間 (單位為毫秒), 可用於避免上述遮擋問題.\n\n當前設定選項僅適用於獲取截圖許可權後的首次截圖操作, 後續截圖操作不再受此設定值影響.</string>
<string name="text_delay_time">延遲時間</string>
<string name="dialog_button_homepage">主頁</string>
</resources>

View File

@@ -1193,5 +1193,6 @@
<string name="text_screen_capture_request_delay">屏幕捕获权限申请延迟</string>
<string name="description_screen_capture_request_delay">申请屏幕捕获权限时, 弹出的权限申请窗口消失时可能存在渐变动画, 此时如果立即调用 `images.captureScreen` 方法, 获取的屏幕截图中会出现权限申请的窗口内容而造成遮挡.\n\n当前设置选项值用于在截图权限申请后立即获取屏幕截图前增加一个延迟时间 (单位为毫秒), 可用于避免上述遮挡问题.\n\n当前设置选项仅适用于获取截图权限后的首次截图操作, 后续截图操作不再受此设置值影响.</string>
<string name="text_delay_time">延迟时间</string>
<string name="dialog_button_homepage">主页</string>
</resources>

View File

@@ -121,6 +121,8 @@
<color name="dialog_progress_success_bg_tint">#DCEDC8</color>
<color name="dialog_progress_success_tint">#00C853</color>
<color name="dialog_options_button_tint">@color/day</color>
<color name="item_background">#FAFAFA</color>
<color name="item_background_dark">#FAFAFA</color>
@@ -170,6 +172,7 @@
<color name="prefTextColorSecondary">#9DA0A2</color>
<color name="explorer_file_operation_button">#A9AAAB</color>
<color name="explorer_category_operation_button">#828384</color>
<color name="project_toolbar_button">#606366</color>
<color name="project_toolbar_title">#606366</color>

View File

@@ -1451,5 +1451,6 @@
<string name="text_screen_capture_request_delay">Screen capture permission request delay</string>
<string name="description_screen_capture_request_delay">When requesting screen capture permission, the permission request window may include a fade-out animation when it disappears. If `images.captureScreen` is called immediately, the captured screenshot may contain the permission request window content and be obstructed.\n\nThe current option value adds a delay (in milliseconds) before capturing the screen immediately after permission is granted, which can be used to avoid the obstruction issue described above.\n\nThis option only applies to the first screenshot after screen capture permission is granted; subsequent screenshots are not affected by this value.</string>
<string name="text_delay_time">Delay time</string>
<string name="dialog_button_homepage">Homepage</string>
</resources>