├── .gitignore
├── Part 1 - Android Studio
├── .gitignore
├── .idea
│ ├── gradle.xml
│ ├── kotlinc.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── runConfigurations.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── owl
│ │ │ └── intro_to_android
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── owl
│ │ │ │ └── intro_to_android
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── owl
│ │ └── intro_to_android
│ │ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── Part 2 - Fundamentals of Kotlin
├── .gitignore
├── .idea
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── runConfigurations.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── owl
│ │ │ └── intro_to_kotlin
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── owl
│ │ │ │ └── intro_to_kotlin
│ │ │ │ ├── Clothing.kt
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── Shoes.kt
│ │ │ │ └── Texts
│ │ │ │ ├── Classes_and_Objects_Texts
│ │ │ │ ├── Collections_Texts
│ │ │ │ ├── Control_Flow_Texts
│ │ │ │ ├── Functions_Texts
│ │ │ │ └── Variables_Texts
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ └── activity_main.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── owl
│ │ └── intro_to_kotlin
│ │ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── Part 3 - Android App Bootcamp
├── .gitignore
├── .idea
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── runConfigurations.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── owl
│ │ │ └── todolist
│ │ │ └── ExampleInstrumentedTest.kt
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── owl
│ │ │ │ └── todolist
│ │ │ │ ├── AddItemActivity.kt
│ │ │ │ ├── DatabaseInfo.kt
│ │ │ │ ├── DatabaseOperations.kt
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── TodoItem.kt
│ │ │ │ └── TodoItemsAdapter.kt
│ │ └── res
│ │ │ ├── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ │ ├── drawable
│ │ │ └── ic_launcher_background.xml
│ │ │ ├── layout
│ │ │ ├── activity_add_item.xml
│ │ │ ├── activity_main.xml
│ │ │ └── to_do_item_layout.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── owl
│ │ └── todolist
│ │ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS generated files
2 | .DS_Store
3 | .DS_Store?
4 | ._*
5 | .Spotlight-V100
6 | .Trashes
7 | Icon?
8 | ehthumbs.db
9 | Thumbs.db
10 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 27
9 | defaultConfig {
10 | applicationId "com.example.owl.intro_to_android"
11 | minSdkVersion 27
12 | targetSdkVersion 27
13 | versionCode 1
14 | versionName "1.0"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | buildToolsVersion '27.0.1'
24 | productFlavors {
25 | }
26 | }
27 |
28 | dependencies {
29 | implementation fileTree(include: ['*.jar'], dir: 'libs')
30 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
31 | implementation 'com.android.support:appcompat-v7:26.1.0'
32 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
33 | testImplementation 'junit:junit:4.12'
34 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
35 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
36 | }
37 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/androidTest/java/com/example/owl/intro_to_android/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.intro_to_android
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.example.owl.intro_to_android", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/java/com/example/owl/intro_to_android/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.intro_to_android
2 |
3 | import android.support.v7.app.AppCompatActivity
4 | import android.os.Bundle
5 | import android.util.Log
6 | import android.view.View
7 | import android.widget.Button
8 | import android.widget.TextView
9 |
10 | class MainActivity : AppCompatActivity() {
11 |
12 | lateinit var textView: TextView
13 |
14 | override fun onCreate(savedInstanceState: Bundle?) {
15 | super.onCreate(savedInstanceState)
16 | setContentView(R.layout.activity_main)
17 |
18 | textView = findViewById(R.id.text_view)
19 | }
20 |
21 | fun pressButtonAction(view: View) {
22 | val textViewText = textView.text.toString()
23 | val button = view as Button
24 | val buttonText = button.text.toString()
25 | textView.text = buttonText
26 | Log.d("MainActivity", textViewText)
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Intro to Android
3 | Press me!
4 | Enter text here
5 |
6 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/app/src/test/java/com/example/owl/intro_to_android/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.intro_to_android
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.2.30'
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 1 - Android Studio/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Part 1 - Android Studio/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Mar 23 15:14:03 PDT 2018
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-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/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 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/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 |
--------------------------------------------------------------------------------
/Part 1 - Android Studio/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 26
9 | defaultConfig {
10 | applicationId "com.example.owl.intro_to_kotlin"
11 | minSdkVersion 27
12 | targetSdkVersion 26
13 | versionCode 1
14 | versionName "1.0"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
28 | implementation 'com.android.support:appcompat-v7:26.1.0'
29 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
33 | }
34 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/androidTest/java/com/example/owl/intro_to_kotlin/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.intro_to_kotlin
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.example.owl.intro_to_kotlin", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/java/com/example/owl/intro_to_kotlin/Clothing.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.intro_to_kotlin
2 |
3 | open class Clothing(var name: String, var size: Int) {
4 |
5 | var isClean: Boolean = false
6 |
7 | constructor(name: String, size: Int, isClean: Boolean): this(name, size) {
8 | this.isClean = isClean
9 | }
10 |
11 | open fun washClothing() {
12 | this.isClean = true
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/java/com/example/owl/intro_to_kotlin/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.intro_to_kotlin
2 |
3 | import android.support.v7.app.AppCompatActivity
4 | import android.os.Bundle
5 | import android.util.Log
6 |
7 | class MainActivity : AppCompatActivity() {
8 |
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 | setContentView(R.layout.activity_main)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/java/com/example/owl/intro_to_kotlin/Shoes.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.intro_to_kotlin
2 |
3 | class ShoesWithLaces(name: String, size: Int): Clothing(name, size) {
4 |
5 | var lacesName: String? = null
6 | var areLacesClean: Boolean = false
7 | var areShoesLaced: Boolean = false
8 |
9 | fun laceShoes(name: String) {
10 | this.lacesName = name
11 | this.areLacesClean = true
12 | areShoesLaced = true
13 | }
14 |
15 | override fun washClothing() {
16 | super.washClothing()
17 | areLacesClean = true
18 | }
19 |
20 | }
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/java/com/example/owl/intro_to_kotlin/Texts/Classes_and_Objects_Texts:
--------------------------------------------------------------------------------
1 | - Intro to classes and objects
2 | - Fields, constructors, methods
3 | - Instantiating classes
4 |
5 | package com.example.owl.intro_to_kotlin
6 |
7 | open class Clothing(var name: String, var size: Int) {
8 |
9 | var isClean: Boolean = false
10 |
11 | constructor(name: String, size: Int, isClean: Boolean): this(name, size) {
12 | this.isClean = isClean
13 | }
14 |
15 | open fun washClothing() {
16 | this.isClean = true
17 | }
18 |
19 | }
20 |
21 | override fun onCreate(savedInstanceState: Bundle?) {
22 | super.onCreate(savedInstanceState)
23 | setContentView(R.layout.activity_main)
24 |
25 | val t_shirt: Clothing = Clothing("t-shirt", 6)
26 | val isClean = t_shirt.isClean
27 | t_shirt.washClothing()
28 |
29 | }
30 |
31 | **********************************************************************************************
32 |
33 | - Subclassing and superclassing
34 |
35 | package com.example.owl.intro_to_kotlin
36 |
37 | class ShoesWithLaces(name: String, size: Int): Clothing(name, size) {
38 |
39 | var lacesName: String? = null
40 | var areLacesClean: Boolean = false
41 | var areShoesLaced: Boolean = false
42 |
43 | fun laceShoes(name: String) {
44 | this.lacesName = name
45 | this.areLacesClean = true
46 | areShoesLaced = true
47 | }
48 |
49 | override fun washClothing() {
50 | super.washClothing()
51 | areLacesClean = true
52 | }
53 |
54 | }
55 |
56 | override fun onCreate(savedInstanceState: Bundle?) {
57 | super.onCreate(savedInstanceState)
58 | setContentView(R.layout.activity_main)
59 |
60 | val t_shirt: Clothing = Clothing("t-shirt", 6)
61 | val isClean = t_shirt.isClean
62 | t_shirt.washClothing()
63 |
64 | val sneakers: ShoesWithLaces = ShoesWithLaces("sneakers", 10)
65 | sneakers.laceShoes("checkered laces")
66 | sneakers.washClothing()
67 |
68 | }
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/java/com/example/owl/intro_to_kotlin/Texts/Collections_Texts:
--------------------------------------------------------------------------------
1 | - Collections
2 | - What are lists and arrays
3 | - Non mutable lists and arrays
4 |
5 | // non-mutable lists, arrays
6 | // val/var name = listof(val1, val2, ...)
7 |
8 | var weekdays = listOf("Monday", "Tuesday", "Wednesday", "Thursday", "Friday")
9 | weekdays.get(4)
10 | weekdays[4]
11 | weekdays[3]
12 | weekdays = listOf("")
13 |
14 | val trueOrFalseAnswerKey = arrayOf(false, true, true, false, false)
15 | trueOrFalseAnswerKey.set(2, false)
16 | trueOrFalseAnswerKey[2] = false
17 |
18 | **********************************************************************************************
19 |
20 | - Mutable lists and arraylists
21 |
22 | // Mutable lists and arrays
23 | var roster = mutableListOf("Nimish", "Sarah", "John")
24 | roster.add("Tracy")
25 | val nimish: String = roster.removeAt(0)
26 |
27 | val bread: String = "Bread"
28 | var shoppingList = arrayListOf("Eggs", "Butter", "Shoes")
29 | shoppingList.add(0, bread)
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/java/com/example/owl/intro_to_kotlin/Texts/Control_Flow_Texts:
--------------------------------------------------------------------------------
1 | - Control flow
2 | - What control flow is
3 | - If statements and expressions
4 |
5 | // if (condition to test) { execute code if true }
6 |
7 | var isDoorOpen: Boolean = false
8 | var isDoorLocked: Boolean = true
9 | var doesHaveKey: Boolean = true
10 | var action: String = ""
11 |
12 | if (isDoorLocked == true && doesHaveKey == false) {
13 | action = "Leave"
14 | } else if (isDoorOpen == true) {
15 | action = "Enter"
16 | } else {
17 | action = "Open door"
18 | }
19 |
20 | action = if (isDoorOpen == true) "Enter" else "Leave"
21 |
22 | **********************************************************************************************
23 |
24 | - When statements and expressions
25 |
26 | // When statements and expressions
27 |
28 | when (isDoorOpen) {
29 | true -> action = "Enter"
30 | false -> action = "Leave"
31 | else -> {}
32 | }
33 |
34 | **********************************************************************************************
35 |
36 | - While loops
37 |
38 | // While loops
39 | // while (condition to test) { code to execute if condition returns true }
40 | var current: Int = 1
41 | val max: Int = 100
42 | var total: Int = 0
43 | while (current <= 100) {
44 | total += current
45 | current += 1
46 | }
47 |
48 | **********************************************************************************************
49 |
50 | - For each loops
51 |
52 | // For in loops
53 |
54 | val roster = listOf("Nimish", "Suzie", "Jack", "Jill")
55 | var namesString: String = ""
56 |
57 | for (name in roster) {
58 | Log.d("mainActivity", name)
59 | namesString += name + ", "
60 | }
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/java/com/example/owl/intro_to_kotlin/Texts/Functions_Texts:
--------------------------------------------------------------------------------
1 | - Functions
2 | - What are functions
3 | - How to implement and call functions
4 |
5 | var playerPosition: Int = 0
6 |
7 | override fun onCreate(savedInstanceState: Bundle?) {
8 | super.onCreate(savedInstanceState)
9 | setContentView(R.layout.activity_main)
10 |
11 | // Function intro
12 | move()
13 | }
14 |
15 | fun move() {
16 | playerPosition += 2
17 | }
18 |
19 | **********************************************************************************************
20 |
21 | - Functions with parameters
22 | - Functions with return values
23 |
24 | var playerPosition: Int = 0
25 | val maxPosition: Int = 10
26 | val minPosition: Int = 0
27 |
28 | override fun onCreate(savedInstanceState: Bundle?) {
29 | super.onCreate(savedInstanceState)
30 | setContentView(R.layout.activity_main)
31 |
32 | // Function intro
33 | // move()
34 | val isValidMove = move(5)
35 | }
36 |
37 | fun move() {
38 | playerPosition += 2
39 | }
40 |
41 | // Functions with parameters
42 |
43 | fun move(byAmount: Int): Boolean {
44 | if (playerPosition + byAmount > maxPosition || playerPosition + byAmount < minPosition) {
45 | return false
46 | } else {
47 | playerPosition += byAmount
48 | return true
49 | }
50 | }
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/java/com/example/owl/intro_to_kotlin/Texts/Variables_Texts:
--------------------------------------------------------------------------------
1 | // Basic variable types
2 | // Primitive types, strings
3 | // Set up and usage
4 |
5 | // val/var name: type
6 | // name = value
7 | // Ints, Floats, Doubles, Booleans, Chars, Strings
8 |
9 | var todaysDate: Int = 27
10 | todaysDate = 28
11 | val daysInMarch: Int = 31
12 |
13 | var bankBalance: Float = 500.50f
14 | val itemCost: Double = 100.99
15 |
16 | var isDoorOpen: Boolean = true
17 |
18 | val spaceCharacter: Char = ' '
19 |
20 | val firstName: String = "Nimish"
21 |
22 | **********************************************************************************************
23 |
24 | // Basic variable operations
25 | // Assignment and arithmetic
26 | // Conditional
27 |
28 | // Operations
29 | // assignment: = !
30 | // arithmetic: + - * / % += -= *= /=
31 | // conditional: > >= < <= != == is
32 |
33 | val isDoorClosed: Boolean = !isDoorOpen
34 |
35 | val tomorrowsDate: Int = todaysDate + 1
36 | // bankBalance = bankBalance - 5.5f
37 | bankBalance -= 5.5f
38 |
39 | val modTodaysDate = todaysDate % 5
40 |
41 | val isNameString: Boolean = firstName is String
42 |
43 | val fullName: String = firstName + "Narang"
44 |
45 | val isGreater: Boolean = firstName > "Narang"
46 |
47 | val stringTodaysDate: String = todaysDate.toString()
48 |
49 | **********************************************************************************************
50 |
51 | // Nullable variables
52 | // Null value
53 | // Safe null value checks
54 | s
55 | // Nullables
56 | var lastName: String? = "Narang"
57 | val length: Int? = lastName?.length
58 | // val length: Int = lastName!!.length
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Intro_to_Kotlin
3 |
4 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/app/src/test/java/com/example/owl/intro_to_kotlin/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.intro_to_kotlin
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.2.30'
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 2 - Fundamentals of Kotlin/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Mar 27 11:37:36 PDT 2018
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-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/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 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/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 |
--------------------------------------------------------------------------------
/Part 2 - Fundamentals of Kotlin/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | apply plugin: 'kotlin-android'
4 |
5 | apply plugin: 'kotlin-android-extensions'
6 |
7 | android {
8 | compileSdkVersion 27
9 | defaultConfig {
10 | applicationId "com.example.owl.todolist"
11 | minSdkVersion 27
12 | targetSdkVersion 26
13 | versionCode 1
14 | versionName "1.0"
15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: 'libs', include: ['*.jar'])
27 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
28 | implementation 'com.android.support:appcompat-v7:27.1.0'
29 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
30 | testImplementation 'junit:junit:4.12'
31 | androidTestImplementation 'com.android.support.test:runner:1.0.1'
32 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
33 | implementation 'com.android.support:recyclerview-v7:27.1.0'
34 | }
35 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/androidTest/java/com/example/owl/todolist/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.todolist
2 |
3 | import android.support.test.InstrumentationRegistry
4 | import android.support.test.runner.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getTargetContext()
22 | assertEquals("com.example.owl.todolist", appContext.packageName)
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/java/com/example/owl/todolist/AddItemActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.todolist
2 |
3 | import android.content.Intent
4 | import android.support.v7.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.view.View
7 | import android.widget.CheckBox
8 | import android.widget.EditText
9 | import android.widget.TextView
10 |
11 | class AddItemActivity : AppCompatActivity() {
12 |
13 | private lateinit var itemNameEditText: EditText
14 | private lateinit var isUrgentCheckBox: CheckBox
15 | private lateinit var titleTextView: TextView
16 |
17 | private var isNewItem = true
18 | private lateinit var oldItem: TodoItem
19 |
20 | override fun onCreate(savedInstanceState: Bundle?) {
21 | super.onCreate(savedInstanceState)
22 | setContentView(R.layout.activity_add_item)
23 |
24 | itemNameEditText = findViewById(R.id.item_name_edit_text)
25 | isUrgentCheckBox = findViewById(R.id.is_urgent_checkbox)
26 | titleTextView = findViewById(R.id.add_item_title_text_view)
27 |
28 | val itemName = intent.getStringExtra("ITEM_NAME")
29 | val itemUrgency = intent.getBooleanExtra("ITEM_URGENCY", false)
30 |
31 | if (itemName != null) {
32 | itemNameEditText.setText(itemName)
33 | titleTextView.setText(R.string.edit_item_message)
34 |
35 | oldItem = TodoItem(itemName)
36 | isNewItem = false
37 | }
38 | if (itemUrgency == true) {
39 | isUrgentCheckBox.isChecked = true
40 |
41 | oldItem.isUrgent = itemUrgency
42 | }
43 | }
44 |
45 | public fun saveItemAction(view: View) {
46 | val itemName = itemNameEditText.text.toString()
47 | val isItemUrgent = isUrgentCheckBox.isChecked
48 | val newTodoItem = TodoItem(itemName, isItemUrgent)
49 |
50 | val dbo = DatabaseOperations(this)
51 | if (isNewItem) {
52 | dbo.addItem(dbo, newTodoItem)
53 | } else {
54 | dbo.updateItem(dbo, this.oldItem, newTodoItem)
55 | }
56 | val intent: Intent = Intent(this, MainActivity::class.java)
57 | startActivity(intent)
58 | }
59 |
60 | public fun cancelAction(view: View) {
61 | val intent: Intent = Intent(this, MainActivity::class.java)
62 | startActivity(intent)
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/java/com/example/owl/todolist/DatabaseInfo.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.todolist
2 |
3 | import android.provider.BaseColumns
4 |
5 | object DatabaseInfo {
6 |
7 | const val SQL_CREATE_TABLE_QUERY =
8 | "CREATE TABLE ${TableInfo.TABLE_NAME} (" +
9 | "${BaseColumns._ID} INTEGER PRIMARY KEY," +
10 | "${TableInfo.COLUMN_ITEM_NAME} TEXT," +
11 | "${TableInfo.COLUMN_ITEM_URGENCY} INTEGER," +
12 | "${TableInfo.COLUMN_DATE} TEXT)"
13 |
14 | const val SQL_DELETE_TABLE_QUERY = "DROP TABLE IF EXISTS ${TableInfo.TABLE_NAME}"
15 |
16 | object TableInfo: BaseColumns {
17 | const val TABLE_NAME = "todoItemsTable"
18 | const val COLUMN_ITEM_NAME = "itemName"
19 | const val COLUMN_ITEM_URGENCY = "itemUrgency"
20 | const val COLUMN_DATE = "itemDate"
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/java/com/example/owl/todolist/DatabaseOperations.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.todolist
2 |
3 | import android.content.ContentValues
4 | import android.content.Context
5 | import android.database.Cursor
6 | import android.database.sqlite.SQLiteDatabase
7 | import android.database.sqlite.SQLiteOpenHelper
8 | import android.provider.BaseColumns
9 |
10 | class DatabaseOperations(context: Context): SQLiteOpenHelper(
11 | context, DATABASE_NAME, null, DATABASE_VERSION) {
12 |
13 | companion object {
14 | const val DATABASE_NAME = "TodoItems.db"
15 | const val DATABASE_VERSION = 1
16 | }
17 |
18 | override fun onCreate(db: SQLiteDatabase) {
19 | db.execSQL(DatabaseInfo.SQL_CREATE_TABLE_QUERY)
20 | }
21 |
22 | override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
23 | db.execSQL(DatabaseInfo.SQL_DELETE_TABLE_QUERY)
24 | onCreate(db)
25 | }
26 |
27 | override fun onDowngrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
28 | onUpgrade(db, oldVersion, newVersion)
29 | }
30 |
31 | // add, fetch, modify/update, delete
32 |
33 | fun addItem(dbo: DatabaseOperations, todoItem: TodoItem) {
34 | val db = dbo.writableDatabase
35 | val itemName = todoItem.name
36 | val isItemUrgent = todoItem.isUrgent
37 | val itemUrgency = if (isItemUrgent) 1 else 0
38 | val itemDate = todoItem.getDateAsString()
39 |
40 | val contentValues = ContentValues().apply {
41 | put(DatabaseInfo.TableInfo.COLUMN_ITEM_NAME, itemName)
42 | put(DatabaseInfo.TableInfo.COLUMN_ITEM_URGENCY, itemUrgency)
43 | put(DatabaseInfo.TableInfo.COLUMN_DATE, itemDate)
44 | }
45 |
46 | val rowID = db.insert(DatabaseInfo.TableInfo.TABLE_NAME, null, contentValues)
47 | }
48 |
49 | fun getAllItems(dbo: DatabaseOperations): Cursor {
50 | val db = dbo.readableDatabase
51 | val projection = arrayOf(
52 | BaseColumns._ID,
53 | DatabaseInfo.TableInfo.COLUMN_ITEM_NAME,
54 | DatabaseInfo.TableInfo.COLUMN_ITEM_URGENCY,
55 | DatabaseInfo.TableInfo.COLUMN_DATE)
56 | val selection = ""
57 | val selectionArgs = null
58 | val sortOrder = null
59 |
60 | val cursor = db.query(
61 | DatabaseInfo.TableInfo.TABLE_NAME,
62 | projection,
63 | selection,
64 | selectionArgs,
65 | null,
66 | null,
67 | sortOrder
68 | )
69 | return cursor
70 | }
71 |
72 | fun updateItem(dbo: DatabaseOperations, oldItem: TodoItem, newItem: TodoItem) {
73 | val db = dbo.writableDatabase
74 | val itemName = newItem.name
75 | val isItemUrgent = newItem.isUrgent
76 | val itemUrgency = if (isItemUrgent) 1 else 0
77 | val itemDate = newItem.getDateAsString()
78 |
79 | val contentValues = ContentValues().apply {
80 | put(DatabaseInfo.TableInfo.COLUMN_ITEM_NAME, itemName)
81 | put(DatabaseInfo.TableInfo.COLUMN_ITEM_URGENCY, itemUrgency)
82 | put(DatabaseInfo.TableInfo.COLUMN_DATE, itemDate)
83 | }
84 |
85 | val selection = "${DatabaseInfo.TableInfo.COLUMN_ITEM_NAME} LIKE ?"
86 | val selectionArgs = arrayOf(oldItem.name)
87 |
88 | val count = db.update(DatabaseInfo.TableInfo.TABLE_NAME, contentValues, selection, selectionArgs)
89 | }
90 |
91 | fun deleteItem(dbo: DatabaseOperations, todoItem: TodoItem) {
92 | val db = dbo.writableDatabase
93 | val selection = "${DatabaseInfo.TableInfo.COLUMN_ITEM_NAME} LIKE ?"
94 | val selectionArgs = arrayOf(todoItem.name)
95 |
96 | val deletedRows = db.delete(DatabaseInfo.TableInfo.TABLE_NAME, selection, selectionArgs)
97 | }
98 |
99 | }
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/java/com/example/owl/todolist/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.todolist
2 |
3 | import android.content.Intent
4 | import android.support.v7.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.support.v7.widget.LinearLayoutManager
7 | import android.support.v7.widget.RecyclerView
8 | import android.view.View
9 | import android.widget.Button
10 | import java.util.*
11 |
12 | class MainActivity : AppCompatActivity() {
13 |
14 | private lateinit var todoItemRecyclerView: RecyclerView
15 | private lateinit var recyclerAdapter: TodoItemsAdapter
16 | private lateinit var recyclerLayoutManager: RecyclerView.LayoutManager
17 | private lateinit var todaysItemsButton: Button
18 | private lateinit var pastItemsButton: Button
19 |
20 | var todoItemsList = ArrayList()
21 | var todaysItemsList = ArrayList()
22 | var pastItemsList = ArrayList()
23 |
24 | override fun onCreate(savedInstanceState: Bundle?) {
25 | super.onCreate(savedInstanceState)
26 | setContentView(R.layout.activity_main)
27 |
28 | val dbo = DatabaseOperations(this)
29 | val cursor = dbo.getAllItems(dbo)
30 | with(cursor) {
31 | while(moveToNext()) {
32 | val itemName = getString(getColumnIndex(DatabaseInfo.TableInfo.COLUMN_ITEM_NAME))
33 | val itemUrgency = getInt(getColumnIndex(DatabaseInfo.TableInfo.COLUMN_ITEM_URGENCY))
34 | val itemDate = getString(getColumnIndex(DatabaseInfo.TableInfo.COLUMN_DATE))
35 | val isUrgent = if (itemUrgency == 0) false else true
36 |
37 | val newTodoItems = TodoItem(itemName, isUrgent)
38 | newTodoItems.dateString = itemDate
39 | todoItemsList.add(newTodoItems)
40 |
41 | if (itemDate == getDateAsString()) {
42 | todaysItemsList.add(newTodoItems)
43 | } else {
44 | pastItemsList.add(newTodoItems)
45 | }
46 | }
47 | }
48 |
49 | todoItemRecyclerView = findViewById(R.id.todo_item_recycler_view)
50 | todaysItemsButton = findViewById(R.id.todays_items_button)
51 | pastItemsButton = findViewById(R.id.past_items_button)
52 |
53 | recyclerLayoutManager = LinearLayoutManager(this)
54 | recyclerAdapter = TodoItemsAdapter(todoItemsList, this)
55 |
56 | todoItemRecyclerView.apply {
57 | setHasFixedSize(true)
58 | layoutManager = recyclerLayoutManager
59 | adapter = recyclerAdapter
60 | }
61 | }
62 |
63 | public fun displayTodaysItems(view: View) {
64 | recyclerAdapter = TodoItemsAdapter(todaysItemsList, this)
65 |
66 | todoItemRecyclerView.apply {
67 | setHasFixedSize(true)
68 | layoutManager = recyclerLayoutManager
69 | adapter = recyclerAdapter
70 | }
71 | todaysItemsButton.background = getDrawable(R.color.pureBlack)
72 | todaysItemsButton.setTextColor(getColor(R.color.pureWhite))
73 | pastItemsButton.background = getDrawable(R.color.pureWhite)
74 | pastItemsButton.setTextColor(getColor(R.color.pureBlack))
75 | }
76 |
77 | public fun displayPastItems(view: View) {
78 | recyclerAdapter = TodoItemsAdapter(pastItemsList, this)
79 |
80 | todoItemRecyclerView.apply {
81 | setHasFixedSize(true)
82 | layoutManager = recyclerLayoutManager
83 | adapter = recyclerAdapter
84 | }
85 | todaysItemsButton.background = getDrawable(R.color.pureWhite)
86 | todaysItemsButton.setTextColor(getColor(R.color.pureBlack))
87 | pastItemsButton.background = getDrawable(R.color.pureBlack)
88 | pastItemsButton.setTextColor(getColor(R.color.pureWhite))
89 | }
90 |
91 | public fun navToAddItemAction(view: View) {
92 | val intent: Intent = Intent(this, AddItemActivity::class.java)
93 | startActivity(intent)
94 | }
95 |
96 | fun getDateAsString(): String {
97 | val date = Calendar.getInstance()
98 | val year = date.get(Calendar.YEAR).toString()
99 | val month = date.get(Calendar.MONTH).toString()
100 | val day = date.get(Calendar.DAY_OF_MONTH).toString()
101 | return "$year/$month/$day"
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/java/com/example/owl/todolist/TodoItem.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.todolist
2 |
3 | import java.util.*
4 |
5 | class TodoItem(var name: String) {
6 |
7 | var isUrgent = false
8 | var date = Calendar.getInstance()
9 | var dateString: String = getDateAsString()
10 |
11 | constructor(name: String, isUrgent: Boolean): this(name) {
12 | this.isUrgent = isUrgent
13 | }
14 |
15 | fun getDateAsString(): String {
16 | val year = date.get(Calendar.YEAR).toString()
17 | val month = date.get(Calendar.MONTH).toString()
18 | val day = date.get(Calendar.DAY_OF_MONTH).toString()
19 | return "$year/$month/$day"
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/java/com/example/owl/todolist/TodoItemsAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.todolist
2 |
3 | import android.content.Intent
4 | import android.support.constraint.ConstraintLayout
5 | import android.support.v7.widget.RecyclerView
6 | import android.view.LayoutInflater
7 | import android.view.View
8 | import android.view.ViewGroup
9 | import android.widget.TextView
10 |
11 | class TodoItemsAdapter(private val todoItemsList: ArrayList, val activity: MainActivity):
12 | RecyclerView.Adapter() {
13 |
14 | class ViewHolder(val constraintLayout: ConstraintLayout): RecyclerView.ViewHolder(constraintLayout)
15 |
16 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
17 | val constraintLayout = LayoutInflater.from(parent.context).inflate(
18 | R.layout.to_do_item_layout, parent, false) as ConstraintLayout
19 |
20 | constraintLayout.setOnClickListener(View.OnClickListener {
21 | val nameTextView = constraintLayout.getChildAt(0) as TextView
22 | val urgencyTextView = constraintLayout.getChildAt(1) as TextView
23 | val nameText = nameTextView.text
24 | val urgencyText = urgencyTextView.text
25 | val isItemUrgent = if (urgencyText == "!!") true else false
26 |
27 | val intent: Intent = Intent(parent.context, AddItemActivity::class.java)
28 | intent.putExtra("ITEM_NAME", nameText)
29 | intent.putExtra("ITEM_URGENCY", isItemUrgent)
30 | activity.startActivity(intent)
31 | })
32 |
33 | constraintLayout.setOnLongClickListener(View.OnLongClickListener {
34 | val position: Int = parent.indexOfChild(it)
35 |
36 | val todoItemToRemove = todoItemsList[position]
37 | val dbo = DatabaseOperations(parent.context)
38 | dbo.deleteItem(dbo, todoItemToRemove)
39 |
40 | todoItemsList.removeAt(position)
41 | notifyItemRemoved(position)
42 | true
43 | })
44 |
45 | return ViewHolder(constraintLayout)
46 | }
47 |
48 | override fun onBindViewHolder(holder: ViewHolder, position: Int) {
49 | val constraintLayout = holder.constraintLayout
50 | val nameTextView = constraintLayout.getChildAt(0) as TextView
51 | val urgencyTextView = constraintLayout.getChildAt(1) as TextView
52 | val dateTextView = constraintLayout.getChildAt(2) as TextView
53 | nameTextView.text = todoItemsList[position].name
54 | urgencyTextView.text = if (todoItemsList[position].isUrgent) "!!" else ""
55 | dateTextView.text = todoItemsList[position].dateString
56 | }
57 |
58 | override fun getItemCount(): Int {
59 | return todoItemsList.size
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/layout/activity_add_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
24 |
25 |
35 |
36 |
44 |
45 |
53 |
54 |
59 |
60 |
61 |
62 |
77 |
78 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
25 |
26 |
38 |
39 |
49 |
50 |
60 |
61 |
62 |
63 |
73 |
74 |
75 |
76 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/layout/to_do_item_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
24 |
25 |
38 |
39 |
52 |
53 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 | #000000
7 | #ffffff
8 | #33ff99
9 |
10 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ToDoList
3 | Welcome to Nim\'s Todo List
4 | +
5 | Add a todo item
6 | Enter todo item name
7 | Urgent?
8 | Save
9 | Cancel
10 | Item name
11 | Item urgency
12 | Edit a todo item
13 | Today\'s Items
14 | Previous Items
15 |
16 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/app/src/test/java/com/example/owl/todolist/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.owl.todolist
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | ext.kotlin_version = '1.2.30'
5 | repositories {
6 | google()
7 | jcenter()
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:3.0.1'
11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
28 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pirple/Android-101/f171ea39ce36cb65181dbdc1ea2fd5fca19f59a9/Part 3 - Android App Bootcamp/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Mar 19 11:28:29 PDT 2018
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-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/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 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/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 |
--------------------------------------------------------------------------------
/Part 3 - Android App Bootcamp/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Android 101
2 | > Code snippets for the "Android 101" course, available at Pirple.com
3 |
4 |
5 | ## This course is now available
6 | This course, like all others, is included with your pirple.com monthly membership. To join Pirple, visit our membership page here:
7 |
8 | [https://pirple.thinkific.com/pages/membership](https://pirple.thinkific.com/pages/membership)
9 |
--------------------------------------------------------------------------------