Class DynamicRemoteThemeFragment
java.lang.Object
androidx.fragment.app.Fragment
com.pranavpandey.android.dynamic.support.fragment.DynamicFragment
com.pranavpandey.android.dynamic.support.theme.fragment.ThemeFragment<DynamicRemoteTheme>
com.pranavpandey.android.dynamic.support.theme.fragment.DynamicRemoteThemeFragment
- All Implemented Interfaces:
ComponentCallbacks,SharedPreferences.OnSharedPreferenceChangeListener,View.OnCreateContextMenuListener,ActivityResultCaller,MenuProvider,HasDefaultViewModelProviderFactory,LifecycleOwner,ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner,DynamicLifecycle,DynamicSearchListener,DynamicTransitionListener,ThemeListener<DynamicRemoteTheme>,ThemeListener.Export<DynamicRemoteTheme>,ThemeListener.Import<DynamicRemoteTheme>,ThemeListener.Value,DynamicProductFlavor
Base theme fragment to provide theme editing functionality.
Extend this fragment to implement theme attributes according to the requirements.
-
Nested Class Summary
Nested classes/interfaces inherited from class androidx.fragment.app.Fragment
Fragment.InstantiationException, Fragment.SavedStateNested classes/interfaces inherited from interface com.pranavpandey.android.dynamic.support.theme.listener.ThemeListener
ThemeListener.Code, ThemeListener.Export<T extends DynamicAppTheme>, ThemeListener.Import<T extends DynamicAppTheme>, ThemeListener.Select, ThemeListener.ValueNested classes/interfaces inherited from interface com.pranavpandey.android.dynamic.support.theme.listener.ThemeListener.Import
ThemeListener.Import.File<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DynamicSpinnerPreferenceDynamic spinner preference to control the background aware functionality.protected DynamicColorPreferenceDynamic color preference to control the dark accent colors.protected DynamicColorPreferenceDynamic color preference to control the accent colors.protected DynamicColorPreferenceDynamic color preference to control the background colors.protected DynamicColorPreferenceDynamic color preference to control the error colors.protected DynamicColorPreferenceDynamic color preference to control the dark primary colors.protected DynamicColorPreferenceDynamic color preference to control the primary colors.protected DynamicColorPreferenceDynamic color preference to control the surface colors.protected DynamicSliderPreferenceDynamic slider preference to control the contrast.protected DynamicSliderPreferenceDynamic slider preference to control the corner radius.protected DynamicSpinnerPreferenceDynamic spinner preference to control the elevation functionality.protected DynamicSliderPreferenceDynamic slider preference to control the font scale.protected DynamicSliderPreferenceDynamic slider preference to control the opacity.protected DynamicPresetsView<DynamicRemoteTheme>View to show the theme presets.protected DynamicSpinnerPreferenceDynamic spinner preference to control the style functionality.protected DynamicColorPreferenceDynamic color preference to control the primary text colors.protected DynamicColorPreferenceDynamic color preference to control the secondary text colors.Fields inherited from class com.pranavpandey.android.dynamic.support.theme.fragment.ThemeFragment
mDynamicTheme, mDynamicThemeDefault, mProgressDialog, mSettingsChanged, mThemeExported, mThemePreviewFields inherited from class androidx.fragment.app.Fragment
mPreviousWhoFields inherited from interface com.pranavpandey.android.dynamic.support.theme.listener.ThemeListener
ADS_NAME_THEME_PREVIEW, ADS_NAME_THEME_PREVIEW_ACTION, ADS_NAME_THEME_PREVIEW_ICON, ADS_PREF_THEME_BACKGROUND_AWARE, ADS_PREF_THEME_COLOR_ACCENT, ADS_PREF_THEME_COLOR_ACCENT_DARK, ADS_PREF_THEME_COLOR_BACKGROUND, ADS_PREF_THEME_COLOR_ERROR, ADS_PREF_THEME_COLOR_PRIMARY, ADS_PREF_THEME_COLOR_PRIMARY_DARK, ADS_PREF_THEME_COLOR_SURFACE, ADS_PREF_THEME_COLOR_TINT_ACCENT, ADS_PREF_THEME_COLOR_TINT_ACCENT_DARK, ADS_PREF_THEME_COLOR_TINT_BACKGROUND, ADS_PREF_THEME_COLOR_TINT_ERROR, ADS_PREF_THEME_COLOR_TINT_PRIMARY, ADS_PREF_THEME_COLOR_TINT_PRIMARY_DARK, ADS_PREF_THEME_COLOR_TINT_SURFACE, ADS_PREF_THEME_CONTRAST, ADS_PREF_THEME_CONTRAST_ALT, ADS_PREF_THEME_CORNER_SIZE, ADS_PREF_THEME_CORNER_SIZE_ALT, ADS_PREF_THEME_ELEVATION, ADS_PREF_THEME_FONT_SCALE, ADS_PREF_THEME_FONT_SCALE_ALT, ADS_PREF_THEME_OPACITY, ADS_PREF_THEME_OPACITY_ALT, ADS_PREF_THEME_STYLE, ADS_PREF_THEME_TEXT_INVERSE_PRIMARY, ADS_PREF_THEME_TEXT_INVERSE_SECONDARY, ADS_PREF_THEME_TEXT_PRIMARY, ADS_PREF_THEME_TEXT_SECONDARY, REQUEST_THEME_CAPTURE, REQUEST_THEME_CODE_LOCATION, REQUEST_THEME_CODE_LOCATION_ALT, REQUEST_THEME_IMPORT, REQUEST_THEME_LOCATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the resolved background aware for the theme.intReturns the resolved contrast for the theme.intReturns the resolved corner size for the theme.intReturns the resolved elevation for the theme.intReturns the resolved font scale for the theme.intReturns the resolved opacity for the theme.intgetStyle()Returns the resolved style for the theme.getThemeBitmap(ThemePreview<DynamicRemoteTheme> themePreview, int themeAction) This method will be called to return a bitmap.Retrieves the theme from the supplies argumentsbooleanReturns whether to register a shared preferences listener for this fragment.static DynamicRemoteThemeFragmentnewInstance(String DynamicRemoteTheme, String DynamicRemoteThemeDefault) Initialize the new instance of this fragment.static DynamicRemoteThemeFragmentnewInstance(String DynamicRemoteTheme, String DynamicRemoteThemeDefault, boolean showPresets) Initialize the new instance of this fragment.voidonCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) onImportTheme(String theme) This method will be called on importing the theme.voidonLoadTheme(DynamicRemoteTheme theme) This method will called to load settings from the supplied theme.voidonResume()voidonSetAction(int themeAction, ThemePreview<DynamicRemoteTheme> themePreview, boolean enable) This method will be called on setting the action icon.voidonSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) voidonViewCreated(View view, Bundle savedInstanceState) booleanReturns whether to set the options menu for this fragment.Methods inherited from class com.pranavpandey.android.dynamic.support.theme.fragment.ThemeFragment
getPreferenceValue, getPreferenceValue, getShareTitle, getThemeExportTask, getThemePreview, importTheme, importTheme, importTheme, onActivityResult, onCreateMenu, onMenuItemSelected, onPrepareMenu, onThemeError, saveTheme, saveThemeSettings, setProgressMethods inherited from class com.pranavpandey.android.dynamic.support.fragment.DynamicFragment
finishActivity, getBooleanFromArguments, getCheckedMenuItemId, getDynamicActivity, getDynamicEnterTransition, getDynamicExitTransition, getDynamicReenterTransition, getDynamicReturnTransition, getHostMenu, getIntFromArguments, getNavigationViewId, getParcelableFromArguments, getPostponeTransitionView, getProductFlavor, getSavedInstanceState, getStringFromArguments, getStringFromArguments, getSubtitle, getSystemActivity, getTextWatcher, getTitle, invalidateHostMenu, isAppCompatActivity, isEnableMenu, isForceMenuIcons, isHasMenuProvider, isSearchViewExpanded, isSearchViewListenerListener, isSupportActionBar, onAddActivityHeader, onAddMenuProvider, onAdjustEnterReturnTransition, onAdjustExitReenterTransition, onApplyTransitions, onDestroy, onDynamicPause, onDynamicResume, onFindView, onMenuClosed, onPause, onRemoveProvider, onSaveInstanceState, onSearchViewCollapsed, onSearchViewExpanded, onStart, onStartActivityException, postponeEnterTransition, setHostMenuItemVisible, setMenuVisibility, setResult, setResult, setResult, setResult, startActivity, startActivity, startActivityForResult, startActivityForResult, startMotionActivity, startMotionActivityForResult, startPostponedEnterTransitionMethods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onAttach, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroyOptionsMenu, onDestroyView, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onStop, onViewStateRestored, postponeEnterTransition, registerForActivityResult, registerForActivityResult, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startIntentSenderForResult, toString, unregisterForContextMenu
-
Field Details
-
mPresetsView
View to show the theme presets. -
mColorBackgroundPreference
Dynamic color preference to control the background colors. -
mColorSurfacePreference
Dynamic color preference to control the surface colors. -
mColorPrimaryPreference
Dynamic color preference to control the primary colors. -
mColorAccentPreference
Dynamic color preference to control the accent colors. -
mColorPrimaryDarkPreference
Dynamic color preference to control the dark primary colors. -
mColorAccentDarkPreference
Dynamic color preference to control the dark accent colors. -
mColorErrorPreference
Dynamic color preference to control the error colors. -
mTextPrimaryPreference
Dynamic color preference to control the primary text colors. -
mTextSecondaryPreference
Dynamic color preference to control the secondary text colors. -
mFontScalePreference
Dynamic slider preference to control the font scale. -
mCornerSizePreference
Dynamic slider preference to control the corner radius. -
mBackgroundAwarePreference
Dynamic spinner preference to control the background aware functionality. -
mContrastPreference
Dynamic slider preference to control the contrast. -
mOpacityPreference
Dynamic slider preference to control the opacity. -
mElevationPreference
Dynamic spinner preference to control the elevation functionality. -
mStylePreference
Dynamic spinner preference to control the style functionality.
-
-
Constructor Details
-
DynamicRemoteThemeFragment
public DynamicRemoteThemeFragment()
-
-
Method Details
-
newInstance
@NonNull public static DynamicRemoteThemeFragment newInstance(@Nullable String DynamicRemoteTheme, @Nullable String DynamicRemoteThemeDefault) Initialize the new instance of this fragment.- Parameters:
DynamicRemoteTheme- The dynamic app theme.DynamicRemoteThemeDefault- The default dynamic app theme.- Returns:
- An instance of
DynamicRemoteThemeFragment. - See Also:
-
newInstance
@NonNull public static DynamicRemoteThemeFragment newInstance(@Nullable String DynamicRemoteTheme, @Nullable String DynamicRemoteThemeDefault, boolean showPresets) Initialize the new instance of this fragment.- Parameters:
DynamicRemoteTheme- The dynamic app theme.DynamicRemoteThemeDefault- The default dynamic app theme.showPresets-trueto show the presets.- Returns:
- An instance of
DynamicRemoteThemeFragment.
-
onCreate
- Overrides:
onCreatein classDynamicFragment
-
onCreateView
@Nullable public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) - Overrides:
onCreateViewin classFragment
-
onViewCreated
- Overrides:
onViewCreatedin classDynamicFragment
-
setHasOptionsMenu
public boolean setHasOptionsMenu()Description copied from class:DynamicFragmentReturns whether to set the options menu for this fragment.- Overrides:
setHasOptionsMenuin classDynamicFragment- Returns:
trueif set the options menu for this fragment.- See Also:
-
onResume
public void onResume()- Overrides:
onResumein classDynamicFragment
-
getThemeFromArguments
Retrieves the theme from the supplies arguments- Parameters:
key- The key to be retrieved.- Returns:
- The dynamic theme from the supplied arguments.
-
onImportTheme
Description copied from interface:ThemeListener.ImportThis method will be called on importing the theme.- Parameters:
theme- The theme string to be imported.- Returns:
- The imported theme.
-
getFontScale
public int getFontScale()Description copied from interface:ThemeListener.ValueReturns the resolved font scale for the theme.- Specified by:
getFontScalein interfaceThemeListener.Value- Overrides:
getFontScalein classThemeFragment<DynamicRemoteTheme>- Returns:
- The resolved font scale for the theme.
-
getCornerSize
public int getCornerSize()Description copied from interface:ThemeListener.ValueReturns the resolved corner size for the theme.- Specified by:
getCornerSizein interfaceThemeListener.Value- Overrides:
getCornerSizein classThemeFragment<DynamicRemoteTheme>- Returns:
- The resolved corner size for the theme.
-
getBackgroundAware
public int getBackgroundAware()Description copied from interface:ThemeListener.ValueReturns the resolved background aware for the theme.- Specified by:
getBackgroundAwarein interfaceThemeListener.Value- Overrides:
getBackgroundAwarein classThemeFragment<DynamicRemoteTheme>- Returns:
- The resolved background aware for the theme.
-
getContrast
public int getContrast()Description copied from interface:ThemeListener.ValueReturns the resolved contrast for the theme.- Specified by:
getContrastin interfaceThemeListener.Value- Overrides:
getContrastin classThemeFragment<DynamicRemoteTheme>- Returns:
- The resolved contrast for the theme.
-
getOpacity
public int getOpacity()Description copied from interface:ThemeListener.ValueReturns the resolved opacity for the theme.- Specified by:
getOpacityin interfaceThemeListener.Value- Overrides:
getOpacityin classThemeFragment<DynamicRemoteTheme>- Returns:
- The resolved opacity for the theme.
-
getElevation
public int getElevation()Description copied from interface:ThemeListener.ValueReturns the resolved elevation for the theme.- Specified by:
getElevationin interfaceThemeListener.Value- Overrides:
getElevationin classThemeFragment<DynamicRemoteTheme>- Returns:
- The resolved elevation for the theme.
-
getStyle
public int getStyle()Description copied from interface:ThemeListener.ValueReturns the resolved style for the theme.- Specified by:
getStylein interfaceThemeListener.Value- Overrides:
getStylein classThemeFragment<DynamicRemoteTheme>- Returns:
- The resolved style for the theme.
-