Skip to content

Commit 37befc4

Browse files
committed
updated
1 parent c5e7201 commit 37befc4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+981
-0
lines changed

BasicSyntax/.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

BasicSyntax/app/src/main/java/com/merttan/BasicSyntax/MainActivity.kt

+34
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ class MainActivity : AppCompatActivity() {
5151
val s2 = "${s1.replace("is" , "vas")}, but now is $a"
5252
println(s2)
5353

54+
println("----------------Conditional expressions--------------")
55+
56+
println("max number is ${maxOf(5,10)}")
57+
58+
println("----------------Nullable values--------------")
59+
printProduct("6", "7")
60+
printProduct("a", "7")
61+
printProduct("a", "b")
62+
63+
5464

5565
}
5666
fun printSum(a: Int, b: Int): Unit {
@@ -63,5 +73,29 @@ class MainActivity : AppCompatActivity() {
6373
vrbl +=1
6474
}
6575

76+
fun maxOf( number1 : Int, number2 : Int ) : Int{
77+
if(number1>number2){
78+
return number1
79+
}else {
80+
return number2
81+
}
82+
}
83+
84+
fun parseInt(str: String): Int? {
85+
return str.toIntOrNull()
86+
}
87+
fun printProduct(arg1: String, arg2: String) {
88+
val x = parseInt(arg1)
89+
val y = parseInt(arg2)
90+
// Using `x * y` yields error because they may hold nulls.
91+
if (x != null && y != null) {
92+
// x and y are automatically cast to non-nullable after null check
93+
println(x * y)
94+
}
95+
else {
96+
println("'$arg1' or '$arg2' is not a number")
97+
}
98+
}
99+
66100

67101
}

Loops/.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx

Loops/.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Loops/.idea/codeStyles/Project.xml

+122
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Loops/.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Loops/.idea/gradle.xml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Loops/.idea/jarRepositories.xml

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Loops/.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Loops/.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Loops/.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Loops/app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

Loops/app/build.gradle

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
apply plugin: 'com.android.application'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
4+
5+
android {
6+
compileSdkVersion 30
7+
buildToolsVersion "30.0.2"
8+
9+
defaultConfig {
10+
applicationId "com.merttan.loopslearning"
11+
minSdkVersion 23
12+
targetSdkVersion 30
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
}
26+
27+
dependencies {
28+
implementation fileTree(dir: "libs", include: ["*.jar"])
29+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
30+
implementation 'androidx.core:core-ktx:1.3.2'
31+
implementation 'androidx.appcompat:appcompat:1.2.0'
32+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
33+
testImplementation 'junit:junit:4.12'
34+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
35+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
36+
37+
}

Loops/app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.merttan.loopslearning
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.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.getInstrumentation().targetContext
22+
assertEquals("com.merttan.loopslearning", appContext.packageName)
23+
}
24+
}
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.merttan.loopslearning">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>

0 commit comments

Comments
 (0)