-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from boostcampwm-2022/feat/big_barcode
겁나 큰 바코드 다이얼로그
- Loading branch information
Showing
17 changed files
with
260 additions
and
266 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
presentation/src/main/java/com/lighthouse/presentation/extension/Bitmap.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.lighthouse.presentation.extension | ||
|
||
import android.graphics.Bitmap | ||
import android.graphics.Matrix | ||
|
||
fun Bitmap.rotated(degrees: Float): Bitmap { | ||
val matrix = Matrix().apply { postRotate(degrees) } | ||
return Bitmap.createBitmap(this, 0, 0, width, height, matrix, false) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
presentation/src/main/java/com/lighthouse/presentation/ui/common/VerticalTextView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.lighthouse.presentation.ui.common | ||
|
||
import android.content.Context | ||
import android.graphics.Canvas | ||
import android.util.AttributeSet | ||
import com.lighthouse.presentation.R | ||
|
||
/** | ||
* TextView 를 세로로 회전한 뷰 | ||
* | ||
* @property topDown true 일 때 시계 방향 회전, false 일 때 반시계 방향 회전 | ||
* | ||
* 코드 참고: [stackoverflow.com/a/45414489](https://stackoverflow.com/a/45414489) | ||
*/ | ||
class VerticalTextView @JvmOverloads constructor( | ||
context: Context, | ||
attrs: AttributeSet? = null, | ||
defStyleAttr: Int = 0 | ||
) : androidx.appcompat.widget.AppCompatTextView(context, attrs, defStyleAttr) { | ||
|
||
var topDown: Boolean = DEFAULT_TOP_DOWN | ||
|
||
init { | ||
attrs?.let { | ||
context.obtainStyledAttributes(it, R.styleable.VerticalTextView).run { | ||
topDown = getBoolean(R.styleable.VerticalTextView_topDown, DEFAULT_TOP_DOWN) | ||
recycle() | ||
} | ||
} | ||
} | ||
|
||
override fun onMeasure( | ||
widthMeasureSpec: Int, | ||
heightMeasureSpec: Int | ||
) { | ||
super.onMeasure(heightMeasureSpec, widthMeasureSpec) | ||
setMeasuredDimension(measuredHeight, measuredWidth) | ||
} | ||
|
||
override fun onDraw(canvas: Canvas) { | ||
if (topDown) { | ||
canvas.translate(width.toFloat(), 0f) | ||
canvas.rotate(90f) | ||
} else { | ||
canvas.translate(0f, height.toFloat()) | ||
canvas.rotate(-90f) | ||
} | ||
canvas.translate( | ||
compoundPaddingLeft.toFloat(), | ||
extendedPaddingTop.toFloat() | ||
) | ||
layout.draw(canvas) | ||
} | ||
|
||
companion object { | ||
private const val DEFAULT_TOP_DOWN = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
...tation/src/main/java/com/lighthouse/presentation/ui/detailgifticon/GifticonDetailEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
package com.lighthouse.presentation.ui.detailgifticon | ||
|
||
import android.graphics.Rect | ||
import com.lighthouse.domain.model.Gifticon | ||
|
||
sealed class GifticonDetailEvent { | ||
object ScrollDownForUseButtonClicked : GifticonDetailEvent() | ||
object ShareButtonClicked : GifticonDetailEvent() | ||
object ShowAllUsedInfoButtonClicked : GifticonDetailEvent() | ||
data class ShowOriginalImage(val origin: String) : GifticonDetailEvent() | ||
data class ShowLargeBarcode(val barcode: String) : GifticonDetailEvent() | ||
object EditButtonClicked : GifticonDetailEvent() | ||
object ExistEmptyInfo : GifticonDetailEvent() | ||
data class OnGifticonInfoChanged(val before: Gifticon, val after: Gifticon) : GifticonDetailEvent() | ||
object ExpireDateClicked : GifticonDetailEvent() | ||
object UseGifticonButtonClicked : GifticonDetailEvent() | ||
object UseGifticonComplete : GifticonDetailEvent() | ||
data class NavigateToCropGifticon(val originPath: String, val croppedRect: Rect) : GifticonDetailEvent() | ||
} |
Oops, something went wrong.