1.开机或按Home键默认Layout_video第1个广告位获取焦点,任意按钮并且进入第三方应用返回也是第1个广告位获取焦点
2.主页加号展开后返回时取消1-10随机缩小动画,焦点定位于gv_short上
This commit is contained in:
@@ -61,6 +61,7 @@ import com.ik.mboxlauncher.ui.fragment.AppsFragment;
|
|||||||
import com.ik.mboxlauncher.ui.fragment.MusicFragment;
|
import com.ik.mboxlauncher.ui.fragment.MusicFragment;
|
||||||
import com.ik.mboxlauncher.ui.fragment.RecommendFragment;
|
import com.ik.mboxlauncher.ui.fragment.RecommendFragment;
|
||||||
import com.ik.mboxlauncher.ui.fragment.VideoFragment;
|
import com.ik.mboxlauncher.ui.fragment.VideoFragment;
|
||||||
|
import com.ik.mboxlauncher.view.HomeMultiView;
|
||||||
import com.ik.mboxlauncher.view.MultiView;
|
import com.ik.mboxlauncher.view.MultiView;
|
||||||
import com.ik.mboxlauncher.view.CustomRecyclerView;
|
import com.ik.mboxlauncher.view.CustomRecyclerView;
|
||||||
import com.ik.mboxlauncher.view.SplashView;
|
import com.ik.mboxlauncher.view.SplashView;
|
||||||
@@ -211,6 +212,9 @@ public class Launcher extends FragmentActivity implements SplashView.SplashAdLi
|
|||||||
LogUtils.loge("open app custom view");
|
LogUtils.loge("open app custom view");
|
||||||
if(selectIndex == 0){
|
if(selectIndex == 0){
|
||||||
gotoAction(AppsFragment.ACTION);
|
gotoAction(AppsFragment.ACTION);
|
||||||
|
handler.postDelayed(()->{
|
||||||
|
layout_video.requestFocus();
|
||||||
|
},120);
|
||||||
} else {
|
} else {
|
||||||
if (!isShowCustomApp()) {
|
if (!isShowCustomApp()) {
|
||||||
showCustomApps();
|
showCustomApps();
|
||||||
@@ -220,6 +224,9 @@ public class Launcher extends FragmentActivity implements SplashView.SplashAdLi
|
|||||||
}else {
|
}else {
|
||||||
LogUtils.loge("open app package name is "+shortAppInfoBean.getPackageName());
|
LogUtils.loge("open app package name is "+shortAppInfoBean.getPackageName());
|
||||||
IntentUtil.startApp(Launcher.this,shortAppInfoBean.getPackageName(),getResources().getString(R.string.app_not_exist));
|
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.setAdapter(mShortAppInfoAdapter);
|
||||||
gv_shortcut.setCanFocusOutHorizontal(false);
|
gv_shortcut.setCanFocusOutHorizontal(false);
|
||||||
gv_shortcut.setCanFocusOutVertical(true);
|
gv_shortcut.setCanFocusOutVertical(true);
|
||||||
|
|
||||||
GridLayoutManager customLayoutManager = new GridLayoutManager(Launcher.this,9);
|
GridLayoutManager customLayoutManager = new GridLayoutManager(Launcher.this,9);
|
||||||
grid_coustom_apps.setLayoutManager(customLayoutManager);
|
grid_coustom_apps.setLayoutManager(customLayoutManager);
|
||||||
grid_coustom_apps.setAdapter(mCustomAppAdapter);
|
grid_coustom_apps.setAdapter(mCustomAppAdapter);
|
||||||
@@ -323,6 +329,9 @@ public class Launcher extends FragmentActivity implements SplashView.SplashAdLi
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
mHomeHeight = findViewById(R.id.layout_homepage).getHeight();
|
mHomeHeight = findViewById(R.id.layout_homepage).getHeight();
|
||||||
|
if(!isShowCustomApp()){
|
||||||
|
layout_video.requestFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -915,6 +924,7 @@ public boolean onGenericMotionEvent(MotionEvent event) {
|
|||||||
grid_coustom_apps.disScrollFocus();
|
grid_coustom_apps.disScrollFocus();
|
||||||
loadShortAppList();
|
loadShortAppList();
|
||||||
coustom_view.clearFocus();
|
coustom_view.clearFocus();
|
||||||
|
disableMultiViewFocusAnimation(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -922,7 +932,7 @@ public boolean onGenericMotionEvent(MotionEvent event) {
|
|||||||
LogUtils.loge("dismissCustomApp onAnimationEnd()");
|
LogUtils.loge("dismissCustomApp onAnimationEnd()");
|
||||||
coustom_view.setVisibility(View.GONE);
|
coustom_view.setVisibility(View.GONE);
|
||||||
gv_shortcut.requestFocus();
|
gv_shortcut.requestFocus();
|
||||||
|
disableMultiViewFocusAnimation(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -988,7 +998,17 @@ public boolean onGenericMotionEvent(MotionEvent event) {
|
|||||||
|
|
||||||
ADSWindowManager.getInstance().bindSourceData(multiViewArrayList,adsDatas);
|
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
|
@Override
|
||||||
public void popBackStackFragment() {
|
public void popBackStackFragment() {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class HomeMultiView extends MultiView {
|
|||||||
private View mMultiInsideLayout;
|
private View mMultiInsideLayout;
|
||||||
private int imageResId;
|
private int imageResId;
|
||||||
|
|
||||||
|
private boolean mFocusAnimationDisable;
|
||||||
public HomeMultiView(@NonNull Context context) {
|
public HomeMultiView(@NonNull Context context) {
|
||||||
super(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
|
@Override
|
||||||
public void onImageRestart(String uri){
|
public void onImageRestart(String uri){
|
||||||
img_view.setVisibility(VISIBLE);
|
img_view.setVisibility(VISIBLE);
|
||||||
@@ -300,6 +306,7 @@ public class HomeMultiView extends MultiView {
|
|||||||
setBackgroundResource(R.drawable.app_item_border);
|
setBackgroundResource(R.drawable.app_item_border);
|
||||||
setTranslationZ(10);
|
setTranslationZ(10);
|
||||||
setElevation(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);
|
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.setZAdjustment(Animation.ZORDER_TOP);
|
||||||
anim.setDuration(animDuration);
|
anim.setDuration(animDuration);
|
||||||
@@ -310,6 +317,7 @@ public class HomeMultiView extends MultiView {
|
|||||||
setBackgroundResource(R.color.transparent_background);
|
setBackgroundResource(R.color.transparent_background);
|
||||||
setTranslationZ(0);
|
setTranslationZ(0);
|
||||||
setElevation(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);
|
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.setZAdjustment(Animation.ZORDER_TOP);
|
||||||
anim.setDuration(animDuration);
|
anim.setDuration(animDuration);
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
app:multiViewImage="@drawable/img_video"
|
app:multiViewImage="@drawable/img_video"
|
||||||
app:multiViewTitle="@string/str_video"
|
app:multiViewTitle="@string/str_video"
|
||||||
android:nextFocusRight="@id/layout_youtube"
|
android:nextFocusRight="@id/layout_youtube"
|
||||||
android:descendantFocusability="beforeDescendants" />
|
android:descendantFocusability="beforeDescendants" >
|
||||||
|
<requestFocus/>
|
||||||
|
</com.ik.mboxlauncher.view.HomeMultiView>
|
||||||
|
|
||||||
|
|
||||||
<com.ik.mboxlauncher.view.HomeMultiView
|
<com.ik.mboxlauncher.view.HomeMultiView
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
app:multiViewImage="@drawable/img_video"
|
app:multiViewImage="@drawable/img_video"
|
||||||
app:multiViewTitle="@string/str_video"
|
app:multiViewTitle="@string/str_video"
|
||||||
android:nextFocusRight="@id/layout_youtube"
|
android:nextFocusRight="@id/layout_youtube"
|
||||||
android:descendantFocusability="beforeDescendants" />
|
android:descendantFocusability="beforeDescendants" >
|
||||||
|
<requestFocus/>
|
||||||
|
</com.ik.mboxlauncher.view.HomeMultiView>
|
||||||
|
|
||||||
|
|
||||||
<com.ik.mboxlauncher.view.HomeMultiView
|
<com.ik.mboxlauncher.view.HomeMultiView
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
app:multiViewImage="@drawable/img_video"
|
app:multiViewImage="@drawable/img_video"
|
||||||
app:multiViewTitle="@string/str_video"
|
app:multiViewTitle="@string/str_video"
|
||||||
android:nextFocusRight="@id/layout_youtube"
|
android:nextFocusRight="@id/layout_youtube"
|
||||||
android:descendantFocusability="beforeDescendants" />
|
android:descendantFocusability="beforeDescendants" >
|
||||||
|
<requestFocus />
|
||||||
|
</com.ik.mboxlauncher.view.HomeMultiView>
|
||||||
|
|
||||||
|
|
||||||
<com.ik.mboxlauncher.view.HomeMultiView
|
<com.ik.mboxlauncher.view.HomeMultiView
|
||||||
|
|||||||
@@ -18,7 +18,9 @@
|
|||||||
app:multiViewImage="@drawable/img_video"
|
app:multiViewImage="@drawable/img_video"
|
||||||
app:multiViewTitle="@string/str_video"
|
app:multiViewTitle="@string/str_video"
|
||||||
android:nextFocusRight="@id/layout_youtube"
|
android:nextFocusRight="@id/layout_youtube"
|
||||||
android:descendantFocusability="beforeDescendants" />
|
android:descendantFocusability="beforeDescendants" >
|
||||||
|
<requestFocus/>
|
||||||
|
</com.ik.mboxlauncher.view.HomeMultiView>
|
||||||
|
|
||||||
|
|
||||||
<com.ik.mboxlauncher.view.HomeMultiView
|
<com.ik.mboxlauncher.view.HomeMultiView
|
||||||
|
|||||||
Reference in New Issue
Block a user