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 User(val firstName: String, | |
val lastName: String, | |
val age: Int) |
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
// ... DECOMPILED CODE GOES ABOVE ... // | |
public String toString() { | |
return "User(firstName=" + this.firstName + ", lastName=" + this.lastName + ", age=" + this.age + ")"; | |
} | |
// ... DECOMPILED CODE GOES BELOW ... // |
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 User(val firstName: String, | |
val lastName: String, | |
val age: Int) { | |
override fun toString() = "ABC-1234567890" | |
} |
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
// ... DECOMPILED CODE GOES ABOVE ... // | |
@NotNull | |
public String toString() { | |
return "ABC-1234567890"; | |
} | |
// ... DECOMPILED CODE GOES BELOW ... // |
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 | |
# Replace APPLICATION_ID, REPORT_DEVICE_LOCATION | |
# and REPORT_DESKTOP_LOCATION with your values | |
BROADCAST_ACTION="build-rx-report" # Intent filter action for BroadcastReceiver | |
APPLICATION_ID=com.myapplication # RENAME | |
SLEEP_BEFORE_PULL=3 # Give a time (in seconds) to generate & save HTML report | |
# Location in Android device SD card | |
REPORT_DEVICE_LOCATION=/storage/emulated/0/Android/data/$APPLICATION_ID/files/report.html | |
REPORT_DESKTOP_LOCATION=~/report.html # Location on desktop |
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 registerReceiver() { | |
val filter = IntentFilter() | |
filter.addAction("build-rx-report") // Action from report.sh | |
val receiver = object : BroadcastReceiver() { | |
override fun onReceive(context: Context, intent: Intent) { | |
val result = RxDisposableWatcher.probe() | |
val report = HtmlReportBuilder(result).build() | |
val file = File(getExternalFilesDir(null), "report.html") |
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 Thermometer { | |
fun observeTemperature(): Observable<Int> | |
} | |
// ... | |
val thermometer = Thermometer.getInstance() | |
// ... | |
thermometer | |
.observeTemperature() | |
.subscribe { /* Handle value */ } // Subscribed, but not disposed afterwards! |
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 WeatherActivity : AppCompatActivity() { | |
private val thermometer = Thermometer.getInstance() | |
private var disposable: Disposable? = null | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
disposable = thermometer // Save the result of subscribe() method | |
.observeTemperature() | |
.subscribe { celsius -> /* Display in a TextView */ } |
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 WeatherActivity : AppCompatActivity() { | |
private val thermometer = Thermometer.getInstance() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
thermometer | |
.observeTemperature() | |
.subscribe { celsius -> /* Display in a TextView */ } | |
} |
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 WeatherActivity : AppCompatActivity() { | |
private val thermometer = Thermometer.getInstance() | |
private var disposable: Disposable? = null | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
disposable = thermometer | |
.observeTemperature() | |
.subscribe { celsius -> /* Display in a TextView */ } |