19 | * For more on system bars, see System Bars.
22 | *
23 | * @see android.view.View#setSystemUiVisibility(int)
24 | * @see android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN
25 | */
26 | public abstract class SystemUiHider {
27 | /**
28 | * When this flag is set, the
29 | * {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN}
30 | * flag will be set on older devices, making the status bar "float" on top
31 | * of the activity layout. This is most useful when there are no controls at
32 | * the top of the activity layout.
33 | *
34 | * This flag isn't used on newer devices because the action
36 | * bar, the most important structural element of an Android app, should
37 | * be visible and not obscured by the system UI.
38 | */
39 | public static final int FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES = 0x1;
40 |
41 | /**
42 | * When this flag is set, {@link #show()} and {@link #hide()} will toggle
43 | * the visibility of the status bar. If there is a navigation bar, show and
44 | * hide will toggle low profile mode.
45 | */
46 | public static final int FLAG_FULLSCREEN = 0x2;
47 |
48 | /**
49 | * When this flag is set, {@link #show()} and {@link #hide()} will toggle
50 | * the visibility of the navigation bar, if it's present on the device and
51 | * the device allows hiding it. In cases where the navigation bar is present
52 | * but cannot be hidden, show and hide will toggle low profile mode.
53 | */
54 | public static final int FLAG_HIDE_NAVIGATION = FLAG_FULLSCREEN | 0x4;
55 |
56 | /**
57 | * The activity associated with this UI hider object.
58 | */
59 | protected Activity mActivity;
60 |
61 | /**
62 | * The view on which {@link View#setSystemUiVisibility(int)} will be called.
63 | */
64 | protected View mAnchorView;
65 |
66 | /**
67 | * The current UI hider flags.
68 | *
69 | * @see #FLAG_FULLSCREEN
70 | * @see #FLAG_HIDE_NAVIGATION
71 | * @see #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES
72 | */
73 | protected int mFlags;
74 |
75 | /**
76 | * The current visibility callback.
77 | */
78 | protected OnVisibilityChangeListener mOnVisibilityChangeListener = sDummyListener;
79 |
80 | /**
81 | * Creates and returns an instance of {@link SystemUiHider} that is
82 | * appropriate for this device. The object will be either a
83 | * {@link SystemUiHiderBase} or {@link SystemUiHiderHoneycomb} depending on
84 | * the device.
85 | *
86 | * @param activity The activity whose window's system UI should be
87 | * controlled by this class.
88 | * @param anchorView The view on which
89 | * {@link View#setSystemUiVisibility(int)} will be called.
90 | * @param flags Either 0 or any combination of {@link #FLAG_FULLSCREEN},
91 | * {@link #FLAG_HIDE_NAVIGATION}, and
92 | * {@link #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES}.
93 | */
94 | public static SystemUiHider getInstance(Activity activity, View anchorView, int flags) {
95 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
96 | return new SystemUiHiderHoneycomb(activity, anchorView, flags);
97 | } else {
98 | return new SystemUiHiderBase(activity, anchorView, flags);
99 | }
100 | }
101 |
102 | protected SystemUiHider(Activity activity, View anchorView, int flags) {
103 | mActivity = activity;
104 | mAnchorView = anchorView;
105 | mFlags = flags;
106 | }
107 |
108 | /**
109 | * Sets up the system UI hider. Should be called from
110 | * {@link Activity#onCreate}.
111 | */
112 | public abstract void setup();
113 |
114 | /**
115 | * Returns whether or not the system UI is visible.
116 | */
117 | public abstract boolean isVisible();
118 |
119 | /**
120 | * Hide the system UI.
121 | */
122 | public abstract void hide();
123 |
124 | /**
125 | * Show the system UI.
126 | */
127 | public abstract void show();
128 |
129 | /**
130 | * Toggle the visibility of the system UI.
131 | */
132 | public void toggle() {
133 | if (isVisible()) {
134 | hide();
135 | } else {
136 | show();
137 | }
138 | }
139 |
140 | /**
141 | * Registers a callback, to be triggered when the system UI visibility
142 | * changes.
143 | */
144 | public void setOnVisibilityChangeListener(OnVisibilityChangeListener listener) {
145 | if (listener == null) {
146 | listener = sDummyListener;
147 | }
148 |
149 | mOnVisibilityChangeListener = listener;
150 | }
151 |
152 | /**
153 | * A dummy no-op callback for use when there is no other listener set.
154 | */
155 | private static OnVisibilityChangeListener sDummyListener = new OnVisibilityChangeListener() {
156 | @Override
157 | public void onVisibilityChange(boolean visible) {
158 | }
159 | };
160 |
161 | /**
162 | * A callback interface used to listen for system UI visibility changes.
163 | */
164 | public interface OnVisibilityChangeListener {
165 | /**
166 | * Called when the system UI visibility has changed.
167 | *
168 | * @param visible True if the system UI is visible.
169 | */
170 | public void onVisibilityChange(boolean visible);
171 | }
172 | }
173 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/java/me/champeau/groovydroid/util/SystemUiHiderBase.java:
--------------------------------------------------------------------------------
1 | package me.champeau.groovydroid.util;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 | import android.view.WindowManager;
6 |
7 | /**
8 | * A base implementation of {@link SystemUiHider}. Uses APIs available in all
9 | * API levels to show and hide the status bar.
10 | */
11 | public class SystemUiHiderBase extends SystemUiHider {
12 | /**
13 | * Whether or not the system UI is currently visible. This is a cached value
14 | * from calls to {@link #hide()} and {@link #show()}.
15 | */
16 | private boolean mVisible = true;
17 |
18 | /**
19 | * Constructor not intended to be called by clients. Use
20 | * {@link SystemUiHider#getInstance} to obtain an instance.
21 | */
22 | protected SystemUiHiderBase(Activity activity, View anchorView, int flags) {
23 | super(activity, anchorView, flags);
24 | }
25 |
26 | @Override
27 | public void setup() {
28 | if ((mFlags & FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES) == 0) {
29 | mActivity.getWindow().setFlags(
30 | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
31 | | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
32 | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
33 | | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
34 | }
35 | }
36 |
37 | @Override
38 | public boolean isVisible() {
39 | return mVisible;
40 | }
41 |
42 | @Override
43 | public void hide() {
44 | if ((mFlags & FLAG_FULLSCREEN) != 0) {
45 | mActivity.getWindow().setFlags(
46 | WindowManager.LayoutParams.FLAG_FULLSCREEN,
47 | WindowManager.LayoutParams.FLAG_FULLSCREEN);
48 | }
49 | mOnVisibilityChangeListener.onVisibilityChange(false);
50 | mVisible = false;
51 | }
52 |
53 | @Override
54 | public void show() {
55 | if ((mFlags & FLAG_FULLSCREEN) != 0) {
56 | mActivity.getWindow().setFlags(
57 | 0,
58 | WindowManager.LayoutParams.FLAG_FULLSCREEN);
59 | }
60 | mOnVisibilityChangeListener.onVisibilityChange(true);
61 | mVisible = true;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/java/me/champeau/groovydroid/util/SystemUiHiderHoneycomb.java:
--------------------------------------------------------------------------------
1 | package me.champeau.groovydroid.util;
2 |
3 | import android.annotation.TargetApi;
4 | import android.app.Activity;
5 | import android.os.Build;
6 | import android.view.View;
7 | import android.view.WindowManager;
8 |
9 | /**
10 | * An API 11+ implementation of {@link SystemUiHider}. Uses APIs available in
11 | * Honeycomb and later (specifically {@link View#setSystemUiVisibility(int)}) to
12 | * show and hide the system UI.
13 | */
14 | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
15 | public class SystemUiHiderHoneycomb extends SystemUiHiderBase {
16 | /**
17 | * Flags for {@link View#setSystemUiVisibility(int)} to use when showing the
18 | * system UI.
19 | */
20 | private int mShowFlags;
21 |
22 | /**
23 | * Flags for {@link View#setSystemUiVisibility(int)} to use when hiding the
24 | * system UI.
25 | */
26 | private int mHideFlags;
27 |
28 | /**
29 | * Flags to test against the first parameter in
30 | * {@link android.view.View.OnSystemUiVisibilityChangeListener#onSystemUiVisibilityChange(int)}
31 | * to determine the system UI visibility state.
32 | */
33 | private int mTestFlags;
34 |
35 | /**
36 | * Whether or not the system UI is currently visible. This is cached from
37 | * {@link android.view.View.OnSystemUiVisibilityChangeListener}.
38 | */
39 | private boolean mVisible = true;
40 |
41 | /**
42 | * Constructor not intended to be called by clients. Use
43 | * {@link SystemUiHider#getInstance} to obtain an instance.
44 | */
45 | protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
46 | super(activity, anchorView, flags);
47 |
48 | mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
49 | mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
50 | mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
51 |
52 | if ((mFlags & FLAG_FULLSCREEN) != 0) {
53 | // If the client requested fullscreen, add flags relevant to hiding
54 | // the status bar. Note that some of these constants are new as of
55 | // API 16 (Jelly Bean). It is safe to use them, as they are inlined
56 | // at compile-time and do nothing on pre-Jelly Bean devices.
57 | mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
58 | mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
59 | | View.SYSTEM_UI_FLAG_FULLSCREEN;
60 | }
61 |
62 | if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
63 | // If the client requested hiding navigation, add relevant flags.
64 | mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
65 | mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
66 | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
67 | mTestFlags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
68 | }
69 | }
70 |
71 | /** {@inheritDoc} */
72 | @Override
73 | public void setup() {
74 | mAnchorView.setOnSystemUiVisibilityChangeListener(mSystemUiVisibilityChangeListener);
75 | }
76 |
77 | /** {@inheritDoc} */
78 | @Override
79 | public void hide() {
80 | mAnchorView.setSystemUiVisibility(mHideFlags);
81 | }
82 |
83 | /** {@inheritDoc} */
84 | @Override
85 | public void show() {
86 | mAnchorView.setSystemUiVisibility(mShowFlags);
87 | }
88 |
89 | /** {@inheritDoc} */
90 | @Override
91 | public boolean isVisible() {
92 | return mVisible;
93 | }
94 |
95 | private View.OnSystemUiVisibilityChangeListener mSystemUiVisibilityChangeListener
96 | = new View.OnSystemUiVisibilityChangeListener() {
97 | @Override
98 | public void onSystemUiVisibilityChange(int vis) {
99 | // Test against mTestFlags to see if the system UI is visible.
100 | if ((vis & mTestFlags) != 0) {
101 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
102 | // Pre-Jelly Bean, we must manually hide the action bar
103 | // and use the old window flags API.
104 | mActivity.getActionBar().hide();
105 | mActivity.getWindow().setFlags(
106 | WindowManager.LayoutParams.FLAG_FULLSCREEN,
107 | WindowManager.LayoutParams.FLAG_FULLSCREEN);
108 | }
109 |
110 | // Trigger the registered listener and cache the visibility
111 | // state.
112 | mOnVisibilityChangeListener.onVisibilityChange(false);
113 | mVisible = false;
114 |
115 | } else {
116 | mAnchorView.setSystemUiVisibility(mShowFlags);
117 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
118 | // Pre-Jelly Bean, we must manually show the action bar
119 | // and use the old window flags API.
120 | mActivity.getActionBar().show();
121 | mActivity.getWindow().setFlags(
122 | 0,
123 | WindowManager.LayoutParams.FLAG_FULLSCREEN);
124 | }
125 |
126 | // Trigger the registered listener and cache the visibility
127 | // state.
128 | mOnVisibilityChangeListener.onVisibilityChange(true);
129 | mVisible = true;
130 | }
131 | }
132 | };
133 | }
134 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/drawable-hdpi/groovy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/GroovyDroid/src/main/res/drawable-hdpi/groovy.png
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/GroovyDroid/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/drawable-mdpi/groovy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/GroovyDroid/src/main/res/drawable-mdpi/groovy.png
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/GroovyDroid/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/drawable-xhdpi/groovy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/GroovyDroid/src/main/res/drawable-xhdpi/groovy.png
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/GroovyDroid/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/drawable-xxhdpi/groovy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/GroovyDroid/src/main/res/drawable-xxhdpi/groovy.png
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/GroovyDroid/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/layout/groovy_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
16 |
17 |
25 |
26 |
34 |
35 |
48 |
49 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/menu/groovy.xml:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values-sw600dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values-sw720dp-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 128dp
5 |
6 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
14 |
33 |
34 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #66000000
4 |
5 |
6 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | GroovyDroid
5 | Execute!
6 | DUMMY\nCONTENT
7 | Code
8 | result
9 | GroovyDroid
10 | Settings
11 | Hello world!
12 | [\'a\',\'b\'].collect { it.toUpperCase() }
13 |
14 |
15 |
--------------------------------------------------------------------------------
/GroovyDroid/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
18 |
19 |
20 |
26 |
42 |
43 |
44 |
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed under the Apache License, Version 2.0 (the "License");
3 | * you may not use this file except in compliance with the License.
4 | * You may obtain a copy of the License at
5 | *
6 | * http://www.apache.org/licenses/LICENSE-2.0
7 | *
8 | * Unless required by applicable law or agreed to in writing, software
9 | * distributed under the License is distributed on an "AS IS" BASIS,
10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 | * See the License for the specific language governing permissions and
12 | * limitations under the License.
13 | *
14 | */
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | GrooidShell: running scripts on Android
2 | ---------------------------------------
3 |
4 | [](https://travis-ci.org/melix/grooidshell-example)
5 |
6 | This application demonstrates how classes can be generated at runtime and executed directly on an Android device. This application
7 | is intended as an example only, and shows the advantages and limits of the concept.
8 |
9 | Scripts are compiled on the device, then dexed in order to be converted to the Dalvik class format. Eventually, the script is executed.
10 |
11 | License
12 | ---
13 |
14 | This application licensed under the terms of the [Apache License, Version 2.0][Apache License, Version 2.0].
15 | [Apache License, Version 2.0]: http://www.apache.org/licenses/LICENSE-2.0.html
16 |
17 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/melix/grooidshell-example/ee781ba1a07fb9ae60304236c51f93a66232c7c6/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Wed Apr 23 22:14:37 CEST 2014
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-bin.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 |
--------------------------------------------------------------------------------
/groovylib/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/groovylib/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 | dependencies {
6 | classpath 'com.android.tools.build:gradle:0.12.1'
7 | classpath 'me.champeau.gradle:gradle-groovy-android-plugin:0.3.0'
8 | }
9 | }
10 | apply plugin: 'android-library'
11 | apply plugin: 'me.champeau.gradle.groovy-android'
12 |
13 | repositories {
14 | mavenCentral()
15 | }
16 |
17 | android {
18 | compileSdkVersion 19
19 | buildToolsVersion "19.1.0"
20 |
21 | defaultConfig {
22 | minSdkVersion 15
23 | targetSdkVersion 19
24 | versionCode 1
25 | versionName "1.0"
26 | }
27 | buildTypes {
28 | release {
29 | runProguard false
30 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
31 | }
32 | }
33 | }
34 |
35 | dependencies {
36 | compile fileTree(dir: 'libs', include: ['*.jar'])
37 | compile 'org.codehaus.groovy:groovy:2.4.0-beta-1:grooid'
38 | }
39 |
--------------------------------------------------------------------------------
/groovylib/proguard-rules.txt:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /home/cchampeau/DEV/ANDROID/android/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the ProGuard
5 | # include property in project.properties.
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 | #}
--------------------------------------------------------------------------------
/groovylib/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/groovylib/src/main/java/me/champeau/testlibrary/groovylib/GroovyUtils.groovy:
--------------------------------------------------------------------------------
1 | package me.champeau.testlibrary.groovylib
2 |
3 | import groovy.transform.CompileStatic
4 |
5 | @CompileStatic
6 | class GroovyUtils {
7 | static String hello() { 'Hello from library!' }
8 | }
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':GroovyDroid', ':groovylib'
2 |
--------------------------------------------------------------------------------