Java Code Examples for androidx.preference.PreferenceViewHolder#findViewById()

The following examples show how to use androidx.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: StoragePreferenceCategory.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
  super.onBindViewHolder(view);

  totalSize        = (TextView) view.findViewById(R.id.total_size);
  storageGraphView = (StorageGraphView) view.findViewById(R.id.storageGraphView);

  view.findViewById(R.id.free_up_space)
    .setOnClickListener(v -> {
      if (onFreeUpSpace != null) {
        onFreeUpSpace.run();
      }
    });

  totalSize.setText(Util.getPrettyFileSize(0));

  if (storage != null) {
    setStorage(storage);
  }
}
 
Example 2
Source File: ColorPickerPreference.java    From mollyim-android 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 3
Source File: WallpaperViewPreferenceX.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
@SuppressLint("StaticFieldLeak")
@Override
public void onBindViewHolder(PreferenceViewHolder holder)
{
    super.onBindViewHolder(holder);

    final ImageView imageView = (ImageView) holder.findViewById(R.id.imageview_pref_imageview);

    //imageTitle = view.findViewById(R.id.imageview_pref_label);
    //imageTitle.setText(preferenceTitle);

    new AsyncTask<Void, Integer, Void>() {
        Bitmap bitmap;

        @Override
        protected Void doInBackground(Void... params) {
            bitmap = getBitmap();
            return null;
        }

        @Override
        protected void onPostExecute(Void result)
        {
            super.onPostExecute(result);
            if (imageView != null)
            {
                if (bitmap != null)
                    imageView.setImageBitmap(bitmap);
                else
                    imageView.setImageResource(R.drawable.ic_empty);
            }
        }

    }.execute();
}
 
Example 4
Source File: ProfileMultiSelectPreferenceX.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder)
{
    super.onBindViewHolder(holder);

    profileIcon = (ImageView)holder.findViewById(R.id.profile_multiselect_pref_icon);
    profileIcons = (RelativeLayout)holder.findViewById(R.id.profile_multiselect_pref_icons);
    profileIcon1 = (ImageView)holder.findViewById(R.id.profile_multiselect_pref_icon1);
    profileIcon2 = (ImageView)holder.findViewById(R.id.profile_multiselect_pref_icon2);
    profileIcon3 = (ImageView)holder.findViewById(R.id.profile_multiselect_pref_icon3);
    profileIcon4 = (ImageView)holder.findViewById(R.id.profile_multiselect_pref_icon4);

    setIcons();
}
 
Example 5
Source File: ProfileIconPreferenceX.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder)
{
    super.onBindViewHolder(holder);

    imageView = (ImageView) holder.findViewById(R.id.profileicon_pref_imageview);
    updateIcon(false);
}
 
Example 6
Source File: SwitchPreference.java    From AndroidMaterialPreferences with Apache License 2.0 5 votes vote down vote up
/**
 * Adapts the preference's switch, depending on the preference's properties and on whether it is
 * currently checked or not.
 *
 * @param viewHolder
 *         The preference' view holder as an instance of the class {@link PreferenceViewHolder}.
 *         The view holder may not be null
 */
private void adaptSwitch(@NonNull final PreferenceViewHolder viewHolder) {
    View view = viewHolder.findViewById(R.id.compound_button);

    if (view instanceof SwitchCompat) {
        SwitchCompat switchWidget = (SwitchCompat) view;
        switchWidget.setTextOn(getSwitchTextOn());
        switchWidget.setTextOff(getSwitchTextOff());
        switchWidget.setShowText(!TextUtils.isEmpty(getSwitchTextOn()) ||
                !TextUtils.isEmpty(getSwitchTextOff()));
    }
}
 
Example 7
Source File: AbstractCompoundButtonPreference.java    From AndroidMaterialPreferences with Apache License 2.0 5 votes vote down vote up
/**
 * Adapts the preference's {@link CompoundButton}, depending on the preference's properties and
 * on whether it is currently checked or not.
 *
 * @param viewHolder
 *         The preference's view holder as an instance of the class {@link
 *         PreferenceViewHolder}. The view holder may not be null
 */
private void adaptCompoundButton(@NonNull final PreferenceViewHolder viewHolder) {
    View view = viewHolder.findViewById(R.id.compound_button);

    if (view instanceof CompoundButton) {
        CompoundButton compoundButton = (CompoundButton) view;
        compoundButton.setOnCheckedChangeListener(null);
        compoundButton.setChecked(isChecked());
        compoundButton.setOnCheckedChangeListener(createCheckedChangeListener());
    }
}
 
Example 8
Source File: ColorChooserPreferenceX.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder)
{
    super.onBindViewHolder(holder);

    widgetLayout = (FrameLayout)holder.findViewById(R.id.dialog_color_chooser_pref_color);

    setColorInWidget();
}
 
Example 9
Source File: ProfilePreference.java    From deltachat-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder viewHolder) {
  super.onBindViewHolder(viewHolder);
  avatarView        = (ImageView)viewHolder.findViewById(R.id.avatar);
  profileNameView   = (TextView)viewHolder.findViewById(R.id.profile_name);
  profileAddressView = (TextView)viewHolder.findViewById(R.id.number);

  refresh();
}
 
Example 10
Source File: ColorPreferenceCompat.java    From colorpreference with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    ImageView colorView = (ImageView) holder.findViewById(R.id.color_view);
    if (colorView != null) {
        ColorUtils.setColorViewValue(colorView, value, false, colorShape);
    }
}
 
