Search in sources :

Example 71 with CheckBox

use of android.widget.CheckBox in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DeviceProfilesSettings method refreshProfiles.

private void refreshProfiles() {
    for (LocalBluetoothProfile profile : mCachedDevice.getConnectableProfiles()) {
        CheckBox profilePref = findProfile(profile.toString());
        if (profilePref == null) {
            profilePref = createProfilePreference(profile);
            mProfileContainer.addView(profilePref);
        } else {
            refreshProfilePreference(profilePref, profile);
        }
    }
    for (LocalBluetoothProfile profile : mCachedDevice.getRemovedProfiles()) {
        CheckBox profilePref = findProfile(profile.toString());
        if (profilePref != null) {
            if (profile instanceof PbapServerProfile) {
                final int pbapPermission = mCachedDevice.getPhonebookPermissionChoice();
                Log.d(TAG, "refreshProfiles: pbapPermission = " + pbapPermission);
                if (pbapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN)
                    continue;
            }
            if (profile instanceof MapProfile) {
                final int mapPermission = mCachedDevice.getMessagePermissionChoice();
                Log.d(TAG, "refreshProfiles: mapPermission = " + mapPermission);
                if (mapPermission != CachedBluetoothDevice.ACCESS_UNKNOWN)
                    continue;
            }
            Log.d(TAG, "Removing " + profile.toString() + " from profile list");
            mProfileContainer.removeView(profilePref);
        }
    }
    showOrHideProfileGroup();
}
Also used : LocalBluetoothProfile(com.android.settingslib.bluetooth.LocalBluetoothProfile) PbapServerProfile(com.android.settingslib.bluetooth.PbapServerProfile) MapProfile(com.android.settingslib.bluetooth.MapProfile) CheckBox(android.widget.CheckBox)

Example 72 with CheckBox

use of android.widget.CheckBox in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiConfigController method showSecurityFields.

private void showSecurityFields() {
    if (mAccessPointSecurity == AccessPoint.SECURITY_NONE) {
        mView.findViewById(R.id.security_fields).setVisibility(View.GONE);
        return;
    }
    mView.findViewById(R.id.security_fields).setVisibility(View.VISIBLE);
    if (mPasswordView == null) {
        mPasswordView = (TextView) mView.findViewById(R.id.password);
        mPasswordView.addTextChangedListener(this);
        mPasswordView.setOnEditorActionListener(this);
        mPasswordView.setOnKeyListener(this);
        ((CheckBox) mView.findViewById(R.id.show_password)).setOnCheckedChangeListener(this);
        if (mAccessPoint != null && mAccessPoint.isSaved()) {
            mPasswordView.setHint(R.string.wifi_unchanged);
        }
    }
    if (mAccessPointSecurity != AccessPoint.SECURITY_EAP) {
        mView.findViewById(R.id.eap).setVisibility(View.GONE);
        return;
    }
    mView.findViewById(R.id.eap).setVisibility(View.VISIBLE);
    if (mEapMethodSpinner == null) {
        getSIMInfo();
        mEapMethodSpinner = (Spinner) mView.findViewById(R.id.method);
        mEapMethodSpinner.setOnItemSelectedListener(this);
        if (Utils.isWifiOnly(mContext) || !mContext.getResources().getBoolean(com.android.internal.R.bool.config_eap_sim_based_auth_supported)) {
            String[] eapMethods = mContext.getResources().getStringArray(R.array.eap_method_without_sim_auth);
            ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_item, eapMethods);
            spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
            mEapMethodSpinner.setAdapter(spinnerAdapter);
        }
        mPhase2Spinner = (Spinner) mView.findViewById(R.id.phase2);
        mEapCaCertSpinner = (Spinner) mView.findViewById(R.id.ca_cert);
        mEapCaCertSpinner.setOnItemSelectedListener(this);
        mEapDomainView = (TextView) mView.findViewById(R.id.domain);
        mEapDomainView.addTextChangedListener(this);
        mEapUserCertSpinner = (Spinner) mView.findViewById(R.id.user_cert);
        mEapUserCertSpinner.setOnItemSelectedListener(this);
        mSimCardSpinner = (Spinner) mView.findViewById(R.id.sim_card);
        mEapIdentityView = (TextView) mView.findViewById(R.id.identity);
        mEapAnonymousView = (TextView) mView.findViewById(R.id.anonymous);
        loadCertificates(mEapCaCertSpinner, Credentials.CA_CERTIFICATE, mDoNotValidateEapServerString, false, true);
        loadCertificates(mEapUserCertSpinner, Credentials.USER_PRIVATE_KEY, mDoNotProvideEapUserCertString, false, false);
        // Modifying an existing network
        if (mAccessPoint != null && mAccessPoint.isSaved()) {
            WifiEnterpriseConfig enterpriseConfig = mAccessPoint.getConfig().enterpriseConfig;
            int eapMethod = enterpriseConfig.getEapMethod();
            int phase2Method = enterpriseConfig.getPhase2Method();
            mEapMethodSpinner.setSelection(eapMethod);
            showEapFieldsByMethod(eapMethod);
            switch(eapMethod) {
                case Eap.PEAP:
                    switch(phase2Method) {
                        case Phase2.NONE:
                            mPhase2Spinner.setSelection(WIFI_PEAP_PHASE2_NONE);
                            break;
                        case Phase2.MSCHAPV2:
                            mPhase2Spinner.setSelection(WIFI_PEAP_PHASE2_MSCHAPV2);
                            break;
                        case Phase2.GTC:
                            mPhase2Spinner.setSelection(WIFI_PEAP_PHASE2_GTC);
                            break;
                        default:
                            Log.e(TAG, "Invalid phase 2 method " + phase2Method);
                            break;
                    }
                    break;
                case Eap.SIM:
                case Eap.AKA:
                case Eap.AKA_PRIME:
                    WifiConfiguration config = mAccessPoint.getConfig();
                    mSimCardSpinner.setSelection(config.SIMNum - 1);
                    break;
                default:
                    mPhase2Spinner.setSelection(phase2Method);
                    break;
            }
            if (!TextUtils.isEmpty(enterpriseConfig.getCaPath())) {
                setSelection(mEapCaCertSpinner, mUseSystemCertsString);
            } else {
                String[] caCerts = enterpriseConfig.getCaCertificateAliases();
                if (caCerts == null) {
                    setSelection(mEapCaCertSpinner, mDoNotValidateEapServerString);
                } else if (caCerts.length == 1) {
                    setSelection(mEapCaCertSpinner, caCerts[0]);
                } else {
                    // Reload the cert spinner with an extra "multiple certificates added" item.
                    loadCertificates(mEapCaCertSpinner, Credentials.CA_CERTIFICATE, mDoNotValidateEapServerString, true, true);
                    setSelection(mEapCaCertSpinner, mMultipleCertSetString);
                }
            }
            mEapDomainView.setText(enterpriseConfig.getDomainSuffixMatch());
            String userCert = enterpriseConfig.getClientCertificateAlias();
            if (TextUtils.isEmpty(userCert)) {
                setSelection(mEapUserCertSpinner, mDoNotProvideEapUserCertString);
            } else {
                setSelection(mEapUserCertSpinner, userCert);
            }
            mEapIdentityView.setText(enterpriseConfig.getIdentity());
            mEapAnonymousView.setText(enterpriseConfig.getAnonymousIdentity());
        } else {
            showEapFieldsByMethod(mEapMethodSpinner.getSelectedItemPosition());
        }
    } else {
        showEapFieldsByMethod(mEapMethodSpinner.getSelectedItemPosition());
    }
}
Also used : WifiEnterpriseConfig(android.net.wifi.WifiEnterpriseConfig) WifiConfiguration(android.net.wifi.WifiConfiguration) CheckBox(android.widget.CheckBox) ArrayAdapter(android.widget.ArrayAdapter) AccessPoint(com.android.settingslib.wifi.AccessPoint)

