Skip to content

Instantly share code, notes, and snippets.

View gilgoldzweig's full-sized avatar

Gil Goldzweig gilgoldzweig

View GitHub Profile
@RunWith(MockitoJUnitRunner::class)
class ExamplePresenterTest {
@Mock
private lateinit var view: ExampleContract.View
@Spy
private var presenter: ExamplePresenter = ExamplePresenter()
@gilgoldzweig
gilgoldzweig / ClickDebouncer.kt
Last active October 17, 2019 11:11
ClickDebouncer.kt
import android.os.Handler
import android.view.View
/**
* A class for debouncing clicks
*/
abstract class DebouncingOnClickListener : View.OnClickListener {
private val clickDebouncer = ClickDebouncer()
@gilgoldzweig
gilgoldzweig / sample_layout.xml&env=plain
Last active November 25, 2019 11:50
|-|&tag=Stackoverflow
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
xmlns:tools="http://schemas.android.com/tools">
<TextView
android:id="@+id/textViewTitle"
android:layout_width="wrap_content"
@gilgoldzweig
gilgoldzweig / sample_collapsing_animation_scene.xml
Last active December 27, 2019 10:13
MotionScene constraint end|-|&tag=MotionLayout
<ConstraintSet android:id="@+id/end">
<Constraint
android:id="@id/search_view"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:elevation="4dp"
motion:layout_constraintEnd_toStartOf="@id/menu_icon"
motion:layout_constraintStart_toEndOf="@id/navigation_icon"
motion:layout_constraintTop_toTopOf="parent"
@gilgoldzweig
gilgoldzweig / sample_collapsing_animation_scene.xml
Last active December 27, 2019 10:15
MotionScene transition
<Transition
motion:constraintSetEnd="@+id/end"
motion:constraintSetStart="@id/start"
motion:motionInterpolator="easeInOut">
<OnSwipe
motion:dragDirection="dragUp"
motion:moveWhenScrollAtTop="true"
motion:onTouchUp="stop"
motion:touchAnchorId="@id/scrollable_content"
@gilgoldzweig
gilgoldzweig / sample_collapsing_animation_scene.xml
Last active December 27, 2019 10:15
MotionScene triger|-|&tag=MotionLayout
<OnSwipe
motion:dragDirection="dragUp"
motion:moveWhenScrollAtTop="true"
motion:onTouchUp="stop"
motion:touchAnchorId="@id/scrollable_content"
motion:touchAnchorSide="top"
motion:dragScale="1"/>
@gilgoldzweig
gilgoldzweig / sample_collapsing_animation_scene.xml
Last active December 27, 2019 10:15
MotionScene constraint start|-|&tag=MotionLayout
<ConstraintSet android:id="@+id/start">
<Constraint
android:id="@id/search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:elevation="4dp"
motion:layout_constraintEnd_toEndOf="parent"
motion:layout_constraintStart_toStartOf="parent"
@gilgoldzweig
gilgoldzweig / sample_collapsing_animation_scene.xml
Last active December 27, 2019 10:16
MotionScene root tag|-|&tag=MotionLayout
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
</MotionScene>
@gilgoldzweig
gilgoldzweig / sample_collapsing_animation.xml
Last active December 27, 2019 10:16
MotionLayout layout guideline|-|&tag=MotionLayout
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidline_toolbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="140dp" />
@gilgoldzweig
gilgoldzweig / sample_collapsing_animation.xml
Last active December 27, 2019 10:18
MotionLayout layout recyclerview|-|&tag=MotionLayout
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/scrollable_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/guidline_toolbar" />