View GenerateBitmap.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
fun generateImage(width: Int, height: Int): Bitmap { | |
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888) | |
val canvas = Canvas(bitmap) | |
val paint = Paint() | |
val path = generatePath() | |
canvas.drawPath(path, paint) | |
return bitmap | |
} |
View SomeFragment.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
class SomeFragment: Fragment(){ | |
@Inject factory: AssistedViewModel.Factory | |
override fun onActivityCreated(savedInstanceState: Bundle?){ | |
super.onActivityCreated(savedInstanceState) | |
val viewModel = factory.create(301) | |
... | |
} |
View AssistedViewModel.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
class AssistedViewModel @AssistedInject constructor( | |
private val dependency1: Dependency1, | |
private val dependency2: Dependency2, | |
... | |
@Assisted private val id: Int){ | |
@AssistedInject.Factory | |
interface Factory{ fun create(id: Int) : AssistedViewModel } | |
} |
View MyViewModel.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
class MyViewModel @Inject constructor(private val dependency1: Dependency1, | |
private val dependency2: Dependency2, | |
...) | |
{ | |
private var id: Int? = null | |
fun setupId(id: Int){ | |
this.id = id | |
} | |
... |
View MyViewModel.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
class MyViewModel @Inject constructor(private val dependency1: Dependency1, | |
private val dependency2: Dependency2, | |
... | |
private val id: Int)//hold on Dagger! I will provide this on my own | |
{ ... } |
View .gitignore
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
# Built application files | |
*.apk | |
*.ap_ | |
*.aab | |
# Files for the ART/Dalvik VM | |
*.dex | |
# Java class files |
View ExampleTest.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
ExampleTest{ | |
@BeforeEach | |
fun setUp() { | |
viewModel = SomeViewModel(...) | |
filtersObserver = viewModel.filtersLiveData.observeEvents() | |
} | |
@Test fun `test 1`(){ | |
val expected = arrayListOf<Any>() |
View AlertDialog.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
fun Fragment.createAlertDialog() = | |
AlertDialog.Builder(ContextThemeWrapper(context, R.style.custom_dialog_style)) | |
data class DialogAction( | |
var text: String, | |
var onClick: (() -> Unit)? = null | |
) |
View print_out_artifact_urls.sh
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
#!/usr/bin/env bash | |
#access token can be generated here(https://app.bitrise.io/me/profile#/security) and stored as secret | |
access_token=$BITRISE_API_ACCESS_TOKEN | |
app_slug="your-app-id" # the id of your app | |
build_slug=$BITRISE_BUILD_SLUG | |
bitrise_api_url="https://api.bitrise.io/v0.1" | |
the_url="$bitrise_api_url/apps/$app_slug/builds/$build_slug/artifacts" | |
artifacts_array=$(curl -s -H "Authorization: $access_token" $the_url) |
NewerOlder