Class DynamicSpinnerPreference

All Implemented Interfaces:
SharedPreferences.OnSharedPreferenceChangeListener, Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent, BaseWidget, DynamicTintWidget, DynamicWidget
Direct Known Subclasses:
ColorPalettePreference, DynamicImagePreference, DynamicLocalePreference, DynamicSeekBarPreference, DynamicSliderPreference, DynamicThemeVersionPreference, ThemePreference, ThemeReceiverPreference

public class DynamicSpinnerPreference extends DynamicSimplePreference
A DynamicPreference to provide the functionality of a ListPreference with single choice.
  • Constructor Details

  • Method Details

    • onLoadAttributes

      protected void onLoadAttributes(@Nullable AttributeSet attrs)
      Description copied from class: DynamicView
      Load values from the supplied attribute set.
      Overrides:
      onLoadAttributes in class DynamicPreference
      Parameters:
      attrs - The attribute set to load the values.
    • onInflate

      protected void onInflate()
      Description copied from class: DynamicView
      This method will be called after loading the attributed.

      Initialize the view layout here.

      Overrides:
      onInflate in class DynamicSimplePreference
    • onUpdate

      protected void onUpdate()
      Description copied from class: DynamicView
      This method will be called whenever there is a change in the view attributes or parameters.

      It is better to do any real time calculation like updating the value string or checked state in this method.

      Overrides:
      onUpdate in class DynamicSimplePreference
    • getEntries

      @Nullable public CharSequence[] getEntries()
      Get the list entries for this preference.
      Returns:
      The list entries for this preference.
    • setEntries

      public void setEntries(@NonNull CharSequence[] entries)
      Sets the list entries for this preference.
      Parameters:
      entries - The list entries to be used.
    • getValues

      @Nullable public CharSequence[] getValues()
      Get the list values for this preference.
      Returns:
      The list values for this preference.
    • setValues

      public void setValues(@NonNull CharSequence[] values)
      Sets the list values for this preference.
      Parameters:
      values - The list values to be used.
    • updateValueString

      public void updateValueString(boolean update)
      Update value string according to the current preference value.
      Parameters:
      update - true to call DynamicView.update() method after setting the value string.
    • getDefaultValue

      public int getDefaultValue()
      Get the default value index for this preference.
      Returns:
      The default value index for this preference.
    • setDefaultValue

      public void setDefaultValue(int defaultValue)
      Set the default value index for this preference.
      Parameters:
      defaultValue - The default value index to be set.
    • getPopupType

      public int getPopupType()
      Get the popup type for this preference.
      Returns:
      The popup type for this preference.
    • setPopupType

      public void setPopupType(int popupType)
      Set the popup type for this preference.
      Parameters:
      popupType - The popup type to be set. Either DynamicPopup.Type.LIST or DynamicPopup.Type.GRID.
    • getPreferenceValue

      @Nullable public String getPreferenceValue()
      Returns the value of this preference.
      Returns:
      The value of this preference.
    • setPreferenceValue

      public void setPreferenceValue(@NonNull String value)
      Set the value for this preference and save it in the shared preferences.
      Parameters:
      value - The preference value to be set.
    • onSharedPreferenceChanged

      public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, @Nullable String key)
      Specified by:
      onSharedPreferenceChanged in interface SharedPreferences.OnSharedPreferenceChangeListener
      Overrides:
      onSharedPreferenceChanged in class DynamicSimplePreference