Search in sources :

Example 51 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 52 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 53 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)

Example 54 with CheckBox

use of android.widget.CheckBox in project android_frameworks_base by ParanoidAndroid.

the class UsbResolverActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    Intent intent = getIntent();
    Parcelable targetParcelable = intent.getParcelableExtra(Intent.EXTRA_INTENT);
    if (!(targetParcelable instanceof Intent)) {
        Log.w("UsbResolverActivity", "Target is not an intent: " + targetParcelable);
        finish();
        return;
    }
    Intent target = (Intent) targetParcelable;
    ArrayList<ResolveInfo> rList = intent.getParcelableArrayListExtra(EXTRA_RESOLVE_INFOS);
    CharSequence title = getResources().getText(com.android.internal.R.string.chooseUsbActivity);
    super.onCreate(savedInstanceState, target, title, null, rList, true);
    CheckBox alwaysUse = (CheckBox) findViewById(com.android.internal.R.id.alwaysUse);
    if (alwaysUse != null) {
        if (mDevice == null) {
            alwaysUse.setText(R.string.always_use_accessory);
        } else {
            alwaysUse.setText(R.string.always_use_device);
        }
    }
    mDevice = (UsbDevice) target.getParcelableExtra(UsbManager.EXTRA_DEVICE);
    if (mDevice != null) {
        mDisconnectedReceiver = new UsbDisconnectedReceiver(this, mDevice);
    } else {
        mAccessory = (UsbAccessory) target.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
        if (mAccessory == null) {
            Log.e(TAG, "no device or accessory");
            finish();
            return;
        }
        mDisconnectedReceiver = new UsbDisconnectedReceiver(this, mAccessory);
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) CheckBox(android.widget.CheckBox) Intent(android.content.Intent) Parcelable(android.os.Parcelable)

Example 55 with CheckBox

use of android.widget.CheckBox in project android_frameworks_base by ParanoidAndroid.

the class ClientTest method onCreate.

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button addpbtn = (Button) findViewById(R.id.addpkg);
    Button procbtn = (Button) findViewById(R.id.procmsg);
    Button delbtn = (Button) findViewById(R.id.delpkg);
    Log.v(LOG_TAG, "activity created!!");
    addpbtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            EditText app_id = (EditText) findViewById(R.id.app_id);
            EditText cont = (EditText) findViewById(R.id.cont);
            EditText pkg = (EditText) findViewById(R.id.pkg);
            EditText cls = (EditText) findViewById(R.id.cls);
            RadioButton act = (RadioButton) findViewById(R.id.act);
            CheckBox sig = (CheckBox) findViewById(R.id.sig);
            CheckBox ftr = (CheckBox) findViewById(R.id.ftr);
            try {
                if (!mWapPushMan.addPackage(app_id.getText().toString(), cont.getText().toString(), pkg.getText().toString(), cls.getText().toString(), act.isChecked() ? WapPushManagerParams.APP_TYPE_ACTIVITY : WapPushManagerParams.APP_TYPE_SERVICE, sig.isChecked(), ftr.isChecked())) {
                    Log.w(LOG_TAG, "remote add pkg failed...");
                    mWapPushMan.updatePackage(app_id.getText().toString(), cont.getText().toString(), pkg.getText().toString(), cls.getText().toString(), act.isChecked() ? WapPushManagerParams.APP_TYPE_ACTIVITY : WapPushManagerParams.APP_TYPE_SERVICE, sig.isChecked(), ftr.isChecked());
                }
            } catch (RemoteException e) {
                Log.w(LOG_TAG, "remote func failed...");
            }
        }
    });
    delbtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            EditText app_id = (EditText) findViewById(R.id.app_id);
            EditText cont = (EditText) findViewById(R.id.cont);
            EditText pkg = (EditText) findViewById(R.id.pkg);
            EditText cls = (EditText) findViewById(R.id.cls);
            try {
                mWapPushMan.deletePackage(app_id.getText().toString(), cont.getText().toString(), pkg.getText().toString(), cls.getText().toString());
            // delall.isChecked());
            } catch (RemoteException e) {
                Log.w(LOG_TAG, "remote func failed...");
            }
        }
    });
    procbtn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            EditText pdu = (EditText) findViewById(R.id.pdu);
            EditText app_id = (EditText) findViewById(R.id.app_id);
            EditText cont = (EditText) findViewById(R.id.cont);
            // wap.dispatchWapPdu(strToHex(pdu.getText().toString()));
            try {
                Intent intent = new Intent();
                intent.putExtra("transactionId", 0);
                intent.putExtra("pduType", 6);
                intent.putExtra("header", HexDump.hexStringToByteArray(pdu.getText().toString()));
                intent.putExtra("data", HexDump.hexStringToByteArray(pdu.getText().toString()));
                mWapPushMan.processMessage(app_id.getText().toString(), cont.getText().toString(), intent);
            //HexDump.hexStringToByteArray(pdu.getText().toString()), 0, 6, 5, 5);
            } catch (RemoteException e) {
                Log.w(LOG_TAG, "remote func failed...");
            }
        }
    });
}
Also used : EditText(android.widget.EditText) RadioButton(android.widget.RadioButton) Button(android.widget.Button) CheckBox(android.widget.CheckBox) Intent(android.content.Intent) RadioButton(android.widget.RadioButton) RemoteException(android.os.RemoteException) View(android.view.View)

Aggregations

CheckBox (android.widget.CheckBox)197 View (android.view.View)102 TextView (android.widget.TextView)78 CompoundButton (android.widget.CompoundButton)51 Button (android.widget.Button)48 ImageView (android.widget.ImageView)32 Intent (android.content.Intent)30 EditText (android.widget.EditText)30 LayoutInflater (android.view.LayoutInflater)25 AdapterView (android.widget.AdapterView)25 DialogInterface (android.content.DialogInterface)21 ListView (android.widget.ListView)20 SuppressLint (android.annotation.SuppressLint)19 RadioButton (android.widget.RadioButton)19 AlertDialog (android.app.AlertDialog)17 Paint (android.graphics.Paint)14 Bundle (android.os.Bundle)12 ViewGroup (android.view.ViewGroup)12 GridLayout (android.widget.GridLayout)12 LinearLayout (android.widget.LinearLayout)12