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);
}
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);
}
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);
}
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...");
}
}
});
}
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();
}
});
}
}
Aggregations