Skip to content

Commit

Permalink
mvvm architecture edited
Browse files Browse the repository at this point in the history
remove flow
  • Loading branch information
ferhatozcelik committed Aug 8, 2023
1 parent 853551d commit c0c6f8e
Show file tree
Hide file tree
Showing 49 changed files with 111 additions and 325 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ dependencies {
kapt "androidx.hilt:hilt-compiler:1.0.0"

// Room
implementation "androidx.room:room-ktx:2.4.3"
implementation "androidx.room:room-runtime:2.4.3"
kapt "androidx.room:room-compiler:2.4.3"

Expand Down
Binary file added app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ferhatozcelik.androidmvvmtemplate.common
package com.ferhatozcelik.androidmvvmtemplate.data.model

sealed class Resource<out T : Any> {
object Loading : Resource<Nothing>()
data class Success<out T : Any>(val data: T) : Resource<T>()
data class Success<out T : Any>(val data: Any) : Resource<T>()
data class Error(val errorMessage: String) : Resource<Nothing>()
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.ferhatozcelik.androidmvvmtemplate.data.model.ExampleModel
import retrofit2.Response
import retrofit2.http.*

interface ExampleApi {
interface AppApi {

@GET("/api/v1/example")
suspend fun getExampleResult(): Response<List<ExampleModel>>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ferhatozcelik.androidmvvmtemplate.data.repository

import com.ferhatozcelik.androidmvvmtemplate.data.dao.ExampleDao
import com.ferhatozcelik.androidmvvmtemplate.data.remote.AppApi
import javax.inject.Inject
import javax.inject.Singleton


@Singleton
class ExampleRepository @Inject constructor(private val appApi: AppApi, private val exampleDao: ExampleDao) {



}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.ferhatozcelik.androidmvvmtemplate.di

import com.ferhatozcelik.androidmvvmtemplate.data.remote.ExampleApi
import com.ferhatozcelik.androidmvvmtemplate.data.remote.AppApi
import com.ferhatozcelik.androidmvvmtemplate.util.BASE_URL
import dagger.Module
import dagger.Provides
Expand Down Expand Up @@ -36,8 +36,8 @@ object ApiModule {

@Provides
@Singleton
fun provideAppApi(retrofit: Retrofit): ExampleApi {
return retrofit.create(ExampleApi::class.java)
fun provideAppApi(retrofit: Retrofit): AppApi {
return retrofit.create(AppApi::class.java)
}

}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.ferhatozcelik.androidmvvmtemplate.ui.fragments.detail

import androidx.lifecycle.ViewModel
import com.ferhatozcelik.androidmvvmtemplate.domain.usecase.main.GetLocalUseCase
import com.ferhatozcelik.androidmvvmtemplate.domain.usecase.main.GetRemoteUseCase
import com.ferhatozcelik.androidmvvmtemplate.data.repository.ExampleRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class DetailViewModel @Inject constructor(private val getLocalUseCase: GetLocalUseCase,
private val getRemoteUseCase: GetRemoteUseCase) : ViewModel() {
class DetailViewModel @Inject constructor(private val exampleRepository: ExampleRepository) : ViewModel() {
private val TAG = DetailViewModel::class.java.simpleName


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ import dagger.hilt.android.AndroidEntryPoint

}


}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.ferhatozcelik.androidmvvmtemplate.ui.fragments.home

import androidx.lifecycle.ViewModel
import com.ferhatozcelik.androidmvvmtemplate.domain.usecase.main.GetLocalUseCase
import com.ferhatozcelik.androidmvvmtemplate.domain.usecase.main.GetRemoteUseCase
import com.ferhatozcelik.androidmvvmtemplate.data.repository.ExampleRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel class HomeViewModel @Inject constructor(private val getLocalUseCase: GetLocalUseCase,
private val getRemoteUseCase: GetRemoteUseCase) : ViewModel() {
@HiltViewModel class HomeViewModel @Inject constructor(private val exampleRepository: ExampleRepository) : ViewModel() {
private val TAG = HomeViewModel::class.java.simpleName


Expand Down
30 changes: 0 additions & 30 deletions app/src/main/res/drawable-v24/ic_launcher_foreground.xml

This file was deleted.

Binary file added app/src/main/res/drawable/app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/button_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item>
<shape android:shape="rectangle">
<corners android:radius="16dp" />
<solid android:color="@color/colorSecondary" />
</shape>
</item>
</layer-list>
</item>
</selector>
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/edittext_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="@color/colorBorder" />
<corners android:radius="16dp" />
<solid android:color="@color/white" />
</shape>
</item>
</selector>
Loading

0 comments on commit c0c6f8e

Please sign in to comment.