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);
}
}
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);
}
});
}
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) {
}
});
}
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);
}
}
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);
}
Aggregations