Search in sources :

Example 61 with CheckBox

use of android.widget.CheckBox in project GreenDroid by cyrilmottier.

the class SegmentedBar method addSegment.

/**
     * Adds a segment to the SegmentBar. This method automatically adds a
     * divider if needed.
     * 
     * @param title The title of the segment to add.
     */
public void addSegment(String title) {
    final Context context = getContext();
    final LayoutInflater inflater = LayoutInflater.from(context);
    /*
         * First of all, we have to check whether or not we need to add a
         * divider. A divider is added when there is at least one segment
         */
    if (mDividerDrawable != null && getSegmentCount() > 0) {
        ImageView divider = new ImageView(context);
        final int width = (mDividerWidth > 0) ? mDividerWidth : mDividerDrawable.getIntrinsicWidth();
        final LinearLayout.LayoutParams lp = new LayoutParams(width, LayoutParams.FILL_PARENT);
        lp.setMargins(0, 0, 0, 0);
        divider.setLayoutParams(lp);
        divider.setBackgroundDrawable(mDividerDrawable);
        addView(divider);
    }
    CheckBox segment = (CheckBox) inflater.inflate(R.layout.gd_segment, this, false);
    segment.setText(title);
    segment.setClickable(true);
    segment.setFocusable(true);
    segment.setOnFocusChangeListener(this);
    segment.setOnCheckedChangeListener(new SegmentCheckedListener(getSegmentCount()));
    segment.setOnClickListener(new SegmentClickedListener(getSegmentCount()));
    addView(segment);
}
Also used : Context(android.content.Context) CheckBox(android.widget.CheckBox) LayoutInflater(android.view.LayoutInflater) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Example 62 with CheckBox

use of android.widget.CheckBox in project bee by orhanobut.

the class SettingsAdapter method createCheckBox.

private View createCheckBox(ViewGroup parent, MethodInfo methodInfo) {
    final Method method = methodInfo.getMethod();
    final Object instance = methodInfo.getInstance();
    final Context context = parent.getContext();
    View view = inflater.inflate(R.layout.item_settings_checkbox, parent, false);
    ((TextView) view.findViewById(R.id.title)).setText(methodInfo.getTitle());
    CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            try {
                method.invoke(instance, isChecked);
            } catch (Exception e) {
                Log.e("Bee", e.getMessage());
            }
            PrefHelper.setBoolean(context, method.getName(), isChecked);
        }
    });
    checkBox.setChecked(PrefHelper.getBoolean(context, method.getName()));
    return view;
}
Also used : Context(android.content.Context) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) Method(java.lang.reflect.Method) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) CompoundButton(android.widget.CompoundButton)

Example 63 with CheckBox

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

the class TransformsAndAnimationsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.transforms_and_animations);
    button1 = (Button) findViewById(R.id.button1);
    button2 = (Button) findViewById(R.id.button2);
    button3 = (Button) findViewById(R.id.button3);
    button1a = (Button) findViewById(R.id.button1a);
    button2a = (Button) findViewById(R.id.button2a);
    button3a = (Button) findViewById(R.id.button3a);
    button1b = (Button) findViewById(R.id.button1b);
    button2b = (Button) findViewById(R.id.button2b);
    button3b = (Button) findViewById(R.id.button3b);
    button4 = (Button) findViewById(R.id.button4);
    button5 = (Button) findViewById(R.id.button5);
    button6 = (Button) findViewById(R.id.button6);
    button7 = (Button) findViewById(R.id.button7);
    button8 = (Button) findViewById(R.id.button8);
    layersNoneCB = (CheckBox) findViewById(R.id.layersNoneCB);
    layersHardwareCB = (CheckBox) findViewById(R.id.layersHwCB);
    layersSoftwareCB = (CheckBox) findViewById(R.id.layersSwCB);
    layersNoneCB.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                setLayerType(View.LAYER_TYPE_NONE);
                layersHardwareCB.setChecked(false);
                layersSoftwareCB.setChecked(false);
            }
        }
    });
    layersSoftwareCB.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                setLayerType(View.LAYER_TYPE_SOFTWARE);
                layersHardwareCB.setChecked(false);
                layersNoneCB.setChecked(false);
            }
        }
    });
    layersHardwareCB.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                setLayerType(View.LAYER_TYPE_HARDWARE);
                layersNoneCB.setChecked(false);
                layersSoftwareCB.setChecked(false);
            }
        }
    });
    button1a.setAlpha(.5f);
    button2a.setAlpha(.5f);
    button3a.setAlpha(.5f);
    button3.setTranslationX(50);
    button7.setTranslationX(50);
    button8.setTranslationX(50);
    final AlphaAnimation alphaAnim = new AlphaAnimation(1, 0);
    alphaAnim.setDuration(1000);
    alphaAnim.setRepeatCount(Animation.INFINITE);
    alphaAnim.setRepeatMode(Animation.REVERSE);
    final TranslateAnimation transAnim = new TranslateAnimation(0, -50, 0, 0);
    transAnim.setDuration(1000);
    transAnim.setRepeatCount(Animation.INFINITE);
    transAnim.setRepeatMode(Animation.REVERSE);
    getWindow().getDecorView().postDelayed(new Runnable() {

        @Override
        public void run() {
            button1.startAnimation(alphaAnim);
            button2.startAnimation(alphaAnim);
            button3.startAnimation(alphaAnim);
            button1a.startAnimation(alphaAnim);
            button2a.startAnimation(alphaAnim);
            button3a.startAnimation(alphaAnim);
            button1b.startAnimation(alphaAnim);
            button2b.startAnimation(alphaAnim);
            button3b.startAnimation(alphaAnim);
            startAnimator(button1b);
            startAnimator(button2b);
            startAnimator(button3b);
            button7.startAnimation(transAnim);
            button8.startAnimation(transAnim);
        }
    }, 2000);
}
Also used : CheckBox(android.widget.CheckBox) TranslateAnimation(android.view.animation.TranslateAnimation) CompoundButton(android.widget.CompoundButton) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 64 with CheckBox

