Skip to content

Commit

Permalink
Merge pull request #85 from yourssu/develop
Browse files Browse the repository at this point in the history
[YDS] 2.0.0 배포
  • Loading branch information
ByeongsuPark authored Mar 7, 2022
2 parents 6f7619e + b07fd8e commit b39c77b
Show file tree
Hide file tree
Showing 156 changed files with 5,396 additions and 1,105 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deployLibraryYDS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
release_name: Release ${{ steps.release_version.outputs.value }}

- name: Upload to Slack
run: curl -F file=@"app/storybook/build/outputs/bundle/productionRelease/YDS-StoryBook-${{ steps.release_version.outputs.value }}($BUILD_NUMBER)-production-release.aab" -F "initial_comment=YDS ${{ steps.release_version.outputs.value }} 라이브러리가 등록되었슈~ https://jitpack.io/#yourssu/YDS-Android/${{ steps.release_version.outputs.value }} aab 파일은 스토어에 업로드 해유~" -F "channels=${{ secrets.SLACK_CHANNEL_ID }}" -H "Authorization:Bearer ${{ secrets.SLACK_WORKSPACE_TOKEN }}" https://slack.com/api/files.upload
run: curl -F file=@"app/storybook/build/outputs/bundle/productionRelease/YDS-StoryBook-${{ steps.release_version.outputs.value }}($BUILD_NUMBER)-production-release.aab" -F "initial_comment=YDS ${{ steps.release_version.outputs.value }} 라이브러리가 등록되었슈~ https://jitpack.io/#yourssu/YDS-Android aab 파일은 스토어에 업로드 해유~" -F "channels=${{ secrets.SLACK_CHANNEL_ID }}" -H "Authorization:Bearer ${{ secrets.SLACK_WORKSPACE_TOKEN }}" https://slack.com/api/files.upload
4 changes: 3 additions & 1 deletion .github/workflows/deployStoryBook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew --no-daemon :app:storybook:assembleDevRelease

