Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/gradle.xml

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

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

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

2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Versions {
const val roomVersion = "2.3.0"
const val composeVersion = "1.0.0"

const val gradleVersion = "7.1.0"
const val gradleVersion = "7.1.2"
const val ktlintVersion = "10.0.0"
const val googleServiceVersion = "4.3.5"
const val playCoreVersion = "1.10.0"
Expand Down
11 changes: 11 additions & 0 deletions core/src/main/java/org/mascota/core/util/ItemDiffCallback.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.mascota.core.util

import androidx.recyclerview.widget.DiffUtil

class ItemDiffCallback<T>(
val onItemsTheSame: (T, T) -> Boolean,
val onContentsTheSame: (T, T) -> Boolean
) : DiffUtil.ItemCallback<T>() {
override fun areItemsTheSame(oldItem: T, newItem: T): Boolean = onItemsTheSame(oldItem, newItem)
override fun areContentsTheSame(oldItem: T, newItem: T): Boolean = onContentsTheSame(oldItem, newItem)
}
1 change: 1 addition & 0 deletions features/farewell/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
22 changes: 22 additions & 0 deletions features/farewell/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
plugins {
id("com.android.library")
kotlin("android")
}

android {
buildFeatures {
dataBinding = true
}
}

dependencies {
implementation(project(":core:"))

implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.appcompat:appcompat:1.4.1")
implementation("com.google.android.material:material:1.5.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
}
Empty file.
21 changes: 21 additions & 0 deletions features/farewell/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,22 @@
package org.mascota.farewell

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
* 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("org.mascota.farewell.test", appContext.packageName)
}
}
11 changes: 11 additions & 0 deletions features/farewell/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.mascota.farewell">

<application android:theme="@style/Theme.Mascota">
<activity
android:name=".ui.view.main.FarewellMainActivity"
android:exported="false" />
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.mascota.farewell.ui.view.main

import android.os.Bundle
import org.mascota.core.base.BindingActivity
import org.mascota.farewell.R
import org.mascota.farewell.databinding.ActivityFarewellMainBinding

class FarewellMainActivity :
BindingActivity<ActivityFarewellMainBinding>(R.layout.activity_farewell_main) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}

private fun initAdapter() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.mascota.farewell.ui.view.main.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import org.mascota.core.util.ItemDiffCallback
import org.mascota.farewell.databinding.ItemHelpBinding
import org.mascota.farewell.databinding.LayoutFarewellMainTopBinding
import org.mascota.farewell.ui.view.main.model.DiaryModel
import org.mascota.farewell.ui.view.main.model.HelpModel

class FarewellMainAdapter(
private val itemClickListener: ItemClickListener
) : ListAdapter<HelpModel, FarewellMainAdapter>(
ItemDiffCallback<HelpModel>(
onContentsTheSame = { old, new -> old == new },
onItemsTheSame = { old, new -> old == new }
)
) {
fun interface ItemClickListener {
fun onClick(place: PlaceModel)
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val inflater = LayoutInflater.from(parent.context)


val binding = ItemPlaceSearchBinding.inflate(inflater, parent, false)
return PlaceViewHolder(binding, itemClickListener)
}

override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {

}

class FarewellMainTopViewHolder(
private val binding: LayoutFarewellMainTopBinding,
private val itemClickListener: ItemClickListener
) : RecyclerView.ViewHolder(binding.root) {
fun onBind(diary: DiaryModel) {

}
}

class HelpViewHolder(
private val binding: ItemHelpBinding,
private val itemClickListener: ItemClickListener
) : RecyclerView.ViewHolder(binding.root) {
fun onBind(help: HelpModel) {

}
}

companion object {
const val FAREWELL_MAIN_TOP = 0
const val HELP_ITEM = 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.mascota.farewell.ui.view.main.model

data class DiaryModel(
val year: String,
val date: String,
val content: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.mascota.farewell.ui.view.main.model

data class HelpModel(
val source: String,
val content: String
)
Loading