object单例

    1. public class MusicPlayerJava {
    2. public static MusicPlayerJava INSTANCE = new MusicPlayerJava();
    3. private MusicPlayerJava(){}
    4. }
    1. class Driver
    2. interface OnExternalDriverMountListener{
    3. fun onMount(driver: Driver)
    4. fun onUnmount(driver: Driver)
    5. }
    6. abstract class Player
    7. object MusicPlayer: Player(), OnExternalDriverMountListener{
    8. override fun onMount(driver: Driver) {
    9. }
    10. override fun onUnmount(driver: Driver) {
    11. }
    12. val state : Int = 0
    13. fun play(url : String){
    14. }
    15. fun stop(){
    16. }
    17. }