Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

issue #61 update target sdk and use android O TYPE_APPLICATION_OVERLAY #62

Merged
merged 3 commits into from
Aug 30, 2017
Merged
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ android:
components:
- tools
- platform-tools
- build-tools-25.0.1
- android-25
- build-tools-26.0.1
- android-26
- extra-android-m2repository
script:
- "./gradlew clean assembleDebug testDebug --stacktrace"
Expand Down
14 changes: 10 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath "com.android.tools.build:gradle:2.2.3"
Expand All @@ -16,21 +19,24 @@ allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com'
}
}
}

// Variables for entire project
ext {
// SDK versions
minSdkVersion = 16
targetSdkVersion = 25
compileSdkVersion = 25
buildToolsVersion = "25.0.1"
targetSdkVersion = 26
compileSdkVersion = 26
buildToolsVersion = "26.0.1"
sourceCompatibilityVersion = JavaVersion.VERSION_1_7
targetCompatibilityVersion = JavaVersion.VERSION_1_7

// Common versions
supportLibraryVersion = "25.0.1"
supportLibraryVersion = "26.0.0"
butterKnifeVersion = "7.0.1"
daggerVersion = "2.8"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.codemonkeylabs.fpslibrary.ui;

import android.os.Build;
import android.view.WindowManager;

public final class PermissionCompat {

private PermissionCompat() {
}

public static int getFlag() {
int permissionFlag;
if(android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
permissionFlag = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else {
permissionFlag = WindowManager.LayoutParams.TYPE_PHONE;
}
return permissionFlag;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ public TinyCoach(Application context, FPSConfig config) {

private void addViewToWindow(View view) {

int permissionFlag = PermissionCompat.getFlag();

WindowManager.LayoutParams paramsF = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
permissionFlag,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);

Expand Down