Represent a square matrix using only List. Access to the matrix must use one-based indices.
interface Cell {
val i: Int
val j: Int
abstract class AbstractListRecycler<T> : RecyclerView.Adapter<RecyclerView.ViewHolder>() { | |
abstract fun layoutId(): Int | |
var collection: List<T> by Delegates.observable(emptyList()) { | |
_, _, _ -> notifyDataSetChanged() | |
} | |
internal var clickListener: (T) -> Unit = { } | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder = |
class MyAdapter : RecyclerView.Adapter<ViewHolder>() { | |
var data: List<MyClass> by Delegates.observable(emptyList()) { | |
_, _, _ -> notifyDataSetChanged() | |
} | |
internal var clickListener: (MyClass) -> Unit = { } | |
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = | |
ViewHolder(parent.inflate(R.layout.data_row)) |
object Mock { | |
val currentWeatherEntry by lazy { currentWeatherEntryMock() } | |
val condition by lazy { conditionMock() } | |
val weatherLocation by lazy { weatherLocationMock() } | |
val currentWeatherResponse by lazy { currentWeatherResponseMock(currentWeatherEntry, weatherLocation) } | |
const val string: String = "string" | |
const val int:Int = 1 | |
const val long: Long = 1L | |
const val double:Double = 1.0 |
package com.ntxdroid.forecastv3.ui.base | |
import android.annotation.SuppressLint | |
import android.os.Bundle | |
import android.os.PersistableBundle | |
import android.util.Log | |
import androidx.appcompat.app.AppCompatActivity | |
@SuppressLint("Registered") | |
open class LoggingActivity : AppCompatActivity() { |
/** | |
* Copyright (C) 2018 Fernando Cejas Open Source Project | |
* Modifications Copyright (C) 2018 Al Warren | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* |
val job = GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT, { MyApi.execute() }) | |
GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, { updateUi(job.await()) }) |
import android.os.Build | |
import timber.log.Timber | |
const val TIMBER_TAG = "--->" | |
const val MAX_TAG_LENGTH = 23 | |
class TimberDebugTree : Timber.DebugTree() { | |
override fun createStackElementTag(element: StackTraceElement): String? { | |
val tag = TIMBER_TAG + super.createStackElementTag(element) |
import android.os.Bundle | |
import android.os.PersistableBundle | |
import android.support.v7.app.AppCompatActivity | |
import timber.log.Timber | |
open class TimberLoggingActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) { | |
Timber.d("onCreate is called") | |
super.onCreate(savedInstanceState, persistentState) | |
} |
/* | |
* Copyright (c) 2016. Al Warren. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |