Search in sources :

Example 16 with CheckedTextView

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();
        }
    });
}
Also used : DialogInterface(android.content.DialogInterface) CheckedTextView(android.widget.CheckedTextView) CheckedTextView(android.widget.CheckedTextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView)

Example 17 with CheckedTextView

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;
}
Also used : SpannableString(android.text.SpannableString) TodoItem(com.example.sqlbrite.todo.db.TodoItem) CheckedTextView(android.widget.CheckedTextView) StrikethroughSpan(android.text.style.StrikethroughSpan)

Example 18 with CheckedTextView

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;
}
Also used : CheckedTextView(android.widget.CheckedTextView)

Example 19 with CheckedTextView

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;
        }
    }
}
Also used : CheckedTextView(android.widget.CheckedTextView) CheckedTextView(android.widget.CheckedTextView) View(android.view.View)

Example 20 with CheckedTextView

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);
}
Also used : RadioGroup(android.widget.RadioGroup) CheckedTextView(android.widget.CheckedTextView)

Aggregations

CheckedTextView (android.widget.CheckedTextView)26 View (android.view.View)17 TextView (android.widget.TextView)9 ListView (android.widget.ListView)6 AdapterView (android.widget.AdapterView)5 SuppressLint (android.annotation.SuppressLint)4 LayoutInflater (android.view.LayoutInflater)4 ArrayAdapter (android.widget.ArrayAdapter)3 Context (android.content.Context)2 DialogInterface (android.content.DialogInterface)2 TypedArray (android.content.res.TypedArray)2 Pair (android.util.Pair)2 ViewGroup (android.view.ViewGroup)2 Button (android.widget.Button)2 ImageView (android.widget.ImageView)2 TrackGroup (com.google.android.exoplayer2.source.TrackGroup)2 SelectionOverride (com.google.android.exoplayer2.trackselection.MappingTrackSelector.SelectionOverride)2 GraphView (com.jjoe64.graphview.GraphView)2 Account (android.accounts.Account)1 Intent (android.content.Intent)1