From de66321ea84ca0fbf3b7fb8790cd8258234a2fc9 Mon Sep 17 00:00:00 2001
From: kangshulong <1095887643@qq.com>
Date: Tue, 24 Mar 2026 14:10:21 +0800
Subject: [PATCH] =?UTF-8?q?1.=E5=BC=80=E6=9C=BA=E6=88=96=E6=8C=89Home?=
=?UTF-8?q?=E9=94=AE=E9=BB=98=E8=AE=A4Layout=5Fvideo=E7=AC=AC1=E4=B8=AA?=
=?UTF-8?q?=E5=B9=BF=E5=91=8A=E4=BD=8D=E8=8E=B7=E5=8F=96=E7=84=A6=E7=82=B9?=
=?UTF-8?q?=EF=BC=8C=E4=BB=BB=E6=84=8F=E6=8C=89=E9=92=AE=E5=B9=B6=E4=B8=94?=
=?UTF-8?q?=E8=BF=9B=E5=85=A5=E7=AC=AC=E4=B8=89=E6=96=B9=E5=BA=94=E7=94=A8?=
=?UTF-8?q?=E8=BF=94=E5=9B=9E=E4=B9=9F=E6=98=AF=E7=AC=AC1=E4=B8=AA?=
=?UTF-8?q?=E5=B9=BF=E5=91=8A=E4=BD=8D=E8=8E=B7=E5=8F=96=E7=84=A6=E7=82=B9?=
=?UTF-8?q?=202.=E4=B8=BB=E9=A1=B5=E5=8A=A0=E5=8F=B7=E5=B1=95=E5=BC=80?=
=?UTF-8?q?=E5=90=8E=E8=BF=94=E5=9B=9E=E6=97=B6=E5=8F=96=E6=B6=881-10?=
=?UTF-8?q?=E9=9A=8F=E6=9C=BA=E7=BC=A9=E5=B0=8F=E5=8A=A8=E7=94=BB=EF=BC=8C?=
=?UTF-8?q?=E7=84=A6=E7=82=B9=E5=AE=9A=E4=BD=8D=E4=BA=8Egv=5Fshort?=
=?UTF-8?q?=E4=B8=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../java/com/ik/mboxlauncher/ui/Launcher.java | 26 ++++++++++++++++---
.../ik/mboxlauncher/view/HomeMultiView.java | 12 +++++++--
.../res/layout-sw480dp/layout_rect_group1.xml | 4 ++-
.../res/layout-sw540dp/layout_rect_group1.xml | 4 ++-
.../res/layout-sw720dp/layout_rect_group1.xml | 4 ++-
.../main/res/layout/layout_rect_group1.xml | 4 ++-
6 files changed, 45 insertions(+), 9 deletions(-)
diff --git a/app/src/main/java/com/ik/mboxlauncher/ui/Launcher.java b/app/src/main/java/com/ik/mboxlauncher/ui/Launcher.java
index 8f9cf25..8491b8b 100644
--- a/app/src/main/java/com/ik/mboxlauncher/ui/Launcher.java
+++ b/app/src/main/java/com/ik/mboxlauncher/ui/Launcher.java
@@ -61,6 +61,7 @@ import com.ik.mboxlauncher.ui.fragment.AppsFragment;
import com.ik.mboxlauncher.ui.fragment.MusicFragment;
import com.ik.mboxlauncher.ui.fragment.RecommendFragment;
import com.ik.mboxlauncher.ui.fragment.VideoFragment;
+import com.ik.mboxlauncher.view.HomeMultiView;
import com.ik.mboxlauncher.view.MultiView;
import com.ik.mboxlauncher.view.CustomRecyclerView;
import com.ik.mboxlauncher.view.SplashView;
@@ -211,6 +212,9 @@ public class Launcher extends FragmentActivity implements SplashView.SplashAdLi
LogUtils.loge("open app custom view");
if(selectIndex == 0){
gotoAction(AppsFragment.ACTION);
+ handler.postDelayed(()->{
+ layout_video.requestFocus();
+ },120);
} else {
if (!isShowCustomApp()) {
showCustomApps();
@@ -220,6 +224,9 @@ public class Launcher extends FragmentActivity implements SplashView.SplashAdLi
}else {
LogUtils.loge("open app package name is "+shortAppInfoBean.getPackageName());
IntentUtil.startApp(Launcher.this,shortAppInfoBean.getPackageName(),getResources().getString(R.string.app_not_exist));
+ handler.postDelayed(()->{
+ layout_video.requestFocus();
+ },120);
}
}
});
@@ -268,7 +275,6 @@ public class Launcher extends FragmentActivity implements SplashView.SplashAdLi
gv_shortcut.setAdapter(mShortAppInfoAdapter);
gv_shortcut.setCanFocusOutHorizontal(false);
gv_shortcut.setCanFocusOutVertical(true);
-
GridLayoutManager customLayoutManager = new GridLayoutManager(Launcher.this,9);
grid_coustom_apps.setLayoutManager(customLayoutManager);
grid_coustom_apps.setAdapter(mCustomAppAdapter);
@@ -323,6 +329,9 @@ public class Launcher extends FragmentActivity implements SplashView.SplashAdLi
// }
mHomeHeight = findViewById(R.id.layout_homepage).getHeight();
+ if(!isShowCustomApp()){
+ layout_video.requestFocus();
+ }
}
@Override
@@ -915,6 +924,7 @@ public boolean onGenericMotionEvent(MotionEvent event) {
grid_coustom_apps.disScrollFocus();
loadShortAppList();
coustom_view.clearFocus();
+ disableMultiViewFocusAnimation(true);
}
@Override
@@ -922,7 +932,7 @@ public boolean onGenericMotionEvent(MotionEvent event) {
LogUtils.loge("dismissCustomApp onAnimationEnd()");
coustom_view.setVisibility(View.GONE);
gv_shortcut.requestFocus();
-
+ disableMultiViewFocusAnimation(false);
}
@Override
@@ -988,7 +998,17 @@ public boolean onGenericMotionEvent(MotionEvent event) {
ADSWindowManager.getInstance().bindSourceData(multiViewArrayList,adsDatas);
}
-
+ /**
+ * 批量设置 HomeMultiView 的焦点动画开关
+ * @param disable true-禁用焦点动画,false-启用焦点动画
+ */
+ private void disableMultiViewFocusAnimation(boolean disable) {
+ for (MultiView multiView : multiViewArray) {
+ if (multiView != null && multiView instanceof HomeMultiView) {
+ ((HomeMultiView) multiView).setFocusAnimationDisable(disable);
+ }
+ }
+ }
@Override
public void popBackStackFragment() {
diff --git a/app/src/main/java/com/ik/mboxlauncher/view/HomeMultiView.java b/app/src/main/java/com/ik/mboxlauncher/view/HomeMultiView.java
index d402777..3ef63dc 100644
--- a/app/src/main/java/com/ik/mboxlauncher/view/HomeMultiView.java
+++ b/app/src/main/java/com/ik/mboxlauncher/view/HomeMultiView.java
@@ -68,7 +68,7 @@ public class HomeMultiView extends MultiView {
private View mMultiInsideLayout;
private int imageResId;
-
+ private boolean mFocusAnimationDisable;
public HomeMultiView(@NonNull Context context) {
super(context);
}
@@ -169,7 +169,13 @@ public class HomeMultiView extends MultiView {
}
}
-
+ /**
+ * 设置焦点动画是不可用
+ * @param disable true-启用,false-禁用
+ */
+ public void setFocusAnimationDisable(boolean disable) {
+ this.mFocusAnimationDisable = disable;
+ }
@Override
public void onImageRestart(String uri){
img_view.setVisibility(VISIBLE);
@@ -300,6 +306,7 @@ public class HomeMultiView extends MultiView {
setBackgroundResource(R.drawable.app_item_border);
setTranslationZ(10);
setElevation(10);
+ if(mFocusAnimationDisable) return;
ScaleAnimation anim = new ScaleAnimation(1f, 1.1f, 1f, 1.1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setZAdjustment(Animation.ZORDER_TOP);
anim.setDuration(animDuration);
@@ -310,6 +317,7 @@ public class HomeMultiView extends MultiView {
setBackgroundResource(R.color.transparent_background);
setTranslationZ(0);
setElevation(0);
+ if(mFocusAnimationDisable) return;
ScaleAnimation anim = new ScaleAnimation(1.1f, 1f, 1.1f, 1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setZAdjustment(Animation.ZORDER_TOP);
anim.setDuration(animDuration);
diff --git a/app/src/main/res/layout-sw480dp/layout_rect_group1.xml b/app/src/main/res/layout-sw480dp/layout_rect_group1.xml
index c3c0502..95432fb 100644
--- a/app/src/main/res/layout-sw480dp/layout_rect_group1.xml
+++ b/app/src/main/res/layout-sw480dp/layout_rect_group1.xml
@@ -19,7 +19,9 @@
app:multiViewImage="@drawable/img_video"
app:multiViewTitle="@string/str_video"
android:nextFocusRight="@id/layout_youtube"
- android:descendantFocusability="beforeDescendants" />
+ android:descendantFocusability="beforeDescendants" >
+
+
+ android:descendantFocusability="beforeDescendants" >
+
+
+ android:descendantFocusability="beforeDescendants" >
+
+
+ android:descendantFocusability="beforeDescendants" >
+
+