Skip to content

Commit

Permalink
Merge pull request #16 from Louiixx-h/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Louiixx-h committed Oct 15, 2023
2 parents 01a6ba9 + cd8c3df commit 175f0a8
Show file tree
Hide file tree
Showing 55 changed files with 799 additions and 804 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: cute-cat-gallery-ci-pipeline
on:
pull_request:
branches: [main]
branches: [main, develop]
push:
branches: [main]
branches: [main, develop]
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -22,6 +22,11 @@ jobs:
with:
arguments: build
gradle-version: 7.6
- name: Run KLint
uses: gradle/gradle-build-action@v2.9.0
with:
arguments: ktlintCheck
gradle-version: 7.6
- name: Run Tests
uses: gradle/gradle-build-action@v2.9.0
with:
Expand Down
119 changes: 114 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,118 @@
# Cute Cats Gallery
<a name="readme-top"></a>

Galeria de gatinhos fofos

<div>
<img src="./images/home.png" width="200"/>
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]

<br />
<div align="center">
<a href="https://github.com/othneildrew/Best-README-Template">
<img src="./app/src/main/ic_launcher-playstore.png" alt="Logo" width="80" height="80">
</a>

<h1 align="center">Cute Cats Gallery</h1>
</div>

<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgments">Acknowledgments</a></li>
</ol>
</details>

## About The Project
<div>
<img src="./images/home.png" width="200"/>
<img src="./images/loading.png" width="200"/>
<img src="./images/error.png" width="200"/>
</div>

### Built With

* Kotlin
* Android Studio
* View Model
* Coroutines
* View Binding
* Koin
* Glide
* Retrofit
* Gson

## Clone project

```git clone https://github.dev/Louiixx-h/cute-cats-gallery-app```

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "improvement".
Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'feat: Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## Contact

