Skip to content

Commit cb90c58

Browse files
committed
Initial commit
1 parent 956e32c commit cb90c58

File tree

87 files changed

+2002
-0
lines changed

Some content is hidden

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

87 files changed

+2002
-0
lines changed

.idea/.gitignore

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

.idea/.name

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

.idea/compiler.xml

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

.idea/misc.xml

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

app/.gitignore

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

app/build.gradle

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
id 'kotlin-kapt'
5+
id 'com.google.dagger.hilt.android'
6+
}
7+
8+
android {
9+
namespace 'com.simba.addatimes'
10+
compileSdk 33
11+
12+
defaultConfig {
13+
applicationId "com.simba.addatimes"
14+
minSdk 23
15+
targetSdk 32
16+
versionCode 1
17+
versionName "1.0"
18+
19+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
20+
}
21+
22+
buildTypes {
23+
release {
24+
minifyEnabled false
25+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
26+
}
27+
}
28+
compileOptions {
29+
sourceCompatibility JavaVersion.VERSION_1_8
30+
targetCompatibility JavaVersion.VERSION_1_8
31+
}
32+
kotlinOptions {
33+
jvmTarget = '1.8'
34+
}
35+
36+
buildFeatures {
37+
viewBinding = true
38+
}
39+
}
40+
41+
dependencies {
42+
43+
implementation 'androidx.core:core-ktx:1.7.0'
44+
implementation 'androidx.appcompat:appcompat:1.6.1'
45+
implementation 'com.google.android.material:material:1.7.0'
46+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
47+
implementation 'androidx.databinding:baseLibrary:3.2.0-alpha11'
48+
testImplementation 'junit:junit:4.13.2'
49+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
50+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
51+
52+
//navigation
53+
implementation 'androidx.navigation:navigation-fragment:2.5.3'
54+
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
55+
56+
//Dependency injection
57+
implementation "com.google.dagger:hilt-android:2.44"
58+
kapt "com.google.dagger:hilt-compiler:2.44"
59+
60+
//Network dependencies
61+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
62+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
63+
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.0"))
64+
implementation 'com.squareup.okhttp3:okhttp'
65+
implementation 'com.squareup.okhttp3:logging-interceptor'
66+
67+
//Livedata
68+
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.5.1")
69+
70+
//Coil
71+
implementation("io.coil-kt:coil:2.2.2")
72+
73+
//Glide
74+
implementation 'com.github.bumptech.glide:glide:4.14.2'
75+
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
76+
77+
implementation 'androidx.viewpager2:viewpager2:1.0.0'
78+
79+
implementation 'com.makeramen:roundedimageview:2.3.0'
80+
81+
implementation 'com.github.denzcoskun:ImageSlideshow:0.1.0'
82+
83+
}

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.simba.addatimes
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.simba.addatimes", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
<uses-permission android:name="android.permission.INTERNET" />
7+
8+
<application
9+
android:name=".AddaTimes"
10+
android:allowBackup="true"
11+
android:dataExtractionRules="@xml/data_extraction_rules"
12+
android:fullBackupContent="@xml/backup_rules"
13+
android:icon="@mipmap/ic_launcher"
14+
android:label="@string/app_name"
15+
android:roundIcon="@mipmap/ic_launcher_round"
16+
android:supportsRtl="true"
17+
android:theme="@style/Theme.AddaTimes"
18+
tools:targetApi="31">
19+
<activity
20+
android:name=".ui.MainActivity"
21+
android:exported="true">
22+
<intent-filter>
23+
<action android:name="android.intent.action.MAIN" />
24+
25+
<category android:name="android.intent.category.LAUNCHER" />
26+
</intent-filter>
27+
28+
<meta-data
29+
android:name="android.app.lib_name"
30+
android:value="" />
31+
</activity>
32+
<meta-data
33+
android:name="preloaded_fonts"
34+
android:resource="@array/preloaded_fonts" />
35+
</application>
36+
37+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.simba.addatimes
2+
3+
import android.app.Application
4+
import com.simba.addatimes.di.component.AppComponent
5+
import dagger.hilt.EntryPoints
6+
import dagger.hilt.android.HiltAndroidApp
7+
8+
@HiltAndroidApp
9+
class AddaTimes : Application() {
10+
override fun onCreate() {
11+
super.onCreate()
12+
instance = this
13+
component().inject(this)
14+
}
15+
16+
fun component(): AppComponent {
17+
return EntryPoints.get(this, AppComponent::class.java)
18+
}
19+
20+
companion object {
21+
@get:Synchronized
22+
lateinit var instance: AddaTimes
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.simba.addatimes.data
2+
3+
import com.simba.addatimes.data.models.OriginalResponse
4+
import com.simba.addatimes.utils.ApiEndpoint
5+
import retrofit2.http.GET
6+
7+
interface ApiService {
8+
9+
@GET(ApiEndpoint.ENDPOINT_MOBILE)
10+
suspend fun getOriginalsData(): OriginalResponse
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.simba.addatimes.data
2+
3+
import com.simba.addatimes.data.models.OriginalResponse
4+
5+
interface RemoteDataSource {
6+
suspend fun getOriginals(): OriginalResponse
7+
}
8+
9+
class DefaultRemoteDataSource(
10+
private val apiService: ApiService
11+
) : RemoteDataSource {
12+
override suspend fun getOriginals(): OriginalResponse {
13+
return apiService.getOriginalsData()
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.simba.addatimes.data
2+
3+
import com.simba.addatimes.data.models.OriginalResponse
4+
import javax.inject.Inject
5+
6+
interface Repository {
7+
suspend fun getOriginals(): OriginalResponse
8+
}
9+
10+
class DefaultRepository @Inject constructor(
11+
private val remoteDataSource: RemoteDataSource
12+
) : Repository {
13+
14+
override suspend fun getOriginals(): OriginalResponse {
15+
return remoteDataSource.getOriginals()
16+
}
17+
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.simba.addatimes.data.models
2+
3+
import com.google.gson.annotations.Expose
4+
import com.google.gson.annotations.SerializedName
5+
6+
data class Banner(
7+
@SerializedName("banner_id")
8+
@Expose
9+
val banner_id: Int,
10+
11+
@SerializedName("id")
12+
@Expose
13+
val id: Int,
14+
15+
@SerializedName("image")
16+
@Expose
17+
val image: String,
18+
19+
@SerializedName("image_order")
20+
@Expose
21+
val image_order: Int,
22+
23+
@SerializedName("url")
24+
@Expose
25+
val url: String
26+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.simba.addatimes.data.models
2+
3+
import com.google.gson.annotations.Expose
4+
import com.google.gson.annotations.SerializedName
5+
import java.io.Serializable
6+
7+
data class Data(
8+
@SerializedName("banners")
9+
@Expose
10+
val banners: List<List<Banner>>,
11+
12+
@SerializedName("category_id")
13+
@Expose
14+
val category_id: Int,
15+
16+
@SerializedName("collection_id")
17+
@Expose
18+
val collection_id: Int,
19+
20+
@SerializedName("items")
21+
@Expose
22+
val items: List<Item>,
23+
24+
@SerializedName("title")
25+
@Expose
26+
val title: String,
27+
28+
@SerializedName("top_banner")
29+
@Expose
30+
val top_banner: Any
31+
) : Serializable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.simba.addatimes.data.models
2+
3+
import com.google.gson.annotations.Expose
4+
import com.google.gson.annotations.SerializedName
5+
6+
data class Item(
7+
@SerializedName("horizontal_image")
8+
@Expose
9+
val horizontal_image: String,
10+
11+
@SerializedName("id")
12+
@Expose
13+
val id: Int,
14+
15+
@SerializedName("type")
16+
@Expose
17+
val type: Int,
18+
19+
@SerializedName("vertical_image")
20+
@Expose
21+
val vertical_image: String
22+
) : java.io.Serializable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.simba.addatimes.data.models
2+
3+
import com.google.gson.annotations.Expose
4+
import com.google.gson.annotations.SerializedName
5+
6+
data class OriginalResponse(
7+
@SerializedName("data")
8+
@Expose
9+
val data: List<Data>? = null,
10+
11+
@SerializedName("success")
12+
@Expose
13+
val success: Boolean
14+
) : java.io.Serializable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.simba.addatimes.di.component
2+
3+
import com.simba.addatimes.AddaTimes
4+
import dagger.hilt.EntryPoint
5+
import dagger.hilt.InstallIn
6+
import dagger.hilt.components.SingletonComponent
7+
8+
@InstallIn(SingletonComponent::class)
9+
@EntryPoint
10+
interface AppComponent {
11+
fun inject(app: AddaTimes?)
12+
}

0 commit comments

Comments
 (0)