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

fix wrong overlay height in case immersive mode #151

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ dependencies {

}

task print_git_tag_command << {
def gradleProps = getGradleProperties()
println "git tag -a v" + gradleProps['VERSION_NAME'] + " -m \"VERSION_CODE=" + gradleProps['VERSION_CODE'] + ", VERSION_NAME=" + gradleProps['VERSION_NAME'] + "\""
println "git push --tags"
}
//task print_git_tag_command << {
// def gradleProps = getGradleProperties()
// println "git tag -a v" + gradleProps['VERSION_NAME'] + " -m \"VERSION_CODE=" + gradleProps['VERSION_CODE'] + ", VERSION_NAME=" + gradleProps['VERSION_NAME'] + "\""
// println "git push --tags"
//}

19 changes: 19 additions & 0 deletions app/src/main/java/tourguide/tourguidedemo/BasicActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.graphics.Color
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.Gravity
import android.view.View
import android.view.Window
import kotlinx.android.synthetic.main.activity_basic.*
import tourguide.tourguide.TourGuide

Expand All @@ -16,6 +18,8 @@ class BasicActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_basic)

window.hideSystemUI()

// the return handler is used to manipulate the cleanup of all the tutorial elements
val tourGuide = TourGuide.create(this) {
technique = TourGuide.Technique.CLICK
Expand Down Expand Up @@ -49,6 +53,21 @@ class BasicActivity : AppCompatActivity() {
button2.setOnClickListener { handler.playOn(button1) }
}

fun Window.hideSystemUI() {
// Enables regular immersive mode.
// For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE.
// Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY
decorView.systemUiVisibility = (View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
// Set the content to appear under the system bars so that the
// content doesn't resize when the system bars hide and show.
or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
// Hide the nav bar and status bar
or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
or View.SYSTEM_UI_FLAG_FULLSCREEN)
}

companion object {
const val COLOR_DEMO = "color_demo"
const val GRAVITY_DEMO = "gravity_demo"
Expand Down
14 changes: 4 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = '1.2.30'
kotlin_version = '1.6.10'
espressoVersion = '2.2.2'
supportVersion = '25.4.0'
compileSdkVersionNum = 26
minSdkVersionNum = 11
targetSdkVersionNum = 26
buildToolVersionNum = '26.0.2'
gradlePluginVersion = '3.0.1'
gradlePluginVersion = '4.2.2'
}
dependencies {
repositories {
Expand All @@ -20,20 +20,14 @@ buildscript {
}
repositories {
mavenCentral()
maven {
url "https://maven.google.com/"
name "Google"
}
google()
}
}

allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://maven.google.com/"
name "Google"
}
jcenter()
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ open class FrameLayoutWithHole @JvmOverloads constructor(private val mActivity:
size.x = mActivity.resources.displayMetrics.widthPixels
size.y = mActivity.resources.displayMetrics.heightPixels

mEraserBitmap = Bitmap.createBitmap(size.x, size.y, Bitmap.Config.ARGB_8888)
_eraserCanvas = Canvas(mEraserBitmap!!)

mPaint = Paint().apply { color = -0x34000000 }
transparentPaint = Paint().apply {
color = ContextCompat.getColor(context, android.R.color.transparent)
Expand All @@ -90,6 +87,12 @@ open class FrameLayoutWithHole @JvmOverloads constructor(private val mActivity:
}
}

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
mEraserBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)
_eraserCanvas = Canvas(mEraserBitmap!!)
}

fun setViewHole(viewHole: View) {
this.mViewHole = viewHole
enforceMotionType()
Expand Down