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
@AndroidEntryPoint | |
class MainActivity : AppCompatActivity() { @Inject lateinit var analytics: AnalyticsAdapter | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
} | |
} |
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 AnalyticsAdapter @Inject constructor() { ... } |
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
@HiltAndroidApp | |
class MyApplication : Application() { ... } |
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
You can overwrite the ${USER} variable in the template file with the | |
#set( $VARIABLE = "value") | |
function. Go to Settings -> File and Code Templates -> Includes -> File Header prepend the #set() function call, for example: | |
#set( $USER = "Your name" ) | |
/** | |
* Created by ${USER} on ${DATE}. | |
*/ |
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"?> | |
<resources> | |
<!-- Red --> | |
<color name="material_red_50">#FFEBEE</color> | |
<color name="material_red_100">#FFCDD2</color> | |
<color name="material_red_200">#EF9A9A</color> | |
<color name="material_red_300">#E57373</color> | |
<color name="material_red_400">#EF5350</color> | |
<color name="material_red_500">#F44336</color> | |
<color name="material_red_600">#E53935</color> |
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 myDelegate(): ReadWriteProperty<Nothing?, Int> = | |
object : ReadWriteProperty<Nothing?, Int> { | |
... | |
} | |
val foo: Int by myDelegate() | |
var bar: Int by myDelegate() |
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 max = maxOf(1, 2, 3, 4) | |
println(max) |
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
println(Double.NaN) // NaN | |
println(Double.NEGATIVE_INFINITY) // -Infinity | |
println(Double.POSITIVE_INFINITY > Double.MAX_VALUE ) // true | |
println(Double.SIZE_BITS) // 64 |
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 s: String? = null | |
println(s.toBoolean()) // false |
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 numbers = mutableListOf(0, 1, 2, 3, 4, 5) | |
val runningReduceSum = numbers.runningReduce() { sum, item -> sum + item} // [0, 1, 3, 6, 10, 15] | |
val runningFoldSum = numbers.runningFold(10) { sum, item -> sum + item} // [10, 10, 11, 13, 16, 20, 25] |