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 TestThread:Thread(){ | |
override fun run() { | |
Thread.sleep(10000) | |
} | |
} | |
val myThread = TestThread() | |
myThread.start() | |
myThread.interrupt() |
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
package com.henrykvdb.tttremote | |
import android.annotation.SuppressLint | |
import android.app.Activity | |
import android.os.Bundle | |
import android.support.v4.content.ContextCompat | |
import android.util.Log | |
import android.view.GestureDetector | |
import android.view.MotionEvent | |
import android.widget.ImageView |
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
private fun updateLayout() { | |
//Clear layout | |
devicesLayout.removeAllViews() | |
//Add all the devices | |
if (devices.size > 0) { | |
for (device in devices) { | |
devicesLayout.addView(TextView(this).apply { | |
text = device.name + "\n" + device.address | |
setTextSize(TypedValue.COMPLEX_UNIT_SP, 18f) |
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
while (true) | |
{ | |
board = board.copy(); | |
List<Byte> moves = board.availableMoves(); | |
Byte move = moves.get(rand.nextInt(moves.size())); | |
board.play(move); | |
if (firstChoice == null) | |
firstChoice = board; |
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
val deviceInfo = ("\n /** please do not remove this block, technical info: " | |
+ "os version: ${System.getProperty("os.version")}(${android.os.Build.VERSION.INCREMENTAL})" | |
+ ", API: ${android.os.Build.VERSION.SDK_INT}" | |
+ try { | |
", app version: ${packageManager.getPackageInfo(packageName, 0).versionName}" | |
} catch (e: PackageManager.NameNotFoundException) { | |
"" | |
} + "**/") |
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
var deviceInfo = ("\n /** please do not remove this block, technical info: " | |
+ "os version: ${System.getProperty("os.version")}(${android.os.Build.VERSION.INCREMENTAL})" | |
+ ", API: ${android.os.Build.VERSION.SDK_INT}") | |
try { | |
val pInfo = packageManager.getPackageInfo(packageName, 0) | |
deviceInfo += ", app version: ${pInfo.versionName}" | |
} catch (e: PackageManager.NameNotFoundException) { | |
//Add nothing | |
} | |
deviceInfo += "**/" |
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 LinkView(context: Context, attrs: AttributeSet) : TextView(context, attrs) { | |
init { | |
movementMethod = LinkMovementMethod.getInstance() | |
text = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) Html.fromHtml(text.toString()) | |
else Html.fromHtml(text.toString(), Html.FROM_HTML_MODE_LEGACY) | |
} | |
} |
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
enum class RemoteMessage(val index:Int) { | |
UNDO(0), | |
SETUP(1), | |
BOARD_UPDATE(2); | |
companion object{ | |
fun fromIndex(index:Int): RemoteMessage { | |
RemoteMessage.values().filter { it.index == index }.forEach { return it } | |
throw IllegalArgumentException("$index is not a valid RemoteMessage") | |
} |
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
version '1.0-SNAPSHOT' | |
buildscript { | |
ext.kotlin_version = '1.2-M1' | |
repositories { | |
maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.2' } | |
mavenCentral() | |
maven {url "https://plugins.gradle.org/m2/"} | |
} |
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
293,236,176,162,112,72,51,50,50,49,48,48,47,44,41,39,39,38,37,37,36,35,35,34,33,30,29,29,28,27,26,26,26,26,26,25,25,25,25,24,24,24,24,24,24,23,23,23,22,22,21,21,20,20,20,19,19,19,19,19,19,19,18,18,18,18,18,18,18,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16,16,16,16,16,16,16,16,16,16,16,16,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,14,14,14,14,14,14,13,13,13,13,13,13,13,13,13,13,13,13,13,12,12,12,12,12,12,12,12,12,12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, |