Skip to content

Commit

Permalink
Merge pull request #197 from yourssu/develop
Browse files Browse the repository at this point in the history
[Version Update] version 2.2.3 배포
  • Loading branch information
cometj03 authored Aug 14, 2023
2 parents 6c6aae5 + eda6b62 commit dda462f
Show file tree
Hide file tree
Showing 59 changed files with 625 additions and 258 deletions.
54 changes: 16 additions & 38 deletions DesignSystem/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,16 @@ plugins {
}
apply plugin: 'kotlin-kapt'

task androidSourcesJar(type: Jar) {
classifier 'sources'
from android.sourceSets.main.java.srcDirs
}

project.afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
}
}
}
}

apply plugin: 'kotlin-kapt'

def versionProperties = new Properties()
versionProperties.load(new FileInputStream(file("../version.properties")))

android {
compileSdkVersion 33
compileSdk 33

defaultConfig {
minSdkVersion 23
targetSdkVersion 33
versionCode ((System.getenv("BUILD_NUMBER") as Integer ?: 10000))
versionCode((System.getenv("BUILD_NUMBER") as Integer ?: 10000))
versionName versionProperties['versionName']
vectorDrawables.useSupportLibrary = true

Expand All @@ -55,38 +38,33 @@ android {
"-Xjvm-default=all",
]
}

composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion kotlin_version
}

buildFeatures {
dataBinding = true
compose = true
}
}

