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
| data class LatLng(val latitude: Double,val longitude: Double) | |
| class Utm(val latlng: LatLng){ | |
| fun utmLongitudeZone(): Int { | |
| return Math.floor(Math.floor((longitude + 180) / 6)).roundToInt() + 1 | |
| } | |
| fun utmLatZone(): Char{ | |
| if (latitude < -80) { |
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
| *.txt |
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
| import com.google.gson.Gson | |
| import com.google.gson.reflect.TypeToken | |
| open class Serializer() { | |
| val gson: Gson = Gson() | |
| fun <T> toJson(targetObject: T): String { | |
| return gson.toJson(targetObject) | |
| } |
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
| import android.content.SharedPreferences | |
| class PreferenceHelper(private val sharedPreferences: SharedPreferences) { | |
| fun getInt(key: String, defaultValue: Int = 0): Int { | |
| return sharedPreferences.getInt(key, defaultValue) | |
| } | |
| fun getFloat(key: String, defaultValue: Float = 0f): Float { | |
| return sharedPreferences.getFloat(key, defaultValue) |
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
| import android.content.SharedPreferences | |
| class PreferenceHelper(private val sharedPreferences: SharedPreferences) { | |
| fun getInt(key: String, defaultValue: Int = 0): Int { | |
| return sharedPreferences.getInt(key, defaultValue) | |
| } | |
| fun getFloat(key: String, defaultValue: Float = 0f): Float { | |
| return sharedPreferences.getFloat(key, defaultValue) |
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 adjustGoogleWaterMark() { | |
| try { | |
| val googleLogo = mapFrame.findViewWithTag<ImageView>("GoogleWatermark") | |
| googleLogo ?: return; | |
| with(googleLogo.layoutParams as RelativeLayout.LayoutParams) { | |
| addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE) | |
| addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0) | |
| addRule(RelativeLayout.ALIGN_PARENT_START, 0) | |
| addRule(RelativeLayout.ALIGN_PARENT_TOP, 0) | |
| addRule(RelativeLayout.ALIGN_PARENT_END, RelativeLayout.TRUE) |
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 readContent(fileNameWithExt: String): String? { | |
| return try { | |
| val classLoader = javaClass.classLoader | |
| val resource = classLoader.getResource(fileNameWithExt) | |
| val file = File(resource.file) | |
| file.readText() | |
| } catch (e: Exception) { | |
| null | |
| } | |
| } |
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.sensehawk.presentation | |
| import android.arch.lifecycle.LifecycleOwner | |
| import android.arch.lifecycle.MutableLiveData | |
| import android.arch.lifecycle.Observer | |
| import android.support.annotation.MainThread | |
| import java.util.concurrent.atomic.AtomicBoolean | |
| class EventLiveData<T> : MutableLiveData<T>() { |
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
| //npm install --save eslint-config-airbnb eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react-redux | |
| module.exports = { | |
| 'env': { | |
| 'jest': true, | |
| }, | |
| 'parser': 'babel-eslint', | |
| 'parserOptions': { | |
| 'sourceType': 'module', | |
| 'ecmaVersion': 6, | |
| 'ecmaFeatures': { |
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
| import android.arch.lifecycle.Observer | |
| /** | |
| * invokes the [callback] if the observer emits a non-null value. | |
| */ | |
| inline fun <reified T: Any?> nonNullObserver(crossinline callback: (T) -> Unit) : Observer<T> { | |
| return Observer { | |
| callback.invoke(it ?: return@Observer) | |
| } | |
| } |
OlderNewer