Search in sources :

Example 56 with Checkable

use of android.widget.Checkable in project android_packages_apps_Settings by DirtyUnicorns.

the class CellDataPreference method onBindViewHolder.

@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    View switchView = holder.findViewById(android.R.id.switch_widget);
    switchView.setClickable(false);
    ((Checkable) switchView).setChecked(mChecked);
}
Also used : Checkable(android.widget.Checkable) View(android.view.View)

Example 57 with Checkable

use of android.widget.Checkable in project android_packages_apps_Settings by DirtyUnicorns.

the class UsbModeChooserActivity method inflateOption.

private void inflateOption(final int mode, boolean selected, LinearLayout container, final boolean disallowedByAdmin) {
    View v = mLayoutInflater.inflate(R.layout.restricted_radio_with_summary, container, false);
    TextView titleView = (TextView) v.findViewById(android.R.id.title);
    titleView.setText(getTitle(mode));
    TextView summaryView = (TextView) v.findViewById(android.R.id.summary);
    updateSummary(summaryView, mode);
    if (disallowedByAdmin) {
        if (mEnforcedAdmin != null) {
            setDisabledByAdmin(v, titleView, summaryView);
        } else {
            return;
        }
    }
    v.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (disallowedByAdmin && mEnforcedAdmin != null) {
                RestrictedLockUtils.sendShowAdminSupportDetailsIntent(UsbModeChooserActivity.this, mEnforcedAdmin);
                return;
            }
            if (!ActivityManager.isUserAMonkey()) {
                mBackend.setMode(mode);
            }
            mDialog.dismiss();
            finish();
        }
    });
    ((Checkable) v).setChecked(selected);
    container.addView(v);
}
Also used : OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) Checkable(android.widget.Checkable) View(android.view.View) TextView(android.widget.TextView)

Example 58 with Checkable

use of android.widget.Checkable in project android_packages_apps_Settings by crdroidandroid.

the class CellDataPreference method onBindViewHolder.

@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    View switchView = holder.findViewById(android.R.id.switch_widget);
    switchView.setClickable(false);
    ((Checkable) switchView).setChecked(mChecked);
}
Also used : Checkable(android.widget.Checkable) View(android.view.View)

Example 59 with Checkable

use of android.widget.Checkable in project android_packages_apps_Settings by crdroidandroid.

the class UsbModeChooserActivity method inflateOption.

private void inflateOption(final int mode, boolean selected, LinearLayout container, final boolean disallowedByAdmin) {
    View v = mLayoutInflater.inflate(R.layout.restricted_radio_with_summary, container, false);
    TextView titleView = (TextView) v.findViewById(android.R.id.title);
    titleView.setText(getTitle(mode));
    TextView summaryView = (TextView) v.findViewById(android.R.id.summary);
    updateSummary(summaryView, mode);
    if (disallowedByAdmin) {
        if (mEnforcedAdmin != null) {
            setDisabledByAdmin(v, titleView, summaryView);
        } else {
            return;
        }
    }
    v.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (disallowedByAdmin && mEnforcedAdmin != null) {
                RestrictedLockUtils.sendShowAdminSupportDetailsIntent(UsbModeChooserActivity.this, mEnforcedAdmin);
                return;
            }
            if (!ActivityManager.isUserAMonkey()) {
                mBackend.setMode(mode);
            }
            mDialog.dismiss();
            finish();
        }
    });
    ((Checkable) v).setChecked(selected);
    container.addView(v);
}
Also used : OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) Checkable(android.widget.Checkable) View(android.view.View) TextView(android.widget.TextView)

Example 60 with Checkable

use of android.widget.Checkable in project Pix-Art-Messenger by kriztan.

the class StartConversationActivity method showJoinConferenceDialog.