dependencies {
afterEvaluate {
publishing {
publications {
yds(MavenPublication) {
from components.release
groupId project.name
artifactId project.name
version versionProperties['versionName']
}
}
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.annotation:annotation:1.5.0"
testImplementation 'junit:junit:4.13.2'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'

implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:1.3.1"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.activity:activity-compose:1.6.1'
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.5.1"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class BaseFullDialog: Dialog {
window?.setDecorFitsSystemWindows(false)
val insetController: WindowInsetsController? = window?.insetsController
// insetController?.hide(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars())
insetController?.systemBarsBehavior = WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE
insetController?.systemBarsBehavior = WindowInsetsController.BEHAVIOR_DEFAULT
} else if (!isAttachWindow && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
window?.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
window?.requestFeature(Window.FEATURE_NO_TITLE)
Expand Down
13 changes: 11 additions & 2 deletions app/storybook/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def versionProperties = new Properties()
versionProperties.load(new FileInputStream(file("../../version.properties")))

android {
compileSdkVersion 33
compileSdk 33

// 당연하지만 배포용은 아니고 release 테스트용
signingConfigs {
Expand All @@ -22,7 +22,7 @@ android {

defaultConfig {
applicationId "com.yourssu.storybook"
minSdkVersion 23
minSdkVersion 26
targetSdkVersion 33
versionCode (System.getenv("BUILD_NUMBER") as Integer ?: 10000) // 로컬에서 10000 번으로 빌드됨
versionName versionProperties['versionName']
Expand Down Expand Up @@ -63,20 +63,29 @@ android {
kotlinOptions {
jvmTarget = '11'
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.3"
}
buildFeatures {
dataBinding = true
compose = true
}
}

dependencies {
implementation project(path: ':DesignSystem')
implementation project(path: ':compose')

implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.activity:activity-ktx:1.6.1'
implementation 'androidx.fragment:fragment-ktx:1.5.5'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'

implementation "androidx.activity:activity-compose:1.7.2"
implementation "androidx.compose.material:material:1.4.0"

implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.13.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.yourssu.storybook.transform.ActivityAnimType

abstract class BaseActivity: AppCompatActivity() {
abstract class BaseActivity : AppCompatActivity() {
abstract var animationType: ActivityAnimType

override fun onCreate(savedInstanceState: Bundle?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment

abstract class BaseFragment: Fragment() {
abstract class BaseFragment : Fragment() {

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Expand Down
157 changes: 32 additions & 125 deletions app/storybook/src/main/java/com/yourssu/storybook/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,142 +1,49 @@
package com.yourssu.storybook

import android.annotation.SuppressLint
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.View
import com.yourssu.design.system.foundation.Icon
import com.yourssu.design.system.foundation.Typo
import com.yourssu.design.system.language.*
import com.yourssu.design.undercarriage.size.dpToIntPx
import com.yourssu.storybook.DetailActivity.Companion.navigateToDetail
import com.yourssu.storybook.atom.*
import com.yourssu.storybook.component.*
import com.yourssu.storybook.foundation.*
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import com.yourssu.design.system.component.BottomBar
import com.yourssu.storybook.databinding.ActivityMainBinding
import com.yourssu.storybook.transform.ActivityAnimType

class MainActivity : BaseActivity() {

/** vvvvvv 추가시 여기에만 선언하면 됨 vvvvvv */

private val foundationList = listOf<Pair<String, Class<*>>>(
"BasicColor" to BaseColorFragment::class.java,
"SemanticColor" to SemanticColorFragment::class.java,
"Vibration" to VibrationFragment::class.java,
"Icon" to IconFragment::class.java,
"Typography" to TypographyFragment::class.java,
)
private val atomList = listOf<Pair<String, Class<*>>> (
"Text" to TextFragment::class.java,
"ProfileImageView" to ProfileImageViewFragment::class.java,
"Badge" to BadgeFragment::class.java,
"BoxButton" to BoxButtonFragment::class.java,
"Divider" to DividerFragment::class.java,
"IconView" to IconViewFragment::class.java,
"PlainButton" to PlainButtonFragment::class.java,
"Checkbox" to CheckboxFragment::class.java,
"Toggle" to ToggleFragment::class.java,
"SimpleTextField" to SimpleTextFieldFragment::class.java,
"SuffixTextField" to SuffixTextFieldFragment::class.java,
"PasswordTextField" to PasswordTextFieldFragment::class.java,
"SearchTextField" to SearchTextFieldFragment::class.java,
"ListItem" to ListItemFragment::class.java,
"ListToggleItem" to ListToggleItemFragment::class.java,
)
private val componentList = listOf<Pair<String, Class<*>>>(
"Toast" to ToastFragment::class.java,
"TopBar" to TopBarFragment::class.java,
"SingleTitleTopBar" to SingleTitleTopBarFragment::class.java,
"DoubleTitleTopBar" to DoubleTitleTopBarFragment::class.java,
"SearchTopBar" to SearchTopBarFragment::class.java,
"BottomBar" to BottomBarFragment::class.java,
"TabBar" to TabBarFragment::class.java,
"Tooltip" to TooltipFragment::class.java,
"List" to ListFragment::class.java,
)

/* 위의 리스트의 합 */
private val totalItemList = listOf<Pair<String, List<Pair<String, Class<*>>>>>(
"1. Foundation" to foundationList,
"2. Atom" to atomList,
"3. Component" to componentList
)

/** ^^^^^^ 추가시 여기에만 선언하면 됨 ^^^^^^^ */

lateinit var binding: ActivityMainBinding
override var animationType: ActivityAnimType = ActivityAnimType.STAY

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
binding.activity = this

initView()
supportFragmentManager.beginTransaction()
.replace(binding.fragmentFrame.id, TabType.XML.fragment)
.commit()
}

@SuppressLint("SetTextI18n")
private fun initView() {
setContentView {
verticalLayout {
singleTitleTopBar {
title = "StoryBook"
thirdIcon = Icon.ic_warningcircle_line
thirdButtonListener = View.OnClickListener {
bottomSheet {
list {
subHeader = "Setting"

listItem {
text = "Current Version : ${BuildConfig.VERSION_NAME}"
}
listItem {
text = "Privacy policy"
rightIcon = Icon.ic_arrow_right_line
setOnClickListener {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(context.getString(
R.string.link_privacy_policy)))
startActivity(intent)
}
}
}
}
}
}
scrollView {
verticalLayout {
totalItemList.forEach {
text {
text = it.first
typo = Typo.SubTitle3

backgroundColor(R.color.dimNormal)
setLayout(
width = MATCH_PARENT,
leftPaddingPx = context.dpToIntPx(16f),
topPaddingPx = context.dpToIntPx(2f),
bottomPaddingPx = context.dpToIntPx(2f)
)
}
it.second.forEach { foundation ->
text {
text = foundation.first
typo = Typo.Body1
setOnClickListener {
navigateToDetail(foundation.first, foundation.second)
}
setLayout(
width = MATCH_PARENT,
leftPaddingPx = context.dpToIntPx(16f),
topPaddingPx = context.dpToIntPx(16f),
bottomPaddingPx = context.dpToIntPx(16f)
)
}
divider {
setLayout(leftMarginPx = context.dpToIntPx(16f))
}
}
}
}
}
}
val tabClickListener = object : BottomBar.TabClickListener {
override fun tabClicked(primaryName: String) {
binding.bottomNav.setSelectedTab(primaryName)
supportFragmentManager.beginTransaction()
.replace(binding.fragmentFrame.id, TabType.from(primaryName)?.fragment ?: return)
.commit()
}
override fun tabChanged(primaryName: String) {}
override fun tabLongClicked(primaryName: String) {}
}

val tabList = listOf(
BottomBar.BottomTabInfo(TabType.XML.name, R.drawable.ic_xml, R.drawable.ic_xml),
BottomBar.BottomTabInfo(TabType.COMPOSE.name, R.drawable.ic_kotlin, R.drawable.ic_kotlin),
)
}

enum class TabType(val fragment: Fragment) {
XML(MainFragment.newInstance()),
COMPOSE(MainComposeFragment.newInstance());

companion object {
fun from(name: String): TabType? = values().find { it.name == name }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.yourssu.storybook

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.foundation.layout.Column
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import com.yourssu.design.system.compose.YdsTheme
import com.yourssu.design.system.compose.atom.ListItem

class MainComposeFragment : BaseFragment() {
companion object {
@JvmStatic
fun newInstance() = MainComposeFragment()
}

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View = ComposeView(requireContext()).apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
YdsTheme {
Column {
ListItem(text = "Hello Jetpack Compose!", onClick = { })
}
}
}
}
}
Loading

0 comments on commit dda462f

Please sign in to comment.