move initial showSystemUi call to loadPdf

The reasoning for calling showSystemUi() in the onCreate method
before was to make the transitions for immersive mode more smooth.
However, it's only needed when the PDF has actually loaded, i.e. when
the immersive mode makes sense to use.

Before, Snackbars were partially covered by the navigation UI due to the
showSystemUi() setting the View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
flag. Moving it so that the function is only called when a PDF is loaded
fixes this issue.
This commit is contained in:
inthewaves 2020-08-24 21:58:59 -07:00 committed by Daniel Micay
parent f3d322ddc1
commit 42de305b7c

View File

@ -29,15 +29,15 @@ import androidx.loader.content.Loader;
import com.google.android.material.snackbar.Snackbar;
import org.grapheneos.pdfviewer.fragment.DocumentPropertiesFragment;
import org.grapheneos.pdfviewer.fragment.JumpToPageFragment;
import org.grapheneos.pdfviewer.loader.DocumentPropertiesLoader;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import org.grapheneos.pdfviewer.fragment.DocumentPropertiesFragment;
import org.grapheneos.pdfviewer.fragment.JumpToPageFragment;
import org.grapheneos.pdfviewer.loader.DocumentPropertiesLoader;
public class PdfViewer extends AppCompatActivity implements LoaderManager.LoaderCallbacks<List<CharSequence>> {
public static final String TAG = "PdfViewer";
@ -234,8 +234,6 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
}
});
showSystemUi();
GestureHelper.attach(PdfViewer.this, mWebView,
new GestureHelper.GestureListener() {
@Override
@ -338,6 +336,8 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
snackbar.setText(R.string.io_error).show();
return;
}
showSystemUi();
mWebView.loadUrl("https://localhost/viewer.html");
}