Skip to content

Commit

Permalink
Created Home module and setting base architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
YKV17 committed Aug 12, 2023
1 parent 0f60578 commit db461dd
Show file tree
Hide file tree
Showing 115 changed files with 569 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

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

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

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

2 changes: 1 addition & 1 deletion .idea/misc.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import androidx.viewbinding.ViewBinding

abstract class BaseActivity<VM : ViewModel, B : ViewBinding> : AppCompatActivity() {

private lateinit var binding: B
protected lateinit var binding: B
protected lateinit var viewModel: VM
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, getLayout())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.noble.common_utils.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModel
import androidx.viewbinding.ViewBinding

abstract class BaseFragment<VM : ViewModel, B : ViewBinding>: Fragment() {

protected lateinit var binding: B
protected lateinit var viewModel: VM


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
super.onCreateView(inflater, container, savedInstanceState)
binding = DataBindingUtil.inflate(inflater, getLayout(), container, false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
setObservers()
}

override fun onStart() {
super.onStart()
setListeners()
}

override fun onResume() {
super.onResume()
}

override fun onPause() {
super.onPause()
}

override fun onStop() {
super.onStop()
removeListeners()
}

override fun onDestroyView() {
super.onDestroyView()
removeObservers()
}

override fun onDestroy() {
super.onDestroy()
}

abstract fun setListeners()
abstract fun removeListeners()
abstract fun setObservers()
abstract fun removeObservers()

@LayoutRes
abstract fun getLayout(): Int
}
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ dependencies {
implementation(Dependencies.CoreDep.material)
implementation(Dependencies.CoreDep.constraint)
implementation(Dependencies.SplashDep.splash)
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.9.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")

testImplementation(Dependencies.TestDep.junit)
androidTestImplementation(Dependencies.TestDep.testJunitExt)
Expand Down
12 changes: 8 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools" >

<application
android:name=".App"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand All @@ -11,10 +12,13 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.CustomSplashScreenTheme"
tools:targetApi="31">
tools:targetApi="31" >
<activity
android:name=".SplashActivity"
android:exported="true">
android:name=".ui.main.MainActivity"
android:exported="false" />
<activity
android:name=".ui.splash.SplashActivity"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import android.app.Application

class App: Application() {
}
12 changes: 12 additions & 0 deletions app/src/main/java/com/noble/rickandmorty/ui/main/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.noble.rickandmorty.ui.main

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.noble.rickandmorty.R

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.noble.rickandmorty
package com.noble.rickandmorty.ui.splash

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SplashActivity">
tools:context=".ui.splash.SplashActivity">

<TextView
android:layout_width="wrap_content"
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_main2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.main.MainActivity">

</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<style name="Theme.CustomSplashScreenTheme" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/white</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
<item name="windowSplashScreenAnimationDuration">300</item>
<item name="windowSplashScreenAnimationDuration">1000</item>
<item name="postSplashScreenTheme">@style/Theme.RickAndMorty</item>
<item name="android:windowSplashScreenBrandingImage">@drawable/ic_branding</item>
</style>
Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ plugins {
id("com.android.application") version "8.1.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.0" apply false
id("com.android.library") version "8.1.0" apply false
id("org.jetbrains.kotlin.jvm") version "1.8.0" apply false
id("com.google.dagger.hilt.android") version "2.47" apply false
}
Binary file modified buildSrc/build/classes/kotlin/main/Dependencies$CoreDep.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified buildSrc/build/classes/kotlin/main/Dependencies$SplashDep.class
Binary file not shown.
Binary file modified buildSrc/build/classes/kotlin/main/Dependencies$TestDep.class
Binary file not shown.
Binary file modified buildSrc/build/classes/kotlin/main/Dependencies.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified buildSrc/build/classes/kotlin/main/Modules.class
Binary file not shown.
Binary file modified buildSrc/build/classes/kotlin/main/Versions.class
Binary file not shown.
2 changes: 1 addition & 1 deletion buildSrc/build/kotlin/buildSrcjar-classes.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$CoreDep.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$SplashDep.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$TestDep.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Modules$Splash.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Modules.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Versions.class
C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$CoreDep.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$Coroutines.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$HiltDep.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$Retrofit.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$SplashDep.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies$TestDep.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Dependencies.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Modules$AndroidCommon.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Modules$App.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Modules$Common.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Modules$Home.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Modules.class;C:\Users\yoges\AndroidStudioProjects\RickAndMorty\buildSrc\build\classes\kotlin\main\Versions.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
6
20
0
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified buildSrc/build/kotlin/compileKotlin/cacheable/last-build.bin
Binary file not shown.
Binary file not shown.
Binary file modified buildSrc/build/libs/buildSrc.jar
Binary file not shown.
35 changes: 27 additions & 8 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
object Dependencies {
object CoreDep {
val coreKtx = "androidx.core:core-ktx:${Versions.coreKtxVersion}"
val appCompat = "androidx.appcompat:appcompat:${Versions.appCompatVersion}"
val material = "com.google.android.material:material:${Versions.materialVersion}"
val constraint = "androidx.constraintlayout:constraintlayout:${Versions.constraintVersion}"
const val coreKtx = "androidx.core:core-ktx:${Versions.coreKtxVersion}"
const val appCompat = "androidx.appcompat:appcompat:${Versions.appCompatVersion}"
const val material = "com.google.android.material:material:${Versions.materialVersion}"
const val constraint = "androidx.constraintlayout:constraintlayout:${Versions.constraintVersion}"
}

object SplashDep{
val splash = "androidx.core:core-splashscreen:${Versions.splashVersion}"
const val splash = "androidx.core:core-splashscreen:${Versions.splashVersion}"
}

object HiltDep{
const val hiltAndroid = "com.google.dagger:hilt-android:${Versions.hilt}"
const val hiltCore = "com.google.dagger:hilt-core:${Versions.hilt}"
const val hiltCompiler = "com.google.dagger:hilt-compiler:${Versions.hilt}"
const val hiltAndroidTest = "com.google.dagger:hilt-android-testing:${Versions.hilt}"
}

object Retrofit{
const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit}"
const val retrofitGsonConverter = "com.squareup.retrofit2:converter-gson:${Versions.retrofit}"
const val retrofitOkHttp = "com.squareup.okhttp3:okhttp:${Versions.okHttp}"
}

object Coroutines{
const val coroutinesAndroid = "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutines}"
const val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.coroutines}"
}

