use of com.lguipeng.notes.adpater.ColorsListAdapter in project Notes by lguipeng.
the class SettingFragment method showThemeChooseDialog.
@Override
public void showThemeChooseDialog() {
AlertDialog.Builder builder = DialogUtils.makeDialogBuilder(activity);
builder.setTitle(R.string.change_theme);
Integer[] res = new Integer[] { R.drawable.red_round, R.drawable.brown_round, R.drawable.blue_round, R.drawable.blue_grey_round, R.drawable.yellow_round, R.drawable.deep_purple_round, R.drawable.pink_round, R.drawable.green_round };
List<Integer> list = Arrays.asList(res);
ColorsListAdapter adapter = new ColorsListAdapter(getActivity(), list);
adapter.setCheckItem(ThemeUtils.getCurrentTheme(activity).getIntValue());
GridView gridView = (GridView) LayoutInflater.from(activity).inflate(R.layout.colors_panel_layout, null);
gridView.setStretchMode(GridView.STRETCH_COLUMN_WIDTH);
gridView.setCacheColorHint(0);
gridView.setAdapter(adapter);
builder.setView(gridView);
final AlertDialog dialog = builder.show();
gridView.setOnItemClickListener((parent, view, position, id) -> {
dialog.dismiss();
settingPresenter.onThemeChoose(position);
});
}
Aggregations