Skip to content

Commit bf7316e

Browse files
committed
Initial commit
0 parents  commit bf7316e

File tree

85 files changed

+2708
-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.

85 files changed

+2708
-0
lines changed

.gitignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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
15+
local.properties

.idea/.gitignore

+3
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/gradle.xml

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

.idea/inspectionProfiles/Project_Default.xml

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

.idea/kotlinc.xml

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

.idea/misc.xml

+9
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

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
id 'kotlin-kapt'
5+
id 'dagger.hilt.android.plugin'
6+
id 'kotlinx-serialization'
7+
8+
}
9+
10+
android {
11+
namespace 'com.example.newzap'
12+
compileSdk 33
13+
14+
defaultConfig {
15+
applicationId "com.example.newzap"
16+
minSdk 24
17+
targetSdk 33
18+
versionCode 1
19+
versionName "1.0"
20+
21+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
22+
vectorDrawables {
23+
useSupportLibrary true
24+
}
25+
}
26+
27+
buildTypes {
28+
release {
29+
minifyEnabled false
30+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
31+
}
32+
}
33+
compileOptions {
34+
sourceCompatibility JavaVersion.VERSION_1_8
35+
targetCompatibility JavaVersion.VERSION_1_8
36+
}
37+
kotlinOptions {
38+
jvmTarget = '1.8'
39+
}
40+
buildFeatures {
41+
compose true
42+
}
43+
composeOptions {
44+
kotlinCompilerExtensionVersion '1.2.0'
45+
}
46+
packagingOptions {
47+
resources {
48+
excludes += '/META-INF/{AL2.0,LGPL2.1}'
49+
}
50+
}
51+
}
52+
53+
dependencies {
54+
55+
implementation 'androidx.core:core-ktx:1.7.0'
56+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
57+
implementation 'androidx.activity:activity-compose:1.3.1'
58+
implementation "androidx.compose.ui:ui:$compose_ui_version"
59+
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
60+
implementation 'androidx.compose.material:material:1.2.0'
61+
testImplementation 'junit:junit:4.13.2'
62+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
63+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
64+
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
65+
debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
66+
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"
67+
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
68+
69+
70+
// Dagger - Hilt
71+
implementation "com.google.dagger:hilt-android:2.44"
72+
kapt "com.google.dagger:hilt-android-compiler:2.44"
73+
kapt 'androidx.hilt:hilt-compiler:1.0.0'
74+
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
75+
76+
// Pager and Indicators - Accompanist
77+
implementation "com.google.accompanist:accompanist-pager:0.24.2-alpha"
78+
implementation "com.google.accompanist:accompanist-pager-indicators:0.24.2-alpha"
79+
80+
implementation "androidx.compose.material:material-icons-extended:$compose_ui_version"
81+
implementation "androidx.navigation:navigation-compose:2.5.1"
82+
83+
84+
//Room
85+
implementation("androidx.room:room-runtime:2.5.1")
86+
implementation("androidx.room:room-ktx:2.5.1")
87+
kapt("androidx.room:room-compiler:2.5.1")
88+
89+
// Kotlin Extensions and Coroutines support for Room
90+
implementation "androidx.room:room-ktx:2.5.1"
91+
92+
//gson
93+
implementation 'com.google.code.gson:gson:2.9.0'
94+
95+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
96+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
97+
implementation "com.squareup.okhttp3:okhttp:4.10.0"
98+
implementation "com.squareup.okhttp3:logging-interceptor:4.9.0"
99+
100+
//Coil
101+
implementation("io.coil-kt:coil-compose:2.2.2")
102+
103+
104+
}

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

app/src/main/AndroidManifest.xml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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.INTERNET" />
6+
7+
8+
<application
9+
android:name=".NewZapApp"
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:supportsRtl="true"
16+
android:theme="@style/Theme.NewZap"
17+
tools:targetApi="31">
18+
<activity
19+
android:name=".presentation.MainActivity"
20+
android:exported="true"
21+
android:label="@string/app_name"
22+
android:theme="@style/Theme.NewZap">
23+
<intent-filter>
24+
<action android:name="android.intent.action.MAIN" />
25+
26+
<category android:name="android.intent.category.LAUNCHER" />
27+
</intent-filter>
28+
</activity>
29+
</application>
30+
31+
</manifest>
13.2 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.example.newzap
2+
3+
import android.app.Application
4+
import dagger.hilt.android.HiltAndroidApp
5+
6+
@HiltAndroidApp
7+
class NewZapApp : Application()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.example.newzap.data.data_source.local
2+
3+
import androidx.room.TypeConverter
4+
import com.example.newzap.data.data_source.remote.dto.SourceDTO
5+
import com.google.gson.Gson
6+
import java.util.Date
7+
8+
class Converters {
9+
10+
@TypeConverter
11+
fun toDate(dateLong: Long?): Date? {
12+
return dateLong?.let { Date(it) }
13+
}
14+
15+
@TypeConverter
16+
fun fromDate(date: Date?): Long? {
17+
return date?.time
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.example.newzap.data.data_source.local
2+
3+
import androidx.room.Dao
4+
import androidx.room.Delete
5+
import androidx.room.Insert
6+
import androidx.room.OnConflictStrategy
7+
import androidx.room.Query
8+
import com.example.newzap.domain.model.News
9+
import kotlinx.coroutines.flow.Flow
10+
11+
@Dao
12+
interface NewsDao {
13+
14+
15+
@Query("SELECT * FROM news_table")
16+
fun getNews(): Flow<List<News>>
17+
18+
@Insert(onConflict = OnConflictStrategy.REPLACE)
19+
suspend fun insert(news: News)
20+
21+
@Delete
22+
suspend fun delete(news: News)
23+
24+
@Query("DELETE FROM news_table WHERE newsTitle = :title")
25+
suspend fun deleteByTitle(title: String)
26+
27+
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.example.newzap.data.data_source.local
2+
3+
import androidx.room.Database
4+
import androidx.room.RoomDatabase
5+
import androidx.room.TypeConverters
6+
import com.example.newzap.data.data_source.remote.dto.NewsDTO
7+
import com.example.newzap.domain.model.News
8+
9+
@Database(
10+
entities = [News::class],
11+
version = 1,
12+
exportSchema = false
13+
)
14+
@TypeConverters(Converters::class)
15+
abstract class NewsDatabase : RoomDatabase() {
16+
abstract val newsDao: NewsDao
17+
companion object{
18+
const val DATABASE_NAME = "news_db"
19+
}
20+
}

0 commit comments

Comments
 (0)