diff --git a/CalrendarView/.gitignore b/CalrendarView/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/CalrendarView/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/CalrendarView/build.gradle.kts b/CalrendarView/build.gradle.kts new file mode 100644 index 0000000..65a9acd --- /dev/null +++ b/CalrendarView/build.gradle.kts @@ -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) +} \ No newline at end of file diff --git a/CalrendarView/consumer-rules.pro b/CalrendarView/consumer-rules.pro new file mode 100644 index 0000000..e69de29 diff --git a/CalrendarView/proguard-rules.pro b/CalrendarView/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/CalrendarView/proguard-rules.pro @@ -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 \ No newline at end of file diff --git a/CalrendarView/src/androidTest/java/com/example/calrendarview/ExampleInstrumentedTest.kt b/CalrendarView/src/androidTest/java/com/example/calrendarview/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..08e8374 --- /dev/null +++ b/CalrendarView/src/androidTest/java/com/example/calrendarview/ExampleInstrumentedTest.kt @@ -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) + } +} \ No newline at end of file diff --git a/CalrendarView/src/main/AndroidManifest.xml b/CalrendarView/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a5918e6 --- /dev/null +++ b/CalrendarView/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/CalrendarView/src/main/java/com/example/calrendarview/BaseCustomViews.kt b/CalrendarView/src/main/java/com/example/calrendarview/BaseCustomViews.kt new file mode 100644 index 0000000..2d9269e --- /dev/null +++ b/CalrendarView/src/main/java/com/example/calrendarview/BaseCustomViews.kt @@ -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?) { + + } +} \ No newline at end of file diff --git a/CalrendarView/src/main/java/com/example/calrendarview/DayView.kt b/CalrendarView/src/main/java/com/example/calrendarview/DayView.kt new file mode 100644 index 0000000..843505d --- /dev/null +++ b/CalrendarView/src/main/java/com/example/calrendarview/DayView.kt @@ -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 + } + +} diff --git a/CalrendarView/src/main/java/com/example/calrendarview/MonthView.kt b/CalrendarView/src/main/java/com/example/calrendarview/MonthView.kt new file mode 100644 index 0000000..b27b75f --- /dev/null +++ b/CalrendarView/src/main/java/com/example/calrendarview/MonthView.kt @@ -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) { + //todo 최대 7*6의 데이터를 받는다. + } +} + diff --git a/CalrendarView/src/main/java/com/example/calrendarview/model/DayInfo.kt b/CalrendarView/src/main/java/com/example/calrendarview/model/DayInfo.kt new file mode 100644 index 0000000..e90d09f --- /dev/null +++ b/CalrendarView/src/main/java/com/example/calrendarview/model/DayInfo.kt @@ -0,0 +1,8 @@ +package com.example.calrendarview.model + + +interface DayInfo { + fun getDayOfNum() + fun getDayOfWeek() + fun isToday() +} \ No newline at end of file diff --git a/CalrendarView/src/test/java/com/example/calrendarview/ExampleUnitTest.kt b/CalrendarView/src/test/java/com/example/calrendarview/ExampleUnitTest.kt new file mode 100644 index 0000000..8335c3f --- /dev/null +++ b/CalrendarView/src/test/java/com/example/calrendarview/ExampleUnitTest.kt @@ -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) + } +} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a406e56..eb6459c 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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) diff --git a/build.gradle.kts b/build.gradle.kts index e60ce26..9fb2867 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.androidApplication) apply false alias(libs.plugins.jetbrainsKotlinAndroid) apply false + alias(libs.plugins.androidLibrary) apply false } buildscript { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cb66a0c..b68869a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" } diff --git a/settings.gradle.kts b/settings.gradle.kts index ae006db..08f4b03 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,4 +21,4 @@ dependencyResolutionManagement { rootProject.name = "AccountBook" include(":app") - \ No newline at end of file +include(":CalrendarView")