use of android.widget.CheckedTextView in project android by cSploit.
the class MultipleChoiceDialog method commonCtor.
private void commonCtor(String title, String[] items, Activity activity, final MultipleChoiceDialogListener listener) {
ListView mList = new ListView(activity);
mList.setAdapter(new ArrayAdapter<String>(activity, android.R.layout.simple_list_item_multiple_choice, items));
checkList = new boolean[items.length];
mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CheckedTextView checkedTextView = (CheckedTextView) view;
checkedTextView.setChecked((checkList[position] = !checkedTextView.isChecked()));
}
});
this.setTitle(title);
this.setView(mList);
setButton(BUTTON_NEGATIVE, activity.getString(R.string.cancel_dialog), new OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
setButton(BUTTON_POSITIVE, activity.getString(R.string.choose), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
int count = 0;
int[] res;
for (boolean b : checkList) if (b)
count++;
res = new int[count];
count = 0;
for (int i = 0; i < checkList.length; i++) if (checkList[i])
res[count++] = i;
listener.onChoice(res);
dialog.dismiss();
}
});
}
use of android.widget.CheckedTextView in project sqlbrite by square.
the class ItemsAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, parent, false);
}
TodoItem item = getItem(position);
CheckedTextView textView = (CheckedTextView) convertView;
textView.setChecked(item.complete());
CharSequence description = item.description();
if (item.complete()) {
SpannableString spannable = new SpannableString(description);
spannable.setSpan(new StrikethroughSpan(), 0, description.length(), 0);
description = spannable;
}
textView.setText(description);
return convertView;
}
use of android.widget.CheckedTextView in project RoboBinding by RoboBinding.
the class MultipleChoiceAdapter method getView.
@Override
public View getView(int position, View convertView, ViewGroup parent) {
CheckedTextView textView;
if (convertView == null) {
textView = new CheckedTextView(context);
} else {
textView = (CheckedTextView) convertView;
}
textView.setText("Item " + position);
return textView;
}
use of android.widget.CheckedTextView in project WordPress-Android by wordpress-mobile.
the class CheckedLinearLayout method onFinishInflate.
@Override
protected void onFinishInflate() {
super.onFinishInflate();
int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
View v = getChildAt(i);
if (v instanceof CheckedTextView) {
mCheckbox = (CheckedTextView) v;
}
}
}
use of android.widget.CheckedTextView in project WordPress-Android by wordpress-mobile.
the class StatsAbstractListFragment method setupTopModulePager.
void setupTopModulePager(LayoutInflater inflater, ViewGroup container, View view, String[] buttonTitles) {
int dp4 = DisplayUtils.dpToPx(view.getContext(), 4);
int dp80 = DisplayUtils.dpToPx(view.getContext(), 80);
for (int i = 0; i < buttonTitles.length; i++) {
CheckedTextView rb = (CheckedTextView) inflater.inflate(R.layout.stats_top_module_pager_button, container, false);
RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT, RadioGroup.LayoutParams.WRAP_CONTENT);
params.weight = 1;
if (i == 0) {
params.setMargins(0, 0, dp4, 0);
} else {
params.setMargins(dp4, 0, 0, 0);
}
rb.setMinimumWidth(dp80);
rb.setGravity(Gravity.CENTER);
rb.setLayoutParams(params);
rb.setText(buttonTitles[i]);
rb.setChecked(i == mTopPagerSelectedButtonIndex);
rb.setOnClickListener(TopModulePagerOnClickListener);
mTopPagerContainer.addView(rb);
}
mTopPagerContainer.setVisibility(View.VISIBLE);
}
Aggregations