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
#!/bin/bash | |
# Get the authentication code from an environment variable | |
auth_code="$AUTH_CODE" | |
# Check if the authentication code is empty | |
if [ -z "$auth_code" ]; then | |
echo "Error: Authentication code not set. Please set the AUTH_CODE environment variable." | |
exit 1 | |
fi |
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
repositories { | |
jcenter() | |
} | |
configurations { | |
ktlint | |
} | |
dependencies { | |
ktlint "com.pinterest:ktlint:0.36.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
<?xml version="1.0" encoding="utf-8"?> | |
<com.example.passiveviewpattern.UserLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:padding="8dp"> | |
<!-- others view components --> |
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
fun UserLayout.bind(data : UserData){ | |
nameTv.text = data.name | |
ageTv.text = data.age | |
/** other fields */ | |
} |
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
data class UserData( | |
val name : String, | |
val surnaname : String, | |
val age : String, | |
var urlImage : String, | |
val city : String, | |
val desc : String | |
) |
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
class UserLayout @JvmOverloads constructor( | |
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 | |
) : ConstraintLayout(context, attrs, defStyleAttr) |
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
import com.nhaarman.mockito_kotlin.mock | |
import com.nhaarman.mockito_kotlin.times | |
import com.nhaarman.mockito_kotlin.verify | |
import org.junit.Test | |
class InterfaceSegregationTest { | |
val mock = mock<()->Unit>() | |
@Test |
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
class Client(eventTrigger : EventTrigger){ | |
init { | |
eventTrigger.setEventListener { | |
onEventType_1 { println("event $it") } | |
} | |
} | |
} |
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
fun EventTrigger.setEventListener(init: EventListenerImpl.() -> Unit) { | |
val listener = EventListenerImpl() | |
... | |
} |
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
class EventTrigger(var eventListener: EventListener? = null) { | |
fun triggerEventType1() { | |
eventListener?.onEventType_1("event 1") | |
} | |
} |
NewerOlder