Skip to content

Commit

Permalink
Wordle quiz #1
Browse files Browse the repository at this point in the history
- Added color blind mode
- Added hard mode
- Added letter hints
- Added wordle infinite translation and row limit
- Added wordle daily clean calendar button
  • Loading branch information
joaomanaia committed Aug 17, 2022
1 parent 4a92a96 commit 855d0de
Show file tree
Hide file tree
Showing 66 changed files with 1,509 additions and 368 deletions.
29 changes: 15 additions & 14 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools">

<dist:module dist:instant="true" />

<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".NewQuizApp"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.NewQuiz.Starting"
android:name=".NewQuizApp"
android:hardwareAccelerated="true">
android:theme="@style/Theme.NewQuiz.Starting">
<activity
android:name="com.infinitepower.newquiz.MainActivity"
android:exported="true"
android:theme="@style/Theme.NewQuiz.Starting"
android:hardwareAccelerated="true">
android:hardwareAccelerated="true"
android:theme="@style/Theme.NewQuiz.Starting">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -28,19 +30,18 @@

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-1923025671607389~2529814126"/>

android:value="ca-app-pub-1923025671607389~2529814126" />
<meta-data
android:name="com.google.android.gms.ads.flag.OPTIMIZE_INITIALIZATION"
android:value="true"/>

android:value="true" />
<meta-data
android:name="com.google.android.gms.ads.flag.OPTIMIZE_AD_LOADING"
android:value="true"/>
android:value="true" />

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove"/>
tools:node="remove" />
</application>

</manifest>
2 changes: 1 addition & 1 deletion app/src/main/java/com/infinitepower/newquiz/NewQuizApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class NewQuizApp : Application(), Configuration.Provider {
initializeMobileAds()
initializeRemoteConfig()
createNotificationChannels()
//createDailyWordleWork()
createDailyWordleWork()
}

private fun initializeMobileAds() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.infinitepower.newquiz.quiz_presentation.destinations.QuizScreenDestin
import com.infinitepower.newquiz.home_presentation.destinations.HomeScreenDestination
import com.infinitepower.newquiz.home_presentation.destinations.LoginScreenDestination
import com.infinitepower.newquiz.quiz_presentation.destinations.QuizListScreenDestination
import com.infinitepower.newquiz.quiz_presentation.destinations.ResultsScreenDestination
import com.infinitepower.newquiz.quiz_presentation.destinations.SavedQuestionsScreenDestination
import com.infinitepower.newquiz.settings_presentation.destinations.SettingsScreenDestination
import com.infinitepower.newquiz.wordle.destinations.DailyWordSelectorScreenDestination
Expand Down Expand Up @@ -56,7 +57,8 @@ internal object AppNavGraphs {
WordleListScreenDestination,
DailyWordSelectorScreenDestination,
QuizListScreenDestination,
LoginScreenDestination
LoginScreenDestination,
ResultsScreenDestination
)
)
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<resources>
<string name="app_name">NewQuiz</string>
<string name="title_dynamicfeaturetest">DynamicFeatureTest</string>

<!-- Facebook -->
</resources>
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ plugins {
id("org.jetbrains.kotlin.plugin.serialization") apply false
id("com.google.dagger.hilt.android") apply false
id("com.google.gms.google-services") apply false
id("com.android.dynamic-feature") version "7.4.0-alpha09" apply false
}

tasks.register("clean", Delete::class) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,65 @@
package com.infinitepower.newquiz.core.common.dataStore

import android.content.Context
import androidx.annotation.Keep
import androidx.annotation.RawRes
import androidx.annotation.StringRes
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.booleanPreferencesKey
import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.core.stringPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import com.infinitepower.newquiz.core.R
import com.infinitepower.newquiz.core.dataStore.manager.PreferenceRequest
import java.util.Locale

val Context.settingsDataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")