@SuppressLint("InflateParams")
protected void showJoinConferenceDialog(final String prefilledJid) {
    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.join_conference);
    final View dialogView = getLayoutInflater().inflate(R.layout.join_conference_dialog, null);
    final TextView yourAccount = dialogView.findViewById(R.id.your_account);
    final Spinner spinner = dialogView.findViewById(R.id.account);
    final AutoCompleteTextView jid = dialogView.findViewById(R.id.jid);
    DelayedHintHelper.setHint(R.string.conference_address_example, jid);
    jid.setAdapter(new KnownHostsAdapter(this, R.layout.simple_list_item, mKnownConferenceHosts));
    if (prefilledJid != null) {
        jid.append(prefilledJid);
    }
    if (xmppConnectionService.multipleAccounts()) {
        yourAccount.setVisibility(View.VISIBLE);
        spinner.setVisibility(View.VISIBLE);
    } else {
        yourAccount.setVisibility(View.GONE);
        spinner.setVisibility(View.GONE);
    }
    populateAccountSpinner(this, mActivatedAccounts, spinner);
    final Checkable bookmarkCheckBox = (CheckBox) dialogView.findViewById(R.id.bookmark);
    builder.setView(dialogView);
    builder.setNegativeButton(R.string.cancel, null);
    builder.setPositiveButton(R.string.join, null);
    final AlertDialog dialog = builder.create();
    dialog.show();
    mCurrentDialog = dialog;
    dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(v -> {
        if (!xmppConnectionServiceBound) {
            return;
        }
        final Account account = getSelectedAccount(spinner);
        if (account == null) {
            return;
        }
        final Jid conferenceJid;
        try {
            conferenceJid = Jid.fromString(jid.getText().toString());
        } catch (final InvalidJidException e) {
            jid.setError(getString(R.string.invalid_jid));
            return;
        }
        if (bookmarkCheckBox.isChecked()) {
            if (account.hasBookmarkFor(conferenceJid)) {
                jid.setError(getString(R.string.bookmark_already_exists));
            } else {
                final Bookmark bookmark = new Bookmark(account, conferenceJid.toBareJid());
                bookmark.setAutojoin(getPreferences().getBoolean("autojoin", getResources().getBoolean(R.bool.autojoin)));
                String nick = conferenceJid.getResourcepart();
                if (nick != null && !nick.isEmpty()) {
                    bookmark.setNick(nick);
                }
                account.getBookmarks().add(bookmark);
                xmppConnectionService.pushBookmarks(account);
                final Conversation conversation = xmppConnectionService.findOrCreateConversation(account, conferenceJid, true, true, true);
                bookmark.setConversation(conversation);
                dialog.dismiss();
                mCurrentDialog = null;
                switchToConversation(conversation);
            }
        } else {
            final Conversation conversation = xmppConnectionService.findOrCreateConversation(account, conferenceJid, true, true, true);
            dialog.dismiss();
            mCurrentDialog = null;
            switchToConversation(conversation);
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) KnownHostsAdapter(de.pixart.messenger.ui.adapter.KnownHostsAdapter) Account(de.pixart.messenger.entities.Account) Jid(de.pixart.messenger.xmpp.jid.Jid) Spinner(android.widget.Spinner) InvalidJidException(de.pixart.messenger.xmpp.jid.InvalidJidException) Conversation(de.pixart.messenger.entities.Conversation) SpannableString(android.text.SpannableString) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) AutoCompleteTextView(android.widget.AutoCompleteTextView) Bookmark(de.pixart.messenger.entities.Bookmark) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) AutoCompleteTextView(android.widget.AutoCompleteTextView) Checkable(android.widget.Checkable) AutoCompleteTextView(android.widget.AutoCompleteTextView) SuppressLint(android.annotation.SuppressLint)

Aggregations

Checkable (android.widget.Checkable)79 View (android.view.View)47 TextView (android.widget.TextView)18 ViewGroup (android.view.ViewGroup)9 OnClickListener (android.view.View.OnClickListener)7 ImageView (android.widget.ImageView)7 Switch (android.widget.Switch)7 ResourceReference (com.android.ide.common.rendering.api.ResourceReference)6 Resources (android.content.res.Resources)5 Paint (android.graphics.Paint)5 Point (android.graphics.Point)4 SuppressLint (android.annotation.SuppressLint)3 AdapterView (android.widget.AdapterView)3 CheckBox (android.widget.CheckBox)3 ListView (android.widget.ListView)3 Spinner (android.widget.Spinner)3 Map (java.util.Map)3 Switch (org.holoeverywhere.widget.Switch)3 SimpleArrayMap (android.support.v4.util.SimpleArrayMap)2 AlertDialog (android.support.v7.app.AlertDialog)2