Java Code Examples for android.widget.TextView#isSelected()

The following examples show how to use android.widget.TextView#isSelected() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: FimiX8-RE   File: LabelsView.java    License: MIT License 6 votes vote down vote up
public void onClick(View v) {
    if (v instanceof TextView) {
        TextView label = (TextView) v;
        if (this.mSelectType != SelectType.NONE) {
            if (label.isSelected()) {
                if (!(this.mSelectType == SelectType.SINGLE_IRREVOCABLY || this.mCompulsorys.contains((Integer) label.getTag(KEY_POSITION)))) {
                    setLabelSelect(label, false);
                }
            } else if (this.mSelectType == SelectType.SINGLE || this.mSelectType == SelectType.SINGLE_IRREVOCABLY) {
                innerClearAllSelect();
                setLabelSelect(label, true);
            } else if (this.mSelectType == SelectType.MULTI && (this.mMaxSelect <= 0 || this.mMaxSelect > this.mSelectLabels.size())) {
                setLabelSelect(label, true);
            }
        }
        if (this.mLabelClickListener != null) {
            this.mLabelClickListener.onLabelClick(label, label.getTag(KEY_DATA), ((Integer) label.getTag(KEY_POSITION)).intValue());
        }
    }
}
 
Example 2
@Override
public void onBackPressed() {
  boolean anyAlarmSelected = false;
  for (TextView tv : mPrayers) {
    if (tv.isSelected()) {
      anyAlarmSelected = true;
    }
  }

  if (!anyAlarmSelected) {
    mAlarm.setChecked(false);
  }

  Intent data = new Intent();
  if (getParent() == null) {
    setResult(RESULT_OK, data);
  } else {
    getParent().setResult(RESULT_OK, data);
  }

  super.onBackPressed();
}
 
Example 3
Source Project: FimiX8-RE   File: LabelsView.java    License: MIT License 5 votes vote down vote up
private void setLabelSelect(TextView label, boolean isSelect) {
    if (label.isSelected() != isSelect) {
        label.setSelected(isSelect);
        if (isSelect) {
            this.mSelectLabels.add((Integer) label.getTag(KEY_POSITION));
        } else {
            this.mSelectLabels.remove((Integer) label.getTag(KEY_POSITION));
        }
        if (this.mLabelSelectChangeListener != null) {
            this.mLabelSelectChangeListener.onLabelSelectChange(label, label.getTag(KEY_DATA), isSelect, ((Integer) label.getTag(KEY_POSITION)).intValue());
        }
    }
}
 
Example 4
Source Project: DanDanPlayForAndroid   File: LabelsView.java    License: MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {
    if (v instanceof TextView) {
        TextView label = (TextView) v;
        if (!isIndicator) {
            if (mSelectType != SelectType.NONE) {
                if (label.isSelected()) {
                    boolean irrevocable = mSelectType == SelectType.MULTI && mCompulsorys.contains((Integer) label.getTag(KEY_POSITION));
                    irrevocable = irrevocable || (mSelectType == SelectType.MULTI && mSelectLabels.size() <= mMinSelect);
                    irrevocable = irrevocable || mSelectType == SelectType.SINGLE_IRREVOCABLY;
                    if (!irrevocable) {
                        setLabelSelect(label, false);
                    }
                } else {
                    if (mSelectType == SelectType.SINGLE || mSelectType == SelectType.SINGLE_IRREVOCABLY) {
                        innerClearAllSelect();
                        setLabelSelect(label, true);
                    } else if (mSelectType == SelectType.MULTI
                            && (mMaxSelect <= 0 || mMaxSelect > mSelectLabels.size())) {
                        setLabelSelect(label, true);
                    }
                }
            }
        }

        if (mLabelClickListener != null) {
            mLabelClickListener.onLabelClick(label, label.getTag(KEY_DATA), (int) label.getTag(KEY_POSITION));
        }
    }
}
 
Example 5
Source Project: DanDanPlayForAndroid   File: LabelsView.java    License: MIT License 5 votes vote down vote up
private void setLabelSelect(TextView label, boolean isSelect) {
    if (label.isSelected() != isSelect) {
        label.setSelected(isSelect);
        if (isSelect) {
            mSelectLabels.add((Integer) label.getTag(KEY_POSITION));
        } else {
            mSelectLabels.remove((Integer) label.getTag(KEY_POSITION));
        }
        if (mLabelSelectChangeListener != null) {
            mLabelSelectChangeListener.onLabelSelectChange(label, label.getTag(KEY_DATA),
                    isSelect, (int) label.getTag(KEY_POSITION));
        }
    }
}
 
Example 6
Source Project: LabelsView   File: LabelsView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    if (v instanceof TextView) {
        TextView label = (TextView) v;
        if (!isIndicator) {
            if (mSelectType != SelectType.NONE) {
                if (label.isSelected()) {
                    boolean irrevocable = mSelectType == SelectType.MULTI && mCompulsorys.contains((Integer) label.getTag(KEY_POSITION));
                    irrevocable = irrevocable || (mSelectType == SelectType.MULTI && mSelectLabels.size() <= mMinSelect);
                    irrevocable = irrevocable || mSelectType == SelectType.SINGLE_IRREVOCABLY;
                    if (!irrevocable && !selectChangeIntercept(label)) {
                        setLabelSelect(label, false);
                    }
                } else {
                    if (mSelectType == SelectType.SINGLE || mSelectType == SelectType.SINGLE_IRREVOCABLY) {
                        if (!selectChangeIntercept(label)) {
                            innerClearAllSelect();
                            setLabelSelect(label, true);
                        }
                    } else if (mSelectType == SelectType.MULTI
                            && (mMaxSelect <= 0 || mMaxSelect > mSelectLabels.size())) {
                        if (!selectChangeIntercept(label)) {
                            setLabelSelect(label, true);
                        }
                    }
                }
            }
        }

        if (mLabelClickListener != null) {
            mLabelClickListener.onLabelClick(label, label.getTag(KEY_DATA), (int) label.getTag(KEY_POSITION));
        }
    }
}
 
Example 7
Source Project: LabelsView   File: LabelsView.java    License: Apache License 2.0 5 votes vote down vote up
private void setLabelSelect(TextView label, boolean isSelect) {
    if (label.isSelected() != isSelect) {
        label.setSelected(isSelect);
        if (isSelect) {
            mSelectLabels.add((Integer) label.getTag(KEY_POSITION));
        } else {
            mSelectLabels.remove((Integer) label.getTag(KEY_POSITION));
        }
        if (mLabelSelectChangeListener != null) {
            mLabelSelectChangeListener.onLabelSelectChange(label, label.getTag(KEY_DATA),
                    isSelect, (int) label.getTag(KEY_POSITION));
        }
    }
}