View product_with_type_converter.java
This file contains 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
@Entity | |
public class Product { | |
// productId, name, price, @Ignore image | |
@TypeConverters(value = SQLTypeConverters.class) | |
@ColumnInfo(defaultValue = "CURRENT_TIMESTAMP") | |
public Date timestamp; | |
public Product(long productId, String name, double price) { | |
this.productId = productId; | |
this.name = name; |
View type_converters.java
This file contains 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
public class SQLTypeConverters { | |
@TypeConverter | |
public Date fromTimestamp(String value) { | |
Date defaultDate = new Date(); | |
SimpleDateFormat format = new SimpleDateFormat(); | |
try { | |
return value.equals("") ? defaultDate : format.parse(value); | |
} catch (ParseException e) { | |
e.printStackTrace(); |
View product.java
This file contains 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
@Entity | |
public class Product { | |
// ... productId, name, price, @Ignore image | |
@ColumnInfo(defaultValue = "CURRENT_TIMESTAMP") | |
public String timestamp; | |
public Product(long productId, String name, double price) { | |
this.productId = productId; | |
this.name = name; | |
this.price = price; |
View desctructive.java
This file contains 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
Room | |
.databaseBuilder(this, Database.class, "database") | |
.addMigrations(Migrations.MIGRATION_1_2) | |
.fallbackToDestructiveMigration() | |
.build(); |
View db.java
This file contains 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
Room | |
.databaseBuilder(this, Database.class, "database") | |
.addMigrations(Migrations.MIGRATION_1_2) | |
.build(); |
View migration_class.java
This file contains 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
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"); | |
} | |
}; | |
} |
View ml_logcat.cl
This file contains 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
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 |
View first_transition.xml
This file contains 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
<!-- 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 |
View derive_constraints.xml
This file contains 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
<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" |
View bs_switch.kt
This file contains 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
bottomSheetSwitch.setOnCheckedChangeListener { _, bottomSheetSmall -> | |
if (bottomSheetSmall) | |
motionLayout.loadLayoutDescription(R.xml.expandable_bottom_sheet_small) | |
else | |
motionLayout.loadLayoutDescription(R.xml.expandable_bottom_sheet_big) | |
} |
NewerOlder