Search in sources :

Example 16 with CheckBox

use of android.widget.CheckBox in project Notes by MiCode.

the class NoteEditActivity method getListItem.

private View getListItem(String item, int index) {
    View view = LayoutInflater.from(this).inflate(R.layout.note_edit_list_item, null);
    final NoteEditText edit = (NoteEditText) view.findViewById(R.id.et_edit_text);
    edit.setTextAppearance(this, TextAppearanceResources.getTexAppearanceResource(mFontSizeId));
    CheckBox cb = ((CheckBox) view.findViewById(R.id.cb_edit_item));
    cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
            } else {
                edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
            }
        }
    });
    if (item.startsWith(TAG_CHECKED)) {
        cb.setChecked(true);
        edit.setPaintFlags(edit.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        item = item.substring(TAG_CHECKED.length(), item.length()).trim();
    } else if (item.startsWith(TAG_UNCHECKED)) {
        cb.setChecked(false);
        edit.setPaintFlags(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG);
        item = item.substring(TAG_UNCHECKED.length(), item.length()).trim();
    }
    edit.setOnTextViewChangeListener(this);
    edit.setIndex(index);
    edit.setText(getHighlightQueryResult(item, mUserQuery));
    return view;
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) CheckBox(android.widget.CheckBox) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) CompoundButton(android.widget.CompoundButton)

Example 17 with CheckBox

use of android.widget.CheckBox in project FloatingStickies by MohammadAdib.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
    boolean key = prefs.getBoolean("key", false);
    if (!key) {
        setContentView(R.layout.tutorial);
        final ImageView iv1 = (ImageView) findViewById(R.id.imageView1);
        final ImageView iv2 = (ImageView) findViewById(R.id.imageView2);
        final ImageView iv3 = (ImageView) findViewById(R.id.imageView3);
        final ImageView iv4 = (ImageView) findViewById(R.id.done);
        final CheckBox cb = (CheckBox) findViewById(R.id.checkBox);
        final Animation anim1 = AnimationUtils.loadAnimation(this, R.anim.show);
        final Animation anim2 = AnimationUtils.loadAnimation(this, R.anim.show);
        final Animation anim3 = AnimationUtils.loadAnimation(this, R.anim.show);
        final Animation anim4 = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
        final Animation anim5 = AnimationUtils.loadAnimation(this, android.R.anim.fade_out);
        final Animation anim6 = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
        anim1.setDuration(500);
        anim2.setDuration(500);
        anim3.setDuration(500);
        anim1.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
                iv1.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                iv2.startAnimation(anim2);
            }
        });
        anim2.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
                iv2.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                iv3.startAnimation(anim3);
            }
        });
        anim3.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
                iv3.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                iv4.startAnimation(anim4);
                iv4.setOnTouchListener(MainActivity.this);
            }
        });
        anim4.setDuration(1000);
        anim4.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
                iv4.setVisibility(View.VISIBLE);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                iv4.startAnimation(anim5);
            }
        });
        anim5.setDuration(1000);
        anim5.setAnimationListener(new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
                iv4.startAnimation(anim4);
            }
        });
        iv1.startAnimation(anim1);
        cb.startAnimation(anim6);
    } else {
        finish();
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) CheckBox(android.widget.CheckBox) Animation(android.view.animation.Animation) ImageView(android.widget.ImageView) AnimationListener(android.view.animation.Animation.AnimationListener)

Example 18 with CheckBox

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;
}
Also used : Context(android.content.Context) EditText(android.widget.EditText) Button(android.widget.Button) Dialog(android.app.Dialog) CheckBox(android.widget.CheckBox) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView) OmWebView(com.openmeap.thinclient.OmWebView)

Example 19 with CheckBox

use of android.widget.CheckBox in project uCrop by Yalantis.

the class SampleActivity method setupUI.

