@@ -423,7 +423,6 @@ public void onCreate(final Bundle savedInstanceState) {
423423 window .requestFeature (Window .FEATURE_ACTION_MODE_OVERLAY );
424424
425425 resources = getResources ();
426- final ActionBar actionBar = getSupportActionBar ();
427426 intent = getIntent ();
428427 final String action = intent .getAction ();
429428
@@ -432,14 +431,18 @@ public void onCreate(final Bundle savedInstanceState) {
432431
433432 dataUtils .registerOnDataChangedListener (this );
434433
434+ if (!Intent .ACTION_MAIN .equals (action )) {
435+ setTheme (R .style .Theme_AppCompat_DayNight );
436+ }
435437 setContentView (R .layout .activity_folder_chooser );
438+ final ActionBar actionBar = getSupportActionBar ();
436439
437440 if (resources .getConfiguration ().orientation == Configuration .ORIENTATION_PORTRAIT ) {
438441 //setContentView(R.layout.activity_folder_chooser_vertical);
439- Log .d (TAG , "ORIENTATION_PORTRAIT " + action );
442+ Log .d (TAG , "ORIENTATION_PORTRAIT " ); // + action + ", " + getTheme() + ", " + actionBar );
440443 } else {
441444 //setContentView(R.layout.activity_folder_chooser);
442- Log .d (TAG , "ORIENTATION_LANDSCAPE " + action );
445+ Log .d (TAG , "ORIENTATION_LANDSCAPE " ); // + action + ", " + getTheme() + ", " + actionBar );
443446 }
444447
445448 final FragmentManager supportFragmentManager = getSupportFragmentManager ();
@@ -501,20 +504,22 @@ public void onCreate(final Bundle savedInstanceState) {
501504 imageView .setLayoutParams (new AbsListView .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , ViewGroup .LayoutParams .WRAP_CONTENT ));
502505 mDrawerList .addHeaderView (imageView );
503506
504- if (Intent .ACTION_MAIN .equals (action ) || Intent .ACTION_VIEW .equals (action )) {
505- findViewById (R .id .buttons ).setVisibility (View .GONE );
506- }
507+ // if (Intent.ACTION_MAIN.equals(action) || Intent.ACTION_VIEW.equals(action)) {
508+ // // findViewById(R.id.buttons).setVisibility(View.GONE);
509+ // }
507510
508511 if (actionBar != null ) {
509512 if (Intent .ACTION_MAIN .equals (action )) {
510513 actionBar .hide ();
511514 } else {
512- actionBar .setNavigationMode (ActionBar .NAVIGATION_MODE_TABS );
513- actionBar .setDisplayOptions (0 , ActionBar .DISPLAY_SHOW_TITLE );
514- actionBar .setDisplayShowTitleEnabled (false );
515+ // actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
516+ // actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
517+ actionBar .setDisplayShowTitleEnabled (true );
515518 actionBar .setDisplayHomeAsUpEnabled (true );
516- actionBar .setHomeButtonEnabled (true );
517- setTitle ("File/Folder chooser" );
519+ //actionBar.setHomeButtonEnabled(true);
520+ final View customView = getLayoutInflater ().inflate (R .layout .filechoosertoolbar , null );
521+ actionBar .setCustomView (customView );
522+ actionBar .setDisplayShowCustomEnabled (true );
518523 actionBar .show ();
519524 }
520525 }
@@ -549,13 +554,17 @@ public void onCreate(final Bundle savedInstanceState) {
549554 if (suffix .length () == 0 ) {
550555 suffix = ".*" ;
551556 }
552- } else if (Intent .ACTION_GET_CONTENT .equals (action ) && !intent .getBooleanExtra (Intent .EXTRA_ALLOW_MULTIPLE , true )) {
553- multiFiles = false ;
554- if (suffix .length () == 0 ) {
557+ } else if (Intent .ACTION_GET_CONTENT .equals (action )) {
558+ if (!intent .getBooleanExtra (Intent .EXTRA_ALLOW_MULTIPLE , true )) {
559+ multiFiles = false ;
560+ if (suffix .length () == 0 ) {
561+ suffix = ".*" ;
562+ }
563+ } else {
555564 suffix = ".*" ;
556565 }
557566 } else {
558- suffix = ". *" ;
567+ suffix = "*" ;
559568 }
560569 previousSelectedStr = intent .getStringArrayExtra (Constants .PREVIOUS_SELECTED_FILES );
561570 Log .d (TAG , "previousSelectedStr " + Util .arrayToString (previousSelectedStr , true , "\n " ));
@@ -2448,7 +2457,7 @@ private void updateColor() {
24482457
24492458 setTheme (mCurTheme );
24502459 window .getDecorView ().setBackgroundColor (Constants .BASE_BACKGROUND );
2451- findViewById (R .id .buttons ).setBackgroundColor (Constants .BASE_BACKGROUND );
2460+ // findViewById(R.id.buttons).setBackgroundColor(Constants.BASE_BACKGROUND);
24522461
24532462 if (configurationChanged ) {
24542463 configurationChanged = false ;
@@ -2896,9 +2905,7 @@ public void ok(View view) {
28962905 intent .putStringArrayListExtra (Constants .PREVIOUS_SELECTED_FILES , fileArr );
28972906 intent .putExtra (Constants .EXTRA_MULTI_SELECT , multiFiles );
28982907 final int size = fileArr .size ();
2899- if (size == 1 ) {
2900- intent .setData (FileProvider .getUriForFile (this , "net.gnu.explorer.fileprovider" , new File (fileArr .get (0 ))));
2901- } else if (size > 1 ) {
2908+ if (size > 1 ) {
29022909 final ClipData clipData = ClipData .newRawUri (
29032910 "" , FileProvider .getUriForFile (this , "net.gnu.explorer.fileprovider" , new File (fileArr .get (0 ))));
29042911 for (int i = 1 ; i < size ; i ++) {
0 commit comments