├── settings.gradle
├── ic_launcher-web.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── app
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── drawable-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── values-v11
│ │ │ └── styles.xml
│ │ ├── xml
│ │ │ └── my_admin_receiver.xml
│ │ ├── values-v14
│ │ │ └── styles.xml
│ │ └── layout
│ │ │ ├── activity_main.xml
│ │ │ └── alert_layout.xml
│ │ ├── java
│ │ └── com
│ │ │ └── cloay
│ │ │ └── alertnotifidemo
│ │ │ ├── MyAdminReceiver.java
│ │ │ ├── MyReceiver.java
│ │ │ ├── MainActivity.java
│ │ │ ├── MyService.java
│ │ │ └── AlertActivity.java
│ │ └── AndroidManifest.xml
└── build.gradle
├── README.md
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── import-summary.txt
└── gradlew
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloay/AlertNotifiDemo/HEAD/ic_launcher-web.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloay/AlertNotifiDemo/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloay/AlertNotifiDemo/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloay/AlertNotifiDemo/HEAD/app/src/main/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloay/AlertNotifiDemo/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cloay/AlertNotifiDemo/HEAD/app/src/main/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | AlertNotifiDemo
5 | Hello world!
6 |
7 |
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | AlertNotifiDemo
2 | ===============
3 |
4 | Show a dialog to display a new message on lock screen like QQ5.0 for android.
5 |
6 | like this:
7 |
8 |
9 | [作者博客: 仿QQ5.0Android版 在锁屏桌面显示消息框](http://cloay.com/blog/2014/08/25/fang-qq5-dot-0androidban-zai-suo-ping-zhuo-mian-xian-shi-xiao-xi-kuang/)
--------------------------------------------------------------------------------
/app/src/main/res/values-v11/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cloay/alertnotifidemo/MyAdminReceiver.java:
--------------------------------------------------------------------------------
1 | package com.cloay.alertnotifidemo;
2 |
3 | import android.app.admin.DeviceAdminReceiver;
4 | /**
5 | *
6 | * @ClassName: MyAdminReceiver
7 | * @Description:
8 | * @author cloay Email:shangrody@gmail.com
9 | * @date 2014-8-22 下午6:21:08
10 | *
11 | */
12 | public class MyAdminReceiver extends DeviceAdminReceiver{
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/my_admin_receiver.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v14/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 14
5 | buildToolsVersion "24.0.0"
6 |
7 | defaultConfig {
8 | applicationId "com.cloay.alertnotifidemo"
9 | minSdkVersion 14
10 | targetSdkVersion 14
11 | }
12 |
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile 'com.android.support:support-v4:18.0.0'
23 | }
24 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 | .idea
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | build/
19 |
20 | # Local configuration file (sdk path, etc)
21 | local.properties
22 |
23 | # Proguard folder generated by Eclipse
24 | proguard/
25 |
26 | # Log Files
27 | *.log
28 |
29 | # Android Studio Navigation editor temp files
30 | .navigation/
31 |
32 | # Android Studio captures folder
33 | captures/
34 |
35 | # Intellij
36 | *.iml
37 | .idea/workspace.xml
38 |
39 | # Keystore files
40 | *.jks
41 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cloay/alertnotifidemo/MyReceiver.java:
--------------------------------------------------------------------------------
1 | package com.cloay.alertnotifidemo;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.util.Log;
7 | /**
8 | *
9 | * @ClassName: MyReceiver
10 | * @Description:
11 | * @author cloay Email:shangrody@gmail.com
12 | * @date 2014-8-22 下午6:20:19
13 | *
14 | */
15 | public class MyReceiver extends BroadcastReceiver{
16 |
17 | @Override
18 | public void onReceive(Context context, Intent intent) {
19 | //
20 | Log.v("AlertNotifi", "on receive.....");
21 |
22 | Intent intentAlert = new Intent(context, AlertActivity.class);
23 | intentAlert.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
24 | context.startActivity(intentAlert);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Thu Aug 11 14:21:34 CST 2016
16 | systemProp.http.proxyHost=127.0.0.1
17 | systemProp.http.proxyPort=1080
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cloay/alertnotifidemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.cloay.alertnotifidemo;
2 |
3 |
4 | import android.app.Activity;
5 | import android.app.admin.DevicePolicyManager;
6 | import android.content.ComponentName;
7 | import android.content.Intent;
8 | import android.os.Bundle;
9 |
10 | /**
11 | *
12 | * @ClassName: MainActivity
13 | * @Description:
14 | * @author cloay Email:shangrody@gmail.com
15 | * @date 2014-8-22 上午10:30:31
16 | *
17 | */
18 | public class MainActivity extends Activity {
19 | private Intent intent;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_main);
25 |
26 | DevicePolicyManager policyManager = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);
27 | ComponentName componentName = new ComponentName(this, MyAdminReceiver.class);
28 |
29 | boolean isAdminActive = policyManager.isAdminActive(componentName);
30 | if(!isAdminActive){
31 | Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
32 | intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, componentName);
33 | startActivity(intent);
34 | }
35 |
36 | intent = new Intent(this, MyService.class);
37 | startService(intent);
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/alert_layout.xml:
--------------------------------------------------------------------------------
1 |
4 |
10 |
15 |
20 |
24 |
28 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
30 |
31 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cloay/alertnotifidemo/MyService.java:
--------------------------------------------------------------------------------
1 | package com.cloay.alertnotifidemo;
2 |
3 | import java.util.Timer;
4 | import java.util.TimerTask;
5 |
6 | import android.app.KeyguardManager;
7 | import android.app.Service;
8 | import android.content.Intent;
9 | import android.content.IntentFilter;
10 | import android.os.IBinder;
11 | import android.util.Log;
12 | /**
13 | *
14 | * @ClassName: MyService
15 | * @Description:
16 | * @author cloay Email:shangrody@gmail.com
17 | * @date 2014-8-22 下午6:20:11
18 | *
19 | */
20 | public class MyService extends Service {
21 | private MyReceiver receiver;
22 | @Override
23 | public IBinder onBind(Intent intent) {
24 | return null;
25 | }
26 |
27 | @Override
28 | public void onCreate() {
29 | super.onCreate();
30 | receiver = new MyReceiver();
31 | IntentFilter filter = new IntentFilter();
32 | filter.addAction("com.cloay.receiver");
33 | registerReceiver(receiver,filter);
34 |
35 | Timer timer = new Timer();
36 | timer.schedule(new TimerTask() {
37 |
38 | @Override
39 | public void run() {
40 | Log.v("AlertNotifi", "I am running.....");
41 |
42 | KeyguardManager mKeyguardManager = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
43 | if (!mKeyguardManager.inKeyguardRestrictedInputMode()) {
44 | Log.v("AlertNotifi", "Screen is on.....");
45 | }else{
46 | Log.v("AlertNotifi", "Screen is off.....");
47 | Intent intentReceiver = new Intent("com.cloay.receiver");
48 | sendBroadcast(intentReceiver);
49 | }
50 | }
51 | }, 10*1000, 10*1000); //send a new message every 10 seconds.
52 | }
53 |
54 | @Override
55 | public void onDestroy() {
56 | super.onDestroy();
57 | unregisterReceiver(receiver);
58 | }
59 |
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cloay/alertnotifidemo/AlertActivity.java:
--------------------------------------------------------------------------------
1 | package com.cloay.alertnotifidemo;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.app.admin.DevicePolicyManager;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 | import android.view.KeyEvent;
9 | import android.view.View;
10 | import android.view.View.OnClickListener;
11 | import android.view.Window;
12 | import android.view.WindowManager;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 | /**
16 | *
17 | * @ClassName: AlertActivity
18 | * @Description:
19 | * @author cloay Email:shangrody@gmail.com
20 | * @date 2014-8-22 下午6:20:33
21 | *
22 | */
23 | public class AlertActivity extends Activity implements OnClickListener{
24 |
25 | private TextView titleTextV;
26 | private TextView msgTextV;
27 |
28 | private Button cancleBtn;
29 | private Button okBtn;
30 | @SuppressLint("ShowToast")
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | Window window = getWindow();
35 | window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
36 | window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
37 | window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
38 | setContentView(R.layout.alert_layout);
39 |
40 | titleTextV = (TextView) findViewById(R.id.msg_title_textV);
41 | titleTextV.setText("New message: ");
42 | msgTextV = (TextView) findViewById(R.id.msg_content_textV);
43 | msgTextV.setText("Hi, I am cloay!");
44 |
45 | cancleBtn = (Button) findViewById(R.id.alert_cancle_btn);
46 | cancleBtn.setOnClickListener(this);
47 | okBtn = (Button) findViewById(R.id.alert_ok_btn);
48 | okBtn.setOnClickListener(this);
49 | }
50 |
51 | @Override
52 | public void onClick(View v) {
53 | getWindow().clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
54 | getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
55 | getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
56 | if(v == cancleBtn){
57 | DevicePolicyManager policyManager = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);
58 | policyManager.lockNow();
59 | new Handler().postDelayed(new Runnable() {
60 |
61 | @Override
62 | public void run() {
63 | finish();
64 | }
65 | }, 1000);
66 | }else if(v == okBtn){
67 | //back to app
68 | finish();
69 | }
70 | }
71 |
72 | @Override
73 | public boolean onKeyDown(int keyCode, KeyEvent event) {
74 | return false;
75 | }
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/import-summary.txt:
--------------------------------------------------------------------------------
1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY
2 | ======================================
3 |
4 | Ignored Files:
5 | --------------
6 | The following files were *not* copied into the new Gradle project; you
7 | should evaluate whether these are still needed in your project and if
8 | so manually move them:
9 |
10 | * .gitignore
11 | * .idea/
12 | * .idea/.name
13 | * .idea/compiler.xml
14 | * .idea/copyright/
15 | * .idea/copyright/profiles_settings.xml
16 | * .idea/encodings.xml
17 | * .idea/misc.xml
18 | * .idea/workspace.xml
19 | * README.md
20 | * app/
21 | * app/build.gradle
22 | * app/src/
23 | * app/src/main/
24 | * app/src/main/AndroidManifest.xml
25 | * app/src/main/java/
26 | * app/src/main/java/com/
27 | * app/src/main/java/com/cloay/
28 | * app/src/main/java/com/cloay/alertnotifidemo/
29 | * app/src/main/java/com/cloay/alertnotifidemo/AlertActivity.java
30 | * app/src/main/java/com/cloay/alertnotifidemo/MainActivity.java
31 | * app/src/main/java/com/cloay/alertnotifidemo/MyAdminReceiver.java
32 | * app/src/main/java/com/cloay/alertnotifidemo/MyReceiver.java
33 | * app/src/main/java/com/cloay/alertnotifidemo/MyService.java
34 | * app/src/main/res/
35 | * app/src/main/res/drawable-hdpi/
36 | * app/src/main/res/drawable-hdpi/ic_launcher.png
37 | * app/src/main/res/drawable-mdpi/
38 | * app/src/main/res/drawable-mdpi/ic_launcher.png
39 | * app/src/main/res/drawable-xhdpi/
40 | * app/src/main/res/drawable-xhdpi/ic_launcher.png
41 | * app/src/main/res/drawable-xxhdpi/
42 | * app/src/main/res/drawable-xxhdpi/ic_launcher.png
43 | * app/src/main/res/layout/
44 | * app/src/main/res/layout/activity_main.xml
45 | * app/src/main/res/layout/alert_layout.xml
46 | * app/src/main/res/values-v11/
47 | * app/src/main/res/values-v11/styles.xml
48 | * app/src/main/res/values-v14/
49 | * app/src/main/res/values-v14/styles.xml
50 | * app/src/main/res/values/
51 | * app/src/main/res/values/strings.xml
52 | * app/src/main/res/values/styles.xml
53 | * app/src/main/res/xml/
54 | * app/src/main/res/xml/my_admin_receiver.xml
55 | * build.gradle
56 | * gradle/
57 | * gradle/wrapper/
58 | * gradle/wrapper/gradle-wrapper.jar
59 | * gradle/wrapper/gradle-wrapper.properties
60 | * gradlew
61 | * gradlew.bat
62 | * ic_launcher-web.png
63 | * pic.jpg
64 | * proguard-project.txt
65 | * settings.gradle
66 |
67 | Replaced Jars with Dependencies:
68 | --------------------------------
69 | The importer recognized the following .jar files as third party
70 | libraries and replaced them with Gradle dependencies instead. This has
71 | the advantage that more explicit version information is known, and the
72 | libraries can be updated automatically. However, it is possible that
73 | the .jar file in your project was of an older version than the
74 | dependency we picked, which could render the project not compileable.
75 | You can disable the jar replacement in the import wizard and try again:
76 |
77 | android-support-v4.jar => com.android.support:support-v4:18.0.0
78 |
79 | Moved Files:
80 | ------------
81 | Android Gradle projects use a different directory structure than ADT
82 | Eclipse projects. Here's how the projects were restructured:
83 |
84 | * AndroidManifest.xml => app/src/main/AndroidManifest.xml
85 | * res/ => app/src/main/res/
86 | * src/ => app/src/main/java/
87 |
88 | Next Steps:
89 | -----------
90 | You can now build the project. The Gradle project needs network
91 | connectivity to download dependencies.
92 |
93 | Bugs:
94 | -----
95 | If for some reason your project does not build, and you determine that
96 | it is due to a bug or limitation of the Eclipse to Gradle importer,
97 | please file a bug at http://b.android.com with category
98 | Component-Tools.
99 |
100 | (This import summary is for your information only, and can be deleted
101 | after import once you are satisfied with the results.)
102 |
--------------------------------------------------------------------------------
/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 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------