android.widget.CheckedTextView#setTextColor ( )源码实例Demo

下面列出了android.widget.CheckedTextView#setTextColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: LrcJaeger   文件: HideFoldersActivity.java
@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;
}
 
源代码2 项目: attendee-checkin   文件: EventSelectionFragment.java
@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);
    }
}
 
源代码3 项目: evercam-android   文件: CameraListAdapter.java
/**
 * 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;
}
 
源代码4 项目: smartcard-reader   文件: AppEditActivity.java
@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;
}
 
源代码5 项目: Twire   文件: SettingsNotificationsActivity.java
/**
 * 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);
}
 
/**
 * 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);
}
 
源代码7 项目: NewsMe   文件: SexUtil.java
@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;
}
 
源代码8 项目: NewsMe   文件: ThemeUtils.java
@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;
        }
 
源代码9 项目: always-on-amoled   文件: FontAdapter.java
@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;
}
 
源代码10 项目: droidddle   文件: ThemeListPreference.java
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;
}
 
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);
}