object TestDep {
var junit = "junit:junit:${Versions.junitVersion}"
var testJunitExt = "androidx.test.ext:junit:${Versions.testJunitExtVersion}"
var espressoCore = "androidx.test.espresso:espresso-core:${Versions.espressoCoreVersion}"
const val junit = "junit:junit:${Versions.junitVersion}"
const val testJunitExt = "androidx.test.ext:junit:${Versions.testJunitExtVersion}"
const val espressoCore = "androidx.test.espresso:espresso-core:${Versions.espressoCoreVersion}"
}

}
15 changes: 13 additions & 2 deletions buildSrc/src/main/java/Modules.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
object Modules {
object Splash{
val presentation = ":splash:splash_presentation"
object App{
val app = ":app"
}
object AndroidCommon{
val common_utils = ":androidCommon:common_utils"
}
object Common{
val common_utils = ":common:common_utils"
}
object Home{
val home_data = ":home:home_data"
val home_domain = ":home:home_domain"
val home_presentation = ":home:home_presentation"
}
}
23 changes: 14 additions & 9 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
object Versions {
val coreKtxVersion = "1.10.1"
val appCompatVersion = "1.6.1"
val materialVersion = "1.9.0"
val constraintVersion = "2.1.4"
val splashVersion = "1.0.0"

val junitVersion = "4.13.2"
val testJunitExtVersion = "1.1.5"
val espressoCoreVersion = "3.5.1"
const val coreKtxVersion = "1.10.1"
const val appCompatVersion = "1.6.1"
const val materialVersion = "1.9.0"
const val constraintVersion = "2.1.4"
const val splashVersion = "1.0.0"

const val hilt = "2.47"
const val coroutines = "1.7.3"
const val retrofit = "2.9.0"
const val okHttp = "3.6.0"

const val junitVersion = "4.13.2"
const val testJunitExtVersion = "1.1.5"
const val espressoCoreVersion = "3.5.1"


}
1 change: 1 addition & 0 deletions common/common_utils/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
13 changes: 13 additions & 0 deletions common/common_utils/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id("java-library")
id("org.jetbrains.kotlin.jvm")
}

java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

dependencies {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.noble.common_utils

object DateTimeHelper {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.noble.common_utils.enums

enum class ErrorType {
NO_INTERNET,
CUSTOM
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.noble.common_utils.state

import com.noble.common_utils.enums.ErrorType

sealed class State<T>{
class Loading<T>():State<T>()
class Success<T>(val data: T?):State<T>()
class Error<T>(val message: String, val type: ErrorType, val data:T? = null):State<T>()
}
1 change: 1 addition & 0 deletions home/home_data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
19 changes: 19 additions & 0 deletions home/home_data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id("java-library")
id("org.jetbrains.kotlin.jvm")
}

java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}

dependencies {
implementation(project(Modules.Home.home_domain))

implementation(Dependencies.Coroutines.coroutinesCore)

implementation(Dependencies.Retrofit.retrofit)
implementation(Dependencies.Retrofit.retrofitOkHttp)
implementation(Dependencies.Retrofit.retrofitGsonConverter)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.noble.home_data.dto

data class CharactersResponseDto(
val info: Info?,
val results: List<Result>?
)
Loading

0 comments on commit db461dd

Please sign in to comment.