Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix - Document Scan Layout #14415

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions appscan/src/main/java/com/nextcloud/appscan/AppScanActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.view.View
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding
import com.zynksoftware.documentscanner.ScanActivity
import com.zynksoftware.documentscanner.model.DocumentScannerErrorModel
import com.zynksoftware.documentscanner.model.ScannerResults
Expand All @@ -20,10 +24,30 @@ import com.zynksoftware.documentscanner.ui.DocumentScanner
class AppScanActivity : ScanActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
addSystemBarPaddings()
DocumentScanner.init(this)
addFragmentContentLayout()
}

private fun addSystemBarPaddings() {
if (window == null) {
return
}

ViewCompat.setOnApplyWindowInsetsListener(window.decorView) { v: View, insets: WindowInsetsCompat ->
val bars = insets.getInsets(WindowInsetsCompat.Type.systemBars())

v.updatePadding(
left = bars.left,
top = bars.top,
right = bars.right,
bottom = bars.bottom
)

WindowInsetsCompat.CONSUMED
}
}

override fun onError(error: DocumentScannerErrorModel) {
// TODO pass this from app somehow?
println(error)
Expand Down
Loading