Search in sources :

Example 81 with CheckBox

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

the class AnimatedStateVectorDrawableTest method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ScrollView scrollView = new ScrollView(this);
    GridLayout container = new GridLayout(this);
    scrollView.addView(container);
    container.setColumnCount(2);
    for (int i = 0; i < icon.length; i++) {
        CheckBox button = new CheckBox(this);
        button.setWidth(400);
        button.setHeight(400);
        button.setBackgroundResource(icon[i]);
        container.addView(button);
    }
    setContentView(scrollView);
}
Also used : GridLayout(android.widget.GridLayout) ScrollView(android.widget.ScrollView) CheckBox(android.widget.CheckBox)

Example 82 with CheckBox

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

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 83 with CheckBox

use of android.widget.CheckBox in project Etar-Calendar by Etar-Group.

the class SelectSyncedCalendarsMultiAccountAdapter method bindChildView.

@Override
protected void bindChildView(View view, Context context, Cursor cursor, boolean isLastChild) {
    final long id = cursor.getLong(ID_COLUMN);
    String name = cursor.getString(NAME_COLUMN);
    String owner = cursor.getString(OWNER_COLUMN);
    final String accountName = cursor.getString(ACCOUNT_COLUMN);
    final String accountType = cursor.getString(ACCOUNT_TYPE_COLUMN);
    int color = Utils.getDisplayColorFromColor(cursor.getInt(COLOR_COLUMN));
    final View colorSquare = view.findViewById(R.id.color);
    colorSquare.setEnabled(mCache.hasColors(accountName, accountType));
    colorSquare.setBackgroundColor(color);
    final View delegateParent = (View) colorSquare.getParent();
    delegateParent.post(new Runnable() {

        @Override
        public void run() {
            final Rect r = new Rect();
            colorSquare.getHitRect(r);
            r.top -= mColorViewTouchAreaIncrease;
            r.bottom += mColorViewTouchAreaIncrease;
            r.left -= mColorViewTouchAreaIncrease;
            r.right += mColorViewTouchAreaIncrease;
            delegateParent.setTouchDelegate(new TouchDelegate(r, colorSquare));
        }
    });
    colorSquare.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            if (!mCache.hasColors(accountName, accountType)) {
                return;
            }
            if (mColorPickerDialog == null) {
                mColorPickerDialog = CalendarColorPickerDialog.newInstance(id, mIsTablet);
            } else {
                mColorPickerDialog.setCalendarId(id);
            }
            mFragmentManager.executePendingTransactions();
            if (!mColorPickerDialog.isAdded()) {
                mColorPickerDialog.show(mFragmentManager, COLOR_PICKER_DIALOG_TAG);
            }
        }
    });
    if (mIsDuplicateName.containsKey(name) && mIsDuplicateName.get(name) && !name.equalsIgnoreCase(owner)) {
        name = new StringBuilder(name).append(Utils.OPEN_EMAIL_MARKER).append(owner).append(Utils.CLOSE_EMAIL_MARKER).toString();
    }
    setText(view, R.id.calendar, name);
    // First see if the user has already changed the state of this calendar
    Boolean sync = mCalendarChanges.get(id);
    if (sync == null) {
        sync = cursor.getInt(SYNCED_COLUMN) == 1;
        mCalendarInitialStates.put(id, sync);
    }
    CheckBox button = (CheckBox) view.findViewById(R.id.sync);
    button.setChecked(sync);
    setText(view, R.id.status, sync ? mSyncedText : mNotSyncedText);
    view.setTag(TAG_ID_CALENDAR_ID, id);
    view.setTag(TAG_ID_SYNC_CHECKBOX, button);
    view.setOnClickListener(this);
}
Also used : Rect(android.graphics.Rect) CheckBox(android.widget.CheckBox) OnClickListener(android.view.View.OnClickListener) TouchDelegate(android.view.TouchDelegate) View(android.view.View) TextView(android.widget.TextView)

Example 84 with CheckBox

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

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)

Example 85 with CheckBox

use of android.widget.CheckBox in project HumaneApp by Ganesh1010.

the class FilterRecycleAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    holder.itemCategory.setText(list.get(position).getItemCategory());
    switch(list.get(position).getItemCategory()) {
        case "Food":
            holder.filterItemIcon.setImageResource(R.drawable.ic_food_black);
            break;
        case "Clothes":
            holder.filterItemIcon.setImageResource(R.drawable.ic_cloth_black);
            break;
        case "Groceries":
            holder.filterItemIcon.setImageResource(R.drawable.ic_grocery_cart_black);
            break;
        case "Stationeries":
            holder.filterItemIcon.setImageResource(R.drawable.ic_stationery_black);
            break;
    }
    final LinearLayout genderMale = new LinearLayout(context);
    final LinearLayout genderFemale = new LinearLayout(context);
    LayoutInflater inflater;
    View view;
    for (int i = 0; i < list.get(position).getItemName().size(); i++) {
        final CheckBox itemName = new CheckBox(context);
        itemName.setText(list.get(position).getItemName().get(i) + "");
        if (HomeActivity.appliedFilter.contains(itemName.getText().toString()))
            itemName.setChecked(true);
        if (itemName.getText().toString().equals("Male")) {
            inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.filter_clothes_gender, null);
            genderMale.addView(view);
            holder.filterLayout.addView(itemName);
            holder.filterLayout.addView(genderMale);
            genderMale.setVisibility(View.GONE);
        } else if (itemName.getText().toString().equals("Female")) {
            inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.filter_clothes_gender, null);
            genderFemale.addView(view);
            holder.filterLayout.addView(itemName);
            holder.filterLayout.addView(genderFemale);
            genderFemale.setVisibility(View.GONE);
        } else
            holder.filterLayout.addView(itemName);
        allCheckBoxes.add(itemName);
        itemName.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                String subItemName = itemName.getText().toString();
                if (isChecked) {
                    // Finding subItemCode & mainItemCode of this checked item
                    DatabaseHelper db = new DatabaseHelper(context);
                    ArrayList<SubItemDetails> subItemDetailsArrayList = db.getAllSubItemDetails();
                    for (int i = 0; i < subItemDetailsArrayList.size(); i++) {
                        SubItemDetails subItemDetails = subItemDetailsArrayList.get(i);
                        if (subItemDetails.getSubItemName().equals(subItemName)) {
                            subItemDetailsArrayList.add(subItemDetails);
                            break;
                        }
                    }
                    // following line is created by Rahul
                    HomeActivity.appliedFilter.add(subItemName);
                } else {
                    // Searching for this subItem in checked list
                    for (int i = 0; i < subItemDetailsArrayList.size(); i++) {
                        SubItemDetails subItemDetails = subItemDetailsArrayList.get(i);
                        if (subItemDetails.getSubItemName().equals(subItemName)) {
                            subItemDetailsArrayList.remove(i);
                            break;
                        }
                    }
                    // following line is created by Rahul
                    HomeActivity.appliedFilter.remove(subItemName);
                }
            //Toast.makeText(context, itemName.getText(), Toast.LENGTH_SHORT).show();
            }
        });
    }
}
Also used : ArrayList(java.util.ArrayList) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View) CheckBox(android.widget.CheckBox) LayoutInflater(android.view.LayoutInflater) LinearLayout(android.widget.LinearLayout) CompoundButton(android.widget.CompoundButton)

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