@@ -61,6 +61,7 @@ public CustomThemeBuilder(Activity activityCtxRef) {
6161 cancelActionBtnIconResId = NULL_RESOURCE_ID ;
6262 themeColorScheme = null ;
6363 toolbarIconResId = NULL_RESOURCE_ID ;
64+ useToolbarGradients = false ;
6465 navBtnIconResIdMap = new HashMap <FileChooserBuilder .DefaultNavFoldersType , Integer >();
6566 fileIconResId = fileHiddenIconResId = folderIconResId = NULL_RESOURCE_ID ;
6667 }
@@ -179,6 +180,8 @@ public int getColorToolbarDivider() {
179180 return themeColorsList [COLOR_TOOLBAR_DIVIDER ];
180181 }
181182
183+ public int getColorTransparent () { return DisplayUtils .resolveColorFromAttribute (R .color .__colorTransparent ); }
184+
182185 public static int [] GenerateThemeColorsList (Activity activityCtxRef , @ ColorRes int baseColorResId ) {
183186 int resolvedColor = baseColorResId ;
184187 try {
@@ -194,7 +197,7 @@ public static int[] GenerateThemeColorsList(Activity activityCtxRef, @ColorRes i
194197 DisplayUtils .darkenColor (resolvedColor , 0.80f ), /* COLOR_PRIMARY_VERY_DARK */
195198 DisplayUtils .lightenColor (resolvedColor , 0.72f ), /* COLOR_ACCENT */
196199 DisplayUtils .lightenColor (resolvedColor , 0.50f ), /* COLOR_ACCENT_MEDIUM */
197- DisplayUtils .lightenColor (resolvedColor , 0.89f ), /* COLOR_ACCENT_LIGHT */
200+ DisplayUtils .lightenColor (resolvedColor , 0.85f ), /* COLOR_ACCENT_LIGHT */
198201 DisplayUtils .darkenColor (resolvedColor , 0.88f ), /* COLOR_TOOLBAR_BG */
199202 DisplayUtils .lightenColor (resolvedColor , 0.85f ), /* COLOR_TOOLBAR_FG */
200203 DisplayUtils .lightenColor (resolvedColor , 0.55f ), /* COLOR_TOOLBAR_NAV */
@@ -228,6 +231,13 @@ public CustomThemeBuilder setActivityToolbarIcon(@DrawableRes int customIconResI
228231 return this ;
229232 }
230233
234+ private boolean useToolbarGradients ;
235+
236+ public CustomThemeBuilder useToolbarGradients (boolean enable ) {
237+ useToolbarGradients = enable ;
238+ return this ;
239+ }
240+
231241 public static int getToolbarIconDimension () {
232242 return 48 ; // pixels
233243 }
@@ -254,6 +264,7 @@ public interface FileChooserActivityMainLayoutStylizer {
254264
255265 public FileChooserActivityMainLayoutStylizer createActivityMainLayoutStylizer () {
256266
267+ final boolean _useToolbarGradients = useToolbarGradients ;
257268 final Drawable _toolbarLogoIconFinal = DisplayUtils .firstNonNull (
258269 DisplayUtils .resolveDrawableFromResId (activityCtx , toolbarIconResId ),
259270 DisplayUtils .resolveDrawableFromResId (R .drawable .file_chooser_default_toolbar_icon48 )
@@ -290,10 +301,6 @@ public FileChooserActivityMainLayoutStylizer createActivityMainLayoutStylizer()
290301 _navBarPrefixTextFinal == null || _doneActionBtnTextFinal == null || _cancelActionBtnTextFinal == null ||
291302 _toolbarLogoIconFinal == null || _globalBackBtnIconFinal == null ||
292303 _doneActionBtnIconFinal == null || _cancelActionBtnIconFinal == null ) {
293- Log .i (LOGTAG , " - " + !DisplayUtils .checkIconDimensions (_toolbarLogoIconFinal , getToolbarIconDimension ()) +
294- ", " + !DisplayUtils .checkIconDimensions (_globalBackBtnIconFinal , getGlobalBackButtonIconDimension ()) +
295- ", " + !DisplayUtils .checkIconDimensions (_doneActionBtnIconFinal , getActionButtonIconDimension ()) +
296- ", " + !DisplayUtils .checkIconDimensions (_cancelActionBtnIconFinal , getActionButtonIconDimension ()));
297304 return null ;
298305 }
299306 return new FileChooserActivityMainLayoutStylizer () {
@@ -316,9 +323,17 @@ public boolean styleNavigationDisplayToolbar(Toolbar toolbar) {
316323 return false ;
317324 }
318325 toolbar .setSubtitle (String .format (Locale .getDefault (), " ⇤%s⇥" , _pickerTitleText ));
326+ toolbar .setBackgroundColor (_themeColorScheme .getColorToolbarBG ());
319327 toolbar .setTitleTextColor (_themeColorScheme .getColorToolbarFG ());
320328 toolbar .setSubtitleTextColor (_themeColorScheme .getColorToolbarFG ());
321329 toolbar .setLogo (_toolbarLogoIcon );
330+ if (_useToolbarGradients ) {
331+ GradientDrawable bgGrad = DisplayUtils .GradientDrawableBuilder .GetStockGradientFromBaseColor (
332+ ColorUtils .blendARGB (_themeColorScheme .getColorToolbarBG (), _themeColorScheme .getColorPrimary (), 0.32f ),
333+ _themeColorScheme .getColorToolbarBG ()
334+ );
335+ toolbar .setBackground (bgGrad );
336+ }
322337 return true ;
323338 }
324339
@@ -362,11 +377,12 @@ public boolean styleBottomNavigationActionButtons(Button doneActionBtn, Button c
362377 if (doneActionBtn == null || cancelActionBtn == null ) {
363378 return false ;
364379 }
365- doneActionBtn .setBackgroundColor (_themeColorScheme .getColorAccentLight ());
380+ int btnBGColor = _useToolbarGradients ? _themeColorScheme .getColorTransparent () : _themeColorScheme .getColorAccentLight ();
381+ doneActionBtn .setBackgroundColor (btnBGColor );
366382 doneActionBtn .setTextColor (_themeColorScheme .getColorAccentMedium ());
367383 doneActionBtn .setText (_doneActionBtnText );
368384 doneActionBtn .setCompoundDrawablesRelativeWithIntrinsicBounds (_doneActionBtnIcon , null , null , null );
369- cancelActionBtn .setBackgroundColor (_themeColorScheme . getColorAccentLight () );
385+ cancelActionBtn .setBackgroundColor (btnBGColor );
370386 cancelActionBtn .setTextColor (_themeColorScheme .getColorAccentMedium ());
371387 cancelActionBtn .setText (_cancelActionBtnText );
372388 cancelActionBtn .setCompoundDrawablesRelativeWithIntrinsicBounds (_cancelActionBtnIcon , null , null , null );
@@ -427,10 +443,25 @@ public boolean styleMainActivityLayout(View parentContainerLayout) throws Runtim
427443 navBtnsLinearLayout .setBackgroundColor (_themeColorScheme .getColorToolbarNav ());
428444 layoutDivider2 .setBackgroundColor (_themeColorScheme .getColorToolbarDivider ());
429445 pathsHistoryContainer .setBackgroundColor (_themeColorScheme .getColorAccentLight ());
446+ if (_useToolbarGradients ) {
447+ GradientDrawable bgGrad = DisplayUtils .GradientDrawableBuilder .GetStockGradientFromBaseColor (
448+ _themeColorScheme .getColorAccentLight (),
449+ _themeColorScheme .getColorPrimary ()
450+ );
451+ pathsHistoryContainer .setBackground (bgGrad );
452+ }
430453 layoutDivider3 .setBackgroundColor (_themeColorScheme .getColorToolbarDivider ());
431454 mainRecyclerViewContainerLayout .setBackgroundColor (_themeColorScheme .getColorPrimary ());
432455 layoutDivider4 .setBackgroundColor (_themeColorScheme .getColorToolbarDivider ());
433456 bottomActionBtnsContainerLayout .setBackgroundColor (_themeColorScheme .getColorAccentLight ());
457+ if (_useToolbarGradients ) {
458+ GradientDrawable bgGrad = DisplayUtils .GradientDrawableBuilder .GetStockGradientFromBaseColor (
459+ _themeColorScheme .getColorAccentLight (),
460+ DisplayUtils .darkenColor (_themeColorScheme .getColorPrimary (), 0.15f )
461+ );
462+ pathsHistoryContainer .setBackground (bgGrad );
463+ bottomActionBtnsContainerLayout .setBackground (bgGrad );
464+ }
434465 return true ;
435466
436467 }
@@ -481,7 +512,7 @@ public interface FileItemLayoutStylizer {
481512
482513 public FileItemLayoutStylizer createFileItemLayoutStylizer () {
483514
484- if (activityCtx == null || themeColorScheme == null ||
515+ if (themeColorScheme == null ||
485516 fileIconResId == NULL_RESOURCE_ID || fileHiddenIconResId == NULL_RESOURCE_ID ||
486517 folderIconResId == NULL_RESOURCE_ID ) {
487518 return null ;
@@ -494,7 +525,6 @@ public FileItemLayoutStylizer createFileItemLayoutStylizer() {
494525 }
495526 return new FileItemLayoutStylizer () {
496527
497- private final Activity _activityCtx = activityCtx ;
498528 private final Drawable _fileIcon = fileIconFinal ;
499529 private final Drawable _fileHiddenIcon = fileHiddenIconFinal ;
500530 private final Drawable _folderIcon = folderIconFinal ;
0 commit comments