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
class DynamicImageView: LinearLayout { | |
private var imagesPath = mutableListOf<String>() | |
private val horizontalLayoutParam by lazy { LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT) } | |
private val weightZeroLayoutParam by lazy { LinearLayout.LayoutParams(0, 380, 1F) } | |
constructor(context: Context) : super(context) | |
fun addImage(vararg path: String) : DynamicImageView { |
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
inline fun ViewManager.flexboxLayout(theme: Int = 0, init: FlexboxLayout.() -> Unit) = ankoView(::FlexboxLayout, theme, init) | |
inline fun ViewManager.swipeRefreshLayout(theme: Int = 0, init: SwipeRefreshLayout.() -> Unit) = ankoView(::SwipeRefreshLayout, theme, init) | |
inline fun ViewManager.zoomTextView(theme: Int = 0, init: ZoomTextView.() -> Unit) = ankoView(::ZoomTextView, theme, init) | |
inline fun ViewManager.textView(theme: Int = 0, init: TextView.() -> Unit) = ankoView(::TextView, theme, init) | |
inline fun ViewManager.imageView(theme: Int = 0, init: ImageView.() -> Unit) = ankoView(::ImageView, theme, init) | |
inline fun ViewManager.view(theme: Int = 0, init: View.() -> Unit) = ankoView(::View, theme, init) | |
inline fun ViewManager.button(theme: Int = 0, init: Button.() -> Unit) = ankoView(::Button, theme, init) |
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.location.Address | |
import android.location.Geocoder | |
import java.io.IOException | |
/** | |
* Created by soulduse on 2018. 2. 10.. | |
*/ | |
object GeocoderUtil { | |
fun getAddress(lat: Double, lon: Double): String{ |
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
val items = arrayOf( | |
longArrayOf(200, 0), | |
longArrayOf(95, 5, 95, 5), | |
longArrayOf(60, 7, 60, 7, 60, 7), | |
longArrayOf(43, 7, 43, 7, 43, 7, 43, 7), | |
longArrayOf(32, 8, 32, 8, 32, 8, 32, 8, 32, 8), | |
longArrayOf(25, 8, 25, 8, 25, 8, 25, 8, 25, 8, 25, 8), | |
longArrayOf(20, 9, 20, 9, 20, 9, 20, 9, 20, 9, 20, 9, 20, 9), | |
longArrayOf(16, 9, 16, 9, 16, 9, 16, 9, 16, 9, 16, 9, 16, 9, 16, 9), | |
longArrayOf(13, 9, 13, 9, 13, 9, 13, 9, 13, 9, 13, 9, 13, 9, 13, 9, 13, 9), |
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
/** | |
* Created by Soulduse on 2018. 1. 11.. | |
* | |
* ex) | |
* CustomDialog(CustomDialog.Items().apply { | |
* this.context = context | |
* this.message = "message" | |
* this.positiveTitle = "ok" | |
* this.negativeTitle = "cancel" | |
* }).show({ |
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
/** | |
* ex) | |
* CustomDialog | |
* .create { | |
* with { mContext } | |
* items { | |
* CustomDialog.Items().apply { | |
* message = "This is dialog message" | |
* positiveTitle = "Positive title" | |
* negativeTitle = "Negative title" |
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
interface ApiInterface { | |
@GET("User") | |
fun getUser( | |
@Query("user_id") userId: String | |
): Deferred<User> | |
} |
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.dave.webviewgps; | |
import android.Manifest; | |
import android.content.pm.PackageManager; | |
import android.os.Bundle; | |
import android.support.annotation.NonNull; | |
import android.support.v4.app.ActivityCompat; | |
import android.support.v4.content.ContextCompat; | |
import android.support.v7.app.AppCompatActivity; | |
import android.webkit.GeolocationPermissions; |
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.dave.webviewgps; | |
import android.os.Bundle; | |
import android.support.v7.app.AppCompatActivity; | |
import android.webkit.GeolocationPermissions; | |
import android.webkit.WebChromeClient; | |
import android.webkit.WebView; | |
import android.webkit.WebViewClient; | |
public class MainActivity extends AppCompatActivity { |
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 org.json.JSONArray; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import java.util.*; | |
public class JsonHelper { | |
public static Object toJSON(Object object) throws JSONException { | |
if (object instanceof Map) { | |
JSONObject json = new JSONObject(); |