@SuppressWarnings("ConstantConditions")
private void setupUI() {
    findViewById(R.id.button_crop).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            pickFromGallery();
        }
    });
    findViewById(R.id.button_random_image).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Random random = new Random();
            int minSizePixels = 800;
            int maxSizePixels = 2400;
            startCropActivity(Uri.parse(String.format(Locale.getDefault(), "https://unsplash.it/%d/%d/?random", minSizePixels + random.nextInt(maxSizePixels - minSizePixels), minSizePixels + random.nextInt(maxSizePixels - minSizePixels))));
        }
    });
    mRadioGroupAspectRatio = ((RadioGroup) findViewById(R.id.radio_group_aspect_ratio));
    mRadioGroupCompressionSettings = ((RadioGroup) findViewById(R.id.radio_group_compression_settings));
    mCheckBoxMaxSize = ((CheckBox) findViewById(R.id.checkbox_max_size));
    mEditTextRatioX = ((EditText) findViewById(R.id.edit_text_ratio_x));
    mEditTextRatioY = ((EditText) findViewById(R.id.edit_text_ratio_y));
    mEditTextMaxWidth = ((EditText) findViewById(R.id.edit_text_max_width));
    mEditTextMaxHeight = ((EditText) findViewById(R.id.edit_text_max_height));
    mSeekBarQuality = ((SeekBar) findViewById(R.id.seekbar_quality));
    mTextViewQuality = ((TextView) findViewById(R.id.text_view_quality));
    mCheckBoxHideBottomControls = ((CheckBox) findViewById(R.id.checkbox_hide_bottom_controls));
    mCheckBoxFreeStyleCrop = ((CheckBox) findViewById(R.id.checkbox_freestyle_crop));
    mRadioGroupAspectRatio.check(R.id.radio_dynamic);
    mEditTextRatioX.addTextChangedListener(mAspectRatioTextWatcher);
    mEditTextRatioY.addTextChangedListener(mAspectRatioTextWatcher);
    mRadioGroupCompressionSettings.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            mSeekBarQuality.setEnabled(checkedId == R.id.radio_jpeg);
        }
    });
    mRadioGroupCompressionSettings.check(R.id.radio_jpeg);
    mSeekBarQuality.setProgress(UCropActivity.DEFAULT_COMPRESS_QUALITY);
    mTextViewQuality.setText(String.format(getString(R.string.format_quality_d), mSeekBarQuality.getProgress()));
    mSeekBarQuality.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            mTextViewQuality.setText(String.format(getString(R.string.format_quality_d), progress));
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
}
Also used : EditText(android.widget.EditText) RadioGroup(android.widget.RadioGroup) SeekBar(android.widget.SeekBar) TextView(android.widget.TextView) View(android.view.View) Random(java.util.Random) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView)

Example 20 with CheckBox

use of android.widget.CheckBox in project actor-platform by actorapp.

