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
fun EditText.allowOnlyLettersAndNoConsecutiveSpaces() { | |
filters = arrayOf(InputFilter { enteredText, start, end, dest, dstart, dend -> | |
if (enteredText.toString().matches("[a-zA-ZğüşıöçĞÜŞİÖÇ ]*".toRegex())) { | |
when { | |
//If the first character is entered as empty | |
enteredText.isBlank() && dest.isEmpty() -> "" | |
//If the entered character is empty and entered as empty at the first index | |
enteredText.isBlank() && dend == 0 -> "" |
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
import androidx.compose.foundation.Image | |
import androidx.compose.foundation.border | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.foundation.layout.height | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.size | |
import androidx.compose.foundation.layout.width | |
import androidx.compose.foundation.layout.wrapContentSize | |
import androidx.compose.foundation.layout.wrapContentWidth |
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
// You can thoroughly monitor the events you send to Firebase Analytics with the commands you enter in the Android Studio terminal. | |
adb shell setprop log.tag.FA VERBOSE | |
adb shell setprop log.tag.FA-SVC VERBOSE | |
adb logcat -v time -s FA FA-SVC |
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( | |
context, | |
RoomDatabase::class.java, "DB_NAME") | |
.addMigrations(MIGRATION_1_2, MIGRATION_2_3) | |
.build()) |
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
val MIGRATION_2_3 = object : Migration(2, 3) { | |
override fun migrate(database: SupportSQLiteDatabase) { | |
// Yeni tablo oluştur | |
database.execSQL("CREATE TABLE USER_NEW (userid TEXT, username TEXT, age INTEGER, PRIMARY KEY(userid))") | |
// Eski tablodan verileri kopyala | |
database.execSQL("INSERT INTO USER_NEW (userid, username, age) SELECT userid, username, age FROM USER") | |
// Eski tabloyu sil |
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
@Database( | |
entities = [], | |
version = 2, // upgrade db version on any change | |
exportSchema = true | |
) |
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( | |
context, | |
RoomDatabase::class.java, "DB_NAME") | |
.addMigrations(MIGRATION_1_2) | |
.build()) |
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
val MIGRATION_1_2 = object : Migration(1, 2) { | |
override fun migrate(database: SupportSQLiteDatabase) { | |
database.execSQL("ALTER TABLE User ADD COLUMN age INTEGER") | |
} | |
} |
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
@Database( | |
version = 2, | |
entities = [ User.class ], | |
autoMigrations = [ | |
AutoMigration ( | |
from = 1, | |
to = 2, | |
spec = UserDatabase.UserAutoMigration::class | |
) | |
] |
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
@Database( | |
- version = 2, // old version | |
+ version = 3, // upgraded version | |
entities = [ User.class ], | |
autoMigrations = [ | |
AutoMigration (from = 1, to = 2), | |
+ AutoMigration (from = 2, to = 3) | |
] | |
) | |
abstract class UserDatabase : RoomDatabase { } |
NewerOlder