Example usage for android.widget CheckedTextView isChecked

List of usage examples for android.widget CheckedTextView isChecked

Introduction

In this page you can find the example usage for android.widget CheckedTextView isChecked.

Prototype

@ViewDebug.ExportedProperty
    public boolean isChecked() 

Source Link

Usage

From source file:android.support.v7.testutils.TestUtilsMatchers.java

/**
 * Returns a matcher that matches <code>CheckedTextView</code>s which are in checked state.
 *//*from www .j a v  a 2 s  .c om*/
public static Matcher isCheckedTextView() {
    return new BoundedMatcher<View, CheckedTextView>(CheckedTextView.class) {
        private String failedDescription;

        @Override
        public void describeTo(final Description description) {
            description.appendText("checked text view: ");

            description.appendText(failedDescription);
        }

        @Override
        public boolean matchesSafely(final CheckedTextView view) {
            if (view.isChecked()) {
                return true;
            }

            failedDescription = "not checked";
            return false;
        }
    };
}

From source file:android.support.v7.testutils.TestUtilsMatchers.java

/**
 * Returns a matcher that matches <code>CheckedTextView</code>s which are in checked state.
 *///  www.j  a va 2 s .com
public static Matcher isNonCheckedTextView() {
    return new BoundedMatcher<View, CheckedTextView>(CheckedTextView.class) {
        private String failedDescription;

        @Override
        public void describeTo(final Description description) {
            description.appendText("non checked text view: ");

            description.appendText(failedDescription);
        }

        @Override
        public boolean matchesSafely(final CheckedTextView view) {
            if (!view.isChecked()) {
                return true;
            }

            failedDescription = "checked";
            return false;
        }
    };
}

From source file:com.agna.setmaster.ui.screen.condition.time.widget.DaysOfWeekView.java

public ArrayList<DayOfWeek> getDays() {
    ArrayList<DayOfWeek> result = new ArrayList<>();
    for (int i = 0; i < dayViews.size(); i++) {
        CheckedTextView v = dayViews.get(i);
        if (v.isChecked()) {
            result.add(DayOfWeek.ENUMS[i]);
        }/*w w  w.  j  a v  a2s  .  co m*/
    }
    return result;
}

From source file:de.aw.monma.reports.ReportWPCats.java

@Override
public void onBottomSheetItemClick(int arrayID, int position, Bundle extras, CheckedTextView view) {
    view.toggle();/*from   ww w.j  av a 2 s  .  c om*/
    if (view.isChecked()) {
        selectedWPTypen.add(position);
    } else {
        selectedWPTypen.remove((Integer) position);
    }
    getAdapter().notifyDataSetChanged();
}

From source file:com.agna.setmaster.ui.screen.condition.time.widget.DaysOfWeekView.java

private void initView(Context context) {
    inflate(context, R.layout.days_of_week_view_layout, this);
    dayViews.addAll(Arrays.asList((CheckedTextView) findViewById(R.id.monday),
            (CheckedTextView) findViewById(R.id.tuesday), (CheckedTextView) findViewById(R.id.wednesday),
            (CheckedTextView) findViewById(R.id.thursday), (CheckedTextView) findViewById(R.id.friday),
            (CheckedTextView) findViewById(R.id.saturday), (CheckedTextView) findViewById(R.id.sunday)));
    for (CheckedTextView view : dayViews) {
        view.setOnClickListener(v -> {
            CheckedTextView checkedTextView = (CheckedTextView) v;
            checkedTextView.setChecked(!checkedTextView.isChecked());
        });//from   w  w w . j  a v a2 s  . c o  m
    }
}

