This file contains hidden or 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 = 1, // old version num. | |
+ version = 2, // upgraded version num. | |
entities = [ User.class ], | |
+ autoMigrations = [ | |
+ AutoMigration (from = 1, to = 2) | |
+ ] | |
) | |
abstract class UserDatabase : RoomDatabase { } |
This file contains hidden or 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") | |
.fallbackToDestructiveMigration() | |
.build()) | |
This file contains hidden or 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 = 1, // upgrade db version on any change | |
exportSchema = true | |
) |
This file contains hidden or 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
private fun prepareCountryRecycler() { | |
countryRecyclerAdapter = CountryRecyclerAdapter() | |
countryRecyclerAdapter.stateRestorationPolicy = RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY | |
binding?.countryRecycler?.adapter = countryRecyclerAdapter | |
} | |
/* | |
Aşağıdakini build.gradle(:app)'e eklemeyi unutmayın! | |
- implementation "androidx.recyclerview:recyclerview:$latestVersionNumber" | |
*/ |
This file contains hidden or 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
private fun onBackPressed() { | |
val callback = object : OnBackPressedCallback(true) { | |
override fun handleOnBackPressed() { | |
//OnBackPressed | |
} | |
} | |
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback) | |
} |
This file contains hidden or 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
private val passwordRegex = Pattern.compile("^" + | |
"(?=.*[0-9])" + // En az bir rakam | |
"(?=.*[a-z])" + // En az bir küçük harf | |
"(?=.*[A-Z])" + // En az bir büyük harf | |
"(?=.*[a-zA-Z])" + // Herhangi bir harf | |
"(?=.*[@#$%^&+=])" + // En az bir özel karakter | |
"(?=\\S+$)" + // Boşluk yok | |
".{8,}" + // En az 8 karakter | |
"$") |
This file contains hidden or 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
private var smsReceiver: SmsReceiver? = null | |
private val otpSmsRegex = "(|^)\\d{4}" | |
private val otpResponseCode = 52 | |
private val otpSmsTitle = "SMSAPI" | |
private fun init() { | |
val client = SmsRetriever.getClient(this) | |
client.startSmsUserConsent(null) | |
} |
This file contains hidden or 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
private val otpSmsTitle = "SMSAPI" | |
private val otpResponseCode = 52 | |
private fun init() { | |
val client = SmsRetriever.getClient(this) | |
client.startSmsUserConsent(otpSmsTitle) | |
} | |
private fun registerBroadcastReceiver() { | |
smsReceiver = SmsReceiver() |
This file contains hidden or 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
class SmsReceiver: BroadcastReceiver() { | |
var smsBroadcastReceiverListener: SmsBroadcastReceiverListener? = null | |
override fun onReceive(context: Context?, intent: Intent?) { | |
if (intent?.action == SmsRetriever.SMS_RETRIEVED_ACTION) { | |
val extras = intent.extras | |
val smsRetrieverStatus = extras?.get(SmsRetriever.EXTRA_STATUS) as Status |
This file contains hidden or 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
<receiver | |
android:name = ".receiver.SmsReceiver" | |
android:permission="android.permission.BROADCAST_SMS" | |
android:exported="true"> | |
<intent-filter> | |
<action android:name="android.provider.Telephony.SMS_RECEIVED" /> | |
</intent-filter> | |
</receiver> |