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
registerReceiver(object : BroadcastReceiver() { | |
override fun onReceive(context: Context, intent: Intent) { | |
if ((intent.extras["networkInfo"] as NetworkInfo).state != NetworkInfo.State.CONNECTED) { | |
Toast.makeText(context, R.string.networkErr, Toast.LENGTH_LONG).show() | |
unregisterReceiver(this) | |
finish() | |
return | |
} | |
} | |
}, IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)) |
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 SimpleMap<in K, V> { | |
private var keys = ArrayList<K>() | |
private var values = ArrayList<V>() | |
operator fun get(key: K): V { | |
return values[keys.indexOf(key)] | |
} | |
operator fun set(key: K, value: V) { |
NewerOlder