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
dependencyResolutionManagement { | |
versionCatalogs { | |
create("libs") { | |
from(files("../gradle/libs.versions.toml")) | |
} | |
} | |
} |
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
@Test | |
fun loadNote() = runTest { | |
val testDispatcher = UnconfinedTestDispatcher(testScheduler) | |
Dispatchers.setMain(testDispatcher) | |
try { | |
val viewModel = NoteViewModel() | |
viewModel.loadNote() | |
assertEquals("Lorem ipsum", viewModel.note.value) | |
} finally { | |
Dispatchers.resetMain() |
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 advertisingId = AdvertisingIdClient.getAdvertisingIdInfo(this).id | |
// Do something with the advertising ID. |
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 reviewManager = ReviewManagerFactory.create(this) | |
reviewManager.requestReviewFlow() | |
.addOnCompleteListener { task -> | |
if (task.isSuccessful) { | |
reviewManager.launchReviewFlow(this, task.result) | |
.addOnCompleteListener { | |
// Continue the normal user flow. | |
} | |
} else { | |
// Continue the normal user flow. |
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
implementation 'com.google.android.play:core:1.9.0' | |
implementation 'com.google.android.play:core-ktx:1.8.1' |
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 prefs = PreferenceManager.getDefaultSharedPreferences(this) | |
val mode = prefs.getInt(Settings.NIGHT_MODE, Settings.MODE_NIGHT_DEFAULT) | |
AppCompatDelegate.setDefaultNightMode(mode) |
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 prefs = PreferenceManager.getDefaultSharedPreferences(this) | |
prefs.edit().putInt(Settings.NIGHT_MODE, mode).apply() | |
AppCompatDelegate.setDefaultNightMode(mode) |
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
<com.google.android.material.floatingactionbutton.FloatingActionButton | |
style="@style/Widget.MaterialComponents.FloatingActionButton" | |
android:id="@+id/fab" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_gravity="bottom|end" | |
android:layout_margin="@dimen/margin" | |
android:src="@drawable/ic_mode_night_default_black_24dp" | |
app:tint="?android:attr/textColorPrimaryInverse" /> |
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
<color name="primary">#ff212121</color> | |
<color name="primary_dark">#ff000000</color> | |
<color name="accent">#ff80cbc4</color> |
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
<color name="primary">#fff5f5f5</color> | |
<color name="primary_dark">#ff757575</color> | |
<color name="accent">#ff009688</color> |
NewerOlder