This commit is contained in:
lunaticbum 2024-11-26 16:09:31 +09:00
parent c0f0cd4cb3
commit 17ecb69646
15 changed files with 246 additions and 1 deletions

1
CalrendarView/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,43 @@
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsKotlinAndroid)
}
android {
namespace = "com.example.calrendarview"
compileSdk = 34
defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = 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"
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}

View File

21
CalrendarView/proguard-rules.pro vendored Normal file
View File

@ -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

View File

@ -0,0 +1,24 @@
package com.example.calrendarview
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.calrendarview.test", appContext.packageName)
}
}

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

View File

@ -0,0 +1,27 @@
package com.example.calrendarview
import android.content.Context
import android.util.AttributeSet
import android.view.View
class BaseCustomViews : View {
constructor(context: Context?) : super(context){appyAttrs(null)}
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs){appyAttrs(attrs)}
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
){appyAttrs(attrs)}
constructor(
context: Context?,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes) {appyAttrs(attrs)}
fun appyAttrs(attrs: AttributeSet?) {
}
}

View File

@ -0,0 +1,40 @@
package com.example.calrendarview
import android.content.Context
import android.util.AttributeSet
import android.view.View
class DayView : View {
constructor(context: Context?) : super(context){appyAttrs(null)}
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs){appyAttrs(attrs)}
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
){appyAttrs(attrs)}
constructor(
context: Context?,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes) {appyAttrs(attrs)}
fun appyAttrs(attrs: AttributeSet?) {
}
fun displayDayNumber() {
//todo 오늘 의 날짜를 표시
}
fun displayDayOfWeek() {
//todo 오늘의 요일을 표시?
}
fun isToday() : Boolean {
return false
}
}

View File

@ -0,0 +1,56 @@
package com.example.calrendarview
import android.content.Context
import android.util.AttributeSet
import android.view.View
import com.example.calrendarview.model.DayInfo
class MonthView : View {
constructor(context: Context?) : super(context){appyAttrs(null)}
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs){appyAttrs(attrs)}
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
){appyAttrs(attrs)}
constructor(
context: Context?,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes) {appyAttrs(attrs)}
fun appyAttrs(attrs: AttributeSet?) {
}
var numberOfRow : Int = 7
set(value) {
field = value
initChildViews()
}
fun initChildViews() {
//todo : 7 * numberOfRow 의 차일드 뷰를 만든다.
}
fun displyMonthOfNumber() {
//todo :월 표시
}
fun displayWeekHeader() {
//todo 주간 요일 표시
}
fun displayYear(){
//todo 년도 표시
}
fun setData(days : Collection<DayInfo>) {
//todo 최대 7*6의 데이터를 받는다.
}
}

View File

@ -0,0 +1,8 @@
package com.example.calrendarview.model
interface DayInfo {
fun getDayOfNum()
fun getDayOfWeek()
fun isToday()
}

View File

@ -0,0 +1,17 @@
package com.example.calrendarview
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@ -46,6 +46,8 @@ dependencies {
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.navigation.fragment.ktx)
implementation(libs.androidx.navigation.ui.ktx)
implementation(project(":CalrendarView"))
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)

View File

@ -2,6 +2,7 @@
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
alias(libs.plugins.androidLibrary) apply false
}
buildscript {

View File

@ -25,4 +25,5 @@ androidx-navigation-ui-ktx = { group = "androidx.navigation", name = "navigation
[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
jetbrainsKotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }

View File

@ -21,4 +21,4 @@ dependencyResolutionManagement {
rootProject.name = "AccountBook"
include(":app")
include(":CalrendarView")