-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
release: 0.0.2(2) 버전 배포
- Loading branch information
Showing
32 changed files
with
1,033 additions
and
234 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/build | ||
/build | ||
/release |
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
71 changes: 71 additions & 0 deletions
71
app/src/main/java/com/woozoo/menumonya/LocationPermissionDialog.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,71 @@ | ||
package com.woozoo.menumonya | ||
|
||
import android.app.Dialog | ||
import android.content.Context | ||
import android.graphics.Color | ||
import android.graphics.Typeface | ||
import android.graphics.drawable.ColorDrawable | ||
import android.os.Bundle | ||
import android.text.Spannable | ||
import android.text.SpannableStringBuilder | ||
import android.text.style.ForegroundColorSpan | ||
import android.text.style.StyleSpan | ||
import android.text.style.UnderlineSpan | ||
import android.view.Gravity.BOTTOM | ||
import android.view.View | ||
import android.view.View.OnClickListener | ||
import com.woozoo.menumonya.databinding.DialogLocationPermissionBinding | ||
|
||
class LocationPermissionDialog(context: Context, private val listener: OnClickListener) | ||
: Dialog(context), OnClickListener { | ||
private lateinit var binding: DialogLocationPermissionBinding | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) // xml의 background 적용되도록 함. | ||
window?.setGravity(BOTTOM) // 다이얼로그가 하단에 표시되도록 설정 | ||
|
||
super.onCreate(savedInstanceState) | ||
binding = DialogLocationPermissionBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
binding.permissionDescriptionTv.text = getSpannableText() | ||
|
||
binding.negativeBtn.setOnClickListener(this) | ||
binding.positiveBtn.setOnClickListener(listener) | ||
} | ||
|
||
override fun onClick(v: View?) { | ||
when (v?.id) { | ||
R.id.negative_btn -> { | ||
dismiss() | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* 위치 권한 다이얼로그의 '위치 서비스 사용' 텍스트에 스타일 적용 | ||
* - (주의) 텍스트 내용 수정시 setSpan()의 start, end 값도 수정해줘야 함. | ||
*/ | ||
private fun getSpannableText(): SpannableStringBuilder { | ||
val locationPermissionString = | ||
context.resources.getString(R.string.location_permission_dialog_description) | ||
val spannable = SpannableStringBuilder(locationPermissionString) | ||
|
||
val spans = listOf( | ||
ForegroundColorSpan(context.resources.getColor(R.color.colorPrimary)), | ||
UnderlineSpan(), | ||
StyleSpan(Typeface.BOLD) | ||
) | ||
|
||
for (span in spans) { | ||
spannable.setSpan( | ||
span, | ||
14, | ||
23, | ||
Spannable.SPAN_EXCLUSIVE_INCLUSIVE | ||
) | ||
} | ||
|
||
return spannable | ||
} | ||
} |
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
Oops, something went wrong.