Skip to content

Instantly share code, notes, and snippets.

View ParkSangGwon's full-sized avatar

Ted Park ParkSangGwon

View GitHub Profile
data class BeforeUser(
val type: Type,
val name: String,
val address: String?,
val phoneNumber: String?,
val businessNumber: String?,
val department: String?
) {
enum class Type {
CUSTOMER, STORE, ADMIN
sealed class User(open val name: String) {
data class Customer(
override val name: String,
val address: String,
val phoneNumber: String
) : User(name)
data class Store(
override val name: String,
sealed class User {
data class Customer(
val name: String,
val address: String,
val phoneNumber: String
) : User()
data class Store(
val name: String,
val address: String,
data class User(
val type: Type,
val name: String,
val address: String?,
val phoneNumber: String?,
val businessNumber: String?,
val department: String?
) {
enum class Type {
CUSTOMER, STORE, ADMIN
private fun handleDeepLink() {
val deepLinkUri = intent.data
logd("deepLinkUri: $deepLinkUri")
val deepLinkIntent = deepLinkUri?.let {
DeepLinkInfo.invoke(deepLinkUri).getIntent(this, it)
} ?: DeepLinkInfo.getMainIntent(this)
if (isTaskRoot) {
TaskStackBuilder.create(this).apply {
if (needAddMainForParent(deepLinkIntent)) {
addNextIntentWithParentStack(DeepLinkInfo.getMainIntent(this@SchemeActivity))
enum class DeepLinkInfo(@StringRes val hostStringResId: Int) {
MAIN(R.string.scheme_host_main) {
override fun getIntent(context: Context, deepLinkUri: Uri) =
getMainIntent(context)
},
DETAIL(R.string.scheme_host_detail) {
override fun getIntent(context: Context, deepLinkUri: Uri) =
DetailActivity.getIntent(context, deepLinkUri)
class TedContentProvider : ContentProvider() {
override fun onCreate(): Boolean {
Log.d("ted", "TedContentProvider::onCreate")
val application = context as Application
Stetho.initializeWithDefaults(application)
startKoin {
androidContext(application)
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel notificationChannel = new NotificationChannel("channel_id", "channel_name", NotificationManager.IMPORTANCE_DEFAULT);
notificationChannel.setDescription("channel description");
notificationChannel.enableLights(true);
notificationChannel.setLightColor(Color.GREEN);
notificationChannel.enableVibration(true);
notificationChannel.setVibrationPattern(new long[]{100, 200, 100, 200});
notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
notificationManager.createNotificationChannel(notificationChannel);
android.app.NotificationManager notificationManager = (android.app.NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
NotificationChannel channelMessage = new NotificationChannel("channel_id", "channel_name", android.app.NotificationManager.IMPORTANCE_DEFAULT);
channelMessage.setDescription("channel description");
channelMessage.enableLights(true);
channelMessage.setLightColor(Color.GREEN);
channelMessage.enableVibration(true);
channelMessage.setVibrationPattern(new long[]{100, 200, 100, 200});
channelMessage.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
notificationManager.createNotificationChannel(channelMessage);