Skip to content

Commit

Permalink
Update dependencies #183
Browse files Browse the repository at this point in the history
Signed-off-by: Sanju S <spikeysanju98@gmail.com>
  • Loading branch information
Spikeysanju committed Oct 27, 2021
1 parent c7dec98 commit 48c0881
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 77 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.

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

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

5 changes: 3 additions & 2 deletions .idea/misc.xml

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

52 changes: 27 additions & 25 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ apply plugin: 'dagger.hilt.android.plugin'


android {
compileSdkVersion 30
compileSdkVersion 31
buildToolsVersion "29.0.3"

defaultConfig {
applicationId "thecodemonks.org.nottzapp"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.3.3"

Expand Down Expand Up @@ -77,57 +77,59 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

// Architectural Components
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"

// Room
implementation "androidx.room:room-runtime:2.2.6"
kapt "androidx.room:room-compiler:2.2.6"
implementation "androidx.room:room-runtime:2.3.0"
kapt "androidx.room:room-compiler:2.3.0"
kapt "org.xerial:sqlite-jdbc:3.36.0.3"


// Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:2.2.6"
implementation "androidx.room:room-ktx:2.3.0"

// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.4.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2-native-mt'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.5.2-native-mt'

// Coroutine Lifecycle Scopes
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"

// activity & fragment ktx
implementation "androidx.fragment:fragment-ktx:1.3.2"
implementation "androidx.activity:activity-ktx:1.3.0-alpha05"
implementation 'androidx.appcompat:appcompat:1.3.0-rc01'
implementation "androidx.fragment:fragment-ktx:1.3.6"
implementation "androidx.activity:activity-ktx:1.4.0-rc01"
implementation 'androidx.appcompat:appcompat:1.4.0-beta01'

// Navigation Components
implementation "androidx.navigation:navigation-fragment-ktx:2.3.4"
implementation "androidx.navigation:navigation-ui-ktx:2.3.4"
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"

// material design
implementation 'com.google.android.material:material:1.3.0'
implementation "androidx.recyclerview:recyclerview:1.2.0"
implementation 'com.google.android.material:material:1.4.0'
implementation "androidx.recyclerview:recyclerview:1.2.1"

// Preference DataStore
implementation "androidx.datastore:datastore-preferences:1.0.0-alpha06"
implementation "androidx.datastore:datastore-preferences:1.0.0"

// Lottie Animation Library
implementation "com.airbnb.android:lottie:3.6.0"
implementation "com.airbnb.android:lottie:4.2.0"

// Hilt
implementation "com.google.dagger:hilt-android:2.30.1-alpha"
kapt "com.google.dagger:hilt-android-compiler:2.30.1-alpha"
annotationProcessor 'androidx.hilt:hilt-compiler:1.0.0-beta01'
implementation "com.google.dagger:hilt-android:2.39.1"
kapt "com.google.dagger:hilt-android-compiler:2.39.1"
annotationProcessor 'androidx.hilt:hilt-compiler:1.0.0'

}
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
android:theme="@style/AppTheme">
<activity
android:name=".app.MainActivity"
android:windowSoftInputMode="adjustPan">
android:windowSoftInputMode="adjustPan"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
26 changes: 10 additions & 16 deletions app/src/main/java/thecodemonks/org/nottzapp/adapter/NotesAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,15 @@ package thecodemonks.org.nottzapp.adapter

import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.item_post_notes.view.*
import thecodemonks.org.nottzapp.R
import thecodemonks.org.nottzapp.databinding.ItemPostNotesBinding
import thecodemonks.org.nottzapp.model.Notes

class NotesAdapter : RecyclerView.Adapter<NotesAdapter.NotesVH>() {

inner class NotesVH(itemView: View) : RecyclerView.ViewHolder(itemView)

private val differCallback = object : DiffUtil.ItemCallback<Notes>() {
override fun areItemsTheSame(oldItem: Notes, newItem: Notes): Boolean {
return oldItem.id == newItem.id
Expand All @@ -58,13 +54,9 @@ class NotesAdapter : RecyclerView.Adapter<NotesAdapter.NotesVH>() {
val differ = AsyncListDiffer(this, differCallback)
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NotesVH {

return NotesVH(
LayoutInflater.from(parent.context).inflate(
R.layout.item_post_notes,
parent,
false
)
)
val binding =
ItemPostNotesBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return NotesVH(binding)
}

override fun getItemCount(): Int {
Expand All @@ -74,18 +66,20 @@ class NotesAdapter : RecyclerView.Adapter<NotesAdapter.NotesVH>() {
override fun onBindViewHolder(holder: NotesVH, position: Int) {

val item = differ.currentList[position]
holder.itemView.apply {
holder.binding.apply {

item_notes_title.text = item.title
item_notes_desc.text = item.description
itemNotesTitle.text = item.title
itemNotesDesc.text = item.description

// on item click
setOnClickListener {
holder.itemView.setOnClickListener {
onItemClickListener?.let { it(item) }
}
}
}

inner class NotesVH(val binding: ItemPostNotesBinding) : RecyclerView.ViewHolder(binding.root)

// on item click listener
private var onItemClickListener: ((Notes) -> Unit)? = null
fun setOnItemClickListener(listener: (Notes) -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,18 @@
package thecodemonks.org.nottzapp.datastore

import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.createDataStore
import androidx.datastore.preferences.preferencesDataStore
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import javax.inject.Singleton

abstract class PrefsDataStore(context: Context, fileName: String) {
internal val dataStore: DataStore<Preferences> = context.createDataStore(fileName)
}
val Context.themePrefDataStore by preferencesDataStore("ui_mode_pref")

class UIModeDataStore(context: Context) : UIModeImpl {

class UIModeDataStore(context: Context) :
PrefsDataStore(
context,
PREF_FILE_UI_MODE
),
UIModeImpl {
private val dataStore = context.themePrefDataStore

// used to get the data from datastore
override val uiMode: Flow<Boolean>
Expand All @@ -65,7 +58,6 @@ class UIModeDataStore(context: Context) :
}

companion object {
private const val PREF_FILE_UI_MODE = "ui_mode_preference"
private val UI_MODE_KEY = booleanPreferencesKey("ui_mode")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ import thecodemonks.org.nottzapp.model.Notes
@Database(
entities = [Notes::class],
version = 1,
exportSchema = false
exportSchema = true
)

abstract class NotesDatabase : RoomDatabase() {

abstract fun getNotesDao(): NotesDao

companion object {
Expand Down
18 changes: 10 additions & 8 deletions app/src/main/java/thecodemonks/org/nottzapp/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,30 @@

package thecodemonks.org.nottzapp.di

import android.app.Application
import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.components.ActivityComponent
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import thecodemonks.org.nottzapp.datastore.UIModeDataStore
import thecodemonks.org.nottzapp.datastore.UIModeImpl
import thecodemonks.org.nottzapp.db.NotesDatabase
import javax.inject.Singleton

@InstallIn(ActivityComponent::class)
@InstallIn(SingletonComponent::class)
@Module
class AppModule {
object AppModule {

@Singleton
@Provides
fun providePreferenceManager(application: Application): UIModeDataStore {
return UIModeDataStore(application.applicationContext)
fun providePreferenceManager(@ApplicationContext context: Context): UIModeImpl {
return UIModeDataStore(context)
}

@Singleton
@Provides
fun provideNoteDatabase(application: Application): NotesDatabase {
return NotesDatabase.invoke(application.applicationContext)
fun provideNoteDatabase(@ApplicationContext context: Context): NotesDatabase {
return NotesDatabase.invoke(context)
}
}
1 change: 1 addition & 0 deletions app/src/main/res/layout/error_dialog_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/dimen_16"
android:textAlignment="center"
android:fontFamily="@font/montserrat"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
app:layout_constraintEnd_toEndOf="parent"
Expand Down
14 changes: 5 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,16 @@

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.32"
ext.kotlin_version = "1.5.31"
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.4"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.30.1-alpha'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
}
}

Expand All @@ -53,7 +49,7 @@ plugins {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
apply plugin: "org.jlleitschuh.gradle.ktlint"
}
Expand Down

0 comments on commit 48c0881

Please sign in to comment.