Example 73 with CheckBox

use of android.widget.CheckBox in project newsrob by marianokamp.

the class ArticleViewHelper method populateEntryView.

static void populateEntryView(final View view, final Entry entry, final EntryManager entryManager, final UIHelper uiHelper) {
    final Resources resources = entryManager.getContext().getResources();
    // swipe
    final SwipeRelativeLayout swipeContainer = (SwipeRelativeLayout) view.findViewById(R.id.swipe_container);
    final View outterContainer = view.findViewById(R.id.outter_container);
    outterContainer.setPadding(0, 0, 0, 0);
    swipeContainer.setSwipeListener(new SwipeRelativeLayout.ISwipeListener() {

        private final int selectionFeedbackColor = resources.getColor(R.color.selection_feedback);

        public boolean swipeTopToBottom(final View v) {
            return false;
        }

        public boolean swipeRightToLeft(final View v) {
            view.setBackgroundColor(selectionFeedbackColor);
            entryManager.increaseUnreadLevel(entry);
            return true;
        }

        public boolean swipeLeftToRight(final View v) {
            view.setBackgroundColor(selectionFeedbackColor);
            entryManager.increaseReadLevel(entry);
            return true;
        }

        public boolean swipeBottomToTop(final View v) {
            return false;
        }

        public boolean onLongClick(final View v, final MotionEvent e) {
            return view.performLongClick();
        }

        public boolean onClick(final View v, final MotionEvent e) {
            return view.performClick();
        }
    });
    swipeContainer.setSwipeEnabeld(entryManager.isSwipeOnArticleDetailViewEnabled());
    swipeContainer.setBackgroundResource(R.drawable.article_header_background_thin);
    final TextView entryTitleView = (TextView) view.findViewById(R.id.entry_title);
    final TextView feedTitleView = (TextView) view.findViewById(R.id.feed_title);
    if (feedTitleView == null || entryTitleView == null) {
        Log.e(TAG, "feedTitleView or entryTitleView were null.");
        return;
    }
    if (entry == null) {
        Log.d(TAG, "entry was null");
        return;
    }
    if (entry.getFeedTitle() == null) {
        Log.e(TAG, "entry.getFeedTitle() was null.");
        return;
    }
    feedTitleView.setText(entry.getFeedTitle());
    entryTitleView.setText(entry.getTitle());
    if (entryManager.shouldTitlesBeEllipsized()) {
        entryTitleView.setEllipsize(TruncateAt.MIDDLE);
        entryTitleView.setLines(2);
    }
    // final int backgroundColor = resources.getColor(entry.isRead() ?
    // R.color.article_read_background
    // : R.color.article_unread_background);
    // final int textColor = resources.getColor(entry.isRead() ?
    // R.color.article_read_text
    // : R.color.article_unread_text);
    final TextView readIndicator = (TextView) view.findViewById(R.id.read_status_indicator);
    final int readIndicatorBackground = entryManager.isLightColorSchemeSelected() ? R.drawable.read_indicator : R.drawable.read_indicator_dark;
    final int pinnedIndicatorBackground = entryManager.isLightColorSchemeSelected() ? R.drawable.pinned_indicator : R.drawable.pinned_indicator_dark;
    int bgReadIndicator = -1;
    switch(entry.getReadState()) {
        case READ:
            bgReadIndicator = R.drawable.read_indicator_invisible;
            break;
        case UNREAD:
            bgReadIndicator = readIndicatorBackground;
            break;
        default:
            bgReadIndicator = pinnedIndicatorBackground;
    }
    readIndicator.setBackgroundResource(bgReadIndicator);
    // view.setBackgroundColor(backgroundColor);
    View container = view.findViewById(R.id.outter_container);
    if (entryManager.isLightColorSchemeSelected())
        container.setBackgroundColor(resources.getColor(R.color.article_read_background));
    else
        container.setBackgroundDrawable(resources.getDrawable(R.drawable.article_header_background_dark));
    // entryTitleView.setTextColor(textColor);
    // feedTitleView.setTextColor(textColor);
    //
    feedTitleView.setCompoundDrawablePadding(3);
    feedTitleView.setCompoundDrawablesWithIntrinsicBounds(resources.getDrawable(uiHelper.getArticleDownloadIndicatorDrawable(entry.getDownloaded(), entry.getDownloadPref(), resources)), null, null, null);
    // star check box
    final CheckBox starCheckBox = (CheckBox) view.findViewById(R.id.star_checkbox);
    starCheckBox.setVisibility(View.VISIBLE);
    starCheckBox.setChecked(entry.isStarred());
    starCheckBox.setOnClickListener(new View.OnClickListener() {

        public void onClick(final View v) {
            entryManager.updateStarredState(entry, starCheckBox.isChecked());
        }
    });
    starCheckBox.requestFocus();
    if (false) {
        // changed
        final TextView changedView = (TextView) view.findViewById(R.id.article_changed);
        final boolean stateChanged = entry.isReadStatePending() || entry.isStarredStatePending();
        changedView.setText(stateChanged ? "*" : "");
    }
}
Also used : CheckBox(android.widget.CheckBox) SwipeRelativeLayout(com.newsrob.widget.SwipeRelativeLayout) TextView(android.widget.TextView) Resources(android.content.res.Resources) TextView(android.widget.TextView) View(android.view.View) MotionEvent(android.view.MotionEvent)

