@@ -29,6 +29,7 @@ Select files, folders, or both from device storage with single-selection and mul
2929- [ Google Play Store policy and compliance] ( #google-play-store-policy-and-compliance )
3030- [ Manifest setup] ( #manifest-setup )
3131- [ Basic usage] ( #basic-usage )
32+ - [ Customizing dialog theme] ( #customizing-dialog-theme )
3233- [ Complete Java example] ( #complete-java-example )
3334- [ DialogProperties reference] ( #dialogproperties-reference )
3435- [ DialogConfigs reference] ( #dialogconfigs-reference )
@@ -402,6 +403,113 @@ dialog.show();
402403
403404---
404405
406+ ## Customizing dialog theme
407+
408+ This section answers a common GitHub issue/question: ** "How to change Dialog theme?"**
409+
410+ ` FilePickerDialog ` supports custom dialog themes through the constructor that accepts ` themeResId ` :
411+
412+ ``` java
413+ FilePickerDialog dialog = new FilePickerDialog (
414+ MainActivity . this ,
415+ properties,
416+ R . style. YourCustomFilePickerTheme
417+ );
418+ ```
419+
420+ Use this constructor when you want to change the dialog colors, typography, shape, background, or Material/AppCompat dialog styling.
421+
422+ ### Complete themed dialog example
423+
424+ ``` java
425+ DialogProperties properties = new DialogProperties ();
426+ properties. selection_mode = DialogConfigs . SINGLE_MODE ;
427+ properties. selection_type = DialogConfigs . FILE_SELECT ;
428+ properties. root = new File (DialogConfigs . DEFAULT_DIR );
429+ properties. offset = new File (DialogConfigs . DEFAULT_DIR );
430+ properties. error_dir = new File (DialogConfigs . DEFAULT_DIR );
431+ properties. extensions = null ;
432+ properties. show_hidden_files = false ;
433+
434+ FilePickerDialog dialog = new FilePickerDialog (
435+ MainActivity . this ,
436+ properties,
437+ R . style. YourCustomFilePickerTheme
438+ );
439+
440+ dialog. setTitle(" Select a File" );
441+ dialog. setPositiveBtnName(" Select" );
442+ dialog. setNegativeBtnName(" Cancel" );
443+
444+ dialog. setDialogSelectionListener(files - > {
445+ for (String path : files) {
446+ // Use selected path
447+ }
448+ });
449+
450+ dialog. show();
451+ ```
452+
453+ ### Example theme using AppCompat
454+
455+ Add this in ` res/values/styles.xml ` :
456+
457+ ``` xml
458+ <style name =" YourCustomFilePickerTheme" parent =" Theme.AppCompat.Light.Dialog.Alert" >
459+ <item name =" colorPrimary" >#6750A4</item >
460+ <item name =" colorPrimaryDark" >#4F378B</item >
461+ <item name =" colorAccent" >#6750A4</item >
462+ <item name =" android:fontFamily" >sans</item >
463+ </style >
464+ ```
465+
466+ ### Example theme using Material Components
467+
468+ Use this only if your app already depends on Material Components and your app theme is Material-compatible.
469+
470+ ``` xml
471+ <style name =" YourCustomFilePickerTheme" parent =" Theme.MaterialComponents.DayNight.Dialog.Alert" >
472+ <item name =" colorPrimary" >#6750A4</item >
473+ <item name =" colorPrimaryVariant" >#4F378B</item >
474+ <item name =" colorSecondary" >#6750A4</item >
475+ <item name =" colorAccent" >#6750A4</item >
476+ <item name =" android:fontFamily" >sans</item >
477+ </style >
478+ ```
479+
480+ ### Dark theme example
481+
482+ ``` xml
483+ <style name =" YourDarkFilePickerTheme" parent =" Theme.AppCompat.Dialog.Alert" >
484+ <item name =" android:windowBackground" >#121212</item >
485+ <item name =" android:textColorPrimary" >#FFFFFF</item >
486+ <item name =" android:textColorSecondary" >#BDBDBD</item >
487+ <item name =" colorPrimary" >#BB86FC</item >
488+ <item name =" colorAccent" >#BB86FC</item >
489+ </style >
490+ ```
491+
492+ Then use it:
493+
494+ ``` java
495+ FilePickerDialog dialog = new FilePickerDialog (
496+ MainActivity . this ,
497+ properties,
498+ R . style. YourDarkFilePickerTheme
499+ );
500+ ```
501+
502+ ### Important theming notes
503+
504+ - The theme must be a dialog-compatible theme.
505+ - If you use a Material Components parent theme, your app should include Material Components and use a Material-compatible application theme.
506+ - ` setTitle() ` , ` setPositiveBtnName() ` , and ` setNegativeBtnName() ` only change text, not the full dialog style.
507+ - Button and checkbox colors are controlled mainly by ` colorAccent ` and related theme color attributes.
508+ - For deep UI changes such as row layout, icon size, text sizes, or spacing, customize the library layout resources in your app or fork the library.
509+ - Do not use a full-screen activity theme as the dialog theme unless you intentionally want full-screen behavior.
510+
511+ ---
512+
405513## Complete Java example
406514
407515This sample uses modern ` ActivityResultLauncher ` APIs instead of deprecated ` startActivityForResult() ` .
0 commit comments