use of android.widget.CheckBox in project Android-Material-Examples by saulmm.
the class ColorActivity method onCreate.
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set the saved theme
sharedpreferences = getSharedPreferences("test", Context.MODE_PRIVATE);
setTheme(sharedpreferences.getInt("theme", R.style.AppTheme));
setContentView(R.layout.activity_color);
// Views
Switch themeSwitch = (Switch) findViewById(R.id.theme_switch);
themeSwitch.setChecked(sharedpreferences.getBoolean(themeSwitch.getId() + "", false));
themeSwitch.setOnCheckedChangeListener(checkedListener);
CheckBox themeCheck = (CheckBox) findViewById(R.id.theme_check);
themeCheck.setChecked(sharedpreferences.getBoolean(themeCheck.getId() + "", false));
themeCheck.setOnCheckedChangeListener(checkedListener);
revealView = findViewById(R.id.reveal_view);
// Show the unReveal effect
final int cx = sharedpreferences.getInt("x", 0);
final int cy = sharedpreferences.getInt("y", 0);
startHideRevealEffect(cx, cy);
}
use of android.widget.CheckBox in project muzei by romannurik.
the class SettingsAdvancedFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.settings_advanced_fragment, container, false);
mBlurSeekBar = (SeekBar) rootView.findViewById(R.id.blur_amount);
mBlurSeekBar.setProgress(Prefs.getSharedPreferences(getContext()).getInt(Prefs.PREF_BLUR_AMOUNT, MuzeiBlurRenderer.DEFAULT_BLUR));
mBlurSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int value, boolean fromUser) {
if (fromUser) {
mHandler.removeCallbacks(mUpdateBlurRunnable);
mHandler.postDelayed(mUpdateBlurRunnable, 750);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
mDimSeekBar = (SeekBar) rootView.findViewById(R.id.dim_amount);
mDimSeekBar.setProgress(Prefs.getSharedPreferences(getContext()).getInt(Prefs.PREF_DIM_AMOUNT, MuzeiBlurRenderer.DEFAULT_MAX_DIM));
mDimSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int value, boolean fromUser) {
if (fromUser) {
mHandler.removeCallbacks(mUpdateDimRunnable);
mHandler.postDelayed(mUpdateDimRunnable, 750);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
mGreySeekBar = (SeekBar) rootView.findViewById(R.id.grey_amount);
mGreySeekBar.setProgress(Prefs.getSharedPreferences(getContext()).getInt(Prefs.PREF_GREY_AMOUNT, MuzeiBlurRenderer.DEFAULT_GREY));
mGreySeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int value, boolean fromUser) {
if (fromUser) {
mHandler.removeCallbacks(mUpdateGreyRunnable);
mHandler.postDelayed(mUpdateGreyRunnable, 750);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
CheckBox mNotifyNewWallpaperCheckBox = (CheckBox) rootView.findViewById(R.id.notify_new_wallpaper_checkbox);
mNotifyNewWallpaperCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton button, boolean checked) {
PreferenceManager.getDefaultSharedPreferences(getContext()).edit().putBoolean(NewWallpaperNotificationReceiver.PREF_ENABLED, checked).apply();
}
});
mNotifyNewWallpaperCheckBox.setChecked(PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean(NewWallpaperNotificationReceiver.PREF_ENABLED, true));
CheckBox mBlurOnLockScreenCheckBox = (CheckBox) rootView.findViewById(R.id.blur_on_lockscreen_checkbox);
mBlurOnLockScreenCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton button, boolean checked) {
Prefs.getSharedPreferences(getContext()).edit().putBoolean(Prefs.PREF_DISABLE_BLUR_WHEN_LOCKED, !checked).apply();
}
});
mBlurOnLockScreenCheckBox.setChecked(!Prefs.getSharedPreferences(getContext()).getBoolean(Prefs.PREF_DISABLE_BLUR_WHEN_LOCKED, false));
return rootView;
}
use of android.widget.CheckBox in project JustAndroid by chinaltz.
the class ShopcartAdapter method getGroupView.
@Override
public View getGroupView(final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
final GroupViewHolder gholder;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_shopcart_group, null);
gholder = new GroupViewHolder(convertView);
convertView.setTag(gholder);
} else {
gholder = (GroupViewHolder) convertView.getTag();
}
final StoreInfo group = (StoreInfo) getGroup(groupPosition);
gholder.tvSourceName.setText(group.getName());
gholder.determineChekbox.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
group.setChoosed(((CheckBox) v).isChecked());
// 暴露组选接口
checkInterface.checkGroup(groupPosition, ((CheckBox) v).isChecked());
}
});
gholder.determineChekbox.setChecked(group.isChoosed());
if (group.isEdtor()) {
gholder.tvStoreEdtor.setText("完成");
} else {
gholder.tvStoreEdtor.setText("编辑");
}
gholder.tvStoreEdtor.setOnClickListener(new GroupViewClick(groupPosition, gholder.tvStoreEdtor, group));
notifyDataSetChanged();
return convertView;
}
use of android.widget.CheckBox in project ChatExchange by HueToYou.
the class AuthenticatorActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_authenticator);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
mEmail = (EditText) findViewById(R.id.auth_email);
mPassword = (EditText) findViewById(R.id.auth_password);
mAccountManager = AccountManager.get(this);
CheckBox showPassword = (CheckBox) findViewById(R.id.show_password);
showPassword.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mPassword.setInputType(isChecked ? InputType.TYPE_CLASS_TEXT + InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD : InputType.TYPE_CLASS_TEXT + InputType.TYPE_TEXT_VARIATION_PASSWORD);
}
});
Button submit = (Button) findViewById(R.id.auth_submit);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean emptyEmail = mEmail.getText().toString().isEmpty();
boolean emptyPassword = mPassword.getText().toString().isEmpty();
if (emptyEmail || emptyPassword) {
if (emptyEmail)
setErrorHint(mEmail, R.string.activity_authenticator_email_required);
if (emptyPassword)
setErrorHint(mPassword, R.string.activity_authenticator_password_required);
} else {
startAuth();
}
}
});
}
use of android.widget.CheckBox in project TaEmCasa by Dionen.
the class LoginActivity method login.
/**
* Ação do botão "Entrar". Pega os dados de login e os compara com a database.
* Faz login do usuário caso a comparação seja bem-sucedida.
* @param view Botão "Entrar"
*/
public void login(View view) {
final EditText username_camp = (EditText) findViewById(R.id.username);
final EditText password_camp = (EditText) findViewById(R.id.password);
final CheckBox keep_connected = (CheckBox) findViewById(R.id.checkBox);
if (username_camp.getText().toString().equals("") || password_camp.getText().toString().equals("")) {
ToastMessage("E-mail/Senha incorretos");
// Apaga o campo "Senha"
password_camp.setText(null);
} else {
// Começa o Loading
showProgress(true);
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
JSONObject jsonResponse = null;
try {
jsonResponse = new JSONObject(response);
boolean success = jsonResponse.getBoolean("success");
if (success) {
/* EMAIL ENCONTRADO */
String salt = jsonResponse.getString("salt");
String hash = jsonResponse.getString("hash");
if (PasswordAuthentication.check_password_hash(password_camp.getText().toString(), salt, hash)) {
/*==================*/
/* LOGIN SUCCESSFUL */
/*==================*/
Intent intent = new Intent(LoginActivity.this, MenuActivity.class);
/* Passa dados do usuario para a proxima activity */
String id = jsonResponse.getString("user_id");
String nome = jsonResponse.getString("nome");
String sobrenome = jsonResponse.getString("sobrenome");
intent.putExtra("user_id", id);
intent.putExtra("nome", nome);
intent.putExtra("sobrenome", sobrenome);
intent.putExtra("email", username_camp.getText().toString());
/* Guarda os dados do usuario para entrar automaticamente */
if (keep_connected.isChecked()) {
SharedPreferences sharedPref = getSharedPreferences("logged_user", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString("nome", nome);
editor.putString("sobrenome", sobrenome);
editor.putString("email", username_camp.getText().toString());
editor.putString("user_id", id);
editor.putBoolean("keep_connected", true);
editor.commit();
}
password_camp.setText(null);
LoginActivity.this.startActivity(intent);
} else {
/* EMAIL CADASTRADO, SENHA INCORRETA */
showProgress(false);
ToastMessage("E-mail/Senha incorretos");
password_camp.setText(null);
}
} else {
/* EMAIL NAO CADASTRADO */
showProgress(false);
ToastMessage("E-mail/Senha incorretos");
password_camp.setText(null);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
};
/* ENTRA NA DATABASE ONLINE */
LoginRequest loginRequest = new LoginRequest(username_camp.getText().toString(), responseListener);
RequestQueue queue = Volley.newRequestQueue(LoginActivity.this);
// Executa as tarefas requisitadas
queue.add(loginRequest);
}
}
Aggregations