Example 74 with CheckBox

use of android.widget.CheckBox in project wechat by motianhuo.

the class AddGroupChatActivity method onItemClick.

@Override
public void onItemClick(AdapterView<?> arg0, View view, int arg2, long arg3) {
    CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
    checkBox.toggle();
}
Also used : CheckBox(android.widget.CheckBox)

Example 75 with CheckBox

use of android.widget.CheckBox in project EasyRecyclerView by Jude95.

the class RefreshAndMoreActivity method onCreateOptionsMenu.

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    MenuItem item = menu.findItem(R.id.checkbox);
    CheckBox box = (CheckBox) item.getActionView();
    box.setChecked(true);
    box.setText("网络");
    box.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            hasNetWork = isChecked;
        }
    });
    return true;
}
Also used : CheckBox(android.widget.CheckBox) MenuItem(android.view.MenuItem) CompoundButton(android.widget.CompoundButton)

Aggregations

CheckBox (android.widget.CheckBox)197 View (android.view.View)102 TextView (android.widget.TextView)78 CompoundButton (android.widget.CompoundButton)51 Button (android.widget.Button)48 ImageView (android.widget.ImageView)32 Intent (android.content.Intent)30 EditText (android.widget.EditText)30 LayoutInflater (android.view.LayoutInflater)25 AdapterView (android.widget.AdapterView)25 DialogInterface (android.content.DialogInterface)21 ListView (android.widget.ListView)20 SuppressLint (android.annotation.SuppressLint)19 RadioButton (android.widget.RadioButton)19 AlertDialog (android.app.AlertDialog)17 Paint (android.graphics.Paint)14 Bundle (android.os.Bundle)12 ViewGroup (android.view.ViewGroup)12 GridLayout (android.widget.GridLayout)12 LinearLayout (android.widget.LinearLayout)12