Skip to content
This repository was archived by the owner on Feb 3, 2020. It is now read-only.

Commit f549e30

Browse files
Merge pull request #94 from recruit-lifestyle/develop
Ver 2.4.0
2 parents 9d13cf3 + 0c7b987 commit f549e30

File tree

15 files changed

+376
-114
lines changed

15 files changed

+376
-114
lines changed

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FloatingView
22
The Android project is View to display information such as chat in front.
3-
To API Level 14 or later are supported
3+
To API Level 14 or higher are supported
44

55
## Screenshots
66
![](./screenshot/animation.gif)
@@ -12,7 +12,7 @@ To API Level 14 or later are supported
1212
[SimpleFloating](http://youtu.be/nb8M2p0agF4)
1313

1414
## Requirements
15-
Target Sdk Version : 27
15+
Target Sdk Version : 28
1616
Min Sdk Version : 14
1717

1818
## How to use
@@ -66,6 +66,7 @@ Describe the process (`onFinishFloatingView`) that is called when you exit the F
6666
5) Add the permission to AndroidManifest
6767
```xml
6868
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
69+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
6970
```
7071

7172
6) Define the Service to AndroidManifest
@@ -83,11 +84,27 @@ example)
8384
```
8485

8586
7) Describe the process to start the Service (run on foreground)
87+
88+
89+
example)
90+
91+
- FloatingViewControlFragment.java
92+
8693
```java
8794
final Intent intent = new Intent(activity, ChatHeadService.class);
8895
ContextCompat.startForegroundService(activity, intent);
8996
```
9097

98+
- ChatHeadService.java
99+
100+
```java
101+
public int onStartCommand(Intent intent, int flags, int startId) {
102+
...
103+
startForeground(NOTIFICATION_ID, createNotification(this));
104+
...
105+
}
106+
```
107+
91108
8) Create notification channel (targetSdkVersion >= 26)
92109

93110
example)
@@ -104,6 +121,29 @@ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
104121

105122
```
106123

124+
9) Add DisplayCutout process(API Level >= 28)
125+
126+
Call `FloatingViewManager.findCutoutSafeArea(activity)`.
127+
Note: Activity must be portrait oriented.
128+
Note: You must not set `windowLayoutInDisplayCutoutMode` to `never`.
129+
130+
example)
131+
132+
- FloatingViewControlFragment.java
133+
134+
```java
135+
final Intent intent = new Intent(activity, ChatHeadService.class);
136+
intent.putExtra(ChatHeadService.EXTRA_CUTOUT_SAFE_AREA, FloatingViewManager.findCutoutSafeArea(activity));
137+
ContextCompat.startForegroundService(activity, intent);
138+
```
139+
140+
- ChatHeadService.java
141+
142+
```java
143+
mFloatingViewManager.setSafeInsetRect((Rect) intent.getParcelableExtra(EXTRA_CUTOUT_SAFE_AREA));
144+
```
145+
146+
107147
## Static Options
108148
It can be set only when displaying for the first time
109149

build.gradle

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
google()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.2'
9+
classpath 'com.android.tools.build:gradle:3.2.0'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
1111
// NOTE: Do not place your application dependencies here; they belong
1212
// in the individual module build.gradle files
@@ -19,11 +19,4 @@ allprojects {
1919
jcenter()
2020
google()
2121
}
22-
}
23-
24-
ext {
25-
compileSdkVersion = 27
26-
buildToolsVersion = '27.0.3'
27-
targetSdkVersion = 27
28-
minSdkVersion = 14
29-
}
22+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon May 07 16:30:08 JST 2018
1+
#Fri Sep 14 15:32:46 JST 2018
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip

library/build.gradle

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion rootProject.ext.compileSdkVersion as Integer
5-
buildToolsVersion rootProject.ext.buildToolsVersion as String
6-
4+
compileSdkVersion 28
75
defaultConfig {
8-
minSdkVersion rootProject.ext.minSdkVersion as Integer
9-
targetSdkVersion rootProject.ext.targetSdkVersion as Integer
6+
minSdkVersion 14
7+
targetSdkVersion 28
108
versionCode 1
119
versionName "1.0"
1210
}
1311
}
1412

1513
dependencies {
16-
implementation 'com.android.support:support-annotations:27.1.1'
17-
implementation 'com.android.support:support-compat:27.1.1'
18-
implementation 'com.android.support:support-dynamic-animation:27.1.1'
14+
implementation 'com.android.support:support-annotations:28.0.0'
15+
implementation 'com.android.support:support-compat:28.0.0'
16+
implementation 'com.android.support:support-dynamic-animation:28.0.0'
1917
}
2018

2119
// build a jar with source files
@@ -25,7 +23,7 @@ task sourcesJar(type: Jar) {
2523
}
2624

2725
task javadoc(type: Javadoc) {
28-
failOnError false
26+
failOnError false
2927
source = android.sourceSets.main.java.sourceFiles
3028
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
3129
}

0 commit comments

Comments
 (0)