当前位置: 首页>>代码示例>>Java>>正文


Java PreferenceViewHolder类代码示例

本文整理汇总了Java中android.support.v7.preference.PreferenceViewHolder的典型用法代码示例。如果您正苦于以下问题:Java PreferenceViewHolder类的具体用法?Java PreferenceViewHolder怎么用?Java PreferenceViewHolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PreferenceViewHolder类属于android.support.v7.preference包,在下文中一共展示了PreferenceViewHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    holder.itemView.setClickable(false);    // disable parent click

    //Loop through all the ThemeViews
    for(WidgetTheme widgetTheme : WidgetTheme.values()) {
        final String name = widgetTheme.name();
        final int themeViewId = widgetTheme.getThemeViewId();
        final int summaryRes = widgetTheme.getSummaryRes();

        View button = holder.findViewById(themeViewId);
        button.setClickable(true);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setSummary(summaryRes);
                persistString(name);
            }
        });
    }
}
 
开发者ID:abicelis,项目名称:PingWidget,代码行数:23,代码来源:ThemePreference.java

示例2: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    holder.itemView.setClickable(false);
    for (int i = 0; i < BUTTONS.size(); i++) {
        final int buttonId = BUTTONS.keyAt(i);
        final String value = BUTTONS.valueAt(i);
        View button = holder.findViewById(buttonId);
        button.setClickable(true);
        button.setOnClickListener(v -> {
            mSelectedTheme = value;
            if (shouldDisableDependents()) {
                Preferences.Theme.disableAutoDayNight(getContext());
            }
            setSummary(VALUES.get(value).summary);
            persistString(value);
        });
    }
}
 
开发者ID:hidroh,项目名称:materialistic,代码行数:20,代码来源:ThemePreference.java

示例3: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
    super.onBindViewHolder(view);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        return;
    }

    mItemView = view.itemView;
    mAnchor = view.itemView.findViewById(android.R.id.empty);

    if (mAnchor == null) {
        throw new IllegalStateException("SimpleMenuPreference item layout must contain" +
                "a view id is android.R.id.empty to support iconSpaceReserved");
    }
}
 
开发者ID:Gericop,项目名称:Android-Support-Preference-V7-Fix,代码行数:17,代码来源:SimpleMenuPreference.java

示例4: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    View view = holder.itemView;
    mColorView = new View(getContext());
    mColorView.setId("ID".hashCode());
    int size = (int) dpToPx(32);
    mColorView.setLayoutParams(new ViewGroup.LayoutParams(size, size));
    ViewGroup frame = (ViewGroup) view.findViewById(android.R.id.widget_frame);
    frame.setVisibility(View.VISIBLE);
    addView(frame, mColorView);
    if (mMaterial) {
        TextView textTitle = (TextView) view.findViewById(android.R.id.title);
        TextView textSummary = (TextView) view.findViewById(android.R.id.summary);
        textTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
        textSummary.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
        textTitle.setTextColor(getColor(android.R.attr.textColor));
        textSummary.setTextColor(getColor(android.R.attr.textColorSecondary));
        View parent = (View) textSummary.getParent().getParent();
        parent.setPadding((int) dpToPx(16), 0, (int) dpToPx(16), 0);
    }
}
 
开发者ID:k0shk0sh,项目名称:FastAccess,代码行数:22,代码来源:AppCompatColorPreference.java

示例5: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(@NonNull PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    // Intercept the click listener for this preference, and if the preference has an intent,
    // launch the intent ourselves, so that we can catch the exception if the intent fails.
    // (but only do this if the preference doesn't already have a click listener)
    if (this.getOnPreferenceClickListener() == null) {
        this.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                if (preference.getIntent() != null) {
                    try {
                        getContext().startActivity(preference.getIntent());
                    } catch (ActivityNotFoundException e) {
                        Toast.makeText(getContext(), getContext().getString(R.string.error_browser_not_found), Toast.LENGTH_LONG).show();
                    }
                    return true;
                }
                return false;
            }
        });
    }
}
 
开发者ID:wikimedia,项目名称:apps-android-wikipedia,代码行数:24,代码来源:PreferenceMultiLine.java