From source file:com.example.listviewanimationdemo.AnimateDismissActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_animateremoval);

    mSelectedPositions = new ArrayList<Integer>();

    ListView listView = (ListView) findViewById(R.id.activity_animateremoval_listview);
    mAdapter = new MyListAdapter(BaseListActivity.getItems());
    final AnimateDismissAdapter animateDismissAdapter = new AnimateDismissAdapter(mAdapter,
            new MyOnDismissCallback());
    animateDismissAdapter.setAbsListView(listView);
    listView.setAdapter(animateDismissAdapter);

    Button button = (Button) findViewById(R.id.activity_animateremoval_button);
    button.setOnClickListener(new OnClickListener() {

        @Override// www  . j av  a2 s. c  o m
        public void onClick(final View v) {
            animateDismissAdapter.animateDismiss(mSelectedPositions);
            mSelectedPositions.clear();
        }
    });

    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(final AdapterView<?> parent, final View view, final int position,
                final long id) {
            CheckedTextView tv = (CheckedTextView) view;
            tv.toggle();
            if (tv.isChecked()) {
                mSelectedPositions.add(position);
            } else {
                mSelectedPositions.remove((Integer) position);
            }
        }
    });
}

From source file:com.example.listviewanimationdemo.itemmanipulation.AnimateDismissActivity.java

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setTitle("item");
    setContentView(R.layout.activity_animateremoval);

    mSelectedPositions = new ArrayList<Integer>();

    ListView listView = (ListView) findViewById(R.id.activity_animateremoval_listview);
    mAdapter = new MyListAdapter(BaseListActivity.getItems());
    final AnimateDismissAdapter animateDismissAdapter = new AnimateDismissAdapter(mAdapter,
            new MyOnDismissCallback());
    animateDismissAdapter.setAbsListView(listView);
    listView.setAdapter(animateDismissAdapter);

    Button button = (Button) findViewById(R.id.activity_animateremoval_button);
    button.setOnClickListener(new OnClickListener() {

        @Override//from  ww  w  .ja  va 2s  . c  o  m
        public void onClick(final View v) {
            animateDismissAdapter.animateDismiss(mSelectedPositions);
            mSelectedPositions.clear();
        }
    });

    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(final AdapterView<?> parent, final View view, final int position,
                final long id) {
            CheckedTextView tv = (CheckedTextView) view;
            tv.toggle();
            if (tv.isChecked()) {
                mSelectedPositions.add(position);
            } else {
                mSelectedPositions.remove((Integer) position);
            }
        }
    });
}

From source file:de.aw.monma.reports.FragmentSelectionListCatClass.java

@Override
public void onRecyclerItemClick(View view, int position, long id) {
    super.onRecyclerItemClick(view, position, id);
    CheckedTextView cb = view.findViewById(R.id.tvSelection_item);
    cb.toggle();//from   w ww. ja  v a 2  s.c o  m
    if (cb.isChecked()) {
        excludedItems.remove(id);
    } else {
        excludedItems.add(id);
    }
}

From source file:de.tu_berlin.snet.commstat.EmailFragment.java

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    CheckedTextView check = (CheckedTextView) v;
    prefs.edit().putBoolean("email" + position, check.isChecked()).commit();

    if (check.isChecked()) {
        Intent intent = new Intent(getActivity(), EmailSettingsActivity.class);
        intent.putExtra(getString(R.string.email_username_key), list.get(position));
        intent.putExtra("position", position);

        startActivity(intent);//from w  w w . ja v  a  2 s. com
    }
}

From source file:de.aw.monma.reports.FragmentSelectionListCat.java

@Override
public void onRecyclerItemClick(View v, int position, Categorie item) {
    CheckedTextView cb = v.findViewById(R.id.tvSelection_item);
    cb.toggle();/*from  w  w w .java2 s  . c o m*/
    boolean ausgeblendet = !cb.isChecked();
    if (!ausgeblendet) {
        excludedItems.remove(item.getID());
    } else {
        excludedItems.add(item.getID());
    }
    item.setAusgeblendet(ausgeblendet);
    if (item.isSuperCat()) {
        int pos = position + 1;
        Categorie cat = getAdapter().get(pos);
        while (cat.isSuperCatMember(item.getID())) {
            if (!ausgeblendet) {
                excludedItems.remove(cat.getID());
            } else {
                excludedItems.add(cat.getID());
            }
            cat.setAusgeblendet(ausgeblendet);
            pos++;
            cat = getAdapter().get(pos);
        }
    }
    super.onRecyclerItemClick(v, position, item);
}