Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Coding from home

Davide Giuseppe Farella 4face-studi0

🏠
Coding from home
View GitHub Profile
View HtmlStyle.kt
package ch.protonmail.htmlcomposer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class HtmlStyle(
@SerialName("0")
@4face-studi0
4face-studi0 / kotlinx-serialization_stack-overflow.java
Created Jun 23, 2019
kotlinx-serialization StackOverflowError
View kotlinx-serialization_stack-overflow.java
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':demo:mergeDexDebug'.
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuild
View mediumBuilderDelegatio_1_4.kt
class NotificationBuilder(
context: Context
) : ResourcedBuilder by context() {
var contentText: CharSequence? by optional { contentTextRes }
@StringRes var contentTextRes: Int? = null
var title: CharSequence by required { titleRes }
@get:StringRes var titleRes: Int? = null
@get:DrawableRes var smallIconRes: Int by required()
View mediumBuilderDelegation_1_3.kt
class NotificationBuilder( private val context: Context ) {
var title: String? = null
@get: StringRes titleRes: Int? = null
...
fun build() : Notification {
val notificationTitle = title
?: titleRes?.let { context.getString( titleRes ) }!!
...
View mediumBuillderDelegation_1_2.kt
context.showNotification( R.id.cache_cleaned_id ) {
importance = NotificationImportance.LOW
channel {
idRes = R.string.background_group_id
nameRes = R.string.background_group_name
}
notification {
smallIconRes = R.drawable.ic_app
View mediumBuilderDelegation_1_1.kt
val notificationManager = context.getSystemService<NotificationManager>()!!
val title = context.getString( R.string.cache_cleaned_title )
val id = context.getString( R.id.cache_cleaned_id ).toInt()
val channelId = context.getString( R.string.background_group_id )
val channelName = context.getString( R.string.background_group_name )
val notification = NotificationCompat.Builder( context, channelId )
.setSmallIcon( R.drawable.ic_app )