object SettingsCommon {
object ShowLoginCard : PreferenceRequest<Boolean>(booleanPreferencesKey("showLoginCard"), true)

object QuickQuizQuestionsSize : PreferenceRequest<Int>(intPreferencesKey("quickQuizQuestionsSize"), 5)
object QuickQuizQuestionsSize :
PreferenceRequest<Int>(intPreferencesKey("quickQuizQuestionsSize"), 5)

object InfiniteWordleQuizLanguage : PreferenceRequest<String>(
stringPreferencesKey("infiniteWordleQuizLanguage"),
getInfiniteWordleDefaultLang()
)

object WordleInfiniteRowsLimited : PreferenceRequest<Boolean>(booleanPreferencesKey("wordleInfiniteRowsLimited"), false)

object WordleInfiniteRowsLimit : PreferenceRequest<Int>(intPreferencesKey("wordleInfiniteRowsLimit"), 6)

object WordleHardMode : PreferenceRequest<Boolean>(booleanPreferencesKey("wordleHardMode"), false)

object WordleColorBlindMode : PreferenceRequest<Boolean>(booleanPreferencesKey("wordleColorBlindMode"), false)

object WordleLetterHints : PreferenceRequest<Boolean>(booleanPreferencesKey("wordleLetterHints"), false)
}

@Keep
data class SettingsWordleLang(
val key: String,
@StringRes val languageId: Int,
@RawRes val rawListId: Int
)

val infiniteWordleSupportedLang = listOf(
SettingsWordleLang(
key = "en",
languageId = R.string.english,
rawListId = R.raw.wordle_list
),
SettingsWordleLang(
key = "pt",
languageId = R.string.portuguese,
rawListId = R.raw.wordle_list_pt
),
)

