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
private fun buildFlowableFromIntervals( | |
intervals: List<Interval>, | |
): Flowable<ApiResponse> { | |
val intervalFlowables = intervals.map(::buildFlowableForInterval) | |
val completeFlowable = Flowable.concat(intervalFlowables) | |
return completeFlowable | |
.flatMap { | |
apiSingle().toFlowable() |
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
/** | |
* Interface defining the contract of any event that can be tracked in the app. It includes a unique key identifying the event, | |
* and ability to record properties. | |
*/ | |
interface AnalyticsEvent { | |
val eventName: String | |
val properties: Map<String, Any> | |
} |
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
sealed class UiImage { | |
data class LocalImage(val imageRes: Int) : UiImage() | |
data class RemoteImage(val imageUrl: String) : UiImage() | |
} | |
// Component | |
@Composable | |
fun UserProfile( | |
avatar: UiImage, | |
) |
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 DramaCategoryFragment : Fragment(R.layout.fragment_drama_category), | |
MovieListAdapter.FavouriteMovieListener { | |
// ... | |
private fun getDramaMovies() { | |
val movieAPI = MoviesData.defaultInstance() | |
// ... |
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
local.properties | |
# Don't forget to ignore this from your source control |
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
val cameroonNumberTranslator = object : OffsetMapping { | |
override fun originalToTransformed(offset: Int): Int { | |
// [offset [0 - 2] remain the same] | |
if (offset <= 2) return offset | |
// [3 - 5] transformed to [4 - 6] respectively | |
if (offset <= 5) return offset + 1 | |
// [6 - 8] transformed to [8 - 10] respectively | |
if (offset <= 8 ) return offset + 2 | |
return 11 // Total number of digits, plus two hyphens | |
} |
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 Fragment : Fragment() { | |
fun listenForNavigation() { | |
lifecycleScope.launchWhenResumed { | |
val directions = viewModel.navigationChannel.receive() | |
findNavController().navigate(directions) | |
} | |
} | |
} |
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
// NOTES: This doesn't help you import it into Intellij, I don't have the time to write that up right now, but if you know how | |
// to create your own live template, you can copy and paste the below. | |
@Preview( | |
name = "Night Mode", | |
uiMode = Configuration.UI_MODE_NIGHT_YES, | |
) | |
@Preview( | |
name = "Day Mode", | |
uiMode = Configuration.UI_MODE_NIGHT_NO, |
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
package // ... | |
import com.android.tools.lint.client.api.UElementHandler | |
import com.android.tools.lint.detector.api.Category | |
import com.android.tools.lint.detector.api.Detector | |
import com.android.tools.lint.detector.api.Implementation | |
import com.android.tools.lint.detector.api.Issue | |
import com.android.tools.lint.detector.api.JavaContext | |
import com.android.tools.lint.detector.api.Scope | |
import com.android.tools.lint.detector.api.Severity |
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 class is the current implementation. | |
* | |
* Notice that in [addPendingPrescriptionCard] and [addActivePrescriptionCard], | |
* we have relatively identical code: | |
* | |
* 1. Create the group. | |
* 2. Create all the models and add them to the group. | |
* 3. Add the group to the main controller. | |
* |
NewerOlder