Search in sources :

Example 21 with CompoundButton

use of android.widget.CompoundButton in project SmartAndroidSource by jaychou2012.

the class ListMenuItemView method setCheckable.

public void setCheckable(boolean checkable) {
    if (!checkable && mRadioButton == null && mCheckBox == null) {
        return;
    }
    if (mRadioButton == null) {
        insertRadioButton();
    }
    if (mCheckBox == null) {
        insertCheckBox();
    }
    // Depending on whether its exclusive check or not, the checkbox or
    // radio button will be the one in use (and the other will be
    // otherCompoundButton)
    final CompoundButton compoundButton;
    final CompoundButton otherCompoundButton;
    if (mItemData.isExclusiveCheckable()) {
        compoundButton = mRadioButton;
        otherCompoundButton = mCheckBox;
    } else {
        compoundButton = mCheckBox;
        otherCompoundButton = mRadioButton;
    }
    if (checkable) {
        compoundButton.setChecked(mItemData.isChecked());
        final int newVisibility = checkable ? VISIBLE : GONE;
        if (compoundButton.getVisibility() != newVisibility) {
            compoundButton.setVisibility(newVisibility);
        }
        // Make sure the other compound button isn't visible
        if (otherCompoundButton.getVisibility() != GONE) {
            otherCompoundButton.setVisibility(GONE);
        }
    } else {
        mCheckBox.setVisibility(GONE);
        mRadioButton.setVisibility(GONE);
    }
}
Also used : CompoundButton(android.widget.CompoundButton)

Example 22 with CompoundButton

use of android.widget.CompoundButton in project k-9 by k9mail.

the class AccountSetupBasics method initializeViewListeners.

private void initializeViewListeners() {
    mEmailView.addTextChangedListener(this);
    mPasswordView.addTextChangedListener(this);
    mClientCertificateCheckBox.setOnCheckedChangeListener(this);
    mClientCertificateSpinner.setOnClientCertificateChangedListener(this);
    mShowPasswordCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            showPassword(isChecked);
        }
    });
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) CompoundButton(android.widget.CompoundButton)

Example 23 with CompoundButton

use of android.widget.CompoundButton in project android-stackblur by kikoso.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    _stackBlurManager = new StackBlurManager(getBitmapFromAsset(this, "android_platform_256.png"));
    _seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            onBlur();
        }
    });
    _toggleButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                IMAGE_TO_ANALYZE = "image_transparency.png";
                _stackBlurManager = new StackBlurManager(getBitmapFromAsset(getApplicationContext(), IMAGE_TO_ANALYZE));
                onBlur();
            } else {
                IMAGE_TO_ANALYZE = "android_platform_256.png";
                _stackBlurManager = new StackBlurManager(getBitmapFromAsset(getApplicationContext(), IMAGE_TO_ANALYZE));
                onBlur();
            }
        }
    });
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.blur_modes, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    _typeSelectSpinner.setAdapter(adapter);
    _typeSelectSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            setBlurMode(position);
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {
        }
    });
}
Also used : SeekBar(android.widget.SeekBar) OnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener) InjectView(roboguice.inject.InjectView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) StackBlurManager(com.enrique.stackblur.StackBlurManager) AdapterView(android.widget.AdapterView) CompoundButton(android.widget.CompoundButton)

Example 24 with CompoundButton

use of android.widget.CompoundButton in project k-9 by k9mail.

the class EditIdentity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mIdentity = (Identity) getIntent().getSerializableExtra(EXTRA_IDENTITY);
    mIdentityIndex = getIntent().getIntExtra(EXTRA_IDENTITY_INDEX, -1);
    String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
    mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
    if (mIdentityIndex == -1) {
        mIdentity = new Identity();
    }
    setContentView(R.layout.edit_identity);
    /*
         * If we're being reloaded we override the original account with the one
         * we saved
         */
    if (savedInstanceState != null && savedInstanceState.containsKey(EXTRA_IDENTITY)) {
        mIdentity = (Identity) savedInstanceState.getSerializable(EXTRA_IDENTITY);
    }
    mDescriptionView = (EditText) findViewById(R.id.description);
    mDescriptionView.setText(mIdentity.getDescription());
    mNameView = (EditText) findViewById(R.id.name);
    mNameView.setText(mIdentity.getName());
    mEmailView = (EditText) findViewById(R.id.email);
    mEmailView.setText(mIdentity.getEmail());
    mReplyTo = (EditText) findViewById(R.id.reply_to);
    mReplyTo.setText(mIdentity.getReplyTo());
    //      mAccountAlwaysBcc = (EditText)findViewById(R.id.bcc);
    //      mAccountAlwaysBcc.setText(mIdentity.getAlwaysBcc());
    mSignatureLayout = (LinearLayout) findViewById(R.id.signature_layout);
    mSignatureUse = (CheckBox) findViewById(R.id.signature_use);
    mSignatureView = (EditText) findViewById(R.id.signature);
    mSignatureUse.setChecked(mIdentity.getSignatureUse());
    mSignatureUse.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                mSignatureLayout.setVisibility(View.VISIBLE);
                mSignatureView.setText(mIdentity.getSignature());
            } else {
                mSignatureLayout.setVisibility(View.GONE);
            }
        }
    });
    if (mSignatureUse.isChecked()) {
        mSignatureView.setText(mIdentity.getSignature());
    } else {
        mSignatureLayout.setVisibility(View.GONE);
    }
}
Also used : Identity(com.fsck.k9.Identity) CompoundButton(android.widget.CompoundButton)

