Skip to content

Commit 56caab9

Browse files
committed
1 parent cd8a93d commit 56caab9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

textoverlay/src/main/java/saschpe/android/textoverlay/service/TextOverlayService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,17 @@ public void onCreate() {
9292
textView.setTextColor(ContextCompat.getColor(this, colorId));
9393
textView.setText(lastUsedOverlayText);
9494

95+
int type;
96+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
97+
type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
98+
} else {
99+
type = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
100+
}
101+
95102
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
96103
WindowManager.LayoutParams.WRAP_CONTENT,
97104
WindowManager.LayoutParams.WRAP_CONTENT,
98-
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
105+
type,
99106
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
100107
WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
101108
PixelFormat.TRANSLUCENT);

0 commit comments

Comments
 (0)