This file contains hidden or 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 isLeapYear(year: Int?): Boolean { | |
| return if (year != null) { | |
| (year % 4 == 0) && (year % 100 != 0 || year % 400 == 0) | |
| } else { | |
| false | |
| } | |
| } | |
| fun main() { | |
| print("Enter favorite year: ") |
This file contains hidden or 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 car = Car.makeCar(150) | |
| println(Car.Factory.cars.size) |
This file contains hidden or 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 Car(val horsepowers: Int) { | |
| companion object Factory { | |
| val cars = mutableListOf<Car>() | |
| fun makeCar(horsepowers: Int): Car { | |
| val car = Car(horsepowers) | |
| cars.add(car) | |
| return car | |
| } | |
| } | |
| } |
This file contains hidden or 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
| companion object { | |
| private var instance: BusinessManager? = null | |
| fun getInstance(): BusinessManager { | |
| if (instance == null) { | |
| instance = BusinessManager() | |
| } | |
| return instance as BusinessManager | |
| } |
This file contains hidden or 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
| String deviceId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); | |
| Toast.makeText(this, deviceId, Toast.LENGTH_LONG).show(); |
This file contains hidden or 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 deviceId: String = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID) | |
| Toast.makeText(this, deviceId, Toast.LENGTH_LONG).show() |
This file contains hidden or 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 com.halil.ozel.exoplayerdashsample | |
| import android.os.Bundle | |
| import androidx.appcompat.app.AppCompatActivity | |
| import com.google.android.exoplayer2.ExoPlayer | |
| import com.google.android.exoplayer2.MediaItem | |
| import com.google.android.exoplayer2.source.MediaSource | |
| import com.google.android.exoplayer2.source.ProgressiveMediaSource | |
| import com.google.android.exoplayer2.upstream.DefaultHttpDataSource | |
| import com.halil.ozel.exoplayerdashsample.databinding.ActivityMainBinding |
This file contains hidden or 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 checkMediaType() { | |
| val type = when(Util.inferContentType(URL.toUri())){ | |
| C.CONTENT_TYPE_HLS -> { | |
| println("Type HLS") | |
| } | |
| C.CONTENT_TYPE_DASH -> { | |
| println("Type DAS") | |
| } | |
| C.CONTENT_TYPE_OTHER -> { | |
| println("Type OTHER") |
NewerOlder