-
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.
v6.0.1 릴리즈
- Loading branch information
Showing
480 changed files
with
13,916 additions
and
3,098 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
40 changes: 40 additions & 0 deletions
40
android/app/src/main/java/com/ddangddangddang/android/feature/common/ErrorTypeHandler.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,10 +1,50 @@ | ||
package com.ddangddangddang.android.feature.common | ||
|
||
import android.app.Activity | ||
import android.view.View | ||
import androidx.annotation.StringRes | ||
import androidx.fragment.app.Fragment | ||
import com.ddangddangddang.android.util.view.Toaster | ||
import com.ddangddangddang.android.util.view.showSnackbar | ||
|
||
fun Activity.notifyFailureMessage(errorType: ErrorType, @StringRes defaultMessageId: Int) { | ||
val defaultMessage = getString(defaultMessageId) | ||
Toaster.showShort(this, errorType.message ?: defaultMessage) | ||
} | ||
|
||
fun Fragment.notifyFailureMessage(errorType: ErrorType, @StringRes defaultMessageId: Int) { | ||
val defaultMessage = getString(defaultMessageId) | ||
Toaster.showShort(requireContext(), errorType.message ?: defaultMessage) | ||
} | ||
|
||
fun Activity.notifyFailureSnackBar( | ||
anchorView: View, | ||
errorType: ErrorType, | ||
@StringRes defaultMessageId: Int, | ||
@StringRes actionMessageId: Int, | ||
action: () -> Unit = {}, | ||
) { | ||
val defaultMessage = getString(defaultMessageId) | ||
val actionMessage = getString(actionMessageId) | ||
anchorView.showSnackbar( | ||
message = errorType.message ?: defaultMessage, | ||
actionMessage = actionMessage, | ||
action, | ||
) | ||
} | ||
|
||
fun Fragment.notifyFailureSnackBar( | ||
anchorView: View, | ||
errorType: ErrorType, | ||
@StringRes defaultMessageId: Int, | ||
@StringRes actionMessageId: Int, | ||
action: () -> Unit = {}, | ||
) { | ||
val defaultMessage = getString(defaultMessageId) | ||
val actionMessage = getString(actionMessageId) | ||
anchorView.showSnackbar( | ||
message = errorType.message ?: defaultMessage, | ||
actionMessage = actionMessage, | ||
action, | ||
) | ||
} |
42 changes: 42 additions & 0 deletions
42
android/app/src/main/java/com/ddangddangddang/android/feature/common/PriceTextWatcher.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,42 @@ | ||
package com.ddangddangddang.android.feature.common | ||
|
||
import android.text.Editable | ||
import android.text.TextWatcher | ||
|
||
class PriceTextWatcher(private val onAfterChanged: (String) -> Unit) : TextWatcher { | ||
private var cursorPositionFromEnd: Int = 0 | ||
|
||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} | ||
|
||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) { | ||
s?.let { str -> | ||
cursorPositionFromEnd = str.length - (start + count) | ||
moveCursorIfOnlyCommaRemoved(str, before) | ||
} | ||
} | ||
|
||
private fun moveCursorIfOnlyCommaRemoved(str: CharSequence, before: Int) { | ||
val strOnlyNumber = str.filter { it.isDigit() } | ||
val expectedCommaCount = (strOnlyNumber.length - 1) / 3 | ||
|
||
// 쉼표의 개수가 적고 지워진 문자가 1개인 경우 커서를 앞으로 1 움직입니다. | ||
val actualCommaCount = str.count { it == ',' } | ||
if (actualCommaCount < expectedCommaCount && before == 1) { | ||
cursorPositionFromEnd++ | ||
} | ||
} | ||
|
||
override fun afterTextChanged(s: Editable?) { | ||
s?.let { onAfterChanged(s.toString()) } | ||
} | ||
|
||
fun getCursorPosition( | ||
textLength: Int, | ||
defaultCursorPositionFromEnd: Int, | ||
): Int { | ||
cursorPositionFromEnd = | ||
if (cursorPositionFromEnd > 0) cursorPositionFromEnd else defaultCursorPositionFromEnd | ||
val cursorPosition = textLength - cursorPositionFromEnd | ||
return if (cursorPosition > 0) cursorPosition else 0 | ||
} | ||
} |
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
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
14 changes: 14 additions & 0 deletions
14
...oid/app/src/main/java/com/ddangddangddang/android/feature/detail/DetailFragmentAdapter.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,14 @@ | ||
package com.ddangddangddang.android.feature.detail | ||
|
||
import androidx.fragment.app.Fragment | ||
import androidx.fragment.app.FragmentManager | ||
import androidx.lifecycle.Lifecycle | ||
import androidx.viewpager2.adapter.FragmentStateAdapter | ||
|
||
class DetailFragmentAdapter(fragmentManager: FragmentManager, lifeCycle: Lifecycle) : | ||
FragmentStateAdapter(fragmentManager, lifeCycle) { | ||
override fun getItemCount(): Int = DetailFragmentType.values().size | ||
override fun createFragment(position: Int): Fragment { | ||
return DetailFragmentType.getTypeFrom(position).create() | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
android/app/src/main/java/com/ddangddangddang/android/feature/detail/DetailFragmentType.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,36 @@ | ||
package com.ddangddangddang.android.feature.detail | ||
|
||
import androidx.annotation.StringRes | ||
import androidx.fragment.app.Fragment | ||
import com.ddangddangddang.android.R | ||
import com.ddangddangddang.android.feature.detail.bidHistory.BidHistoryFragment | ||
import com.ddangddangddang.android.feature.detail.info.AuctionInfoFragment | ||
import com.ddangddangddang.android.feature.detail.qna.QnaFragment | ||
|
||
enum class DetailFragmentType(val tag: String, @StringRes val nameId: Int) { | ||
AUCTION_INFO("auction_info", R.string.detail_auction_info_title) { | ||
override fun create(): Fragment { | ||
return AuctionInfoFragment() | ||
} | ||
}, | ||
|
||
QNA("qna_tag", R.string.detail_auction_qna_title) { | ||
override fun create(): Fragment { | ||
return QnaFragment() | ||
} | ||
}, | ||
BID_HISTORY("bid_history_tag", R.string.detail_auction_bid_history) { | ||
override fun create(): Fragment { | ||
return BidHistoryFragment() | ||
} | ||
}, | ||
; | ||
|
||
abstract fun create(): Fragment | ||
|
||
companion object { | ||
fun getTypeFrom(position: Int): DetailFragmentType { | ||
return values()[position] | ||
} | ||
} | ||
} |
Oops, something went wrong.