use of android.widget.CheckBox in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DockService method createDialog.

private void createDialog(BluetoothDevice device, int state, int startId) {
    if (mDialog != null) {
        // Shouldn't normally happen
        mDialog.dismiss();
        mDialog = null;
    }
    mDevice = device;
    switch(state) {
        case Intent.EXTRA_DOCK_STATE_CAR:
        case Intent.EXTRA_DOCK_STATE_DESK:
        case Intent.EXTRA_DOCK_STATE_LE_DESK:
        case Intent.EXTRA_DOCK_STATE_HE_DESK:
            break;
        default:
            return;
    }
    startForeground(0, new Notification());
    final AlertDialog.Builder ab = new AlertDialog.Builder(this);
    View view;
    LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
    mAudioMediaCheckbox = null;
    if (device != null) {
        // Device in a new dock.
        boolean firstTime = !LocalBluetoothPreferences.hasDockAutoConnectSetting(this, device.getAddress());
        CharSequence[] items = initBtSettings(device, state, firstTime);
        ab.setTitle(getString(R.string.bluetooth_dock_settings_title));
        // Profiles
        ab.setMultiChoiceItems(items, mCheckedItems, mMultiClickListener);
        // Remember this settings
        view = inflater.inflate(R.layout.remember_dock_setting, null);
        CheckBox rememberCheckbox = (CheckBox) view.findViewById(R.id.remember);
        // check "Remember setting" by default if no value was saved
        boolean checked = firstTime || LocalBluetoothPreferences.getDockAutoConnectSetting(this, device.getAddress());
        rememberCheckbox.setChecked(checked);
        rememberCheckbox.setOnCheckedChangeListener(mCheckedChangeListener);
        if (DEBUG) {
            Log.d(TAG, "Auto connect = " + LocalBluetoothPreferences.getDockAutoConnectSetting(this, device.getAddress()));
        }
    } else {
        ab.setTitle(getString(R.string.bluetooth_dock_settings_title));
        view = inflater.inflate(R.layout.dock_audio_media_enable_dialog, null);
        mAudioMediaCheckbox = (CheckBox) view.findViewById(R.id.dock_audio_media_enable_cb);
        boolean checked = Settings.Global.getInt(getContentResolver(), Settings.Global.DOCK_AUDIO_MEDIA_ENABLED, 0) == 1;
        mAudioMediaCheckbox.setChecked(checked);
        mAudioMediaCheckbox.setOnCheckedChangeListener(mCheckedChangeListener);
    }
    float pixelScaleFactor = getResources().getDisplayMetrics().density;
    int viewSpacingLeft = (int) (14 * pixelScaleFactor);
    int viewSpacingRight = (int) (14 * pixelScaleFactor);
    ab.setView(view, viewSpacingLeft, 0, /* top */
    viewSpacingRight, 0);
    // Ok Button
    ab.setPositiveButton(getString(android.R.string.ok), mClickListener);
    mStartIdAssociatedWithDialog = startId;
    mDialog = ab.create();
    mDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    mDialog.setOnDismissListener(mDismissListener);
    mDialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) CheckBox(android.widget.CheckBox) LayoutInflater(android.view.LayoutInflater) View(android.view.View) Notification(android.app.Notification)

Example 65 with CheckBox

use of android.widget.CheckBox in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SupportDisclaimerDialogFragment method onClick.

@Override
public void onClick(DialogInterface dialog, int which) {
    if (which == Dialog.BUTTON_NEGATIVE) {
        MetricsLogger.action(getContext(), MetricsProto.MetricsEvent.ACTION_SUPPORT_DISCLAIMER_CANCEL);
        return;
    }
    final Activity activity = getActivity();
    final CheckBox doNotShow = (CheckBox) getDialog().findViewById(R.id.support_disclaimer_do_not_show_again);
    final SupportFeatureProvider supportFeatureProvider = FeatureFactory.getFactory(activity).getSupportFeatureProvider(activity);
    supportFeatureProvider.setShouldShowDisclaimerDialog(getContext(), !doNotShow.isChecked());
    final Bundle bundle = getArguments();
    MetricsLogger.action(activity, MetricsProto.MetricsEvent.ACTION_SUPPORT_DISCLAIMER_OK);
    supportFeatureProvider.startSupport(getActivity(), (Account) bundle.getParcelable(EXTRA_ACCOUNT), bundle.getInt(EXTRA_TYPE));
}
Also used : CheckBox(android.widget.CheckBox) Bundle(android.os.Bundle) Activity(android.app.Activity) SupportFeatureProvider(com.android.settings.overlay.SupportFeatureProvider)

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