Luis Henrique da Silva Moreira - [luis-henrique.dev](https://luis-henrique.dev/) - louix.sm@gmail.com

Project Link: [https://github.dev/Louiixx-h/cute-cats-gallery-app](https://github.dev/Louiixx-h/cute-cats-gallery-app)


<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[contributors-shield]: https://img.shields.io/github/contributors/othneildrew/Best-README-Template.svg?style=for-the-badge
[contributors-url]: https://github.com/othneildrew/Best-README-Template/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=for-the-badge
[forks-url]: https://github.com/othneildrew/Best-README-Template/network/members
[stars-shield]: https://img.shields.io/github/stars/othneildrew/Best-README-Template.svg?style=for-the-badge
[stars-url]: https://github.com/othneildrew/Best-README-Template/stargazers
[issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=for-the-badge
[issues-url]: https://github.com/othneildrew/Best-README-Template/issues
[license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=for-the-badge
[license-url]: https://github.com/othneildrew/Best-README-Template/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/luishenr-m
[product-screenshot]: images/screenshot.png
[Next.js]: https://img.shields.io/badge/next.js-000000?style=for-the-badge&logo=nextdotjs&logoColor=white
[Next-url]: https://nextjs.org/
[React.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB
[React-url]: https://reactjs.org/
[Vue.js]: https://img.shields.io/badge/Vue.js-35495E?style=for-the-badge&logo=vuedotjs&logoColor=4FC08D
[Vue-url]: https://vuejs.org/
[Angular.io]: https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular&logoColor=white
[Angular-url]: https://angular.io/
[Svelte.dev]: https://img.shields.io/badge/Svelte-4A4A55?style=for-the-badge&logo=svelte&logoColor=FF3E00
[Svelte-url]: https://svelte.dev/
[Laravel.com]: https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white
[Laravel-url]: https://laravel.com
[Bootstrap.com]: https://img.shields.io/badge/Bootstrap-563D7C?style=for-the-badge&logo=bootstrap&logoColor=white
[Bootstrap-url]: https://getbootstrap.com
[JQuery.com]: https://img.shields.io/badge/jQuery-0769AD?style=for-the-badge&logo=jquery&logoColor=white
[JQuery-url]: https://jquery.com

81 changes: 54 additions & 27 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,65 +1,92 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
id "com.android.application"
id "kotlin-android"
id "com.google.android.libraries.mapsplatform.secrets-gradle-plugin"
}

android {
compileSdk 33

viewBinding {
enabled = true
}
compileSdk 34

defaultConfig {
applicationId "com.luishenrique.cutecatsgallery"
minSdk 21
targetSdkVersion 33
minSdkVersion 21
targetSdkVersion 34
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable = true
buildConfigField "String", "API_URL", "\"https://api.thecatapi.com/v1/\""
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
release {
minifyEnabled true
buildConfigField "String", "API_URL", "\"https://api.thecatapi.com/v1/\""
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
jvmTarget = "17"
}
composeOptions {
kotlinCompilerExtensionVersion = compose_compiler_version
}
namespace "com.luishenrique.cutecatsgallery"

buildFeatures {
compose = true
}
namespace 'com.luishenrique.cutecatsgallery'
}

dependencies {

api project(path: ':domain')
// Retrofit
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"

// Compose
implementation platform("androidx.compose:compose-bom:2023.10.00")
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation "androidx.activity:activity-compose:1.8.0"
implementation "androidx.compose.material3:material3:1.1.2"
implementation "androidx.compose.material:material-android:1.5.3"
implementation "io.coil-kt:coil-compose:2.4.0"
implementation "androidx.navigation:navigation-compose:2.7.4"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
androidTestImplementation platform("androidx.compose:compose-bom:2023.10.00")
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"

implementation 'com.google.accompanist:accompanist-swiperefresh:0.32.0'

// progressbar cat
implementation 'com.roger.catloadinglibrary:catloadinglibrary:1.0.9'
implementation "com.roger.catloadinglibrary:catloadinglibrary:1.0.9"

// glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation "com.github.bumptech.glide:glide:4.15.1"

// coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0-RC'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"

// koin
implementation 'org.koin:koin-android-viewmodel:2.1.6'
implementation "io.insert-koin:koin-android:$koin_version"

// viewmodel
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0'
// viewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.core:core-ktx:1.12.0"
implementation "com.google.android.material:material:1.10.0"
implementation "androidx.appcompat:appcompat:1.6.1"
testImplementation "junit:junit:4.13.2"
androidTestImplementation "androidx.test.ext:junit:1.1.5"
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
}
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.CuteCatsGallery">
<activity
android:name=".ui.view.HomeActivity"
android:name=".home.presentation.HomeActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
14 changes: 2 additions & 12 deletions app/src/main/kotlin/com/luishenrique/cutecatsgallery/App.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.luishenrique.cutecatsgallery

import android.app.Application
import com.luishenrique.cutecatsgallery.di.viewModelModule
import com.luishenrique.domain.di.apiServiceModule
import com.luishenrique.domain.di.repositoryModule
import com.luishenrique.domain.di.useCaseModule
import com.luishenrique.cutecatsgallery.di.DependencyInjection
import org.koin.android.ext.koin.androidContext
import org.koin.core.context.startKoin

Expand All @@ -15,14 +12,7 @@ class App : Application() {

startKoin {
androidContext(this@App)
modules(
listOf(
viewModelModule,
apiServiceModule,
repositoryModule,
useCaseModule,
)
)
modules(DependencyInjection.modules)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.luishenrique.cutecatsgallery.base

interface BaseMapper<Response, UiModel> {
fun toUiModel(response: Response?) : UiModel
fun toResponse(uiModel: UiModel?) : Response
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.luishenrique.cutecatsgallery.base

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

abstract class BaseViewModel : ViewModel() {
protected fun <T> request(
block: suspend () -> T,
onStartRequest: () -> Unit = {},
onSuccess: (T) -> Unit,
onError: (ErrorContent) -> Unit,
onFinally: () -> Unit = {}
) : Job {
return viewModelScope.launch {
onStartRequest.invoke()
runCatching {
val response = withContext(Dispatchers.IO) { block.invoke() }
onSuccess.invoke(response)
}.onFailure {
onError.invoke(ErrorContent(it.message.toString(), it))
}
onFinally.invoke()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.luishenrique.cutecatsgallery.base

data class ErrorContent(
val message: String,
val throwable: Throwable
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.luishenrique.cutecatsgallery.commonComponents

import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarColors
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun Toolbar(
colors: TopAppBarColors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.primaryContainer,
titleContentColor = MaterialTheme.colorScheme.primary,
),
title: @Composable () -> Unit
) {
TopAppBar(
colors = colors,
title = {
title.invoke()
}
)
}

This file was deleted.

Loading

0 comments on commit 175f0a8

Please sign in to comment.