Skip to content

Instantly share code, notes, and snippets.

View tmaxxdd's full-sized avatar
💻
In my mind, 🍺 in my heart

Tomasz Kądziołka tmaxxdd

💻
In my mind, 🍺 in my heart
View GitHub Profile
public class Migrations {
public static final Migration MIGRATION_1_2 = new Migration(1, 2) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE user ADD COLUMN professionOwnerId INTEGER NOT NULL DEFAULT 1");
}
};
}
V/MotionLayout: CHECK: start is hided
V/MotionLayout: CHECK: end is shown
W/MotionLayout: CHECK: hided NO View matches id itemBackground
W/MotionLayout: CHECK: hided(itemBackground) no LAYOUT_HEIGHT
W/MotionLayout: CHECK: hided NO View matches id dragLabel
W/MotionLayout: CHECK: hided NO View matches id itemForeground
W/MotionLayout: CHECK: hided(itemForeground) no LAYOUT_HEIGHT
W/MotionLayout: CHECK: hided NO View matches id deleteAction
V/MotionLayout: CHECK: CURRENT
V/MotionLayout: CHECK: transition = hided -> shown
<!-- This is applied for default -->
<Transition
app:constraintSetEnd="@id/panelExpanded"
app:constraintSetStart="@id/panelCollapsed"
app:duration="500">
<OnSwipe app:dragDirection="dragRight" />
</Transition>
<!-- This must be set explicitly from code or xml -->
<Transition
<MotionScene>
<!-- You must implement all the attributes -->
<ConstraintSet android:id="@+id/viewsInvisible">
<Constraint android:id="@+id/loading">
<Layout
android:layout_width="64dp"
android:layout_height="64dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
bottomSheetSwitch.setOnCheckedChangeListener { _, bottomSheetSmall ->
if (bottomSheetSmall)
motionLayout.loadLayoutDescription(R.xml.expandable_bottom_sheet_small)
else
motionLayout.loadLayoutDescription(R.xml.expandable_bottom_sheet_big)
}
<ConstraintSet
android:id="@+id/end"
motion:deriveConstraintsFrom="@id/start">
<Constraint
android:id="@+id/card"
android:layout_width="0dp"
android:layout_height="100dp"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
motionLayout.setTransitionListener(MotionProgressListener { progress: Float ->
lottie.progress = progress
arrow.isVisible = (progress <= 0.5f)
editText.isVisible = (progress >= 0.5f)
})
<com.google.android.material.card.MaterialCardView
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="100dp"
app:cardCornerRadius="0dp"
app:cardElevation="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
dependencies {
implementation 'com.airbnb.android:lottie:3.4.0'
}
list.adapter = RvAdapter { name ->
editText.setText(name)
motionLayout.transitionToEnd()
}