Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10 from Talentica/networking_with_kotlin
Networking with kotlin
  • Loading branch information
suyashgupta25 committed Jun 15, 2017
2 parents 3e0d35f + f6e463b commit 7532674
Show file tree
Hide file tree
Showing 163 changed files with 2,643 additions and 48 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -8,9 +8,9 @@ android:
components:
- tools
- platform-tools
- build-tools-26.0.0-preview
- build-tools-26.0.0
- tools
- 'android-O'
- 'android-26'
- extra-android-support
- extra-google-google_play_services
- extra-android-m2repository
Expand All @@ -21,6 +21,6 @@ android:
- 'android-sdk-license-.+'
- '.+'
install: [
"echo yes | ${ANDROID_HOME}tools/bin/sdkmanager \"platforms;android-O\" --channel=3"]
"echo yes | ${ANDROID_HOME}tools/bin/sdkmanager \"platforms;android-26\" --channel=3"]
script:
- ./gradlew build
10 changes: 6 additions & 4 deletions README.md
Expand Up @@ -11,20 +11,21 @@ The project contains the following apps:
#### 6. customcamera: This is a MVP pattern, custom camera app with flash support. The home screen is a gridview which shows clicked photos. Dagger 2 implementation added.
#### 7. o_notifications: This is a MVP pattern, android-O notifications. The home screen provides simple way to create notification channels and notifications. By default there are 2 notification groups “Personal” and “Business”.
#### 8. sensors: Explore how to make a compass app using magnetic field sensor and accelerometer.
#### 9. networking: Networking with popular networking libraries like retrofit and volley. Also recycler view with kotlin.

More to come in future :octocat: :star2:

<img src="http://i.imgur.com/HzmmBvZ.jpg" />&nbsp;


## Minimum Requirements

* Android Studio 3.0 Canery 3
* Kotlin compiler and runtime version 1.1.2-4
* Android O
* Android SDK Platform 26 (android-O)
* Android sdk tools 26.0.2
* Android sdk build-tools 26 rc2
* Android sdk plateform-toools 26.0.0 rc2
* Android sdk build-tools 26.0.0
* Android sdk plateform-tools 26.0.0


Projects
Expand All @@ -39,3 +40,4 @@ Video Streaming (Always use device to run this App since emulator has rendering
Custom Camera | <img src="/gifs/customcamera.gif" width="59%">
Android-O Notifications | <img src="/gifs/o_notification_003.gif" width="59%">
Compass (designed using accelerometer and magnetic field sensor) | <img src="/gifs/compass.gif" width="59%">
Networking & Recycler view (REST calls with volley, retrofit and okhttp) | <img src="/gifs/networking_with_kotlin_003.gif" width="59%">
4 changes: 2 additions & 2 deletions app/build.gradle
Expand Up @@ -3,8 +3,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0-rc2"
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.talentica.androidkotlin"
minSdkVersion 16
Expand Down
8 changes: 6 additions & 2 deletions audioplayer/build.gradle
Expand Up @@ -3,8 +3,8 @@ apply plugin: 'kotlin-android'


android {
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0 rc2"
compileSdkVersion 26
buildToolsVersion "26.0.0"


defaultConfig {
Expand All @@ -23,6 +23,10 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}

}

dependencies {
Expand Down
10 changes: 8 additions & 2 deletions customcamera/build.gradle
Expand Up @@ -2,8 +2,8 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0 rc2"
compileSdkVersion 26
buildToolsVersion "26.0.0"


defaultConfig {
Expand All @@ -22,6 +22,12 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
lintOptions {
abortOnError false
}
}

}

dependencies {
Expand Down
Binary file added gifs/networking_with_kotlin_003.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions locationmanager/build.gradle
Expand Up @@ -3,8 +3,8 @@ apply plugin: 'kotlin-android'


android {
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0 rc2"
compileSdkVersion 26
buildToolsVersion "26.0.0"


defaultConfig {
Expand All @@ -23,6 +23,12 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
lintOptions {
abortOnError false
}
}

}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions networking/.gitignore
@@ -0,0 +1 @@
/build
21 changes: 21 additions & 0 deletions networking/README.md
@@ -0,0 +1,21 @@
# Networking with popular libraries using Kotlin

This project is written in Kotlin to showcase REST communication with popular networking libraries (retrofit, volley and okhttp).

MVP has been used in this app, usage of dependency injection framework like dagger2 is highly recommended (currently not used).

Recycler view is used to display a list of user’s github repositories. Recycler view, adapter, view holder all in Kotlin.


## Minimum Requirements

* Android Studio 3.0 Canery 3
* Kotlin compiler and runtime version 1.1.2-4
* Android SDK Platform 26 (android-O)
* Android sdk tools 26.0.2
* Android sdk build-tools 26.0.0
* Android sdk plateform-tools 26.0.0

Networking & Recycler view

<img src="../gifs/networking_with_kotlin_003.gif" width="59%">
55 changes: 55 additions & 0 deletions networking/build.gradle
@@ -0,0 +1,55 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'


android {
compileSdkVersion 26
buildToolsVersion "26.0.0"


defaultConfig {
applicationId "com.talentica.androidkotlin.networking"
minSdkVersion 21
targetSdkVersion 'O'
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
android {
lintOptions {
abortOnError false
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:recyclerview-v7:26.0.0-beta2'
// https://mvnrepository.com/artifact/com.google.code.gson/gson
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
// https://mvnrepository.com/artifact/com.squareup.retrofit2/converter-gson
compile group: 'com.squareup.retrofit2', name: 'converter-gson', version: '2.3.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
}
repositories {
mavenCentral()
}
25 changes: 25 additions & 0 deletions networking/proguard-rules.pro
@@ -0,0 +1,25 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/kaushald/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -0,0 +1,24 @@
package com.talentica.androidkotlin.networking

import android.support.test.InstrumentationRegistry
import android.support.test.runner.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("com.talentica.androidkotlin.networking", appContext.packageName)
}
}
25 changes: 25 additions & 0 deletions networking/src/main/AndroidManifest.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.talentica.androidkotlin.networking">

<uses-permission android:name="android.permission.INTERNET"/>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".repoui.UserRepositories">
</activity>
</application>

</manifest>

0 comments on commit 7532674

Please sign in to comment.