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