private fun getInfiniteWordleDefaultLang(): String {
val localeLanguage = Locale.getDefault().language
val langKeys = infiniteWordleSupportedLang.map { it.key }
return if (localeLanguage in langKeys) localeLanguage else "en"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import com.ramcosta.composedestinations.spec.Direction
sealed class NavEvent {
object PopBackStack : NavEvent()

data class Navigate(val direction: Direction) : NavEvent()
data class Navigate(
val direction: Direction
) : NavEvent()

data class ShowSnackBar(val message: String) : NavEvent()
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ abstract class NavEventViewModel : ViewModel() {
private val _navEvent = MutableSharedFlow<NavEvent>()
val navEvent = _navEvent.asSharedFlow()

fun sendUiEvent(uiEvent: NavEvent) {
suspend fun sendNavEvent(event: NavEvent) {
_navEvent.emit(event)
}

fun sendNavEventAsync(event: NavEvent) {
viewModelScope.launch(Dispatchers.IO) {
_navEvent.emit(uiEvent)
_navEvent.emit(event)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ private val initializeExtend = ExtendedColors(
harmonized = true,
roles = initializeColorRoles()
),
CustomColor(
key = CustomColor.Keys.Blue,
color = Color.Blue,
harmonized = true,
roles = initializeColorRoles()
),
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ fun HomeMediumCard(
HomeCardIcon(
icon = data.icon,
contentDescription = title,
modifier = Modifier.size(75.dp)
modifier = Modifier
.size(75.dp)
.padding(MaterialTheme.spacing.small),
)
}
Spacer(modifier = Modifier.width(spaceMedium))
Expand Down
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions core/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="quick_quiz">Quiz rápido</string>
<string name="back">Voltar</string>
<string name="saved_questions">Perguntas guardadas</string>
<string name="wordle">Wordle</string>
<string name="wordle_infinite">Wordle infinito</string>
<string name="wordle_daily">Wordle diário</string>
<string name="verify">Verificar</string>
<string name="play_again">Jogar novamente</string>
<string name="close">Fechar</string>
<string name="watch_ad">Ver anúncio</string>
<string name="loading_rewarded_ad">A carregar o anúncio</string>
<string name="game_over">Fim de jogo</string>
<string name="you_lost_the_game_watch_ad_q">Você perdeu o jogo.\\n Quer assistir um anúncio para poder adicionar mais uma linha?</string>
<string name="item_empty">Item vazio</string>
<string name="item_i_none">Item %1$s nada</string>
<string name="item_i_present">Item %1$s present</string>
<string name="item_i_correct">Item %1$s correto</string>
<string name="four_letters">4 Letras</string>
<string name="five_letters">5 Letras</string>
<string name="six_letters">6 Letras</string>
<string name="back_month">Voltar o mês</string>
<string name="next_month">Próximo mês</string>
<string name="settings">Opções</string>
<string name="general">Geral</string>
<string name="quiz">Quiz</string>
<string name="quiz_language">Idioma do quiz</string>
<string name="english">Inglês</string>
<string name="portuguese">Português</string>
<string name="normal_quiz">Quiz normal</string>
<string name="color_blind_mode">Modo daltónico</string>
<string name="high_contrast_colors">Cores com alto contraste</string>
<string name="info">Informações</string>
<string name="letter_hints">Ajudas da letra</string>
<string name="hint_above_the_letter_that_it_appears_twice_or_more_in_the_hidden_word">Ajuda sobre a letra presente que aparece duas ou mais vezes.</string>
<string name="hard_mode">Modo difícil</string>
<string name="any_revealed_hints_must_be_used_in_subsequest_guesses">Todas as dicas usadas têm de ser usadas na próxima linha</string>
<string name="wordle_infinite_row_limited">Linhas limitadas no wordle infinito</string>
<string name="row_limit">Limite das linhas</string>
<string name="wordle_infinite_row_limit_value">Limite das linhas do wordle infinito.</string>
<string name="clean_calendar_data">Limpar os dados do calendário</string>
<string name="clean_saved_calendar_wins_losses">Limpar todas vitórias/derrotas do calendário.</string>
<string name="rows_limited">Linhas limitadas</string>
<string name="clear_settings">Apagar Definições</string>
<string name="remove_all_saved_settings">Remova todas as definições guardadas</string>
</resources>
38 changes: 38 additions & 0 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="normal_quiz">Normal Quiz</string>
<string name="quick_quiz">Quick Quiz</string>
<string name="back">Back</string>
<string name="saved_questions">Saved questions</string>
<string name="wordle">Wordle</string>
<string name="wordle_infinite">Wordle infinite</string>
<string name="wordle_daily">Daily wordle</string>
<string name="verify">Verify</string>
<string name="play_again">Play again</string>
<string name="close">Close</string>
<string name="watch_ad">Watch ad</string>
<string name="loading_rewarded_ad">Loading rewarded ad</string>
<string name="game_over">Game Over</string>
<string name="you_lost_the_game_watch_ad_q">You lost the game.\nDo you want to watch one ad to try one more row?</string>
<string name="item_empty">Item empty</string>
<string name="item_i_none">Item %1$s none</string>
<string name="item_i_present">Item %1$s present</string>
<string name="item_i_correct">Item %1$s correct</string>
<string name="four_letters">4 Letters</string>
<string name="five_letters">5 Letters</string>
<string name="six_letters">6 Letters</string>
<string name="back_month">Back month</string>
<string name="next_month">Next month</string>
<string name="settings">Settings</string>
<string name="general">General</string>
<string name="quiz">Quiz</string>
<string name="quiz_language">Quiz language</string>
<string name="english">English</string>
<string name="portuguese">Portuguese</string>
<string name="color_blind_mode">Color blind mode</string>
<string name="high_contrast_colors" >High contrast colors</string>
<string name="info">Info</string>
<string name="letter_hints">Letter hints</string>
<string name="hint_above_the_letter_that_it_appears_twice_or_more_in_the_hidden_word">Hint above the letter that it appears twice or more in the hidden word</string>
<string name="hard_mode">Hard mode</string>
<string name="any_revealed_hints_must_be_used_in_subsequest_guesses">Any revealed hints must be used in subsequent guesses</string>
<string name="rows_limited">Rows limited</string>
<string name="wordle_infinite_row_limited">Wordle infinite row limited.</string>
<string name="row_limit">Row limit</string>
<string name="wordle_infinite_row_limit_value">Wordle infinite row limit value.</string>
<string name="clean_calendar_data">Clean calendar data</string>
<string name="clean_saved_calendar_wins_losses">Cleans all saved calendar wins/losses.</string>
<string name="clear_settings">Clear Preferences</string>
<string name="remove_all_saved_settings">Remove all saved settings</string>
</resources>
Loading

0 comments on commit 855d0de

Please sign in to comment.