use of android.widget.CheckBox in project TextSurface by elevenetc.
the class SampleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sample_activity);
textSurface = (TextSurface) findViewById(R.id.text_surface);
textSurface.postDelayed(new Runnable() {
@Override
public void run() {
show();
}
}, 1000);
findViewById(R.id.btn_refresh).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
show();
}
});
CheckBox checkDebug = (CheckBox) findViewById(R.id.check_debug);
checkDebug.setChecked(Debug.ENABLED);
checkDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Debug.ENABLED = isChecked;
textSurface.invalidate();
}
});
}
use of android.widget.CheckBox in project cw-omnibus by commonsguy.
the class DatePickerDemoActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
CheckBox cb = (CheckBox) findViewById(R.id.showCalendar);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
cb.setOnCheckedChangeListener(this);
} else {
cb.setVisibility(View.GONE);
}
GregorianCalendar now = new GregorianCalendar();
picker = (DatePicker) findViewById(R.id.picker);
picker.init(now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH), this);
}
use of android.widget.CheckBox in project c-geo by just-radovan.
the class cgeoinit method init.
public void init() {
// geocaching.com settings
String usernameNow = prefs.getString("username", null);
if (usernameNow != null) {
((EditText) findViewById(R.id.username)).setText(usernameNow);
}
String passwordNow = prefs.getString("password", null);
if (usernameNow != null) {
((EditText) findViewById(R.id.password)).setText(passwordNow);
}
Button logMeIn = (Button) findViewById(R.id.log_me_in);
logMeIn.setOnClickListener(new logIn());
TextView legalNote = (TextView) findViewById(R.id.legal_note);
legalNote.setClickable(true);
legalNote.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.geocaching.com/about/termsofuse.aspx")));
}
});
// gcvote settings
String passvoteNow = prefs.getString("pass-vote", null);
if (passvoteNow != null) {
((EditText) findViewById(R.id.passvote)).setText(passvoteNow);
}
// go4cache settings
TextView go4cache = (TextView) findViewById(R.id.about_go4cache);
go4cache.setClickable(true);
go4cache.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://go4cache.com/")));
}
});
CheckBox publicButton = (CheckBox) findViewById(R.id.publicloc);
if (prefs.getInt("publicloc", 0) == 0) {
publicButton.setChecked(false);
} else {
publicButton.setChecked(true);
}
publicButton.setOnClickListener(new cgeoChangePublic());
// Twitter settings
Button authorizeTwitter = (Button) findViewById(R.id.authorize_twitter);
authorizeTwitter.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
Intent authIntent = new Intent(activity, cgeoauth.class);
activity.startActivity(authIntent);
}
});
CheckBox twitterButton = (CheckBox) findViewById(R.id.twitter_option);
if (prefs.getInt("twitter", 0) == 0 || settings.tokenPublic == null || settings.tokenPublic.length() == 0 || settings.tokenSecret == null || settings.tokenSecret.length() == 0) {
twitterButton.setChecked(false);
} else {
twitterButton.setChecked(true);
}
twitterButton.setOnClickListener(new cgeoChangeTwitter());
// Signature settings
EditText sigEdit = (EditText) findViewById(R.id.signature);
if (sigEdit.getText().length() == 0) {
sigEdit.setText(settings.getSignature());
}
Button sigBtn = (Button) findViewById(R.id.signature_help);
sigBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
warning.helpDialog(res.getString(R.string.init_signature_help_title), res.getString(R.string.init_signature_help_text));
}
});
// Other settings
CheckBox skinButton = (CheckBox) findViewById(R.id.skin);
if (prefs.getInt("skin", 0) == 0) {
skinButton.setChecked(false);
} else {
skinButton.setChecked(true);
}
skinButton.setOnClickListener(new cgeoChangeSkin());
CheckBox addressButton = (CheckBox) findViewById(R.id.address);
if (prefs.getInt("showaddress", 1) == 0) {
addressButton.setChecked(false);
} else {
addressButton.setChecked(true);
}
addressButton.setOnClickListener(new cgeoChangeAddress());
CheckBox captchaButton = (CheckBox) findViewById(R.id.captcha);
if (prefs.getBoolean("showcaptcha", false) == false) {
captchaButton.setChecked(false);
} else {
captchaButton.setChecked(true);
}
captchaButton.setOnClickListener(new cgeoChangeCaptcha());
CheckBox useEnglishButton = (CheckBox) findViewById(R.id.useenglish);
if (prefs.getBoolean("useenglish", false) == false) {
useEnglishButton.setChecked(false);
} else {
useEnglishButton.setChecked(true);
}
useEnglishButton.setOnClickListener(new cgeoChangeUseEnglish());
CheckBox excludeButton = (CheckBox) findViewById(R.id.exclude);
if (prefs.getInt("excludemine", 0) == 0) {
excludeButton.setChecked(false);
} else {
excludeButton.setChecked(true);
}
excludeButton.setOnClickListener(new cgeoChangeExclude());
CheckBox disabledButton = (CheckBox) findViewById(R.id.disabled);
if (prefs.getInt("excludedisabled", 0) == 0) {
disabledButton.setChecked(false);
} else {
disabledButton.setChecked(true);
}
disabledButton.setOnClickListener(new cgeoChangeDisabled());
CheckBox offlineButton = (CheckBox) findViewById(R.id.offline);
if (prefs.getInt("offlinemaps", 1) == 0) {
offlineButton.setChecked(false);
} else {
offlineButton.setChecked(true);
}
offlineButton.setOnClickListener(new cgeoChangeOffline());
CheckBox autoloadButton = (CheckBox) findViewById(R.id.autoload);
if (prefs.getInt("autoloaddesc", 0) == 0) {
autoloadButton.setChecked(false);
} else {
autoloadButton.setChecked(true);
}
autoloadButton.setOnClickListener(new cgeoChangeAutoload());
CheckBox livelistButton = (CheckBox) findViewById(R.id.livelist);
if (prefs.getInt("livelist", 1) == 0) {
livelistButton.setChecked(false);
} else {
livelistButton.setChecked(true);
}
livelistButton.setOnClickListener(new cgeoChangeLivelist());
CheckBox unitsButton = (CheckBox) findViewById(R.id.units);
if (prefs.getInt("units", cgSettings.unitsMetric) == cgSettings.unitsMetric) {
unitsButton.setChecked(false);
} else {
unitsButton.setChecked(true);
}
unitsButton.setOnClickListener(new cgeoChangeUnits());
CheckBox gnavButton = (CheckBox) findViewById(R.id.gnav);
if (prefs.getInt("usegnav", 1) == 1) {
gnavButton.setChecked(true);
} else {
gnavButton.setChecked(false);
}
gnavButton.setOnClickListener(new cgeoChangeGNav());
CheckBox browserButton = (CheckBox) findViewById(R.id.browser);
if (prefs.getInt("asbrowser", 1) == 0) {
browserButton.setChecked(false);
} else {
browserButton.setChecked(true);
}
browserButton.setOnClickListener(new cgeoChangeBrowser());
// Altitude settings
EditText altitudeEdit = (EditText) findViewById(R.id.altitude);
altitudeEdit.setText("" + prefs.getInt("altcorrection", 0));
// Map source settings
Spinner mapSourceSelector = (Spinner) findViewById(R.id.mapsource);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.map_sources, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mapSourceSelector.setAdapter(adapter);
int mapsource = prefs.getInt("mapsource", 0);
mapSourceSelector.setSelection(mapsource);
mapSourceSelector.setOnItemSelectedListener(new cgeoChangeMapSource());
EditText mfmapFileEdit = (EditText) findViewById(R.id.mapfile);
mfmapFileEdit.setText(prefs.getString("mfmapfile", ""));
setMapFileEditState();
// Cache db backup
TextView lastBackup = (TextView) findViewById(R.id.backup_last);
File lastBackupFile = app.isRestoreFile();
if (lastBackupFile != null) {
lastBackup.setText(res.getString(R.string.init_backup_last) + " " + cgBase.timeOut.format(lastBackupFile.lastModified()) + ", " + cgBase.dateOut.format(lastBackupFile.lastModified()));
} else {
lastBackup.setText(res.getString(R.string.init_backup_last_no));
}
}
use of android.widget.CheckBox in project OpenMEAP by OpenMEAP.
the class MainActivity method createLoginFormDialog.
private Dialog createLoginFormDialog() {
Context mContext = this;
final Dialog dialog = new Dialog(mContext);
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
final View layout = inflater.inflate(R.layout.login_form, (ViewGroup) findViewById(R.id.login_form_container));
dialog.setContentView(layout);
dialog.setTitle("Authentication Prompt");
String infoText = loginFormCallback.getInfoText();
TextView infoTextView = (TextView) layout.findViewById(R.id.info);
infoTextView.setText(infoText);
Button proceedButton = (Button) layout.findViewById(R.id.proceed);
proceedButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
EditText passwordText = (EditText) layout.findViewById(R.id.password);
EditText usernameText = (EditText) layout.findViewById(R.id.username);
CheckBox rememberBox = (CheckBox) layout.findViewById(R.id.remember);
loginFormCallback.onProceed(usernameText.getEditableText().toString(), passwordText.getEditableText().toString(), rememberBox.isChecked());
loginFormCallback = null;
if (!rememberBox.isChecked()) {
usernameText.setText("");
passwordText.setText("");
}
dialog.dismiss();
}
});
Button cancelButton = (Button) layout.findViewById(R.id.cancel);
cancelButton.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
EditText passwordText = (EditText) layout.findViewById(R.id.password);
EditText usernameText = (EditText) layout.findViewById(R.id.username);
CheckBox rememberBox = (CheckBox) layout.findViewById(R.id.remember);
loginFormCallback.onCancel();
loginFormCallback = null;
if (!rememberBox.isChecked()) {
usernameText.setText("");
passwordText.setText("");
}
dialog.dismiss();
}
});
EditText usernameText = (EditText) layout.findViewById(R.id.username);
usernameText.requestFocus();
return dialog;
}
use of android.widget.CheckBox in project SlidingMenu by jfeinstein10.
the class PropertiesActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setSlidingActionBarEnabled(true);
setContentView(R.layout.properties);
// left and right modes
RadioGroup mode = (RadioGroup) findViewById(R.id.mode);
mode.check(R.id.left);
mode.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
SlidingMenu sm = getSlidingMenu();
switch(checkedId) {
case R.id.left:
sm.setMode(SlidingMenu.LEFT);
sm.setShadowDrawable(R.drawable.shadow);
break;
case R.id.right:
sm.setMode(SlidingMenu.RIGHT);
sm.setShadowDrawable(R.drawable.shadowright);
break;
case R.id.left_right:
sm.setMode(SlidingMenu.LEFT_RIGHT);
sm.setSecondaryMenu(R.layout.menu_frame_two);
getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame_two, new SampleListFragment()).commit();
sm.setSecondaryShadowDrawable(R.drawable.shadowright);
sm.setShadowDrawable(R.drawable.shadow);
}
}
});
// touch mode stuff
RadioGroup touchAbove = (RadioGroup) findViewById(R.id.touch_above);
touchAbove.check(R.id.touch_above_full);
touchAbove.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch(checkedId) {
case R.id.touch_above_full:
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
break;
case R.id.touch_above_margin:
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
break;
case R.id.touch_above_none:
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
break;
}
}
});
// scroll scale stuff
SeekBar scrollScale = (SeekBar) findViewById(R.id.scroll_scale);
scrollScale.setMax(1000);
scrollScale.setProgress(333);
scrollScale.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
getSlidingMenu().setBehindScrollScale((float) seekBar.getProgress() / seekBar.getMax());
}
});
// behind width stuff
SeekBar behindWidth = (SeekBar) findViewById(R.id.behind_width);
behindWidth.setMax(1000);
behindWidth.setProgress(750);
behindWidth.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
float percent = (float) seekBar.getProgress() / seekBar.getMax();
getSlidingMenu().setBehindWidth((int) (percent * getSlidingMenu().getWidth()));
getSlidingMenu().requestLayout();
}
});
// shadow stuff
CheckBox shadowEnabled = (CheckBox) findViewById(R.id.shadow_enabled);
shadowEnabled.setChecked(true);
shadowEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked)
getSlidingMenu().setShadowDrawable(getSlidingMenu().getMode() == SlidingMenu.LEFT ? R.drawable.shadow : R.drawable.shadowright);
else
getSlidingMenu().setShadowDrawable(null);
}
});
SeekBar shadowWidth = (SeekBar) findViewById(R.id.shadow_width);
shadowWidth.setMax(1000);
shadowWidth.setProgress(75);
shadowWidth.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
float percent = (float) seekBar.getProgress() / (float) seekBar.getMax();
int width = (int) (percent * (float) getSlidingMenu().getWidth());
getSlidingMenu().setShadowWidth(width);
getSlidingMenu().invalidate();
}
});
// fading stuff
CheckBox fadeEnabled = (CheckBox) findViewById(R.id.fade_enabled);
fadeEnabled.setChecked(true);
fadeEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
getSlidingMenu().setFadeEnabled(isChecked);
}
});
SeekBar fadeDeg = (SeekBar) findViewById(R.id.fade_degree);
fadeDeg.setMax(1000);
fadeDeg.setProgress(666);
fadeDeg.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
getSlidingMenu().setFadeDegree((float) seekBar.getProgress() / seekBar.getMax());
}
});
}
Aggregations