- name: Upload to Slack
run: curl -F file=@"app/storybook/build/outputs/apk/dev/release/YDS-StoryBook-${{ steps.release_version.outputs.value }}($BUILD_NUMBER)-dev-release.apk" -F "initial_comment=개발중인 YDS StoryBook이 나왔슈~" -F "channels=${{ secrets.SLACK_CHANNEL_ID }}" -H "Authorization:Bearer ${{ secrets.SLACK_WORKSPACE_TOKEN }}" https://slack.com/api/files.upload
run: curl -F file=@"app/storybook/build/outputs/apk/dev/release/YDS-StoryBook-${{ steps.release_version.outputs.value }}($BUILD_NUMBER)-dev-release.apk" -F "initial_comment=개발중인 YDS StoryBook이 나왔슈~" -F "channels=${{ secrets.SLACK_CHANNEL_ID_ANDROID }}" -H "Authorization:Bearer ${{ secrets.SLACK_WORKSPACE_TOKEN }}" https://slack.com/api/files.upload
31 changes: 0 additions & 31 deletions DesignSystem/src/main/java/com/yourssu/design/system/GlobalRule.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class BoxButton : LinearLayout {
Small -> {
layoutParams.height = context.dpToIntPx(32F)
binding.text.typo = Typo.Button4
binding.leftIcon.size = IconView.Small
binding.leftIcon.size = IconView.ExtraSmall
binding.boxButtonFrame.setPadding(
context.dpToIntPx(12F),
0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.yourssu.design.system.atom

import android.content.Context
import android.graphics.Canvas
import android.graphics.drawable.ShapeDrawable
import android.util.AttributeSet
import android.view.View
import androidx.annotation.*
import androidx.core.content.ContextCompat
import androidx.databinding.BindingAdapter
import com.yourssu.design.R
import com.yourssu.design.undercarriage.size.dpToIntPx
Expand Down Expand Up @@ -36,51 +33,34 @@ class Divider : View {
requestLayout()
}

@ColorInt
private var dividerColor: Int = ContextCompat.getColor(context, R.color.borderNormal)

@Px
private var dividerThicknessInPx: Int = 0

private var dividerDrawable: ShapeDrawable = ShapeDrawable()

private fun setDividerInfo() {
val thickness = getThickness(thickness)
val color = getDividerColor(this.thickness)

dividerThicknessInPx =
context.dpToIntPx(resources.getDimensionPixelSize(thickness).toFloat())
dividerColor = context.getColor(color)
}

override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
val width = MeasureSpec.getSize(widthMeasureSpec)
val height = MeasureSpec.getSize(heightMeasureSpec)
setBackgroundColor(context.getColor(color))

if (direction == HORIZONTAL) {
setMeasuredDimension(width, dividerThicknessInPx)
} else {
setMeasuredDimension(dividerThicknessInPx, height)
}
dividerThicknessInPx = if (this.thickness == THIN)
1 // THIN 일 경우만 예외적으로 1px 사용해야함
else
context.dpToIntPx(thickness)
}

override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {

if (direction == HORIZONTAL) {
dividerDrawable.setBounds(0, 0, width, dividerThicknessInPx)
setMeasuredDimension(widthMeasureSpec, dividerThicknessInPx)
} else {
dividerDrawable.setBounds(0, 0, dividerThicknessInPx, height)
setMeasuredDimension(dividerThicknessInPx, heightMeasureSpec)
}
dividerDrawable.paint.color = dividerColor
dividerDrawable.draw(canvas)
}

@DimenRes
private fun getThickness(thickness: Int) = when (thickness) {
THIN -> R.dimen.thin
THICK -> R.dimen.thick
else -> R.dimen.thin
THIN -> 1f
THICK -> 8f
else -> 1f
}

@ColorRes
Expand Down
120 changes: 120 additions & 0 deletions DesignSystem/src/main/java/com/yourssu/design/system/atom/EditText.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package com.yourssu.design.system.atom

import android.content.Context
import android.graphics.Color
import android.util.AttributeSet
import android.util.Log
import androidx.appcompat.widget.AppCompatEditText
import androidx.core.content.ContextCompat
import androidx.databinding.BindingAdapter
import com.yourssu.design.R
import com.yourssu.design.system.foundation.Typo
import com.yourssu.design.system.foundation.Typography
import com.yourssu.design.undercarriage.size.getDimenFloat

class EditText @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : AppCompatEditText(context, attrs, defStyleAttr) {

init {
setTextColor(ContextCompat.getColor(context, R.color.textPrimary))
setBackgroundColor(Color.TRANSPARENT)
setHintTextColor(ContextCompat.getColor(context, R.color.textTertiary))
isFocusableInTouchMode = true
}

private var text: String = ""
set(text) {
field = text
changeText()
}

private var hint: String = ""
set(text) {
field = text
changeHint()
}

@Typography
private var typo: Int = Typo.SubTitle1
set(@Typography typo) {
field = typo
setTextInfo()
}

private var editTextType: Int = TITLE
set(value) {
field = value
changeEditTextType()
}

private fun changeHint() {
setHint(hint)
}

private fun setTextInfo() {
setTextAppearance(Typo.getStyle(typo))

// 폰트의 커스텀 padding 제거
includeFontPadding = false

// 폰트가 가지고 있는 lineHeight 값 추출
val fontLineHeight = paint.getFontMetrics(paint.fontMetrics)

// 디자이너가 요청한 lineHeight 값
val figmaLineHeight = context.getDimenFloat(Typo.getLineHeight(typo))

// 줄 간 간격인 lineSpacing 이자 (topPadding, bottomPadding) 의 합
val lineSpacing = figmaLineHeight - fontLineHeight

setPadding(0, lineSpacing.toInt() / 2, 0, lineSpacing.toInt() / 2)
setLineSpacing(lineSpacing, 1f)
}

private fun changeEditTextType() {
typo = when (editTextType) {
TITLE -> {
Typo.SubTitle1
}
CONTENT -> {
Typo.Body1
}
else -> {
Typo.SubTitle1
}
}
Log.d("KWK", Typo.getName(typo))
}

private fun changeText() {
setText(text)
requestLayout()
invalidate()
}

companion object {
const val TITLE = 0
const val CONTENT = 1

@JvmStatic
@BindingAdapter("android:hint")
fun setHint(editText: EditText, hint: String) {
editText.hint = hint
}

@JvmStatic
@BindingAdapter("android:text")
fun setText(editText: EditText, text: String) {
editText.text = text
}

@JvmStatic
@BindingAdapter("editTextType")
fun setEditTextType(editText: EditText, editTextType: Int) {
editText.editTextType = editTextType
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ class PasswordTextField @JvmOverloads constructor(
LayoutInflater.from(context), this, true
)
binding.onClickListener = getEyeIconClickListener()
binding.edittext.setOnFocusChangeListener { v, hasFocus ->
binding.eyeIcon.visibility = if (hasFocus) {
if (binding.edittext.text.isNotEmpty()) {
VISIBLE
} else {
GONE
}
} else {
GONE
}
}
}

@SuppressLint("CustomViewStyleable")
Expand All @@ -99,6 +110,10 @@ class PasswordTextField @JvmOverloads constructor(
}
}

override fun setOnEditorActionListener(onEditorActionListener: TextView.OnEditorActionListener) {
binding.edittext.setOnEditorActionListener(onEditorActionListener)
}

override fun extendSelection(index: Int) {
binding.edittext.extendSelection(index)
}
Expand Down Expand Up @@ -157,29 +172,37 @@ class PasswordTextField @JvmOverloads constructor(
}

override fun setDisabledTextColor() {
setEditTextTextColor(R.color.textDisabled)
setPlaceholderTextColor(R.color.textDisabled)
setFieldLabelTextColor(R.color.textDisabled)
setHelperLabelTextColor(R.color.textDisabled)
}

override fun setPositiveTextColor() {
setEditTextTextColor(R.color.textSecondary)
setPlaceholderTextColor(R.color.textTertiary)
setFieldLabelTextColor(R.color.textSecondary)
setHelperLabelTextColor(R.color.textTertiary)
}

override fun setNegativeTextColor() {
setEditTextTextColor(R.color.textSecondary)
setPlaceholderTextColor(R.color.textTertiary)
setFieldLabelTextColor(R.color.textSecondary)
setHelperLabelTextColor(R.color.textWarned)
}

override fun setDefaultTextColor() {
setEditTextTextColor(R.color.textSecondary)
setPlaceholderTextColor(R.color.textTertiary)
setFieldLabelTextColor(R.color.textSecondary)
setHelperLabelTextColor(R.color.textTertiary)
}

override fun setEditTextTextColor(color: Int) {
binding.edittext.setTextColor(resources.getColor(color, null))
}

override fun setPlaceholderTextColor(color: Int) {
binding.edittext.setHintTextColor(resources.getColor(color, null))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class PlainButton @JvmOverloads constructor(
setButtonInfo()
}

MotionEvent.ACTION_UP -> {
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
isPressed = false
setButtonInfo()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ class ProfileImageView @JvmOverloads constructor(
const val ExtraLarge = 3
const val ExtraSmall = 4

private const val SmallSize = 36f
private const val SmallSize = 32f
private const val MediumSize = 48f
private const val LargeSize = 72f
private const val ExtraLargeSize = 96f
private const val ExtraSmallSize = 32f
private const val ExtraSmallSize = 24f

private const val ExtraMargin =
1f // stoke 가 path 를 기준으로 양쪽에 표시되기 때문에 짤린것처럼 보인다 이를 보안하기 위한 여분의 마진
Expand Down
Loading

0 comments on commit b39c77b

Please sign in to comment.