Search in sources :

Example 1 with PdfSurfaceView

use of org.ebookdroid.ui.viewer.viewers.PdfSurfaceView in project LibreraReader by foobnix.

the class VerticalViewActivity method onCreate.

/**
 * Called when the activity is first created.
 */
@Override
public void onCreate(final Bundle savedInstanceState) {
    intetrstialTimeoutSec = ADS.FULL_SCREEN_TIMEOUT_SEC;
    DocumentController.doRotation(this);
    AppState.get().load(this);
    FileMetaCore.checkOrCreateMetaInfo(this);
    if (AppState.get().isRememberMode && AppState.get().isAlwaysOpenAsMagazine) {
        super.onCreate(savedInstanceState);
        if (AppState.get().isDayNotInvert) {
            setTheme(R.style.StyledIndicatorsWhite);
        } else {
            setTheme(R.style.StyledIndicatorsBlack);
        }
        finish();
        ExtUtils.showDocumentInner(this, getIntent().getData(), getIntent().getIntExtra(DocumentController.EXTRA_PAGE, 0));
        return;
    } else {
        if (getIntent().getData() != null) {
            String path = getIntent().getData().getPath();
            final BookSettings bs = SettingsManager.getBookSettings(path);
            // AppState.get().setNextScreen(bs.isNextScreen);
            if (bs != null) {
                // AppState.get().isLocked = bs.isLocked;
                AppState.get().autoScrollSpeed = bs.speed;
                AppState.get().isCut = bs.isTextFormat() ? false : bs.splitPages;
                AppState.get().isCrop = bs.cropPages;
                AppState.get().isDouble = false;
                AppState.get().isDoubleCoverAlone = false;
                AppState.get().isLocked = bs.isLocked;
                TempHolder.get().pageDelta = bs.pageDelta;
                if (AppState.get().isCropPDF && !bs.isTextFormat()) {
                    AppState.get().isCrop = true;
                }
            }
            BookCSS.get().detectLang(path);
        }
        getController().beforeCreate(this);
        BrightnessHelper.applyBrigtness(this);
        if (AppState.get().isDayNotInvert) {
            setTheme(R.style.StyledIndicatorsWhite);
        } else {
            setTheme(R.style.StyledIndicatorsBlack);
        }
        super.onCreate(savedInstanceState);
    }
    if (PasswordDialog.isNeedPasswordDialog(this)) {
        return;
    }
    setContentView(R.layout.activity_vertical_view);
    Android6.checkPermissions(this);
    getController().createWrapper(this);
    frameLayout = (FrameLayout) findViewById(R.id.documentView);
    view = new PdfSurfaceView(getController());
    frameLayout.addView(view.getView());
    getController().afterCreate(this);
    // ADS.activate(this, adView);
    handler = new Handler();
    getController().onBookLoaded(new Runnable() {

        @Override
        public void run() {
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    isInitPosistion = Dips.screenHeight() > Dips.screenWidth();
                    isInitOrientation = AppState.get().orientation;
                }
            }, 1000);
        }
    });
}
Also used : PdfSurfaceView(org.ebookdroid.ui.viewer.viewers.PdfSurfaceView) BookSettings(org.ebookdroid.common.settings.books.BookSettings) Handler(android.os.Handler)

Aggregations

Handler (android.os.Handler)1 BookSettings (org.ebookdroid.common.settings.books.BookSettings)1 PdfSurfaceView (org.ebookdroid.ui.viewer.viewers.PdfSurfaceView)1