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

Commit

Permalink
Add Jitpack
Browse files Browse the repository at this point in the history
  • Loading branch information
amyu committed Jul 31, 2015
1 parent a180233 commit 8b3920f
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 24 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.gradle
/local.properties
.DS_Store
/build
/captures
/.idea
*.iml
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# FloatingView
このAndroidプロジェクトは、チャットや何らかの情報を前面に表示するためのViewです
AndroidのAPI 14以降に対応しています
The Android project is View to display information such as chat in front
To API Level 14 or later are supported

##Screenshots
![](./screenshot/ss01.png) 
![](./screenshot/ss02.png) 
![](./screenshot/ss03.png)


動作の詳細はYouTubeの動画を確認してください
*Watch YouTube video*
[SimpleFloating](http://youtu.be/nb8M2p0agF4)
[FloatingAd](http://youtu.be/PmvbQzxSBU0)

Expand All @@ -17,60 +17,71 @@ Target Sdk Version : 22
Min Sdk Version : 14

##How to use
1) FloatingViewを使用したいプロジェクトに本プロジェクトのlibraryを追加します
1) Add this to your **build.gradle**.
```java
repositories {
maven {
url "https://jitpack.io"
}
}

dependencies {
compile 'com.github.recruit-lifestyle:FloatingView:1.0'
}
```

2) FloatingViewを表示するためのServiceを定義します
2) Implement Service for displaying FloatingView
```java
public class ChatHeadService extends Service {
・・・
}
```

3) FloatingViewに表示するViewの設定を行います(サンプルではonStartCommandで行っています)
3) You will do the setting of the View to be displayed in the FloatingView(Sample have a set in onStartCommand)
```java
final LayoutInflater inflater = LayoutInflater.from(this);
final ImageView iconView = (ImageView) inflater.inflate(R.layout.widget_chathead, null, false);
iconView.setOnClickListener(・・・);
```

4) FloatingViewManagerを使用して、FloatingViewの設定を行います
4) Use the FloatingViewManager, make the setting of FloatingView
```java
mFloatingViewManager = new FloatingViewManager(this, this);
mFloatingViewManager.setFixedTrashIconImage(R.drawable.ic_trash_fixed);
mFloatingViewManager.setActionTrashIconImage(R.drawable.ic_trash_action);
mFloatingViewManager.addViewToWindow(iconView, FloatingViewManager.SHAPE_CIRCLE, (int) (16 * metrics.density));
```

なお、FloatingViewManagerの第2引数はFloatingViewListenerです
The second argument of FloatingViewManager is FloatingViewListener

これは、FloatingViewを終了する際に呼び出される処理(onFinishFloatingView)を記述します
Describe the process (onFinishFloatingView) that is called when you exit the FloatingView
```java
@Override
public void onFinishFloatingView() {
stopSelf();
}
```

5) AndroidManifestにパーミッションを追加します
5) Add the permission to AndroidManifest
```xml
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.VIBRATE"/>
```

6) AndroidManifestにServiceを定義します
)
6) Define the Service to AndroidManifest
example)
```java
<application ・・・>
・・・
<!-- デモ表示サービス -->
<!-- Demo -->
<service
android:name="jp.co.recruit_lifestyle.sample.service.ChatHeadService"
android:exported="false"/>
・・・
</application>
```

7) Serviceを開始する処理を記述します(以下はFragmentの例)
7) Describe the process to start the Service (example of Fragment)
```java
final Activity activity = getActivity();
activity.startService(new Intent(activity, ChatHeadService.class));
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'

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
}
}

allprojects {
repositories {
maven { url "https://jitpack.io" }
jcenter()
}
}
Expand Down
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 @@
#Wed Apr 10 15:27:10 PDT 2013
#Fri Jul 31 17:33:25 JST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
32 changes: 25 additions & 7 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

android {
compileSdkVersion rootProject.ext.compileSdkVersion as Integer
Expand All @@ -10,15 +11,32 @@ android {
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}

// build a jar with source files
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

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

// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
}

0 comments on commit 8b3920f

Please sign in to comment.