Skip to content

Commit 28e9ffa

Browse files
committed
Added fullscreen
1 parent e85166e commit 28e9ffa

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Not Released
22

3+
# 0.1.4
4+
> 2020-07-21
5+
- Added fullscreen
6+
37
# 0.1.3
48
> 2020-07-21
59
- Removed unused dependencies

app/src/main/java/net/kuama/documentscanner/presentation/BaseScannerActivity.kt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package net.kuama.documentscanner.presentation
33
import android.os.Bundle
44
import android.util.Log
55
import android.view.View
6+
import android.view.Window
67
import android.view.WindowManager
78
import android.widget.SeekBar
89
import androidx.activity.viewModels
@@ -20,8 +21,15 @@ abstract class BaseScannerActivity : AppCompatActivity() {
2021

2122
override fun onCreate(savedInstanceState: Bundle?) {
2223
super.onCreate(savedInstanceState)
23-
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
24-
24+
window.decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE
25+
// Set the content to appear under the system bars so that the
26+
// content doesn't resize when the system bars hide and show.
27+
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
28+
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
29+
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
30+
// Hide the nav bar and status bar
31+
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
32+
or View.SYSTEM_UI_FLAG_FULLSCREEN)
2533
setContentView(R.layout.activity_scanner)
2634
val viewModel: ScannerViewModel by viewModels()
2735
viewModel.isBusy.observe(this, Observer { isBusy ->
@@ -84,11 +92,11 @@ abstract class BaseScannerActivity : AppCompatActivity() {
8492
}
8593

8694
closePreview.setOnClickListener {
87-
previewWrap.visibility = View.GONE
88-
viewModel.onClosePreview()
95+
closePreview()
8996
}
9097

9198
confirmDocument.setOnClickListener {
99+
previewWrap.visibility = View.GONE
92100
onDocumentAccepted(viewModel.documentPath!!)
93101
}
94102

@@ -113,6 +121,11 @@ abstract class BaseScannerActivity : AppCompatActivity() {
113121
viewModel.onViewCreated(Loader(this), this, viewFinder)
114122
}
115123

124+
public fun closePreview() {
125+
previewWrap.visibility = View.GONE
126+
viewModel.onClosePreview()
127+
}
128+
116129
abstract fun onError(throwable: Throwable)
117130
abstract fun onDocumentAccepted(path: String)
118131
abstract fun onClose()

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ android.useAndroidX=true
1919
android.enableJetifier=true
2020
# Kotlin code style for this project: "official" or "obsolete":
2121
kotlin.code.style=official
22-
version_code=4
23-
version_name=0.1.3
22+
version_code=5
23+
version_name=0.1.4

0 commit comments

Comments
 (0)