Skip to content

Commit

Permalink
Removed unused API methods. Code clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
boy12hoody committed Sep 16, 2021
1 parent 4c9115f commit 1e89a44
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 19 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2-native-mt'

// Lifecycle
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha03"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0-alpha03"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0-alpha03"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-beta01"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0-beta01"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0-beta01"

// Image Loading library Coil
implementation 'io.coil-kt:coil:1.3.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import uz.boywonder.playstoredemo.databinding.ParentRecyclerviewItemsBinding
import uz.boywonder.playstoredemo.model.CategoryItem
import uz.boywonder.playstoredemo.model.ImageItem
import uz.boywonder.playstoredemo.util.MyDiffUtil

class ParentRecyclerViewAdapter :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ package uz.boywonder.playstoredemo.data

import retrofit2.Response
import uz.boywonder.playstoredemo.data.network.ImageAPI
import uz.boywonder.playstoredemo.model.CategoryItem
import uz.boywonder.playstoredemo.model.ImageItem
import javax.inject.Inject

class RemoteDataSource @Inject constructor(
private val imageAPI: ImageAPI
) {

suspend fun getRandomImage(width: Int, height: Int) : Response<ImageItem> {
return imageAPI.getRandomImage(width, height)
}

suspend fun getImageList(): Response<List<ImageItem>> {
return imageAPI.getImageList()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@ import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Query
import uz.boywonder.playstoredemo.model.CategoryItem
import uz.boywonder.playstoredemo.model.ImageItem
import uz.boywonder.playstoredemo.util.Constants.Companion.QUERY_PAGE_NUMBER
import uz.boywonder.playstoredemo.util.Constants.Companion.QUERY_PAGE_SIZE

interface ImageAPI {

@GET("{width}/{height}")
suspend fun getRandomImage(
@Path("width") width: Int,
@Path("height") height: Int
): Response<ImageItem>

@GET("v2/list")
suspend fun getImageList(
@Query("page") page: Int = QUERY_PAGE_NUMBER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.widget.Toast
import androidx.lifecycle.ViewModelProvider
import androidx.navigation.fragment.findNavController
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.snackbar.Snackbar
import uz.boywonder.playstoredemo.R
import uz.boywonder.playstoredemo.databinding.FragmentBottomSheetLanguageBinding
import uz.boywonder.playstoredemo.ui.settings.SettingsViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import kotlinx.coroutines.flow.MutableStateFlow

class NetworkListener : ConnectivityManager.NetworkCallback() {

// State of Network exposed to Recipes Fragment
private val isNetworkAvailable = MutableStateFlow(false)

// Network Check Function
@RequiresApi(Build.VERSION_CODES.N)
fun checkNetworkAvailability(context: Context): MutableStateFlow<Boolean> {

Expand Down

0 comments on commit 1e89a44

Please sign in to comment.