Example 11
Source File: DefaultBrowserPreference.java    From focus-android with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);

    switchView = (Switch) holder.findViewById(R.id.switch_widget);

    update();
}
 
Example 12
Source File: DpcPreferenceHelper.java    From android-testdpc with Apache License 2.0 5 votes vote down vote up
/**
 * Override the summary with any constraint violation messages.
 */
public void onBindViewHolder(PreferenceViewHolder holder) {
    if (!constraintsMet()) {
        final TextView summaryView = (TextView) holder.findViewById(android.R.id.summary);
        if (summaryView != null) {
            summaryView.setText(mConstraintViolationSummary);
            summaryView.setVisibility(View.VISIBLE);
        }
    }
}
 
Example 13
Source File: ApplicationsDialogPreferenceX.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder)
{
    super.onBindViewHolder(holder);

    packageIcon = (ImageView) holder.findViewById(R.id.applications_pref_icon);
    packageIcons = (RelativeLayout) holder.findViewById(R.id.applications_pref_icons);
    packageIcon1 = (ImageView) holder.findViewById(R.id.applications_pref_icon1);
    packageIcon2 = (ImageView) holder.findViewById(R.id.applications_pref_icon2);
    packageIcon3 = (ImageView) holder.findViewById(R.id.applications_pref_icon3);
    packageIcon4 = (ImageView) holder.findViewById(R.id.applications_pref_icon4);

    setIcons();
}
 
Example 14
Source File: ProfilePreference.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder viewHolder) {
  super.onBindViewHolder(viewHolder);
  avatarView         = (ImageView)viewHolder.findViewById(R.id.avatar);
  profileNameView    = (TextView)viewHolder.findViewById(R.id.profile_name);
  profileSubtextView = (TextView)viewHolder.findViewById(R.id.number);

  refresh();
}
 
Example 15
Source File: ProgressPreference.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
  super.onBindViewHolder(view);

  this.container    = view.findViewById(R.id.container);
  this.progressText = (TextView) view.findViewById(R.id.progress_text);

  this.container.setVisibility(View.GONE);
}
 
Example 16
Source File: ApplicationsMultiSelectDialogPreferenceX.java    From PhoneProfilesPlus with Apache License 2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder)
{
    super.onBindViewHolder(holder);

    packageIcon = (ImageView) holder.findViewById(R.id.applications_pref_icon);
    packageIcons = (RelativeLayout) holder.findViewById(R.id.applications_pref_icons);
    packageIcon1 = (ImageView) holder.findViewById(R.id.applications_pref_icon1);
    packageIcon2 = (ImageView) holder.findViewById(R.id.applications_pref_icon2);
    packageIcon3 = (ImageView) holder.findViewById(R.id.applications_pref_icon3);
    packageIcon4 = (ImageView) holder.findViewById(R.id.applications_pref_icon4);

    setIcons();
}
 
Example 17
Source File: FloatMeasurementView.java    From openScale with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);

    ImageView helpView = (ImageView)holder.findViewById(R.id.helpView);

    helpView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getContext().startActivity(new Intent(
                    Intent.ACTION_VIEW,
                    Uri.parse("https://github.com/oliexdev/openScale/wiki/Body-metric-estimations")));
        }
    });
}
 
Example 18
Source File: SignalPreference.java    From mollyim-android 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 19
Source File: ContactPreference.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder view) {
  super.onBindViewHolder(view);

  this.itemView          = view.itemView;
  this.messageButton     = (ImageView) view.findViewById(R.id.message);
  this.callButton        = (ImageView) view.findViewById(R.id.call);
  this.secureCallButton  = (ImageView) view.findViewById(R.id.secure_call);
  this.secureVideoButton = (ImageView) view.findViewById(R.id.secure_video);

  if (listener != null) setListener(listener);
  setState(secure, blocked);
}
 
Example 20
Source File: ProfilePreferenceX.java    From PhoneProfilesPlus with Apache License 2.0 4 votes vote down vote up
@Override
public void onBindViewHolder(PreferenceViewHolder holder)
{
    super.onBindViewHolder(holder);

    //preferenceTitleView = view.findViewById(R.id.applications_pref_label);  // resource na title
    //preferenceTitleView.setText(preferenceTitle);

    ImageView profileIcon = (ImageView) holder.findViewById(R.id.profile_pref_icon);

    if (profileIcon != null)
    {
        Profile profile = dataWrapper.getProfileById(Long.parseLong(profileId), true, false, false);
        if (profile != null)
        {
            if (profile.getIsIconResourceID())
            {
                if (profile._iconBitmap != null)
                    profileIcon.setImageBitmap(profile._iconBitmap);
                else {
                    //profileIcon.setImageBitmap(null);
                    //int res = prefContext.getResources().getIdentifier(profile.getIconIdentifier(), "drawable",
                    //        prefContext.getPackageName());
                    int res = Profile.getIconResource(profile.getIconIdentifier());
                    profileIcon.setImageResource(res); // icon resource
                }
            }
            else
            {
                profileIcon.setImageBitmap(profile._iconBitmap);
            }
        }
        else
        {
            //if ((addNoActivateItem == 1) && (Long.parseLong(profileId) == PPApplication.PROFILE_NO_ACTIVATE))
            //    profileIcon.setImageResource(R.drawable.ic_profile_default); // icon resource
            //else
                profileIcon.setImageResource(R.drawable.ic_empty); // icon resource
        }

        Handler handler = new Handler(prefContext.getMainLooper());
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                setSummary(Long.parseLong(profileId));
            }
        }, 200);
    }
}