Java Code Examples for android.widget.CheckedTextView#setTextColor()

The following examples show how to use android.widget.CheckedTextView#setTextColor() . 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 check out the related API usage on the sidebar.
Example 1
Source File: HideFoldersActivity.java    From LrcJaeger with Apache License 2.0 8 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.folder_item, parent, false);
    }

    String folder = getItem(position);

    CheckedTextView tv = (CheckedTextView) convertView.findViewById(R.id.cb_folder);
    tv.setText(folder);
    if (mHiddenFolders.contains(folder.hashCode())) {
        // this folder was set to be hidden
        tv.setChecked(false);
        tv.setTextColor(Color.LTGRAY);
    } else {
        // set default status
        tv.setChecked(true);
        tv.setTextColor(Color.BLACK);
    }

    return convertView;
}
 
Example 2
Source File: EventSelectionFragment.java    From attendee-checkin with Apache License 2.0 6 votes vote down vote up
@Override
public void bindView(View view, Context context, Cursor cursor) {
    CheckedTextView textView = (CheckedTextView) view;
    textView.setText(cursor.getString(cursor.getColumnIndexOrThrow(Table.Event.NAME)));
    String eventId = cursor.getString(cursor.getColumnIndexOrThrow(Table.Event.ID));
    view.setTag(eventId);
    if (textView.getPaddingLeft() > 0) { // on Dropdown
        long endTime = cursor.getLong(cursor.getColumnIndexOrThrow(Table.Event.END_TIME));
        if (TextUtils.equals(mCurrentEventId, eventId)) {
            textView.setTextColor(mTextColorCurrent);
        } else if (endTime * 1000 < System.currentTimeMillis()) { // Past
            textView.setTextColor(mTextColorPast);
        } else {
            textView.setTextColor(mTextColorDefault);
        }
    } else { // on Toolbar
        textView.setTextColor(mTextColorInverse);
    }
}
 
Example 3
Source File: CameraListAdapter.java    From evercam-android with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Remove offline icon for selected camera that is showing as title
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = super.getView(position, convertView, parent);
    ImageView offlineIcon = (ImageView) view.findViewById(R.id.spinner_offline_icon);
    offlineIcon.setVisibility(View.GONE);

    //Title text should be white
    CheckedTextView titleTextView = (CheckedTextView) view.findViewById(R.id.spinner_camera_name_text);
    titleTextView.setTextColor(Color.WHITE);

    //Make spinner text fit landscape too
    RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.list_spinner_layout);
    layout.setPadding(10, 0, 10, 0);

    return view;
}
 
Example 4
Source File: AppEditActivity.java    From smartcard-reader with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    final View itemView = super.getView(position, convertView, parent);
    if (itemView == null) {
        return null;
    }
    final CheckedTextView checkedTextView = (CheckedTextView)itemView;

    if (hasCheckbox(position)) {
        checkedTextView.setEnabled(isEnabled(position));
    } else {
        checkedTextView.setCheckMarkDrawable(null);
        checkedTextView.setTextColor(getResources().getColor(R.color.accent));
    }
    return checkedTextView;
}
 
Example 5
Source File: SettingsNotificationsActivity.java    From Twire with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Enables or disables the ability to change the blink LED function.
 * It also changes the color of the view
 */
private static void enableBlinkLED(boolean boo, Activity ac) {
    final CheckedTextView soundPlayView = ac.findViewById(R.id.notifications_led);
    MaterialRippleLayout rippleSoundPlay = ac.findViewById(R.id.notifications_led_ripple);

    int color = getEnabledTextColor(ac);

    if (!boo)
        color = getDisabledTextColor(ac);

    soundPlayView.setTextColor(color);
    rippleSoundPlay.setEnabled(boo);
}
 
Example 6
Source File: SettingsNotificationsActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Enables or disables the ability to change the blink LED function.
 * It also changes the color of the view
 */
private static void enableBlinkLED(boolean boo, Activity ac) {
	final CheckedTextView soundPlayView = (CheckedTextView) ac.findViewById(R.id.notifications_led);
	MaterialRippleLayout rippleSoundPlay = (MaterialRippleLayout) ac.findViewById(R.id.notifications_led_ripple);

	int color = getEnabledTextColor(ac);

	if(!boo)
		color = getDisabledTextColor(ac);

	soundPlayView.setTextColor(color);
	rippleSoundPlay.setEnabled(boo);
}
 
Example 7
Source File: SexUtil.java    From NewsMe with Apache License 2.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    Sex sex = getItem(position);
    View view = super.getView(position, convertView, parent);
    CheckedTextView textView = (CheckedTextView) view.findViewById(mTextId);
    MDTintHelper.setTint(textView, getContext().getResources().getColor(sex.color));
    textView.setTextColor(getContext().getResources().getColor(sex.color));
    return view;
}
 
Example 8
Source File: ThemeUtils.java    From NewsMe with Apache License 2.0 5 votes vote down vote up
@Override
        public View getView(int position, View convertView, ViewGroup parent) {
            Theme theme = getItem(position);
            View view = super.getView(position, convertView, parent);
            CheckedTextView textView = (CheckedTextView) view.findViewById(mTextId);
            MDTintHelper.setTint(textView, getContext().getResources().getColor(theme.color));
            textView.setTextColor(getContext().getResources().getColor(theme.color));
//            textView.setChecked(convertView.getiss);
//            textView.setChecked(true);
            return view;
        }
 
