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" >
+
+