the class NotificationsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View res = inflater.inflate(R.layout.fr_settings_notifications, container, false);
    res.setBackgroundColor(ActorSDK.sharedActor().style.getMainBackgroundColor());
    // Conversation tone
    final CheckBox enableTones = (CheckBox) res.findViewById(R.id.enableConversationTones);
    enableTones.setChecked(messenger().isConversationTonesEnabled());
    View.OnClickListener enableTonesListener = v -> {
        messenger().changeConversationTonesEnabled(!messenger().isConversationTonesEnabled());
        enableTones.setChecked(messenger().isConversationTonesEnabled());
    };
    ActorStyle style = ActorSDK.sharedActor().style;
    ((TextView) res.findViewById(R.id.settings_conversation_tones_title)).setTextColor(style.getTextPrimaryColor());
    ((TextView) res.findViewById(R.id.settings_conversation_tones_hint)).setTextColor(style.getTextSecondaryColor());
    enableTones.setOnClickListener(enableTonesListener);
    res.findViewById(R.id.conversationTonesCont).setOnClickListener(enableTonesListener);
    // Vibration
    final CheckBox enableVibration = (CheckBox) res.findViewById(R.id.enableVibration);
    enableVibration.setChecked(messenger().isNotificationVibrationEnabled());
    View.OnClickListener enableVibrationListener = v -> {
        messenger().changeNotificationVibrationEnabled(!messenger().isNotificationVibrationEnabled());
        enableVibration.setChecked(messenger().isNotificationVibrationEnabled());
    };
    enableVibration.setOnClickListener(enableVibrationListener);
    res.findViewById(R.id.vibrationCont).setOnClickListener(enableVibrationListener);
    ((TextView) res.findViewById(R.id.settings_vibration_title)).setTextColor(style.getTextPrimaryColor());
    ((TextView) res.findViewById(R.id.settings_vibration_hint)).setTextColor(style.getTextSecondaryColor());
    // Group
    final CheckBox enableGroup = (CheckBox) res.findViewById(R.id.enableGroup);
    enableGroup.setChecked(messenger().isGroupNotificationsEnabled());
    View.OnClickListener enableGroupListener = v -> {
        messenger().changeGroupNotificationsEnabled(!messenger().isGroupNotificationsEnabled());
        enableGroup.setChecked(messenger().isGroupNotificationsEnabled());
    };
    enableGroup.setOnClickListener(enableGroupListener);
    res.findViewById(R.id.groupCont).setOnClickListener(enableGroupListener);
    ((TextView) res.findViewById(R.id.settings_group_title)).setTextColor(style.getTextPrimaryColor());
    ((TextView) res.findViewById(R.id.settings_group_hint)).setTextColor(style.getTextSecondaryColor());
    // Mentions
    final CheckBox enableGroupMentions = (CheckBox) res.findViewById(R.id.enableGroupMentions);
    enableGroupMentions.setChecked(messenger().isGroupNotificationsOnlyMentionsEnabled());
    View.OnClickListener enableGroupMentionsListener = v -> {
        messenger().changeGroupNotificationsOnlyMentionsEnabled(!messenger().isGroupNotificationsOnlyMentionsEnabled());
        enableGroupMentions.setChecked(messenger().isGroupNotificationsOnlyMentionsEnabled());
    };
    enableGroupMentions.setOnClickListener(enableGroupMentionsListener);
    res.findViewById(R.id.groupMentionsCont).setOnClickListener(enableGroupMentionsListener);
    ((TextView) res.findViewById(R.id.settings_group_mentions_title)).setTextColor(style.getTextPrimaryColor());
    ((TextView) res.findViewById(R.id.settings_group_mentions_hint)).setTextColor(style.getTextSecondaryColor());
    // Names and messages
    final CheckBox enableText = (CheckBox) res.findViewById(R.id.enableTitles);
    enableText.setChecked(messenger().isShowNotificationsText());
    View.OnClickListener enableTextListener = v -> {
        messenger().changeShowNotificationTextEnabled(!messenger().isShowNotificationsText());
        enableText.setChecked(messenger().isShowNotificationsText());
    };
    enableText.setOnClickListener(enableTextListener);
    res.findViewById(R.id.titlesCont).setOnClickListener(enableTextListener);
    ((TextView) res.findViewById(R.id.settings_titles_title)).setTextColor(style.getTextPrimaryColor());
    ((TextView) res.findViewById(R.id.settings_titles_hint)).setTextColor(style.getTextSecondaryColor());
    // Sound
    View soundPickerCont = res.findViewById(R.id.soundPickerCont);
    View soundPickerDivider = res.findViewById(R.id.divider);
    if (messenger().isNotificationSoundEnabled()) {
        ViewUtils.showViews(false, soundPickerCont, soundPickerDivider);
    } else {
        ViewUtils.goneViews(false, soundPickerCont, soundPickerDivider);
    }
    final CheckBox enableSound = (CheckBox) res.findViewById(R.id.enableSound);
    enableSound.setChecked(messenger().isNotificationSoundEnabled());
    View.OnClickListener enableSoundListener = v -> {
        messenger().changeNotificationSoundEnabled(!messenger().isNotificationSoundEnabled());
        enableSound.setChecked(messenger().isNotificationSoundEnabled());
        if (messenger().isNotificationSoundEnabled()) {
            ViewUtils.showViews(soundPickerCont, soundPickerDivider);
        } else {
            ViewUtils.goneViews(soundPickerCont, soundPickerDivider);
        }
    };
    enableSound.setOnClickListener(enableSoundListener);
    res.findViewById(R.id.soundCont).setOnClickListener(enableSoundListener);
    ((TextView) res.findViewById(R.id.settings_sound_title)).setTextColor(style.getTextPrimaryColor());
    ((TextView) res.findViewById(R.id.settings_sound_hint)).setTextColor(style.getTextSecondaryColor());
    // Sound picker
    View.OnClickListener soundPickerListener = v -> {
        Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
        Uri currentSound = null;
        String defaultPath = null;
        Uri defaultUri = Settings.System.DEFAULT_NOTIFICATION_URI;
        if (defaultUri != null) {
            defaultPath = defaultUri.getPath();
        }
        String path = messenger().getPreferences().getString("globalNotificationSound");
        if (path == null) {
            path = defaultPath;
        }
        if (path != null && !path.equals("none")) {
            if (path.equals(defaultPath)) {
                currentSound = defaultUri;
            } else {
                currentSound = Uri.parse(path);
            }
        }
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, currentSound);
        startActivityForResult(intent, SOUND_PICKER_REQUEST_CODE);
    };
    res.findViewById(R.id.soundPickerCont).setOnClickListener(soundPickerListener);
    ((TextView) res.findViewById(R.id.settings_sound_picker_title)).setTextColor(style.getTextPrimaryColor());
    ((TextView) res.findViewById(R.id.settings_sound_picker_hint)).setTextColor(style.getTextSecondaryColor());
    return res;
}
Also used : BaseFragment(im.actor.sdk.controllers.BaseFragment) ActorSDK(im.actor.sdk.ActorSDK) Bundle(android.os.Bundle) LayoutInflater(android.view.LayoutInflater) ActorSDKMessenger.messenger(im.actor.sdk.util.ActorSDKMessenger.messenger) Uri(android.net.Uri) Intent(android.content.Intent) ViewGroup(android.view.ViewGroup) ViewUtils(im.actor.sdk.util.ViewUtils) R(im.actor.sdk.R) TextView(android.widget.TextView) CheckBox(android.widget.CheckBox) RingtoneManager(android.media.RingtoneManager) View(android.view.View) Settings(android.provider.Settings) ActorStyle(im.actor.sdk.ActorStyle) Activity(android.app.Activity) ActorStyle(im.actor.sdk.ActorStyle) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) Intent(android.content.Intent) TextView(android.widget.TextView) View(android.view.View) Uri(android.net.Uri)

Aggregations

CheckBox (android.widget.CheckBox)183 View (android.view.View)92 TextView (android.widget.TextView)69 CompoundButton (android.widget.CompoundButton)46 Button (android.widget.Button)43 ImageView (android.widget.ImageView)29 Intent (android.content.Intent)28 EditText (android.widget.EditText)27 AdapterView (android.widget.AdapterView)25 ListView (android.widget.ListView)20 LayoutInflater (android.view.LayoutInflater)19 DialogInterface (android.content.DialogInterface)16 RadioButton (android.widget.RadioButton)16 SuppressLint (android.annotation.SuppressLint)14 RemoteException (android.os.RemoteException)13 AlertDialog (android.app.AlertDialog)12 Paint (android.graphics.Paint)12 GridLayout (android.widget.GridLayout)12 Bundle (android.os.Bundle)11 ViewGroup (android.view.ViewGroup)11