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 <T> unsafeLazy(initializer: () -> T) = lazy(LazyThreadSafetyMode.NONE, initializer) | |
| @JvmOverloads @Dimension(unit = Dimension.PX) fun Number.dpToPx( | |
| metrics: DisplayMetrics = Resources.getSystem().displayMetrics | |
| ): Float { | |
| return toFloat() * metrics.density | |
| } | |
| @JvmOverloads @Dimension(unit = Dimension.DP) fun Number.pxToDp( | |
| metrics: DisplayMetrics = Resources.getSystem().displayMetrics |
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 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:flutter/services.dart'; | |
| // See: https://twitter.com/shakil807/status/1042127387515858949 | |
| // https://github.com/pchmn/MaterialChipsInput/tree/master/library/src/main/java/com/pchmn/materialchips | |
| // https://github.com/BelooS/ChipsLayoutManager | |
| void main() => runApp(ChipsDemoApp()); |
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.GenericLifecycleObserver | |
| import android.arch.lifecycle.Lifecycle | |
| import android.arch.lifecycle.Lifecycle.Event.ON_DESTROY | |
| import android.arch.lifecycle.LifecycleOwner | |
| import kotlinx.coroutines.experimental.CoroutineScope | |
| import kotlinx.coroutines.experimental.Dispatchers | |
| import kotlinx.coroutines.experimental.Job | |
| import kotlinx.coroutines.experimental.android.Main | |
| fun Lifecycle.createJob(cancelEvent: Lifecycle.Event = ON_DESTROY): Job = Job().also { job -> |
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 'package:flutter/material.dart'; | |
| import 'package:carousel_slider/carousel_slider.dart'; | |
| import 'package:cached_network_image/cached_network_image.dart'; | |
| void main() => runApp(new MyApp()); | |
| class MyApp extends StatelessWidget { | |
| // This widget is the root of your application. | |
| @override | |
| Widget build(BuildContext context) { | |
| return new MaterialApp( |
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
| object ApiClient { | |
| fun getIntance(): ApiStores { | |
| val builder = OkHttpClient.Builder() | |
| if (BuildConfig.DEBUG) { | |
| val loggingInterceptor = HttpLoggingInterceptor() | |
| loggingInterceptor.level = HttpLoggingInterceptor.Level.BODY | |
| builder.addInterceptor(loggingInterceptor) |
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
| https://stackoverflow.com/questions/16536414/how-to-use-mapview-in-android-using-google-map-v2 |
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.Lifecycle | |
| import android.arch.lifecycle.LifecycleObserver | |
| import android.arch.lifecycle.LifecycleOwner | |
| import android.arch.lifecycle.OnLifecycleEvent | |
| import android.util.Log | |
| import kotlinx.coroutines.experimental.CoroutineStart | |
| import kotlinx.coroutines.experimental.Deferred | |
| import kotlinx.coroutines.experimental.Job | |
| import kotlinx.coroutines.experimental.android.UI | |
| import kotlinx.coroutines.experimental.async |
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 <T> tryOrDefault(default: T? = null, block: () -> T?) = try { | |
| block() | |
| } catch(e: Exception){ | |
| default | |
| } | |
| inline fun <T> tryOrNull(block: () -> T?) = try { | |
| block() | |
| } catch(e: Exception){ |
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 be.brol | |
| import android.os.Binder | |
| import android.os.Bundle | |
| import android.support.v4.app.BundleCompat | |
| import android.support.v4.app.Fragment | |
| /** | |
| * Eases the Fragment.newInstance ceremony by marking the fragment's args with this delegate | |
| * Just write the property in newInstance and read it like any other property after the fragment has been created |
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
| showProgress("Loading.."); | |
| ApiClient.getInstance().login(email,pass) /// api call | |
| .retryWhen(new RetryWithDelay(5,1000)) | |
| .doAfterNext(userResponse -> { | |
| if(userResponse.isStatus()){ | |
| if(userResponse.getBody() != null){ | |
| User user = userResponse.getBody(); | |
| setUser(user); |