Java Code Examples for android.support.v7.preference.PreferenceViewHolder#findViewById()

The following examples show how to use android.support.v7.preference.PreferenceViewHolder#findViewById() . 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: TwoTargetPreference.java    From notification-channel-compat with Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    final ImageView icon = holder.itemView.findViewById(android.R.id.icon);
    switch (mIconSize) {
        case ICON_SIZE_SMALL:
            icon.setLayoutParams(new LinearLayout.LayoutParams(mSmallIconSize, mSmallIconSize));
            break;
        case ICON_SIZE_MEDIUM:
            icon.setLayoutParams(
                    new LinearLayout.LayoutParams(mMediumIconSize, mMediumIconSize));
            break;
    }
    final View divider = holder.findViewById(R.id.two_target_divider);
    final View widgetFrame = holder.findViewById(android.R.id.widget_frame);
    final boolean shouldHideSecondTarget = shouldHideSecondTarget();
    if (divider != null) {
        divider.setVisibility(shouldHideSecondTarget ? View.GONE : View.VISIBLE);
    }
    if (widgetFrame != null) {
        widgetFrame.setVisibility(shouldHideSecondTarget ? View.GONE : View.VISIBLE);
    }
}
 
Example 2
Source File: ColorPickerPreference.java    From openlauncher with Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
	super.onBindViewHolder(view);

	int tmpColor = isEnabled()
			? selectedColor
			: darken(selectedColor, .5f);

	colorIndicator = (ImageView) view.findViewById(R.id.color_indicator);

	ColorCircleDrawable colorChoiceDrawable = null;
	Drawable currentDrawable = colorIndicator.getDrawable();
	if (currentDrawable != null && currentDrawable instanceof ColorCircleDrawable)
		colorChoiceDrawable = (ColorCircleDrawable) currentDrawable;

	if (colorChoiceDrawable == null)
		colorChoiceDrawable = new ColorCircleDrawable(tmpColor);

	colorIndicator.setImageDrawable(colorChoiceDrawable);
}
 
Example 3
Source File: ColorPreferenceSupport.java    From IslamicLibraryAndroid with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
    super.onBindViewHolder(view);
    preview = (ColorPanelView) view.findViewById(R.id.cpv_preference_preview_color_panel);
    if (preview != null) {
        preview.setColor(color);
    }

}
 
Example 4
Source File: ColorChooserPreference.java    From OpenHub with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    View colorView = holder.findViewById(R.id.color_view);
    colorView.setBackgroundResource(R.drawable.shape_circle);
    colorView.getBackground().setColorFilter(getSelectedColor(), PorterDuff.Mode.SRC_IN);
}
 
Example 5
Source File: SpectrumPreferenceCompat.java    From Muzesto with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);

    mColorView = holder.findViewById(com.thebluealliance.spectrum.R.id.color_preference_widget);
    updateColorView();
}
 
Example 6
Source File: ColorChooserPreference.java    From MaterialPreference with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    //holder.itemView.setClickable(false); // disable parent click
    ImageView imageView = (ImageView) holder.findViewById(R.id.imageViewIcon);
    //noinspection StatementWithEmptyBody
    if (imageView != null) {
        GradientDrawable gradientDrawable = (GradientDrawable) imageView.getBackground();
        gradientDrawable.setColor(Color.parseColor(MaterialPrefUtil.secondaryColor[MaterialPrefUtil.getSecondaryColorPosition()]));

        imageView.setClickable(true); // enable custom view click

    } else {
    }
}
 
Example 7
Source File: MaterialPreferenceCategory.java    From MaterialPreference with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    TextView titleView = (TextView) holder.findViewById(android.R.id.title);

    titleView.setTextColor(Color.parseColor(MaterialPrefUtil.secondaryColor[MaterialPrefUtil.getSecondaryColorPosition()]));
}
 
Example 8
Source File: DimmableIconPreference.java    From android_external_MicroGUiTools with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
    super.onBindViewHolder(view);
    if (!TextUtils.isEmpty(mContentDescription)) {
        final TextView titleView = (TextView) view.findViewById(android.R.id.title);
        titleView.setContentDescription(mContentDescription);
    }
    ViewGroup.LayoutParams layoutParams = view.findViewById(R.id.icon_frame).getLayoutParams();
    if (layoutParams instanceof LinearLayout.LayoutParams) {
        if (((LinearLayout.LayoutParams) layoutParams).leftMargin < 0) {
            ((LinearLayout.LayoutParams) layoutParams).leftMargin = 0;
        }
    }
    dimIcon(shouldDimIcon());
}
 
Example 9
Source File: LongTextPreference.java    From android_external_MicroGUiTools with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    TextView view = (TextView) holder.findViewById(android.R.id.summary);
    if (view != null) {
        view.setMaxLines(Integer.MAX_VALUE);
    }
}
 
Example 10
Source File: ColorPickerPreference.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
  super.onBindViewHolder(holder);

  colorWidget = (ImageView) holder.findViewById(R.id.color_picker_widget);
  setColorOnWidget(color);
}
 
Example 11
Source File: SilenceRingtonePreference.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
  super.onBindViewHolder(view);

  this.rightSummary = (TextView)view.findViewById(R.id.right_summary);
  setSummary(summary);
}
 
Example 12
Source File: SilenceListPreference.java    From Silence with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
  super.onBindViewHolder(view);

  this.rightSummary = (TextView)view.findViewById(R.id.right_summary);
  setSummary(this.summary);
}
 
Example 13
Source File: ColorPreferenceCategory.java    From openlauncher with Apache License 2.0 4 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    TextView titleView = (TextView) holder.findViewById(android.R.id.title);
    titleView.setTextColor(AppSettings.get().getPrimaryColor());
}
 
Example 14
Source File: LEDColorListPreference.java    From Silence with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
  super.onBindViewHolder(view);
  this.colorImageView = (ImageView)view.findViewById(R.id.color_view);
  setPreviewColor(getValue());
}