Skip to content

Instantly share code, notes, and snippets.

View eugenebrusov's full-sized avatar

Eugene Brusov eugenebrusov

View GitHub Profile
<html>
<body>
<p>some_test</p>
</body>
</html>
fun findAutocompletePredictions(
lat: Double,
lng: Double,
query: String
): Single<List<AutocompletePrediction>> = Single
.create<RectangularBounds> { emitter ->
try {
val from = LatLng(lat, lng)
val distance = 20000.0
val southwestHeading = 225.0
@eugenebrusov
eugenebrusov / gist:8ec243835474685934c3916ece7ab7f1
Created October 26, 2018 09:22
Exception on broadcast unregister
Flowable
.create<Boolean>({ emitter ->
val broadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
try {
throw RuntimeException("Test exception")
} catch(e: Throwable) {
emitter.tryOnError(e)
}
}
<resources>
...
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowBackground">@drawable/background</item>
</style>
...
<resources>
...
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowBackground">@drawable/background</item>
</style>
...
@eugenebrusov
eugenebrusov / build.gradle
Created September 14, 2017 09:55
Gradle dependency for ConstraintLayout
dependencies {
...
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
...
}
@eugenebrusov
eugenebrusov / constraint_layout.xml
Last active September 14, 2017 09:54
Using of ConstraintLayout to set your ImageView in 16:9 ratio
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="0dp"
android:layout_height="0dp"
@eugenebrusov
eugenebrusov / 1_item_media3x_primarytext_subtext_actions.xml
Created September 14, 2017 09:11
CardView - media 3x and actions
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CardView.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp">
<android.support.constraint.ConstraintLayout
@eugenebrusov
eugenebrusov / item_media2x_primarytext_subtext_actions.xml
Created September 14, 2017 09:05
CardView - media 2x, primary text, subtext and actions
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CardView.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp">
<android.support.constraint.ConstraintLayout
@eugenebrusov
eugenebrusov / item_media15x_primarytext_subtext_actions.xml
Created September 14, 2017 09:03
CardView - media 1.5x, primary text, subtext and actions
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/CardView.Light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp">
<android.support.constraint.ConstraintLayout