Skip to content

Commit

Permalink
Adds full screen mode on Pdf Screen. Closes #140
Browse files Browse the repository at this point in the history
Upping versionCode to 84
  • Loading branch information
Dima-Android committed Jul 24, 2024
1 parent d87f2b3 commit ce38c78
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions app/src/main/java/org/zotero/android/pdf/reader/PdfReaderScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.Lifecycle
import org.zotero.android.architecture.ui.CustomLayoutSize
Expand Down Expand Up @@ -64,6 +66,16 @@ internal fun PdfReaderScreen(
}
}
CustomThemeWithStatusAndNavBars(isDarkTheme = viewState.isDark) {
val window = activity.window
val decorView = window.decorView
val systemBars = WindowInsetsCompat.Type.systemBars()
val insetsController = WindowCompat.getInsetsController(window, decorView)
if (viewState.isTopBarVisible) {
insetsController.show(systemBars)
} else {
insetsController.hide(systemBars)
}

val params = viewModel.screenArgs
val uri = params.uri
val lazyListState = rememberLazyListState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import android.transition.TransitionManager
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isVisible
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.commit
Expand Down Expand Up @@ -1612,6 +1614,12 @@ class PdfReaderViewModel @Inject constructor(
this.document.annotationProvider.removeAnnotationFromPage(it)
}
submitPendingPage(fragment.pageIndex)
val activity = fragment.activity
if (activity != null) {
WindowCompat.getInsetsController(activity.window, activity.window.decorView).show(
WindowInsetsCompat.Type.systemBars()
)
}
super.onCleared()
}

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/BuildConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ object BuildConfig {
const val compileSdkVersion = 34
const val targetSdk = 34

val versionCode = 83 // Must be updated on every build
val versionCode = 84 // Must be updated on every build
val version = Version(
major = 1,
minor = 0,
Expand Down

0 comments on commit ce38c78

Please sign in to comment.