Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hammad Tariq
committed
Apr 20, 2018
0 parents
commit 351ab35
Showing
49 changed files
with
1,051 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/libraries | ||
/.idea/modules.xml | ||
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
apply plugin: 'kotlin-android' | ||
apply plugin: 'kotlin-kapt' | ||
apply plugin: 'kotlin-android-extensions' | ||
|
||
android { | ||
|
||
kapt { | ||
generateStubs = true | ||
} | ||
compileSdkVersion 27 | ||
defaultConfig { | ||
applicationId "com.es.mewphone" | ||
minSdkVersion 15 | ||
targetSdkVersion 27 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" | ||
implementation 'com.android.support:appcompat-v7:27.1.1' | ||
implementation 'com.android.support.constraint:constraint-layout:1.1.0' | ||
testImplementation 'junit:junit:4.12' | ||
androidTestImplementation 'com.android.support.test:runner:1.0.1' | ||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' | ||
|
||
//RETROFIT ... NETWORK LIBRARY | ||
implementation "com.squareup.retrofit2:retrofit:$retrofit_version" | ||
// RETROFIT .. CONVERTER | ||
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version" | ||
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version" | ||
|
||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' | ||
|
||
// implementation 'com.google.dagger:dagger:2.15' | ||
// kapt 'com.google.dagger:dagger-compiler:2.15' | ||
|
||
implementation 'com.google.dagger:dagger-android:2.15' | ||
implementation 'com.google.dagger:dagger-android-support:2.15' | ||
// if you use the support libraries | ||
kapt 'com.google.dagger:dagger-android-processor:2.15' | ||
kapt 'com.google.dagger:dagger-compiler:2.15' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# 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 |
24 changes: 24 additions & 0 deletions
24
app/src/androidTest/java/com/es/developine/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.es.developine | ||
|
||
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.es.mewphone", appContext.packageName) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.es.developine"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application | ||
android:name=".ApplicationClass" | ||
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=".ui.login.LoginActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.es.developine | ||
|
||
import android.app.Application | ||
import com.es.developine.di.component.ApplicationComponent | ||
import com.es.developine.di.component.DaggerApplicationComponent | ||
import com.es.developine.di.module.AppModule | ||
import com.es.developine.di.module.NetModule | ||
|
||
open class ApplicationClass : Application() { | ||
|
||
|
||
public lateinit var applicationComponent: ApplicationComponent | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
applicationComponent = DaggerApplicationComponent.builder() | ||
.netModule(NetModule()) | ||
.build() | ||
|
||
applicationComponent.inject(this) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.es.developine.data | ||
|
||
data class Post(var userId: Int, var postId: Int, var title: String, var body: String) |
17 changes: 17 additions & 0 deletions
17
app/src/main/java/com/es/developine/di/component/ApplicationComponent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.es.developine.di.component | ||
|
||
import com.es.developine.ApplicationClass | ||
import com.es.developine.di.module.AppModule | ||
import com.es.developine.di.module.NetModule | ||
import com.es.developine.ui.login.LoginActivity | ||
import com.es.developine.ui.login.LoginPresenterImpl | ||
import dagger.Component | ||
|
||
@Component(modules = [AppModule::class, NetModule::class]) | ||
interface ApplicationComponent { | ||
|
||
fun inject(mewApplication: ApplicationClass) | ||
fun inject(mLoginPresenterImpl: LoginPresenterImpl) | ||
fun inject(mLoginActivity: LoginActivity) | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/es/developine/di/module/AppModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.es.developine.di.module | ||
|
||
import android.app.Application | ||
import dagger.Module | ||
import dagger.Provides | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
class AppModule(var application: Application) { | ||
|
||
lateinit var applicationInst: Application | ||
|
||
init { | ||
applicationInst = application | ||
} | ||
|
||
|
||
@Provides | ||
@Singleton | ||
fun provideApplication(): Application { | ||
return applicationInst | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/es/developine/di/module/NetModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.es.developine.di.module | ||
|
||
import com.es.developine.network.INetworkApi | ||
import com.google.gson.Gson | ||
import com.google.gson.GsonBuilder | ||
import dagger.Module | ||
import dagger.Provides | ||
import retrofit2.Retrofit | ||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory | ||
import retrofit2.converter.gson.GsonConverterFactory | ||
|
||
@Module | ||
class NetModule { | ||
|
||
@Provides | ||
fun provideRetrofit(gson: Gson): Retrofit { | ||
return Retrofit.Builder().addConverterFactory(GsonConverterFactory.create(gson)) | ||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create()) | ||
.baseUrl("https://jsonplaceholder.typicode.com/").build() | ||
} | ||
|
||
@Provides | ||
fun providesGson(): Gson { | ||
return GsonBuilder().create() | ||
} | ||
|
||
@Provides | ||
fun provideNetworkService(retrofit: Retrofit): INetworkApi { | ||
return retrofit.create(INetworkApi::class.java) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.es.developine.network | ||
|
||
object Endpoints { | ||
const val posts = "posts/" | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/es/developine/network/INetworkApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.es.developine.network | ||
|
||
import com.es.developine.data.Post | ||
import com.google.gson.JsonElement | ||
import io.reactivex.Observable | ||
import retrofit2.Call | ||
import retrofit2.http.GET | ||
|
||
interface INetworkApi { | ||
|
||
@GET(Endpoints.posts) | ||
fun getAllPosts(): Observable<JsonElement> | ||
} |
Oops, something went wrong.