|
|
|
|
@ -623,13 +623,15 @@ public class HomeActivity extends BaseActivity { |
|
|
|
|
SelectDialog<SourceBean> dialog = new SelectDialog<>(HomeActivity.this); |
|
|
|
|
TvRecyclerView tvRecyclerView = dialog.findViewById(R.id.list); |
|
|
|
|
int spanCount; |
|
|
|
|
spanCount = (int)Math.floor(sites.size() / 20); |
|
|
|
|
spanCount = (int)Math.floor(sites.size()/20); |
|
|
|
|
spanCount = Math.min(spanCount, 2); |
|
|
|
|
tvRecyclerView.setLayoutManager(new V7GridLayoutManager(dialog.getContext(), spanCount+1)); |
|
|
|
|
ConstraintLayout cl_root = dialog.findViewById(R.id.cl_root); |
|
|
|
|
ViewGroup.LayoutParams clp = cl_root.getLayoutParams(); |
|
|
|
|
clp.width = AutoSizeUtils.mm2px(dialog.getContext(), 380+200*spanCount); |
|
|
|
|
dialog.setTip("请选择首页数据源"); |
|
|
|
|
int select = sites.indexOf(ApiConfig.get().getHomeSourceBean()); |
|
|
|
|
if (select<0) select = 0; |
|
|
|
|
dialog.setAdapter(new SelectDialogAdapter.SelectDialogInterface<SourceBean>() { |
|
|
|
|
@Override |
|
|
|
|
public void click(SourceBean value, int pos) { |
|
|
|
|
@ -656,7 +658,7 @@ public class HomeActivity extends BaseActivity { |
|
|
|
|
public boolean areContentsTheSame(@NonNull @NotNull SourceBean oldItem, @NonNull @NotNull SourceBean newItem) { |
|
|
|
|
return oldItem.getKey().equals(newItem.getKey()); |
|
|
|
|
} |
|
|
|
|
}, sites, sites.indexOf(ApiConfig.get().getHomeSourceBean())); |
|
|
|
|
}, sites, select); |
|
|
|
|
dialog.show(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|