com.yarolegovich.lovelydialog.LovelyChoiceDialog Java Examples
The following examples show how to use
com.yarolegovich.lovelydialog.LovelyChoiceDialog.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MagnetSearchActivity.java From AndroidMagnetSearch with Apache License 2.0 | 6 votes |
@Event(value = R.id.bt_source) private void btSourceClick(View view) { if(sourceDialog==null) { sourceDialog=new LovelyChoiceDialog(this) .setTopColorRes(R.color.colorMain) .setIcon(R.drawable.ic_source) .setItems(btSources, new LovelyChoiceDialog.OnItemSelectedListener<String>() { @Override public void onItemSelected(int position, String item) { rule = GsonUtil.getMagnetRule(rules).get(item); searchSourceText.setText(String.format(getString(R.string.search_source), item)); refreshLayout.startRefresh(); } }); } sourceDialog.show(); }
Example #2
Source File: MagnetSearchActivity.java From AndroidMagnetSearch with Apache License 2.0 | 6 votes |
@Event(value = R.id.bt_sort) private void btSortClick(View view) { if(sortDialog==null) { sortDialog= new LovelyChoiceDialog(this) .setTopColorRes(R.color.colorMain) .setIcon(R.drawable.ic_sort) .setItems(Arrays.asList(getString(R.string.date),getString(R.string.hot)), new LovelyChoiceDialog.OnItemSelectedListener<String>() { @Override public void onItemSelected(int position, String item) { if(item.equals(getString(R.string.date))){ searchSort=Const.SEARCH_SORT_DATE; }else{ searchSort=Const.SEARCH_SORT_HOT; } searchSortText.setText(String.format(getString(R.string.search_sort), item)); refreshLayout.startRefresh(); } }); } sortDialog.show(); }
Example #3
Source File: MagnetSearchActivity.java From AndroidDownload with Apache License 2.0 | 6 votes |
@Event(value = R.id.bt_source) private void btSourceClick(View view) { if(sourceDialog==null) { sourceDialog=new LovelyChoiceDialog(this) .setTopColorRes(R.color.colorMain) .setIcon(R.drawable.ic_source) .setItems(btSources, new LovelyChoiceDialog.OnItemSelectedListener<String>() { @Override public void onItemSelected(int position, String item) { rule = GsonUtil.getMagnetRule(rules).get(item); searchSourceText.setText(String.format(getString(R.string.search_source), item)); refreshLayout.startRefresh(); } }); } sourceDialog.show(); }
Example #4
Source File: MagnetSearchActivity.java From AndroidDownload with Apache License 2.0 | 6 votes |
@Event(value = R.id.bt_sort) private void btSortClick(View view) { if(sortDialog==null) { sortDialog= new LovelyChoiceDialog(this) .setTopColorRes(R.color.colorMain) .setIcon(R.drawable.ic_sort) .setItems(Arrays.asList(getString(R.string.date),getString(R.string.hot)), new LovelyChoiceDialog.OnItemSelectedListener<String>() { @Override public void onItemSelected(int position, String item) { if(item.equals(getString(R.string.date))){ searchSort=Const.SEARCH_SORT_DATE; }else{ searchSort=Const.SEARCH_SORT_HOT; } searchSortText.setText(String.format(getString(R.string.search_sort), item)); refreshLayout.startRefresh(); } }); } sortDialog.show(); }
Example #5
Source File: LovelyInputModule.java From MaterialPreferences with Apache License 2.0 | 6 votes |
@Override public void showSingleChoiceInput( String key, CharSequence title, CharSequence[] displayItems, final CharSequence[] values, int selected, final Listener<String> listener) { standardInit(new LovelyChoiceDialog(context) .setItems(displayItems, new LovelyChoiceDialog.OnItemSelectedListener<CharSequence>() { @Override public void onItemSelected(int position, CharSequence item) { listener.onInput(values[position].toString()); } }), key, title) .show(); }
Example #6
Source File: LovelyInputModule.java From MaterialPreferences with Apache License 2.0 | 6 votes |
@Override public void showMultiChoiceInput( String key, CharSequence title, CharSequence[] displayItems, final CharSequence[] values, boolean[] itemStates, final Listener<Set<String>> listener) { standardInit(new LovelyChoiceDialog(context) .setItemsMultiChoice(displayItems, itemStates, new LovelyChoiceDialog.OnItemsSelectedListener<CharSequence>() { @Override public void onItemsSelected(List<Integer> positions, List<CharSequence> items) { Set<String> selected = new HashSet<>(); for (int position : positions) { selected.add(values[position].toString()); } listener.onInput(selected); } }), key, title) .show(); }
Example #7
Source File: MainActivity.java From LovelyDialog with Apache License 2.0 | 6 votes |
private void showSingleChoiceDialog(Bundle savedInstanceState) { ArrayAdapter<DonationOption> adapter = new DonationAdapter(this, loadDonationOptions()); new LovelyChoiceDialog(this) .setTopColorRes(R.color.darkGreen) .setTitle(R.string.donate_title) .setInstanceStateHandler(ID_SINGLE_CHOICE_DIALOG, saveStateHandler) .setIcon(R.drawable.ic_local_atm_white_36dp) .setMessage(R.string.donate_message) .setItems(adapter, (position, item) -> Toast.makeText(MainActivity.this, getString(R.string.you_donated, item.amount), Toast.LENGTH_SHORT) .show()) .setSavedInstanceState(savedInstanceState) .show(); }
Example #8
Source File: MainActivity.java From LovelyDialog with Apache License 2.0 | 6 votes |
private void showMultiChoiceDialog(Bundle savedInstanceState) { String[] items = getResources().getStringArray(R.array.food); new LovelyChoiceDialog(this, R.style.CheckBoxTintTheme) .setTopColorRes(R.color.darkRed) .setTitle(R.string.order_food_title) .setIcon(R.drawable.ic_food_white_36dp) .setInstanceStateHandler(ID_MULTI_CHOICE_DIALOG, saveStateHandler) .setItemsMultiChoice(items, (positions, items1) -> Toast.makeText(MainActivity.this, getString(R.string.you_ordered, TextUtils.join("\n", items1)), Toast.LENGTH_SHORT) .show()) .setConfirmButtonText(R.string.confirm) .setSavedInstanceState(savedInstanceState) .show(); }