├── .gitignore
├── LICENSE
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── io
│ │ └── github
│ │ └── vickychijwani
│ │ └── bubblenote
│ │ ├── BubbleNoteActivity.java
│ │ ├── BubbleNoteService.java
│ │ └── Utils.java
│ └── res
│ ├── drawable-hdpi
│ └── ic_launcher.png
│ ├── drawable-mdpi
│ └── ic_launcher.png
│ ├── drawable-xhdpi
│ └── ic_launcher.png
│ ├── drawable-xxhdpi
│ └── ic_launcher.png
│ ├── layout
│ ├── activity_bubble_note.xml
│ └── bubble.xml
│ └── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/*
4 | .DS_Store
5 | /build
6 | **/*.iml
7 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Vicky Chijwani
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vickychijwani/BubbleNote/7a6723f9b30cd77815728c3618e74193317a7c13/README.md
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 19
5 | buildToolsVersion "20.0.0"
6 |
7 | defaultConfig {
8 | applicationId "io.github.vickychijwani.bubblenote"
9 | minSdkVersion 14
10 | targetSdkVersion 19
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 |
15 | signingConfigs {
16 | release {
17 | storeFile file(System.getenv("KEYSTORE"))
18 | storePassword System.getenv("KEYSTORE_PASSWORD")
19 | keyAlias System.getenv("KEY_ALIAS")
20 | keyPassword System.getenv("KEY_PASSWORD")
21 | }
22 | }
23 |
24 | buildTypes {
25 | release {
26 | signingConfig signingConfigs.release
27 | runProguard true
28 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
29 | }
30 | }
31 | }
32 |
33 | dependencies {
34 | compile 'com.facebook.rebound:rebound:0.3.4'
35 | compile fileTree(dir: 'libs', include: ['*.jar'])
36 | }
37 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /opt/android-studio/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/vickychijwani/bubblenote/BubbleNoteActivity.java:
--------------------------------------------------------------------------------
1 | package io.github.vickychijwani.bubblenote;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.SeekBar;
9 |
10 | public class BubbleNoteActivity extends Activity implements SeekBar.OnSeekBarChangeListener {
11 |
12 | public static final String TAG = "BubbleNoteActivity";
13 |
14 | private Button mShowChatHead;
15 | private SeekBar mSpringTensionSlider;
16 | private SeekBar mSpringFrictionSlider;
17 |
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | setContentView(R.layout.activity_bubble_note);
22 |
23 | mShowChatHead = (Button) findViewById(R.id.show_bubble);
24 | mSpringTensionSlider = (SeekBar) findViewById(R.id.spring_tension);
25 | mSpringFrictionSlider = (SeekBar) findViewById(R.id.spring_friction);
26 |
27 | mShowChatHead.setOnClickListener(new View.OnClickListener() {
28 | @Override
29 | public void onClick(View v) {
30 | Intent i = new Intent(getApplicationContext(), BubbleNoteService.class);
31 | startService(i);
32 | }
33 | });
34 |
35 | mSpringTensionSlider.setProgress(BubbleNoteService.sSpringTension);
36 | mSpringFrictionSlider.setProgress(BubbleNoteService.sSpringFriction);
37 |
38 | mSpringTensionSlider.setOnSeekBarChangeListener(this);
39 | mSpringFrictionSlider.setOnSeekBarChangeListener(this);
40 | }
41 |
42 | @Override
43 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
44 | if (seekBar == mSpringTensionSlider) {
45 | BubbleNoteService.sSpringTension = progress;
46 | } else if (seekBar == mSpringFrictionSlider) {
47 | BubbleNoteService.sSpringFriction = progress;
48 | }
49 | BubbleNoteService.setSpringConfig();
50 | }
51 |
52 | @Override
53 | public void onStartTrackingTouch(SeekBar seekBar) {
54 |
55 | }
56 |
57 | @Override
58 | public void onStopTrackingTouch(SeekBar seekBar) {
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/vickychijwani/bubblenote/BubbleNoteService.java:
--------------------------------------------------------------------------------
1 | package io.github.vickychijwani.bubblenote;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.graphics.PixelFormat;
6 | import android.os.Build;
7 | import android.os.IBinder;
8 | import android.view.Gravity;
9 | import android.view.LayoutInflater;
10 | import android.view.MotionEvent;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.view.ViewTreeObserver;
14 | import android.view.WindowManager;
15 |
16 | import com.facebook.rebound.Spring;
17 | import com.facebook.rebound.SpringConfig;
18 | import com.facebook.rebound.SpringListener;
19 | import com.facebook.rebound.SpringSystem;
20 | import com.facebook.rebound.SpringUtil;
21 |
22 | public class BubbleNoteService extends Service {
23 |
24 | public static final String TAG = "BubbleNoteService";
25 | private static final int MOVE_THRESHOLD = 100; // square of the threshold distance in pixels
26 |
27 | private WindowManager mWindowManager;
28 | private ViewGroup mBubble;
29 | private View mContent;
30 |
31 | private boolean mbExpanded = false;
32 | private boolean mbMoved = false;
33 | private int[] mPos = {0, -20};
34 |
35 | private static Spring sBubbleSpring;
36 | private static Spring sContentSpring;
37 | public static int sSpringTension = 200;
38 | public static int sSpringFriction = 20;
39 |
40 | public static void setSpringConfig() {
41 | SpringConfig config = sBubbleSpring.getSpringConfig();
42 | config.tension = sSpringTension;
43 | config.friction = sSpringFriction;
44 | }
45 |
46 | @Override
47 | public IBinder onBind(Intent intent) {
48 | // Not used
49 | return null;
50 | }
51 |
52 | @Override public void onCreate() {
53 | super.onCreate();
54 |
55 | mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
56 |
57 | LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
58 | mBubble = (ViewGroup) inflater.inflate(R.layout.bubble, null, false);
59 |
60 | mContent = mBubble.findViewById(R.id.content);
61 | mContent.setScaleX(0.0f);
62 | mContent.setScaleY(0.0f);
63 | ViewGroup.LayoutParams contentParams = mContent.getLayoutParams();
64 | contentParams.width = Utils.getScreenWidth(this);
65 | contentParams.height = Utils.getScreenHeight(this) - getResources().getDimensionPixelOffset(R.dimen.bubble_height);
66 | mContent.setLayoutParams(contentParams);
67 |
68 | mBubble.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
69 | @Override
70 | public void onGlobalLayout() {
71 | mContent.setPivotX(mBubble.findViewById(R.id.bubble).getWidth() / 2);
72 | if (Build.VERSION.SDK_INT >= 16) {
73 | mBubble.getViewTreeObserver().removeOnGlobalLayoutListener(this);
74 | } else {
75 | mBubble.getViewTreeObserver().removeGlobalOnLayoutListener(this);
76 | }
77 | }
78 | });
79 |
80 | final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
81 | WindowManager.LayoutParams.WRAP_CONTENT,
82 | WindowManager.LayoutParams.WRAP_CONTENT,
83 | WindowManager.LayoutParams.TYPE_PHONE,
84 | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
85 | | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
86 | | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
87 | PixelFormat.TRANSLUCENT);
88 | params.gravity = Gravity.TOP | Gravity.LEFT;
89 | params.x = mPos[0];
90 | params.y = mPos[1];
91 | params.dimAmount = 0.6f;
92 |
93 |
94 | SpringSystem system = SpringSystem.create();
95 | SpringConfig springConfig = new SpringConfig(sSpringTension, sSpringFriction);
96 |
97 | sContentSpring = system.createSpring();
98 | sContentSpring.setSpringConfig(springConfig);
99 | sContentSpring.setCurrentValue(0.0);
100 | sContentSpring.addListener(new SpringListener() {
101 | @Override
102 | public void onSpringUpdate(Spring spring) {
103 | float value = (float) spring.getCurrentValue();
104 | float clampedValue = (float) SpringUtil.clamp(value, 0.0, 1.0);
105 | mContent.setScaleX(value);
106 | mContent.setScaleY(value);
107 | mContent.setAlpha(clampedValue);
108 | }
109 |
110 | @Override
111 | public void onSpringAtRest(Spring spring) {
112 | mContent.setLayerType(View.LAYER_TYPE_NONE, null);
113 | if (spring.currentValueIsApproximately(0.0)) {
114 | hideContent();
115 | }
116 | }
117 |
118 | @Override
119 | public void onSpringActivate(Spring spring) {
120 | mContent.setLayerType(View.LAYER_TYPE_HARDWARE, null);
121 | }
122 |
123 | @Override
124 | public void onSpringEndStateChange(Spring spring) {
125 |
126 | }
127 | });
128 |
129 | sBubbleSpring = system.createSpring();
130 | sBubbleSpring.setSpringConfig(springConfig);
131 | sBubbleSpring.setCurrentValue(1.0);
132 | sBubbleSpring.addListener(new SpringListener() {
133 | @Override
134 | public void onSpringUpdate(Spring spring) {
135 | double value = spring.getCurrentValue();
136 | params.x = (int) (SpringUtil.mapValueFromRangeToRange(value, 0.0, 1.0, 0.0, mPos[0]));
137 | params.y = (int) (SpringUtil.mapValueFromRangeToRange(value, 0.0, 1.0, 0.0, mPos[1]));
138 | mWindowManager.updateViewLayout(mBubble, params);
139 | if (spring.isOvershooting() && sContentSpring.isAtRest()) {
140 | sContentSpring.setEndValue(1.0);
141 | }
142 | }
143 |
144 | @Override
145 | public void onSpringAtRest(Spring spring) {
146 |
147 | }
148 |
149 | @Override
150 | public void onSpringActivate(Spring spring) {
151 |
152 | }
153 |
154 | @Override
155 | public void onSpringEndStateChange(Spring spring) {
156 |
157 | }
158 | });
159 |
160 |
161 | mBubble.setOnTouchListener(new View.OnTouchListener() {
162 | private int initialX;
163 | private int initialY;
164 | private float initialTouchX;
165 | private float initialTouchY;
166 |
167 | @Override
168 | public boolean onTouch(View v, MotionEvent event) {
169 | switch (event.getAction()) {
170 | case MotionEvent.ACTION_DOWN:
171 | mbMoved = false;
172 | initialX = params.x;
173 | initialY = params.y;
174 | initialTouchX = event.getRawX();
175 | initialTouchY = event.getRawY();
176 | showContent();
177 | return true;
178 | case MotionEvent.ACTION_UP:
179 | if (mbMoved) return true;
180 | if (! mbExpanded) {
181 | mBubble.getLocationOnScreen(mPos);
182 | mPos[1] -= Utils.getStatusBarHeight(BubbleNoteService.this);
183 | params.flags &= ~WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
184 | params.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
185 | sBubbleSpring.setEndValue(0.0);
186 | } else {
187 | params.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
188 | params.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
189 | sBubbleSpring.setEndValue(1.0);
190 | sContentSpring.setEndValue(0.0);
191 | }
192 | mbExpanded = ! mbExpanded;
193 | mWindowManager.updateViewLayout(mBubble, params);
194 | return true;
195 | case MotionEvent.ACTION_MOVE:
196 | int deltaX = (int) (event.getRawX() - initialTouchX);
197 | int deltaY = (int) (event.getRawY() - initialTouchY);
198 | params.x = initialX + deltaX;
199 | params.y = initialY + deltaY;
200 | if (deltaX * deltaX + deltaY * deltaY >= MOVE_THRESHOLD) {
201 | mbMoved = true;
202 | hideContent();
203 | mWindowManager.updateViewLayout(mBubble, params);
204 | }
205 | return true;
206 | }
207 | return false;
208 | }
209 | });
210 |
211 | mWindowManager.addView(mBubble, params);
212 | }
213 |
214 | @Override
215 | public void onDestroy() {
216 | super.onDestroy();
217 | if (mBubble != null) {
218 | mWindowManager.removeView(mBubble);
219 | }
220 | }
221 |
222 | private void showContent() {
223 | mContent.setVisibility(View.VISIBLE);
224 | }
225 |
226 | private void hideContent() {
227 | mContent.setVisibility(View.GONE);
228 | }
229 |
230 | }
231 |
--------------------------------------------------------------------------------
/app/src/main/java/io/github/vickychijwani/bubblenote/Utils.java:
--------------------------------------------------------------------------------
1 | package io.github.vickychijwani.bubblenote;
2 |
3 | import android.content.Context;
4 | import android.graphics.Point;
5 | import android.view.Display;
6 | import android.view.WindowManager;
7 |
8 | public class Utils {
9 |
10 | private static Point sScreenSize = null;
11 |
12 | private Utils() {}
13 |
14 | public static int getStatusBarHeight(Context context) {
15 | int result = 0;
16 | int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
17 | if (resourceId > 0) {
18 | result = context.getResources().getDimensionPixelSize(resourceId);
19 | }
20 | return result;
21 | }
22 |
23 | public static int getScreenWidth(Context context) {
24 | fetchScreenSize(context);
25 | return sScreenSize.x;
26 | }
27 |
28 | public static int getScreenHeight(Context context) {
29 | fetchScreenSize(context);
30 | return sScreenSize.y;
31 | }
32 |
33 | private static void fetchScreenSize(Context context) {
34 | if (sScreenSize != null) return;
35 | WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
36 | Display display = wm.getDefaultDisplay();
37 | sScreenSize = new Point();
38 | display.getSize(sScreenSize);
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vickychijwani/BubbleNote/7a6723f9b30cd77815728c3618e74193317a7c13/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vickychijwani/BubbleNote/7a6723f9b30cd77815728c3618e74193317a7c13/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vickychijwani/BubbleNote/7a6723f9b30cd77815728c3618e74193317a7c13/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vickychijwani/BubbleNote/7a6723f9b30cd77815728c3618e74193317a7c13/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_bubble_note.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
14 |
15 |
21 |
22 |
27 |
28 |
34 |
35 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/bubble.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
14 |
15 |
20 |
21 |
22 |
23 |
36 |
37 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 4dp
6 | 8dp
7 | 16dp
8 |
9 |
10 | 12sp
11 | 14sp
12 | 16sp
13 | 18sp
14 | 22sp
15 | 32sp
16 | 72sp
17 |
18 |
19 | 48dp
20 | 48dp
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | BubbleNote
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:0.12.2'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vickychijwani/BubbleNote/7a6723f9b30cd77815728c3618e74193317a7c13/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 10 15:27:10 PDT 2013
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------