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

Commit

Permalink
Merge pull request #94 from recruit-lifestyle/develop
Browse files Browse the repository at this point in the history
Ver 2.4.0
  • Loading branch information
YoshihideSogawa authored Oct 15, 2018
2 parents 9d13cf3 + 0c7b987 commit f549e30
Show file tree
Hide file tree
Showing 15 changed files with 376 additions and 114 deletions.
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FloatingView
The Android project is View to display information such as chat in front.
To API Level 14 or later are supported
To API Level 14 or higher are supported

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

## Requirements
Target Sdk Version : 27
Target Sdk Version : 28
Min Sdk Version : 14

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

6) Define the Service to AndroidManifest
Expand All @@ -83,11 +84,27 @@ example)
```

7) Describe the process to start the Service (run on foreground)


example)

- FloatingViewControlFragment.java

```java
final Intent intent = new Intent(activity, ChatHeadService.class);
ContextCompat.startForegroundService(activity, intent);
```

- ChatHeadService.java

```java
public int onStartCommand(Intent intent, int flags, int startId) {
...
startForeground(NOTIFICATION_ID, createNotification(this));
...
}
```

8) Create notification channel (targetSdkVersion >= 26)

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

```

9) Add DisplayCutout process(API Level >= 28)

Call `FloatingViewManager.findCutoutSafeArea(activity)`.
Note: Activity must be portrait oriented.
Note: You must not set `windowLayoutInDisplayCutoutMode` to `never`.

example)

- FloatingViewControlFragment.java

```java
final Intent intent = new Intent(activity, ChatHeadService.class);
intent.putExtra(ChatHeadService.EXTRA_CUTOUT_SAFE_AREA, FloatingViewManager.findCutoutSafeArea(activity));
ContextCompat.startForegroundService(activity, intent);
```

- ChatHeadService.java

```java
mFloatingViewManager.setSafeInsetRect((Rect) intent.getParcelableExtra(EXTRA_CUTOUT_SAFE_AREA));
```


## Static Options
It can be set only when displaying for the first time

Expand Down
11 changes: 2 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -19,11 +19,4 @@ allprojects {
jcenter()
google()
}
}

ext {
compileSdkVersion = 27
buildToolsVersion = '27.0.3'
targetSdkVersion = 27
minSdkVersion = 14
}
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon May 07 16:30:08 JST 2018
#Fri Sep 14 15:32:46 JST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
16 changes: 7 additions & 9 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion rootProject.ext.compileSdkVersion as Integer
buildToolsVersion rootProject.ext.buildToolsVersion as String

compileSdkVersion 28
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion as Integer
targetSdkVersion rootProject.ext.targetSdkVersion as Integer
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
}

dependencies {
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:support-compat:27.1.1'
implementation 'com.android.support:support-dynamic-animation:27.1.1'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
implementation 'com.android.support:support-dynamic-animation:28.0.0'
}

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

task javadoc(type: Javadoc) {
failOnError false
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
Expand Down
Loading

0 comments on commit f549e30

Please sign in to comment.