Search in sources :

Example 1 with QKEditText

use of com.moez.QKSMS.ui.view.QKEditText in project qksms by moezbhatti.

the class BlockedNumberDialog method showDialog.

public static void showDialog(final QKActivity context) {
    final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    Set<String> addresses = BlockedConversationHelper.getFutureBlockedConversations(prefs);
    new QKDialog().setContext(context).setTitle(R.string.pref_block_future).setItems(addresses.toArray(new String[addresses.size()]), new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
            new QKDialog().setContext(context).setTitle(R.string.title_unblock_address).setMessage(((TextView) view).getText().toString()).setPositiveButton(R.string.yes, new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    BlockedConversationHelper.unblockFutureConversation(prefs, ((TextView) view).getText().toString());
                }
            }).setNegativeButton(R.string.cancel, null).show();
        }
    }).setPositiveButton(R.string.add, new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final QKEditText editText = new QKEditText(context);
            new QKDialog().setContext(context).setTitle(R.string.title_block_address).setCustomView(editText).setPositiveButton(R.string.add, new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    if (editText.getText().length() > 0) {
                        BlockedConversationHelper.blockFutureConversation(prefs, editText.getText().toString());
                    }
                }
            }).setNegativeButton(R.string.cancel, null).show();
        }
    }).setNegativeButton(R.string.cancel, null).show();
}
Also used : QKEditText(com.moez.QKSMS.ui.view.QKEditText) SharedPreferences(android.content.SharedPreferences) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView)

Aggregations

SharedPreferences (android.content.SharedPreferences)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 TextView (android.widget.TextView)1 QKEditText (com.moez.QKSMS.ui.view.QKEditText)1