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 seriousWork() = thread(name = "Worker") { | |
while (!Thread.currentThread().isInterrupted) { | |
// Perform Genetic Sequencing | |
} | |
} |
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 HomeFragment : Fragment() { | |
private val adapter = Adapter() | |
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, | |
savedInstanceState: Bundle?): View? = | |
inflater.inflate(R.layout.fragment_home, container, false) | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, 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
interface ApiService { | |
@GET("status") | |
suspend fun getStatus(): Response<Status> | |
} | |
class LearningCoroutinesViewModel @Inject constructor(private val apiService: ApiService) : | |
ViewModel() { | |
fun getStatus() { |
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 Toy(override val id: String, val name: String, val color: Int): UniqueList.Unique<String> |
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 Unique<T> { | |
val id: T | |
} |
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 ToyViewAdapter : RecyclerView.Adapter<ToyViewHolder>() { | |
private val toys = mutableListOf<Toy>() | |
fun addToys(vararg toys: Toy) { | |
val start = toys.size - 1 | |
this.toys.addAll(toys) | |
notifyItemRangeInserted(start, toys.size) | |
} |
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 ToyViewHolder(view: View) : RecyclerView.ViewHolder(view) { | |
fun bind(toy: Toy) { | |
// TODO Bind toy to view | |
} | |
} |
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 Toy(val id: String, val name: String, val color: 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
@dynamicCallable | |
protocol UseCase { | |
func invoke() | |
} | |
extension UseCase { | |
func dynamicallyCall(withArguments: [Void]) { | |
invoke() | |
} | |
} |
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 UseCase { | |
operator fun invoke() | |
} | |
class UseCaseImpl: UseCase { | |
override fun invoke() { | |
println("Invalidate cache") | |
} | |
} |