Skip to content

Commit

Permalink
nearly
Browse files Browse the repository at this point in the history
  • Loading branch information
RenHeyzer committed Jan 8, 2022
0 parents commit db78162
Show file tree
Hide file tree
Showing 145 changed files with 4,063 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
108 changes: 108 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
plugins {
id 'com.android.application'
id 'kotlin-android'
// Kotlin Kapt
id 'kotlin-kapt'
// Parcelable
id("kotlin-parcelize")
// Hilt
id("dagger.hilt.android.plugin")
// Navigation Safe Args
id("androidx.navigation.safeargs.kotlin")
}

android {
compileSdk 31

defaultConfig {
applicationId "com.example.rickandmortyapp"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}

dependencies {

// Kotlin
// | Stdlib
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

// Kotlin Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2")

// Core
implementation 'androidx.core:core-ktx:1.7.0'

// Appcompat
implementation 'androidx.appcompat:appcompat:1.3.0'

// Material Design Components
implementation 'com.google.android.material:material:1.4.0'

// UI Components
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'

// Hilt
implementation("com.google.dagger:hilt-android:$hilt_version")
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
kapt("com.google.dagger:hilt-android-compiler:$hilt_version")

// Navigation Components
def nav_version = "2.3.5"
implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
implementation("androidx.navigation:navigation-ui-ktx:$nav_version")

// Retrofit 2
def retrofit_version = "2.9.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
// Gson
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"

// OkHttp
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.0"))

// define any required OkHttp artifacts without version
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")

// Activity version
def activity_version = "1.3.0"
implementation("androidx.activity:activity-ktx:$activity_version")

// Fragment version
def fragment_version = "1.3.6"
implementation("androidx.fragment:fragment-ktx:$fragment_version")

// ViewBindingPropertyDelegate
def view_binding_property_delegate = '1.5.3'
// To use only without reflection variants of viewBinding
implementation "com.github.kirich1409:viewbindingpropertydelegate-noreflection:$view_binding_property_delegate"

// Glide
implementation 'com.github.bumptech.glide:glide:4.12.0'

// Paging 3
def paging_version = "3.0.1"
implementation("androidx.paging:paging-runtime-ktx:$paging_version")
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.example.rickandmortyapp

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.rickandmortyapp", appContext.packageName)
}
}
31 changes: 31 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.rickandmortyapp">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.RickAndMortyApp">
<activity
android:name=".presentation.ui.activity.MainActivity"
android:exported="true"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
</application>

</manifest>
7 changes: 7 additions & 0 deletions app/src/main/java/com/example/rickandmortyapp/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.example.rickandmortyapp

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class App : Application()
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.rickandmortyapp.base

import androidx.recyclerview.widget.DiffUtil

class BaseDiffUtilItemCallback<T : IBaseDiffModel> : DiffUtil.ItemCallback<T>() {

override fun areItemsTheSame(oldItem: T, newItem: T): Boolean {
return oldItem.id == newItem.id
}

override fun areContentsTheSame(oldItem: T, newItem: T): Boolean {
return oldItem == newItem
}
}
39 changes: 39 additions & 0 deletions app/src/main/java/com/example/rickandmortyapp/base/BaseFragment.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.example.rickandmortyapp.base

import android.os.Bundle
import android.view.View
import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment
import androidx.viewbinding.ViewBinding

abstract class BaseFragment<BaseViewBinding : ViewBinding, ViewModel : BaseViewModel>(
@LayoutRes layoutId: Int
) : Fragment(layoutId) {

protected abstract val binding: BaseViewBinding
protected abstract val viewModel: ViewModel

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
initialize()
setupViews()
setupListeners()
setupRequests()
setupObserves()
}

open fun initialize() {
}

open fun setupViews() {
}

open fun setupListeners() {
}

open fun setupRequests() {
}

open fun setupObserves() {
}
}
Loading

0 comments on commit db78162

Please sign in to comment.