Example 25 with CompoundButton

use of android.widget.CompoundButton in project LollipopShowcase by mikepenz.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final SharedPreferences pref = getSharedPreferences("com.mikepenz.applicationreader", 0);
    drawer = new DrawerBuilder(this).withToolbar(toolbar).addDrawerItems(new SwitchDrawerItem().withOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton compoundButton, boolean b) {
            SharedPreferences.Editor editor = pref.edit();
            editor.putBoolean("autouploadenabled", b);
            editor.apply();
        }
    }).withName(R.string.drawer_switch).withChecked(pref.getBoolean("autouploadenabled", false))).addStickyDrawerItems(new SecondaryDrawerItem().withName(R.string.drawer_opensource).withIdentifier(DRAWER_ITEM_OPEN_SOURCE).withIcon(FontAwesome.Icon.faw_github).withSelectable(false)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {

        @Override
        public boolean onItemClick(View view, int i, IDrawerItem drawerItem) {
            if (drawerItem.getIdentifier() == DRAWER_ITEM_OPEN_SOURCE) {
                new LibsBuilder().withFields(R.string.class.getFields()).withVersionShown(true).withLicenseShown(true).withActivityTitle(getString(R.string.drawer_opensource)).withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).start(MainActivity.this);
            }
            return false;
        }
    }).withSelectedItem(-1).withSavedInstance(savedInstanceState).build();
    // Handle ProgressBar
    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    // Fab Button
    mFabButton = (FloatingActionButton) findViewById(R.id.fab_normal);
    mFabButton.setImageDrawable(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_file_upload).color(Color.WHITE).actionBar());
    mFabButton.setOnClickListener(fabClickListener);
    mRecyclerView = (RecyclerView) findViewById(R.id.list);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setItemAnimator(new CustomItemAnimator());
    //mRecyclerView.setItemAnimator(new ReboundItemAnimator());
    mAdapter = new ApplicationAdapter(new ArrayList<AppInfo>(), R.layout.row_application, MainActivity.this);
    mRecyclerView.setAdapter(mAdapter);
    mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe_container);
    mSwipeRefreshLayout.setColorSchemeColors(getResources().getColor(R.color.theme_accent));
    mSwipeRefreshLayout.setRefreshing(true);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            new InitializeApplicationsTask().execute();
        }
    });
    new InitializeApplicationsTask().execute();
    if (savedInstanceState != null) {
        if (uploadComponentInfoTask != null) {
            if (uploadComponentInfoTask.isRunning) {
                uploadComponentInfoTask.showProgress(this);
            }
        }
    }
    //show progress
    mRecyclerView.setVisibility(View.GONE);
    mProgressBar.setVisibility(View.VISIBLE);
}
Also used : IDrawerItem(com.mikepenz.materialdrawer.model.interfaces.IDrawerItem) OnCheckedChangeListener(com.mikepenz.materialdrawer.interfaces.OnCheckedChangeListener) SharedPreferences(android.content.SharedPreferences) ArrayList(java.util.ArrayList) SwitchDrawerItem(com.mikepenz.materialdrawer.model.SwitchDrawerItem) Drawer(com.mikepenz.materialdrawer.Drawer) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SecondaryDrawerItem(com.mikepenz.materialdrawer.model.SecondaryDrawerItem) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) LibsBuilder(com.mikepenz.aboutlibraries.LibsBuilder) CustomItemAnimator(com.mikepenz.lollipopshowcase.itemanimator.CustomItemAnimator) DrawerBuilder(com.mikepenz.materialdrawer.DrawerBuilder) ApplicationAdapter(com.mikepenz.lollipopshowcase.adapter.ApplicationAdapter) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable) CompoundButton(android.widget.CompoundButton) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

CompoundButton (android.widget.CompoundButton)235 View (android.view.View)118 TextView (android.widget.TextView)95 OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)60 ImageView (android.widget.ImageView)48 CheckBox (android.widget.CheckBox)42 AdapterView (android.widget.AdapterView)25 Button (android.widget.Button)22 DialogInterface (android.content.DialogInterface)21 LayoutInflater (android.view.LayoutInflater)20 OnClickListener (android.view.View.OnClickListener)18 Intent (android.content.Intent)17 SeekBar (android.widget.SeekBar)17 Switch (android.widget.Switch)17 SwitchCompat (android.support.v7.widget.SwitchCompat)15 AlertDialog (android.app.AlertDialog)13 ArrayList (java.util.ArrayList)12 Context (android.content.Context)11 OnClickListener (android.content.DialogInterface.OnClickListener)11 Cursor (android.database.Cursor)11