1.已展开app列表,有app卸载或新任务安装时,下方已勾选误抢焦点的问题
This commit is contained in:
@@ -71,21 +71,23 @@ public class LocalFragment extends CategoryFragment {
|
||||
appBeanList.add(new LocalAppBean());
|
||||
mLocalAppAdapter.addDatas(appBeanList);
|
||||
}
|
||||
gv_category_apps.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gv_category_apps.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
gv_category_apps.scrollToPosition(0);
|
||||
gv_category_apps.post(()->{
|
||||
int firstVisibleItemPosition = ((GridLayoutManager) gv_category_apps.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
RecyclerView.ViewHolder holderview = gv_category_apps.findViewHolderForAdapterPosition(firstVisibleItemPosition);
|
||||
if(holderview !=null){
|
||||
View targetView = holderview.itemView;
|
||||
targetView.post(() -> targetView.requestFocus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if(!isShowCustomApp()){
|
||||
gv_category_apps.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gv_category_apps.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
gv_category_apps.scrollToPosition(0);
|
||||
gv_category_apps.post(()->{
|
||||
int firstVisibleItemPosition = ((GridLayoutManager) gv_category_apps.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
RecyclerView.ViewHolder holderview = gv_category_apps.findViewHolderForAdapterPosition(firstVisibleItemPosition);
|
||||
if(holderview !=null){
|
||||
View targetView = holderview.itemView;
|
||||
targetView.post(() -> targetView.requestFocus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
super.onResult(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,21 +69,23 @@ public class MusicFragment extends CategoryFragment {
|
||||
appBeanList.add(new MusicAppBean());
|
||||
mMusicAppAdapter.addDatas(appBeanList);
|
||||
}
|
||||
gv_category_apps.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gv_category_apps.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
gv_category_apps.scrollToPosition(0);
|
||||
gv_category_apps.post(()->{
|
||||
int firstVisibleItemPosition = ((GridLayoutManager) gv_category_apps.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
RecyclerView.ViewHolder holderview = gv_category_apps.findViewHolderForAdapterPosition(firstVisibleItemPosition);
|
||||
if(holderview !=null){
|
||||
View targetView = holderview.itemView;
|
||||
targetView.post(() -> targetView.requestFocus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if(!isShowCustomApp()){
|
||||
gv_category_apps.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gv_category_apps.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
gv_category_apps.scrollToPosition(0);
|
||||
gv_category_apps.post(()->{
|
||||
int firstVisibleItemPosition = ((GridLayoutManager) gv_category_apps.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
RecyclerView.ViewHolder holderview = gv_category_apps.findViewHolderForAdapterPosition(firstVisibleItemPosition);
|
||||
if(holderview !=null){
|
||||
View targetView = holderview.itemView;
|
||||
targetView.post(() -> targetView.requestFocus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
super.onResult(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,22 +69,24 @@ public class RecommendFragment extends CategoryFragment {
|
||||
appBeanList.add(new RecommendAppBean());
|
||||
mRecommendAppAdapter.addDatas(appBeanList);
|
||||
}
|
||||
gv_category_apps.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gv_category_apps.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
LogUtils.loge("onGlobalLayout===>RecommendFragment"+ GsonUtil.GsonString(data));
|
||||
gv_category_apps.scrollToPosition(0);
|
||||
gv_category_apps.post(()->{
|
||||
int firstVisibleItemPosition = ((GridLayoutManager) gv_category_apps.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
RecyclerView.ViewHolder holderview = gv_category_apps.findViewHolderForAdapterPosition(firstVisibleItemPosition);
|
||||
if(holderview !=null){
|
||||
View targetView = holderview.itemView;
|
||||
targetView.post(() -> targetView.requestFocus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
if(!isShowCustomApp()){
|
||||
gv_category_apps.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gv_category_apps.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
LogUtils.loge("onGlobalLayout===>RecommendFragment"+ GsonUtil.GsonString(data));
|
||||
gv_category_apps.scrollToPosition(0);
|
||||
gv_category_apps.post(()->{
|
||||
int firstVisibleItemPosition = ((GridLayoutManager) gv_category_apps.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
RecyclerView.ViewHolder holderview = gv_category_apps.findViewHolderForAdapterPosition(firstVisibleItemPosition);
|
||||
if(holderview !=null){
|
||||
View targetView = holderview.itemView;
|
||||
targetView.post(() -> targetView.requestFocus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
super.onResult(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,22 +69,24 @@ public class VideoFragment extends CategoryFragment {
|
||||
appBeanList.add(new VideoAppBean());
|
||||
mVideoAppAdapter.addDatas(appBeanList);
|
||||
}
|
||||
gv_category_apps.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
if(!isShowCustomApp()){
|
||||
gv_category_apps.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gv_category_apps.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
gv_category_apps.scrollToPosition(0);
|
||||
gv_category_apps.post(()->{
|
||||
int firstVisibleItemPosition = ((GridLayoutManager) gv_category_apps.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
RecyclerView.ViewHolder holderview = gv_category_apps.findViewHolderForAdapterPosition(firstVisibleItemPosition);
|
||||
if(holderview !=null){
|
||||
View targetView = holderview.itemView;
|
||||
targetView.post(() -> targetView.requestFocus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
gv_category_apps.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
gv_category_apps.scrollToPosition(0);
|
||||
gv_category_apps.post(()->{
|
||||
int firstVisibleItemPosition = ((GridLayoutManager) gv_category_apps.getLayoutManager()).findFirstVisibleItemPosition();
|
||||
RecyclerView.ViewHolder holderview = gv_category_apps.findViewHolderForAdapterPosition(firstVisibleItemPosition);
|
||||
if(holderview !=null){
|
||||
View targetView = holderview.itemView;
|
||||
targetView.post(() -> targetView.requestFocus());
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
super.onResult(data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user