diff --git a/BroadcastReceiver2/.gitignore b/BroadcastReceiver2/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/BroadcastReceiver2/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/BroadcastReceiver2/.idea/.name b/BroadcastReceiver2/.idea/.name new file mode 100644 index 0000000..010d35a --- /dev/null +++ b/BroadcastReceiver2/.idea/.name @@ -0,0 +1 @@ +BroadcastReceiver2 \ No newline at end of file diff --git a/BroadcastReceiver2/.idea/compiler.xml b/BroadcastReceiver2/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/BroadcastReceiver2/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/BroadcastReceiver2/.idea/copyright/profiles_settings.xml b/BroadcastReceiver2/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/BroadcastReceiver2/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/BroadcastReceiver2/.idea/encodings.xml b/BroadcastReceiver2/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/BroadcastReceiver2/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/BroadcastReceiver2/.idea/gradle.xml b/BroadcastReceiver2/.idea/gradle.xml new file mode 100644 index 0000000..2cbb09b --- /dev/null +++ b/BroadcastReceiver2/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/BroadcastReceiver2/.idea/misc.xml b/BroadcastReceiver2/.idea/misc.xml new file mode 100644 index 0000000..59436c9 --- /dev/null +++ b/BroadcastReceiver2/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/BroadcastReceiver2/.idea/modules.xml b/BroadcastReceiver2/.idea/modules.xml new file mode 100644 index 0000000..5be5f5b --- /dev/null +++ b/BroadcastReceiver2/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/BroadcastReceiver2/.idea/scopes/scope_settings.xml b/BroadcastReceiver2/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/BroadcastReceiver2/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/BroadcastReceiver2/.idea/vcs.xml b/BroadcastReceiver2/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/BroadcastReceiver2/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/BroadcastReceiver2/BroadcastReceiver2.iml b/BroadcastReceiver2/BroadcastReceiver2.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/BroadcastReceiver2/BroadcastReceiver2.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/BroadcastReceiver2/app/.gitignore b/BroadcastReceiver2/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/BroadcastReceiver2/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/BroadcastReceiver2/app/app.iml b/BroadcastReceiver2/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/BroadcastReceiver2/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BroadcastReceiver2/app/build.gradle b/BroadcastReceiver2/app/build.gradle new file mode 100644 index 0000000..cfb8177 --- /dev/null +++ b/BroadcastReceiver2/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "alarm.android.vogella.de.broadcastreceiver2" + minSdkVersion 9 + targetSdkVersion 21 + 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:21.0.3' +} diff --git a/BroadcastReceiver2/app/proguard-rules.pro b/BroadcastReceiver2/app/proguard-rules.pro new file mode 100644 index 0000000..a3c7c26 --- /dev/null +++ b/BroadcastReceiver2/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\USER\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/BroadcastReceiver2/app/src/androidTest/java/alarm/android/vogella/de/broadcastreceiver2/ApplicationTest.java b/BroadcastReceiver2/app/src/androidTest/java/alarm/android/vogella/de/broadcastreceiver2/ApplicationTest.java new file mode 100644 index 0000000..171f4bd --- /dev/null +++ b/BroadcastReceiver2/app/src/androidTest/java/alarm/android/vogella/de/broadcastreceiver2/ApplicationTest.java @@ -0,0 +1,13 @@ +package alarm.android.vogella.de.broadcastreceiver2; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/BroadcastReceiver2/app/src/main/AndroidManifest.xml b/BroadcastReceiver2/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..77447a4 --- /dev/null +++ b/BroadcastReceiver2/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/BroadcastReceiver2/app/src/main/java/alarm/android/vogella/de/broadcastreceiver2/AlarmActivity.java b/BroadcastReceiver2/app/src/main/java/alarm/android/vogella/de/broadcastreceiver2/AlarmActivity.java new file mode 100644 index 0000000..b8a532d --- /dev/null +++ b/BroadcastReceiver2/app/src/main/java/alarm/android/vogella/de/broadcastreceiver2/AlarmActivity.java @@ -0,0 +1,32 @@ +package alarm.android.vogella.de.broadcastreceiver2; + +import android.app.Activity; +import android.app.AlarmManager; +import android.app.PendingIntent; +import android.content.Intent; +import android.os.Bundle; +import android.view.View; +import android.widget.EditText; +import android.widget.Toast; + + +public class AlarmActivity extends Activity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_alarm); + } + + public void startAlert(View view) { + EditText text = (EditText) findViewById(R.id.time); + int i = Integer.parseInt(text.getText().toString()); + Intent intent = new Intent(this, MyBroadcastReceiver.class); + PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 234324243, intent, 0); + AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); + alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + + (i * 1000), pendingIntent); + Toast.makeText(this, "Alarm set in " + i + " seconds", + Toast.LENGTH_LONG).show(); + } +} diff --git a/BroadcastReceiver2/app/src/main/java/alarm/android/vogella/de/broadcastreceiver2/MyBroadcastReceiver.java b/BroadcastReceiver2/app/src/main/java/alarm/android/vogella/de/broadcastreceiver2/MyBroadcastReceiver.java new file mode 100644 index 0000000..09c1fa2 --- /dev/null +++ b/BroadcastReceiver2/app/src/main/java/alarm/android/vogella/de/broadcastreceiver2/MyBroadcastReceiver.java @@ -0,0 +1,19 @@ +package alarm.android.vogella.de.broadcastreceiver2; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.os.Vibrator; +import android.widget.Toast; + +public class MyBroadcastReceiver extends BroadcastReceiver { + @Override + public void onReceive(Context context, Intent intent) { + Toast.makeText(context, "Don't panik but your time is up!!!!.", + Toast.LENGTH_LONG).show(); + // Vibrate the mobile phone + Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); + vibrator.vibrate(2000); + } + +} \ No newline at end of file diff --git a/BroadcastReceiver2/app/src/main/res/drawable-hdpi/ic_launcher.png b/BroadcastReceiver2/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/BroadcastReceiver2/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/BroadcastReceiver2/app/src/main/res/drawable-mdpi/ic_launcher.png b/BroadcastReceiver2/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/BroadcastReceiver2/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/BroadcastReceiver2/app/src/main/res/drawable-xhdpi/ic_launcher.png b/BroadcastReceiver2/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/BroadcastReceiver2/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/BroadcastReceiver2/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/BroadcastReceiver2/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/BroadcastReceiver2/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/BroadcastReceiver2/app/src/main/res/layout/activity_alarm.xml b/BroadcastReceiver2/app/src/main/res/layout/activity_alarm.xml new file mode 100644 index 0000000..145689d --- /dev/null +++ b/BroadcastReceiver2/app/src/main/res/layout/activity_alarm.xml @@ -0,0 +1,23 @@ + + + + + + + + + \ No newline at end of file diff --git a/BroadcastReceiver2/app/src/main/res/menu/menu_alarm.xml b/BroadcastReceiver2/app/src/main/res/menu/menu_alarm.xml new file mode 100644 index 0000000..aed6bc4 --- /dev/null +++ b/BroadcastReceiver2/app/src/main/res/menu/menu_alarm.xml @@ -0,0 +1,6 @@ + + + diff --git a/BroadcastReceiver2/app/src/main/res/values-w820dp/dimens.xml b/BroadcastReceiver2/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/BroadcastReceiver2/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/BroadcastReceiver2/app/src/main/res/values/dimens.xml b/BroadcastReceiver2/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/BroadcastReceiver2/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/BroadcastReceiver2/app/src/main/res/values/strings.xml b/BroadcastReceiver2/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..6f9e9eb --- /dev/null +++ b/BroadcastReceiver2/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + + + BroadcastReceiver2 + Hello world! + Settings + + diff --git a/BroadcastReceiver2/app/src/main/res/values/styles.xml b/BroadcastReceiver2/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..766ab99 --- /dev/null +++ b/BroadcastReceiver2/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/BroadcastReceiver2/build.gradle b/BroadcastReceiver2/build.gradle new file mode 100644 index 0000000..6356aab --- /dev/null +++ b/BroadcastReceiver2/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/BroadcastReceiver2/gradle.properties b/BroadcastReceiver2/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/BroadcastReceiver2/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/BroadcastReceiver2/gradle/wrapper/gradle-wrapper.jar b/BroadcastReceiver2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/BroadcastReceiver2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/BroadcastReceiver2/gradle/wrapper/gradle-wrapper.properties b/BroadcastReceiver2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/BroadcastReceiver2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +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 diff --git a/BroadcastReceiver2/gradlew.bat b/BroadcastReceiver2/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/BroadcastReceiver2/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/BroadcastReceiver2/settings.gradle b/BroadcastReceiver2/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/BroadcastReceiver2/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/BroadcastReceiverApp/.gitignore b/BroadcastReceiverApp/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/BroadcastReceiverApp/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/BroadcastReceiverApp/.idea/.name b/BroadcastReceiverApp/.idea/.name new file mode 100644 index 0000000..2ecb929 --- /dev/null +++ b/BroadcastReceiverApp/.idea/.name @@ -0,0 +1 @@ +BroadcastReceiverApp \ No newline at end of file diff --git a/BroadcastReceiverApp/.idea/compiler.xml b/BroadcastReceiverApp/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/BroadcastReceiverApp/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/BroadcastReceiverApp/.idea/copyright/profiles_settings.xml b/BroadcastReceiverApp/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/BroadcastReceiverApp/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/BroadcastReceiverApp/.idea/encodings.xml b/BroadcastReceiverApp/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/BroadcastReceiverApp/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/BroadcastReceiverApp/.idea/gradle.xml b/BroadcastReceiverApp/.idea/gradle.xml new file mode 100644 index 0000000..2cbb09b --- /dev/null +++ b/BroadcastReceiverApp/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/BroadcastReceiverApp/.idea/misc.xml b/BroadcastReceiverApp/.idea/misc.xml new file mode 100644 index 0000000..59436c9 --- /dev/null +++ b/BroadcastReceiverApp/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/BroadcastReceiverApp/.idea/modules.xml b/BroadcastReceiverApp/.idea/modules.xml new file mode 100644 index 0000000..bde4250 --- /dev/null +++ b/BroadcastReceiverApp/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/BroadcastReceiverApp/.idea/scopes/scope_settings.xml b/BroadcastReceiverApp/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/BroadcastReceiverApp/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/BroadcastReceiverApp/.idea/vcs.xml b/BroadcastReceiverApp/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/BroadcastReceiverApp/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/BroadcastReceiverApp/BroadcastReceiverApp.iml b/BroadcastReceiverApp/BroadcastReceiverApp.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/BroadcastReceiverApp/BroadcastReceiverApp.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/BroadcastReceiverApp/app/.gitignore b/BroadcastReceiverApp/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/BroadcastReceiverApp/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/BroadcastReceiverApp/app/app.iml b/BroadcastReceiverApp/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/BroadcastReceiverApp/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BroadcastReceiverApp/app/build.gradle b/BroadcastReceiverApp/app/build.gradle new file mode 100644 index 0000000..0563f4f --- /dev/null +++ b/BroadcastReceiverApp/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "phon.receiver.android.vogella.de.broadcastreceiverapp" + minSdkVersion 9 + targetSdkVersion 21 + 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:21.0.3' +} diff --git a/BroadcastReceiverApp/app/proguard-rules.pro b/BroadcastReceiverApp/app/proguard-rules.pro new file mode 100644 index 0000000..a3c7c26 --- /dev/null +++ b/BroadcastReceiverApp/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\USER\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/BroadcastReceiverApp/app/src/androidTest/java/phon/receiver/android/vogella/de/broadcastreceiverapp/ApplicationTest.java b/BroadcastReceiverApp/app/src/androidTest/java/phon/receiver/android/vogella/de/broadcastreceiverapp/ApplicationTest.java new file mode 100644 index 0000000..759aad1 --- /dev/null +++ b/BroadcastReceiverApp/app/src/androidTest/java/phon/receiver/android/vogella/de/broadcastreceiverapp/ApplicationTest.java @@ -0,0 +1,13 @@ +package phon.receiver.android.vogella.de.broadcastreceiverapp; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/BroadcastReceiverApp/app/src/main/AndroidManifest.xml b/BroadcastReceiverApp/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..ecb2040 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/BroadcastReceiverApp/app/src/main/java/phon/receiver/android/vogella/de/broadcastreceiverapp/MainActivity.java b/BroadcastReceiverApp/app/src/main/java/phon/receiver/android/vogella/de/broadcastreceiverapp/MainActivity.java new file mode 100644 index 0000000..6dbbc46 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/java/phon/receiver/android/vogella/de/broadcastreceiverapp/MainActivity.java @@ -0,0 +1,39 @@ +package phon.receiver.android.vogella.de.broadcastreceiverapp; + +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + + +public class MainActivity extends ActionBarActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/BroadcastReceiverApp/app/src/main/java/phon/receiver/android/vogella/de/broadcastreceiverapp/MyPhoneReceiver.java b/BroadcastReceiverApp/app/src/main/java/phon/receiver/android/vogella/de/broadcastreceiverapp/MyPhoneReceiver.java new file mode 100644 index 0000000..6ebdfb2 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/java/phon/receiver/android/vogella/de/broadcastreceiverapp/MyPhoneReceiver.java @@ -0,0 +1,29 @@ +package phon.receiver.android.vogella.de.broadcastreceiverapp; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Log; + +/** + * Created by USER on 2/8/2015. + */ +public class MyPhoneReceiver extends BroadcastReceiver{ + + @Override + public void onReceive(Context context, Intent intent) { + Bundle extras = intent.getExtras(); + if(extras!=null) { + String state = extras.getString(TelephonyManager.EXTRA_STATE); + Log.w("MY_DEBUG_TAG",state); + if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)) { + String phoneNumber = extras + .getString(TelephonyManager.EXTRA_INCOMING_NUMBER); + Log.w("MY_DEBUG_TAG",phoneNumber); + } + } + } + +} diff --git a/BroadcastReceiverApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/BroadcastReceiverApp/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/BroadcastReceiverApp/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/BroadcastReceiverApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/BroadcastReceiverApp/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/BroadcastReceiverApp/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/BroadcastReceiverApp/app/src/main/res/drawable-xhdpi/ic_launcher.png b/BroadcastReceiverApp/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/BroadcastReceiverApp/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/BroadcastReceiverApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/BroadcastReceiverApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/BroadcastReceiverApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/BroadcastReceiverApp/app/src/main/res/layout/activity_main.xml b/BroadcastReceiverApp/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..f7158b8 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/BroadcastReceiverApp/app/src/main/res/menu/menu_main.xml b/BroadcastReceiverApp/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..b1cb908 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,6 @@ + + + diff --git a/BroadcastReceiverApp/app/src/main/res/values-w820dp/dimens.xml b/BroadcastReceiverApp/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/BroadcastReceiverApp/app/src/main/res/values/dimens.xml b/BroadcastReceiverApp/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/BroadcastReceiverApp/app/src/main/res/values/strings.xml b/BroadcastReceiverApp/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..6965c33 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + + + BroadcastReceiverApp + Hello world! + Settings + + diff --git a/BroadcastReceiverApp/app/src/main/res/values/styles.xml b/BroadcastReceiverApp/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..766ab99 --- /dev/null +++ b/BroadcastReceiverApp/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/BroadcastReceiverApp/build.gradle b/BroadcastReceiverApp/build.gradle new file mode 100644 index 0000000..6356aab --- /dev/null +++ b/BroadcastReceiverApp/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/BroadcastReceiverApp/gradle.properties b/BroadcastReceiverApp/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/BroadcastReceiverApp/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/BroadcastReceiverApp/gradle/wrapper/gradle-wrapper.jar b/BroadcastReceiverApp/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/BroadcastReceiverApp/gradle/wrapper/gradle-wrapper.jar differ diff --git a/BroadcastReceiverApp/gradle/wrapper/gradle-wrapper.properties b/BroadcastReceiverApp/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/BroadcastReceiverApp/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +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 diff --git a/BroadcastReceiverApp/gradlew.bat b/BroadcastReceiverApp/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/BroadcastReceiverApp/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/BroadcastReceiverApp/settings.gradle b/BroadcastReceiverApp/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/BroadcastReceiverApp/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/IntentApp/.gitignore b/IntentApp/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/IntentApp/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/IntentApp/.idea/.name b/IntentApp/.idea/.name new file mode 100644 index 0000000..a173b2f --- /dev/null +++ b/IntentApp/.idea/.name @@ -0,0 +1 @@ +IntentApp \ No newline at end of file diff --git a/IntentApp/.idea/compiler.xml b/IntentApp/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/IntentApp/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/IntentApp/.idea/copyright/profiles_settings.xml b/IntentApp/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/IntentApp/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/IntentApp/.idea/encodings.xml b/IntentApp/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/IntentApp/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/IntentApp/.idea/gradle.xml b/IntentApp/.idea/gradle.xml new file mode 100644 index 0000000..2cbb09b --- /dev/null +++ b/IntentApp/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/IntentApp/.idea/misc.xml b/IntentApp/.idea/misc.xml new file mode 100644 index 0000000..59436c9 --- /dev/null +++ b/IntentApp/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/IntentApp/.idea/modules.xml b/IntentApp/.idea/modules.xml new file mode 100644 index 0000000..060b83f --- /dev/null +++ b/IntentApp/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/IntentApp/.idea/scopes/scope_settings.xml b/IntentApp/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/IntentApp/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/IntentApp/.idea/vcs.xml b/IntentApp/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/IntentApp/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/IntentApp/IntentApp.iml b/IntentApp/IntentApp.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/IntentApp/IntentApp.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/IntentApp/app/.gitignore b/IntentApp/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/IntentApp/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/IntentApp/app/app.iml b/IntentApp/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/IntentApp/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IntentApp/app/build.gradle b/IntentApp/app/build.gradle new file mode 100644 index 0000000..22e6f09 --- /dev/null +++ b/IntentApp/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "explicit.intent.android.vogella.com.intentapp" + minSdkVersion 9 + targetSdkVersion 21 + 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:21.0.3' +} diff --git a/IntentApp/app/proguard-rules.pro b/IntentApp/app/proguard-rules.pro new file mode 100644 index 0000000..a3c7c26 --- /dev/null +++ b/IntentApp/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\USER\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/IntentApp/app/src/main/AndroidManifest.xml b/IntentApp/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..0d52f67 --- /dev/null +++ b/IntentApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + diff --git a/IntentApp/app/src/main/java/explicit/intent/android/vogella/com/intentapp/MainActivity.java b/IntentApp/app/src/main/java/explicit/intent/android/vogella/com/intentapp/MainActivity.java new file mode 100644 index 0000000..c5d48f9 --- /dev/null +++ b/IntentApp/app/src/main/java/explicit/intent/android/vogella/com/intentapp/MainActivity.java @@ -0,0 +1,66 @@ +package explicit.intent.android.vogella.com.intentapp; + +import android.content.Intent; +import android.app.Activity; +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.EditText; +import android.widget.Toast; + + +public class MainActivity extends ActionBarActivity { + + private static final int REQUEST_CODE = 10; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } + + public void onClick(View view) { + EditText text = (EditText) findViewById(R.id.inputforintent); + String string = text.getText().toString(); + Intent intent = new Intent(this,ResultActivity.class); + intent.putExtra("MyKey",string); + startActivityForResult(intent,REQUEST_CODE); + //startActivityForResult(intent,"REQUEST_CODE"); + //startActivity(intent); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (resultCode == RESULT_OK && requestCode == REQUEST_CODE) { + if (data.hasExtra("MyKey")) { + String result = data.getExtras().getString("MyKey"); + if (result != null && result.length() > 0) { + Toast.makeText(this, result, Toast.LENGTH_SHORT).show(); + } + } + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/IntentApp/app/src/main/java/explicit/intent/android/vogella/com/intentapp/ResultActivity.java b/IntentApp/app/src/main/java/explicit/intent/android/vogella/com/intentapp/ResultActivity.java new file mode 100644 index 0000000..1378951 --- /dev/null +++ b/IntentApp/app/src/main/java/explicit/intent/android/vogella/com/intentapp/ResultActivity.java @@ -0,0 +1,36 @@ +package explicit.intent.android.vogella.com.intentapp; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; +import android.widget.EditText; +import android.widget.TextView; + +/** + * Created by USER on 2/8/2015. + */ +public class ResultActivity extends Activity{ + + @Override + public void onCreate(Bundle bundle) { + super.onCreate(bundle); + setContentView(R.layout.activity_result); + Bundle extras = getIntent().getExtras(); + + String ReceivedString = extras.getString("MyKey"); + TextView textVw = (TextView) findViewById(R.id.displayintentextra); + textVw.setText(ReceivedString); + + + } + + @Override + public void finish() { + Intent intent = new Intent(); + EditText text = (EditText) findViewById(R.id.returnValue); + //String txt = et.getText().toString(); + intent.putExtra("MyKey",text.getText().toString()); + setResult(RESULT_OK,intent); + super.finish(); + } +} diff --git a/IntentApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/IntentApp/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/IntentApp/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/IntentApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/IntentApp/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/IntentApp/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/IntentApp/app/src/main/res/drawable-xhdpi/ic_launcher.png b/IntentApp/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/IntentApp/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/IntentApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/IntentApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/IntentApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/IntentApp/app/src/main/res/layout/activity_main.xml b/IntentApp/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..e68abca --- /dev/null +++ b/IntentApp/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,30 @@ + + + + + + + + \ No newline at end of file diff --git a/IntentApp3/app/src/main/res/menu/menu_call_intents.xml b/IntentApp3/app/src/main/res/menu/menu_call_intents.xml new file mode 100644 index 0000000..8e515e1 --- /dev/null +++ b/IntentApp3/app/src/main/res/menu/menu_call_intents.xml @@ -0,0 +1,6 @@ + + + diff --git a/IntentApp3/app/src/main/res/values-w820dp/dimens.xml b/IntentApp3/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/IntentApp3/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/IntentApp3/app/src/main/res/values/dimens.xml b/IntentApp3/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/IntentApp3/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/IntentApp3/app/src/main/res/values/intents.xml b/IntentApp3/app/src/main/res/values/intents.xml new file mode 100644 index 0000000..ec8baae --- /dev/null +++ b/IntentApp3/app/src/main/res/values/intents.xml @@ -0,0 +1,14 @@ + + + + Open Browser + Call Someone + Dial + Show Map + Search on Map + Take picture + Show contacts + Edit first contact + + + diff --git a/IntentApp3/app/src/main/res/values/strings.xml b/IntentApp3/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..22ee411 --- /dev/null +++ b/IntentApp3/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + + + IntentApp3 + Hello world! + Settings + + diff --git a/IntentApp3/app/src/main/res/values/styles.xml b/IntentApp3/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..766ab99 --- /dev/null +++ b/IntentApp3/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/IntentApp3/build.gradle b/IntentApp3/build.gradle new file mode 100644 index 0000000..6356aab --- /dev/null +++ b/IntentApp3/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/IntentApp3/gradle.properties b/IntentApp3/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/IntentApp3/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/IntentApp3/gradle/wrapper/gradle-wrapper.jar b/IntentApp3/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/IntentApp3/gradle/wrapper/gradle-wrapper.jar differ diff --git a/IntentApp3/gradle/wrapper/gradle-wrapper.properties b/IntentApp3/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/IntentApp3/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +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 diff --git a/IntentApp3/gradlew.bat b/IntentApp3/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/IntentApp3/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/IntentApp3/settings.gradle b/IntentApp3/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/IntentApp3/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/IntentApps4/.gitignore b/IntentApps4/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/IntentApps4/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/IntentApps4/.idea/.name b/IntentApps4/.idea/.name new file mode 100644 index 0000000..5c28b93 --- /dev/null +++ b/IntentApps4/.idea/.name @@ -0,0 +1 @@ +IntentApps4 \ No newline at end of file diff --git a/IntentApps4/.idea/compiler.xml b/IntentApps4/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/IntentApps4/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/IntentApps4/.idea/copyright/profiles_settings.xml b/IntentApps4/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/IntentApps4/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/IntentApps4/.idea/encodings.xml b/IntentApps4/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/IntentApps4/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/IntentApps4/.idea/gradle.xml b/IntentApps4/.idea/gradle.xml new file mode 100644 index 0000000..2cbb09b --- /dev/null +++ b/IntentApps4/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/IntentApps4/.idea/misc.xml b/IntentApps4/.idea/misc.xml new file mode 100644 index 0000000..59436c9 --- /dev/null +++ b/IntentApps4/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/IntentApps4/.idea/modules.xml b/IntentApps4/.idea/modules.xml new file mode 100644 index 0000000..e21de28 --- /dev/null +++ b/IntentApps4/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/IntentApps4/.idea/scopes/scope_settings.xml b/IntentApps4/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/IntentApps4/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/IntentApps4/.idea/vcs.xml b/IntentApps4/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/IntentApps4/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/IntentApps4/IntentApps4.iml b/IntentApps4/IntentApps4.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/IntentApps4/IntentApps4.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/IntentApps4/app/.gitignore b/IntentApps4/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/IntentApps4/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/IntentApps4/app/app.iml b/IntentApps4/app/app.iml new file mode 100644 index 0000000..a07fb8c --- /dev/null +++ b/IntentApps4/app/app.iml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IntentApps4/app/build.gradle b/IntentApps4/app/build.gradle new file mode 100644 index 0000000..c67aaa5 --- /dev/null +++ b/IntentApps4/app/build.gradle @@ -0,0 +1,25 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + + defaultConfig { + applicationId "imagepick.android.vogella.de.intentapps4" + minSdkVersion 9 + targetSdkVersion 21 + 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:21.0.3' +} diff --git a/IntentApps4/app/proguard-rules.pro b/IntentApps4/app/proguard-rules.pro new file mode 100644 index 0000000..a3c7c26 --- /dev/null +++ b/IntentApps4/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\USER\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/IntentApps4/app/src/androidTest/java/imagepick/android/vogella/de/intentapps4/ApplicationTest.java b/IntentApps4/app/src/androidTest/java/imagepick/android/vogella/de/intentapps4/ApplicationTest.java new file mode 100644 index 0000000..6ad6b4b --- /dev/null +++ b/IntentApps4/app/src/androidTest/java/imagepick/android/vogella/de/intentapps4/ApplicationTest.java @@ -0,0 +1,13 @@ +package imagepick.android.vogella.de.intentapps4; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/IntentApps4/app/src/main/AndroidManifest.xml b/IntentApps4/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..4fbf3cf --- /dev/null +++ b/IntentApps4/app/src/main/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/IntentApps4/app/src/main/java/imagepick/android/vogella/de/intentapps4/ImagePickActivity.java b/IntentApps4/app/src/main/java/imagepick/android/vogella/de/intentapps4/ImagePickActivity.java new file mode 100644 index 0000000..f1f8d8b --- /dev/null +++ b/IntentApps4/app/src/main/java/imagepick/android/vogella/de/intentapps4/ImagePickActivity.java @@ -0,0 +1,64 @@ +package imagepick.android.vogella.de.intentapps4; + + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +import android.app.Activity; +import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.Bundle; +import android.view.View; +import android.widget.ImageView; + +public class ImagePickActivity extends Activity { + private static final int REQUEST_CODE = 1; + private Bitmap bitmap; + private ImageView imageView; + + + /** Called when the activity is first created. */ + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_image_pick); + imageView = (ImageView) findViewById(R.id.result); + } + + public void pickImage(View View) { + Intent intent = new Intent(); + intent.setType("image/*"); + intent.setAction(Intent.ACTION_GET_CONTENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + startActivityForResult(intent, REQUEST_CODE); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + InputStream stream = null; + if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) + try { + // recyle unused bitmaps + if (bitmap != null) { + bitmap.recycle(); + } + stream = getContentResolver().openInputStream(data.getData()); + bitmap = BitmapFactory.decodeStream(stream); + + imageView.setImageBitmap(bitmap); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } finally { + if (stream != null) + try { + stream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} + diff --git a/IntentApps4/app/src/main/res/drawable-hdpi/ic_launcher.png b/IntentApps4/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/IntentApps4/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/IntentApps4/app/src/main/res/drawable-mdpi/ic_launcher.png b/IntentApps4/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/IntentApps4/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/IntentApps4/app/src/main/res/drawable-xhdpi/ic_launcher.png b/IntentApps4/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/IntentApps4/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/IntentApps4/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/IntentApps4/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/IntentApps4/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/IntentApps4/app/src/main/res/layout/activity_image_pick.xml b/IntentApps4/app/src/main/res/layout/activity_image_pick.xml new file mode 100644 index 0000000..423cbe4 --- /dev/null +++ b/IntentApps4/app/src/main/res/layout/activity_image_pick.xml @@ -0,0 +1,22 @@ + + + + + + + + + \ No newline at end of file diff --git a/IntentApps4/app/src/main/res/menu/menu_image_pick.xml b/IntentApps4/app/src/main/res/menu/menu_image_pick.xml new file mode 100644 index 0000000..412a6fd --- /dev/null +++ b/IntentApps4/app/src/main/res/menu/menu_image_pick.xml @@ -0,0 +1,6 @@ + + + diff --git a/IntentApps4/app/src/main/res/values-w820dp/dimens.xml b/IntentApps4/app/src/main/res/values-w820dp/dimens.xml new file mode 100644 index 0000000..63fc816 --- /dev/null +++ b/IntentApps4/app/src/main/res/values-w820dp/dimens.xml @@ -0,0 +1,6 @@ + + + 64dp + diff --git a/IntentApps4/app/src/main/res/values/dimens.xml b/IntentApps4/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..47c8224 --- /dev/null +++ b/IntentApps4/app/src/main/res/values/dimens.xml @@ -0,0 +1,5 @@ + + + 16dp + 16dp + diff --git a/IntentApps4/app/src/main/res/values/strings.xml b/IntentApps4/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..3b73f7b --- /dev/null +++ b/IntentApps4/app/src/main/res/values/strings.xml @@ -0,0 +1,8 @@ + + + + IntentApps4 + Hello world! + Settings + + diff --git a/IntentApps4/app/src/main/res/values/styles.xml b/IntentApps4/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..766ab99 --- /dev/null +++ b/IntentApps4/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/IntentApps4/build.gradle b/IntentApps4/build.gradle new file mode 100644 index 0000000..6356aab --- /dev/null +++ b/IntentApps4/build.gradle @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.0.0' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} diff --git a/IntentApps4/gradle.properties b/IntentApps4/gradle.properties new file mode 100644 index 0000000..1d3591c --- /dev/null +++ b/IntentApps4/gradle.properties @@ -0,0 +1,18 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true \ No newline at end of file diff --git a/IntentApps4/gradle/wrapper/gradle-wrapper.jar b/IntentApps4/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..8c0fb64 Binary files /dev/null and b/IntentApps4/gradle/wrapper/gradle-wrapper.jar differ diff --git a/IntentApps4/gradle/wrapper/gradle-wrapper.properties b/IntentApps4/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0c71e76 --- /dev/null +++ b/IntentApps4/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Wed Apr 10 15:27:10 PDT 2013 +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 diff --git a/IntentApps4/gradlew.bat b/IntentApps4/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/IntentApps4/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/IntentApps4/settings.gradle b/IntentApps4/settings.gradle new file mode 100644 index 0000000..e7b4def --- /dev/null +++ b/IntentApps4/settings.gradle @@ -0,0 +1 @@ +include ':app' diff --git a/LifecycleApp/.gitignore b/LifecycleApp/.gitignore new file mode 100644 index 0000000..afbdab3 --- /dev/null +++ b/LifecycleApp/.gitignore @@ -0,0 +1,6 @@ +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build diff --git a/LifecycleApp/.idea/.name b/LifecycleApp/.idea/.name new file mode 100644 index 0000000..4b1eba4 --- /dev/null +++ b/LifecycleApp/.idea/.name @@ -0,0 +1 @@ +LifecycleApp \ No newline at end of file diff --git a/LifecycleApp/.idea/compiler.xml b/LifecycleApp/.idea/compiler.xml new file mode 100644 index 0000000..217af47 --- /dev/null +++ b/LifecycleApp/.idea/compiler.xml @@ -0,0 +1,23 @@ + + + + + + diff --git a/LifecycleApp/.idea/copyright/profiles_settings.xml b/LifecycleApp/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/LifecycleApp/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/LifecycleApp/.idea/encodings.xml b/LifecycleApp/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/LifecycleApp/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/LifecycleApp/.idea/gradle.xml b/LifecycleApp/.idea/gradle.xml new file mode 100644 index 0000000..2cbb09b --- /dev/null +++ b/LifecycleApp/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + + diff --git a/LifecycleApp/.idea/misc.xml b/LifecycleApp/.idea/misc.xml new file mode 100644 index 0000000..59436c9 --- /dev/null +++ b/LifecycleApp/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/LifecycleApp/.idea/modules.xml b/LifecycleApp/.idea/modules.xml new file mode 100644 index 0000000..df099de --- /dev/null +++ b/LifecycleApp/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/LifecycleApp/.idea/scopes/scope_settings.xml b/LifecycleApp/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/LifecycleApp/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/LifecycleApp/.idea/vcs.xml b/LifecycleApp/.idea/vcs.xml new file mode 100644 index 0000000..def6a6a --- /dev/null +++ b/LifecycleApp/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/LifecycleApp/LifecycleApp.iml b/LifecycleApp/LifecycleApp.iml new file mode 100644 index 0000000..2a02201 --- /dev/null +++ b/LifecycleApp/LifecycleApp.iml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/LifecycleApp/app/.gitignore b/LifecycleApp/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/LifecycleApp/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/LifecycleApp/app/app.iml b/LifecycleApp/app/app.iml new file mode 100644 index 0000000..c6c55c4 --- /dev/null +++ b/LifecycleApp/app/app.iml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/LifecycleApp/app/build.gradle b/LifecycleApp/app/build.gradle new file mode 100644 index 0000000..fa1b36d --- /dev/null +++ b/LifecycleApp/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 21 + buildToolsVersion "21.1.2" + defaultConfig { + applicationId "activity.lifecycle.android.vogella.com.lifecycleapp" + minSdkVersion 16 + targetSdkVersion 21 + versionCode 1 + versionName "1.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + productFlavors { + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + compile 'com.android.support:appcompat-v7:21.0.3' +} diff --git a/LifecycleApp/app/proguard-rules.pro b/LifecycleApp/app/proguard-rules.pro new file mode 100644 index 0000000..a3c7c26 --- /dev/null +++ b/LifecycleApp/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\Users\USER\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/LifecycleApp/app/src/androidTest/java/activity/lifecycle/android/vogella/com/lifecycleapp/ApplicationTest.java b/LifecycleApp/app/src/androidTest/java/activity/lifecycle/android/vogella/com/lifecycleapp/ApplicationTest.java new file mode 100644 index 0000000..f49a0bf --- /dev/null +++ b/LifecycleApp/app/src/androidTest/java/activity/lifecycle/android/vogella/com/lifecycleapp/ApplicationTest.java @@ -0,0 +1,13 @@ +package activity.lifecycle.android.vogella.com.lifecycleapp; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/LifecycleApp/app/src/main/AndroidManifest.xml b/LifecycleApp/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..9a994f5 --- /dev/null +++ b/LifecycleApp/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + diff --git a/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/MainActivity.java b/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/MainActivity.java new file mode 100644 index 0000000..6dbebf6 --- /dev/null +++ b/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/MainActivity.java @@ -0,0 +1,51 @@ +package activity.lifecycle.android.vogella.com.lifecycleapp; + +import android.content.Intent; +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.Spinner; + + +public class MainActivity extends TracerActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Spinner spinner = (Spinner) findViewById(R.id.spinner); + String[] values = getResources().getStringArray(R.array.operating_system); + ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,values); + spinner.setAdapter(adapter); + } + + public void onClick(View view) { + Intent intent = new Intent(this,SecondActivity.class); + startActivity(intent); + } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/SecondActivity.java b/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/SecondActivity.java new file mode 100644 index 0000000..1468f63 --- /dev/null +++ b/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/SecondActivity.java @@ -0,0 +1,39 @@ +package activity.lifecycle.android.vogella.com.lifecycleapp; + +import android.support.v7.app.ActionBarActivity; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuItem; + + +public class SecondActivity extends TracerActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_second); + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_second, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/TracerActivity.java b/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/TracerActivity.java new file mode 100644 index 0000000..61a4474 --- /dev/null +++ b/LifecycleApp/app/src/main/java/activity/lifecycle/android/vogella/com/lifecycleapp/TracerActivity.java @@ -0,0 +1,66 @@ +package activity.lifecycle.android.vogella.com.lifecycleapp; + +import android.app.Activity; +import android.app.Notification; +import android.app.NotificationManager; +import android.os.Bundle; + + +/** + * Created by USER on 2/8/2015. + */ +public class TracerActivity extends Activity{ + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + notify("onCreate"); + } + + @Override + protected void onPause() { + super.onPause(); + notify("onPause"); + } + + @Override + protected void onResume() { + super.onResume(); + notify("onResume"); + } + + @Override + protected void onStop() { + super.onStop(); + notify("onStop"); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + notify("onDestroy"); + } + + @Override + protected void onRestoreInstanceState(Bundle savedInstanceState) { + super.onRestoreInstanceState(savedInstanceState); + notify("onRestoreInstanceState"); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + notify("onSaveInstanceState"); + } + + private void notify(String methodName) { + String name = this.getClass().getName(); + String[] strings = name.split("\\."); + Notification noti = new Notification.Builder(this) + .setContentTitle(methodName + " " + strings[strings.length-1]).setAutoCancel(true) + .setSmallIcon(R.drawable.ic_launcher) + .setContentText(name).build(); + NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); + notificationManager.notify((int)System.currentTimeMillis(),noti); + } + +} diff --git a/LifecycleApp/app/src/main/res/drawable-hdpi/ic_launcher.png b/LifecycleApp/app/src/main/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..96a442e Binary files /dev/null and b/LifecycleApp/app/src/main/res/drawable-hdpi/ic_launcher.png differ diff --git a/LifecycleApp/app/src/main/res/drawable-mdpi/ic_launcher.png b/LifecycleApp/app/src/main/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..359047d Binary files /dev/null and b/LifecycleApp/app/src/main/res/drawable-mdpi/ic_launcher.png differ diff --git a/LifecycleApp/app/src/main/res/drawable-xhdpi/ic_launcher.png b/LifecycleApp/app/src/main/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..71c6d76 Binary files /dev/null and b/LifecycleApp/app/src/main/res/drawable-xhdpi/ic_launcher.png differ diff --git a/LifecycleApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/LifecycleApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..4df1894 Binary files /dev/null and b/LifecycleApp/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/LifecycleApp/app/src/main/res/layout/activity_main.xml b/LifecycleApp/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..e2d3a62 --- /dev/null +++ b/LifecycleApp/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,28 @@ + + + + +