@@ -166,7 +166,8 @@ public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater)
166166
167167 // the other menu items are dynamically enabled based on the loaded document
168168 if (lastResult != null ) {
169- prepareMenu (lastResult .loaderType );
169+ // TODO
170+ toggleDocumentMenu (true , true );
170171 }
171172 }
172173
@@ -361,25 +362,6 @@ private boolean isActivityReadyForResult(FileLoader.Result result) {
361362 return true ;
362363 }
363364
364- private void prepareMenu (FileLoader .LoaderType loaderType ) {
365- boolean isEditEnabled = false ;
366- boolean isDarkModeSupported = true ;
367-
368- switch (loaderType ) {
369- case CORE :
370- isEditEnabled = true ;
371- break ;
372- case PDF2HTMLEX :
373- isDarkModeSupported = false ;
374- break ;
375- default :
376- break ;
377- }
378-
379- toggleDocumentMenu (true , isEditEnabled );
380- pageView .toggleDarkMode (isDarkModeSupported );
381- }
382-
383365 @ Override
384366 public void onLoadSuccess (FileLoader .Result result ) {
385367 if (!isActivityReadyForResult (result )) {
@@ -420,7 +402,7 @@ public void onLoadSuccess(FileLoader.Result result) {
420402
421403 if (result .loaderType == FileLoader .LoaderType .RAW || result .loaderType == FileLoader .LoaderType .ONLINE ) {
422404 offerReopen (activity , options , R .string .toast_hint_unsupported_file , false );
423- } else if (result .loaderType == FileLoader .LoaderType .CORE || result .loaderType == FileLoader .LoaderType .WVWARE || result . loaderType == FileLoader . LoaderType . PDF2HTMLEX ) {
405+ } else if (result .loaderType == FileLoader .LoaderType .CORE || result .loaderType == FileLoader .LoaderType .WVWARE ) {
424406 offerUpload (activity , options , false );
425407 }
426408
@@ -486,25 +468,18 @@ public void onEncrypted(FileLoader.Result result) {
486468 builder .setView (input );
487469
488470 builder .setPositiveButton (getString (android .R .string .ok ),
489- new DialogInterface .OnClickListener () {
471+ (dialog , whichButton ) -> {
472+ options .password = input .getText ().toString ();
490473
491- @ Override
492- public void onClick (DialogInterface dialog ,
493- int whichButton ) {
494- options .password = input .getText ().toString ();
495-
496- // close dialog before progress is shown again
497- dialog .dismiss ();
498-
499- if (result .loaderType == FileLoader .LoaderType .CORE ) {
500- loadWithType (FileLoader .LoaderType .CORE , options );
501- } else if (result .loaderType == FileLoader .LoaderType .WVWARE ) {
502- loadWithType (FileLoader .LoaderType .WVWARE , options );
503- } else if (result .loaderType == FileLoader .LoaderType .PDF2HTMLEX ) {
504- loadWithType (FileLoader .LoaderType .PDF2HTMLEX , options );
505- } else {
506- throw new RuntimeException ("encryption not supported for type: " + result .loaderType );
507- }
474+ // close dialog before progress is shown again
475+ dialog .dismiss ();
476+
477+ if (result .loaderType == FileLoader .LoaderType .CORE ) {
478+ loadWithType (FileLoader .LoaderType .CORE , options );
479+ } else if (result .loaderType == FileLoader .LoaderType .WVWARE ) {
480+ loadWithType (FileLoader .LoaderType .WVWARE , options );
481+ } else {
482+ throw new RuntimeException ("encryption not supported for type: " + result .loaderType );
508483 }
509484 });
510485 builder .setNegativeButton (getString (android .R .string .cancel ), null );
@@ -529,7 +504,7 @@ public void onUnsupported(FileLoader.Result result) {
529504 } else {
530505 offerReopen (activity , options , R .string .toast_error_illegal_file_reopen , true );
531506 }
532- } else if (result .loaderType == FileLoader .LoaderType .PDF2HTMLEX || result . loaderType == FileLoader . LoaderType . WVWARE ) {
507+ } else if (result .loaderType == FileLoader .LoaderType .WVWARE ) {
533508 offerUpload (activity , options , true );
534509 } else if (result .loaderType == FileLoader .LoaderType .ONLINE ) {
535510 offerReopen (activity , options , R .string .toast_error_illegal_file_reopen , true );
0 commit comments