示例6: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
  super.onBindViewHolder(holder);
  // We get the reference to the mSeekBar
  mSeekBar = (SeekBar) holder.findViewById(R.id.size_seek_bar);
  mSeekBar.setMax(mMaxValue);
  mSeekBar.setOnSeekBarChangeListener(this);
  mSeekBarValueTextView = (TextView) holder.findViewById(R.id.seek_bar_value);
  mTitleView = (TextView) holder.findViewById(R.id.title);
  mTitleView.setText(getTitle());
  // This is called after the initial value is set
  mSeekBar.setProgress(mProgressValue);
  updateCurrentValue(mProgressValue);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:SizePreferences.java

示例7: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);

    colorWidget = (ImageView) holder.findViewById(R.id.color_picker_widget);
    setColorOnWidget(color);
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:8,代码来源:ColorPickerPreference.java

示例8: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    if (primary) {
        ((CircularView) holder.findViewById(R.id.color_indicator)).setColor(getContext().getResources().getColor(Colorful.getThemeDelegate().getPrimaryColor().getColorRes()));
    } else if (accent) {
        ((CircularView) holder.findViewById(R.id.color_indicator)).setColor(getContext().getResources().getColor(Colorful.getThemeDelegate().getAccentColor().getColorRes()));
    }
}
 
开发者ID:woxingxiao,项目名称:GracefulMovies,代码行数:10,代码来源:ColorPickerPreference.java

示例9: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@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);
}
 
开发者ID:ThirtyDegreesRay,项目名称:OpenHub,代码行数:8,代码来源:ColorChooserPreference.java

示例10: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder viewHolder) {
	super.onBindViewHolder(viewHolder);
	colorView = viewHolder.findViewById(R.id.color_preview);

	((GradientDrawable)
			((LayerDrawable) colorView.getBackground())
					.findDrawableByLayerId(R.id.color))
			.setColor(color);
}
 
开发者ID:ashutoshgngwr,项目名称:10-bitClockWidget,代码行数:11,代码来源:ColorPickerPreference.java

示例11: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
    App app = (App) getContext().getApplicationContext();
    TextView user = (TextView) holder.findViewById(R.id.user_Name);
    ImageView picture = (ImageView) holder.findViewById(R.id.user_Profile);
    String name = app.account.getName();
    if (name == null) {
        name = "User";
    }
    user.setText(name);
    Picasso.with(getContext()).load(app.account.getPictureURL()).placeholder(R.drawable.ic_placeholder).into(picture);
}
 
开发者ID:Onelio,项目名称:ConnectU,代码行数:15,代码来源:ProfilePreference.java

示例12: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);

    mColorView = holder.findViewById(com.thebluealliance.spectrum.R.id.color_preference_widget);
    updateColorView();
}
 
开发者ID:rohanoid5,项目名称:Muzesto,代码行数:8,代码来源:SpectrumPreferenceCompat.java

示例13: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object o) {
            String changedText = (String) o;
            if (getText() == null || getText().compareTo(changedText) != 0) {
                setChanged(true);
                setSummary(changedText);
            }
            return true;
        }
    });
}
 
开发者ID:Microsoft,项目名称:ProjectOxford-Apps-MimickerAlarm,代码行数:16,代码来源:NamePreference.java

示例14: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    LinearLayout container = (LinearLayout) holder.findViewById(R.id.pref_repeating_container);
    container.removeAllViews();
    for(int i = 0; i < mRepeatingDays.length; i++) {
        DayView dayView = new DayView(getContext(), this, i);
        dayView.setText(mDayNames[i]);
        dayView.setRepeating(mRepeatingDays[i]);
        container.addView(dayView);
    }
    super.onBindViewHolder(holder);
}
 
开发者ID:Microsoft,项目名称:ProjectOxford-Apps-MimickerAlarm,代码行数:13,代码来源:RepeatingDaysPreference.java

示例15: onBindViewHolder

import android.support.v7.preference.PreferenceViewHolder; //导入依赖的package包/类
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object o) {
            setChanged(mInitiallyChecked != (boolean) o);
            return true;
        }
    });
}
 
开发者ID:Microsoft,项目名称:ProjectOxford-Apps-MimickerAlarm,代码行数:12,代码来源:VibratePreference.java


注:本文中的android.support.v7.preference.PreferenceViewHolder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。