Example 9
Source File: FontAdapter.java    From always-on-amoled with GNU General Public License v3.0 5 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    Typeface font = getFontByNumber(context, position);
    if (view == null) {
        final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(android.R.layout.select_dialog_singlechoice, parent, false);
    }
    CheckedTextView item = (CheckedTextView) view.findViewById(android.R.id.text1);
    item.setText(items[position]);
    item.setTypeface(font);
    item.setTextColor(Color.WHITE);
    return view;
}
 
Example 10
Source File: ThemeListPreference.java    From droidddle with Apache License 2.0 5 votes vote down vote up
public View getView(final int position, View convertView, ViewGroup parent) {
    View row = convertView;

    if (row == null) {
        row = mInflater.inflate(android.R.layout.simple_list_item_single_choice, parent, false);
    }
    CheckedTextView tv = (CheckedTextView) row.findViewById(android.R.id.text1);
    tv.setText(getItem(position).toString());
    tv.setChecked(mEntryIndex == position);
    tv.setTextColor(Color.parseColor(colors[position]));
    return row;
}
 
Example 11
Source File: AppCompatTimePickerDelegate.java    From AppCompat-Extension-Library with Apache License 2.0 4 votes vote down vote up
public AppCompatTimePickerDelegate(AppCompatTimePicker delegator, Context context, AttributeSet attrs,
                                   int defStyleAttr, int defStyleRes) {
    super(delegator, context);

    // process style attributes
    final TypedArray a = mContext.obtainStyledAttributes(attrs,
            R.styleable.TimePickerDialog, defStyleAttr, defStyleRes);
    final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
            Context.LAYOUT_INFLATER_SERVICE);
    final Resources res = mContext.getResources();

    mSelectHours = res.getString(R.string.select_hours);
    mSelectMinutes = res.getString(R.string.select_minutes);

    String[] amPmStrings = getAmPmStrings(context);
    mAmText = amPmStrings[0];
    mPmText = amPmStrings[1];

    final View mainView = inflater.inflate(R.layout.time_picker_material, delegator);

    mHeaderView = mainView.findViewById(R.id.time_header);

    // Set up hour/minute labels.
    mHourView = (TextView) mainView.findViewById(R.id.hours);
    mHourView.setOnClickListener(mClickListener);
    ViewCompat.setAccessibilityDelegate(mHourView,
            new ClickActionDelegate(context, R.string.select_hours));
    mSeparatorView = (TextView) mainView.findViewById(R.id.separator);
    mMinuteView = (TextView) mainView.findViewById(R.id.minutes);
    mMinuteView.setOnClickListener(mClickListener);
    ViewCompat.setAccessibilityDelegate(mMinuteView,
            new ClickActionDelegate(context, R.string.select_minutes));

    // Now that we have text appearances out of the way, make sure the hour
    // and minute views are correctly sized.
    mHourView.setMinWidth(computeStableWidth(mHourView, 24));
    mMinuteView.setMinWidth(computeStableWidth(mMinuteView, 60));

    // Set up AM/PM labels.
    mAmPmLayout = mainView.findViewById(R.id.ampm_layout);
    mAmLabel = (CheckedTextView) mAmPmLayout.findViewById(R.id.am_label);
    mAmLabel.setText(obtainVerbatim(amPmStrings[0]));
    mAmLabel.setOnClickListener(mClickListener);
    mPmLabel = (CheckedTextView) mAmPmLayout.findViewById(R.id.pm_label);
    mPmLabel.setText(obtainVerbatim(amPmStrings[1]));
    mPmLabel.setOnClickListener(mClickListener);


    // Set up header text color, if available.
    ColorStateList headerTextColor;
    if (a.hasValue(R.styleable.TimePickerDialog_headerTextColor)) {
        headerTextColor = a.getColorStateList(R.styleable.DatePickerDialog_headerTextColor);
    } else {
        headerTextColor = PickerThemeUtils.getHeaderTextColorStateList(mContext);
    }
    mHourView.setTextColor(headerTextColor);
    mSeparatorView.setTextColor(headerTextColor);
    mMinuteView.setTextColor(headerTextColor);
    mAmLabel.setTextColor(headerTextColor);
    mPmLabel.setTextColor(headerTextColor);

    // Set up header background, if available.
    ViewCompatUtils.setBackground(mHeaderView, PickerThemeUtils.getHeaderBackground(mContext,
            a.getColor(R.styleable.DatePickerDialog_headerBackground,
                    ThemeUtils.getThemeAttrColor(mContext, R.attr.colorAccent))));

    a.recycle();

    mRadialTimePickerView = (RadialTimePickerView) mainView.findViewById(
            R.id.radial_picker);

    setupListeners();

    mAllowAutoAdvance = true;

    // Set up for keyboard mode.
    mDoublePlaceholderText = res.getString(R.string.time_placeholder);
    mDeletedKeyFormat = res.getString(R.string.deleted_key);
    mPlaceholderText = mDoublePlaceholderText.charAt(0);
    mAmKeyCode = mPmKeyCode = -1;
    generateLegalTimesTree();

    // Initialize with current time
    final Calendar calendar = Calendar.getInstance(mCurrentLocale);
    final int currentHour = calendar.get(Calendar.HOUR_OF_DAY);
    final int currentMinute = calendar.get(Calendar.MINUTE);
    initialize(currentHour, currentMinute, false /* 12h */, HOUR_INDEX);
}