From 6f0d0bd8b3b69ce1d2d4167ea80c7348732a4762 Mon Sep 17 00:00:00 2001 From: Vasily Horodetskyi Date: Fri, 2 Dec 2022 23:35:37 +0200 Subject: [PATCH] wip --- .idea/misc.xml | 1 + .../857831421eecec47c8c097feac5e71bf4fc7e7f9 | 2 +- .../fda3622ab8d207ddf1c0950e53a3a67579941d5f | 2 +- .idea/sonarlint/issuestore/index.pb | 58 +++--- app/build.gradle | 4 +- .../java/com/maestrovs/slovo/data/Game.kt | 4 +- .../maestrovs/slovo/screens/MainViewModel.kt | 54 +++--- .../slovo/screens/game_end/GameEndFragment.kt | 167 ++++++++++++++++++ .../screens/game_end/GameEndViewModel.kt | 40 +++++ .../slovo/screens/main/MainScreenFragment.kt | 36 ++-- .../screens/splash/SplashScreenViewModel.kt | 1 + .../slovo/screens/webview/WebViewFragment.kt | 2 +- app/src/main/res/drawable/ic_about.xml | 9 + app/src/main/res/drawable/ic_about_fill.xml | 9 + .../main/res/drawable/ic_statistic_fill.xml | 9 + .../main/res/drawable/img_hidding_pass.png | Bin 0 -> 8594 bytes app/src/main/res/layout/fragment_game_end.xml | 157 ++++++++++++++++ .../main/res/layout/fragment_main_screen.xml | 52 ++++-- .../main/res/navigation/mobile_navigation.xml | 25 +++ 19 files changed, 554 insertions(+), 78 deletions(-) create mode 100644 app/src/main/java/com/maestrovs/slovo/screens/game_end/GameEndFragment.kt create mode 100644 app/src/main/java/com/maestrovs/slovo/screens/game_end/GameEndViewModel.kt create mode 100644 app/src/main/res/drawable/ic_about.xml create mode 100644 app/src/main/res/drawable/ic_about_fill.xml create mode 100644 app/src/main/res/drawable/ic_statistic_fill.xml create mode 100644 app/src/main/res/drawable/img_hidding_pass.png create mode 100644 app/src/main/res/layout/fragment_game_end.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index c4a3ab6..dd76ea9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -18,6 +18,7 @@ + diff --git a/.idea/sonarlint/issuestore/8/5/857831421eecec47c8c097feac5e71bf4fc7e7f9 b/.idea/sonarlint/issuestore/8/5/857831421eecec47c8c097feac5e71bf4fc7e7f9 index fd7f947..fe81749 100644 --- a/.idea/sonarlint/issuestore/8/5/857831421eecec47c8c097feac5e71bf4fc7e7f9 +++ b/.idea/sonarlint/issuestore/8/5/857831421eecec47c8c097feac5e71bf4fc7e7f9 @@ -1,2 +1,2 @@ -E kotlin:S108$")Either remove or fill this block of code.( \ No newline at end of file +E kotlin:S108%")Either remove or fill this block of code.( \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/f/d/fda3622ab8d207ddf1c0950e53a3a67579941d5f b/.idea/sonarlint/issuestore/f/d/fda3622ab8d207ddf1c0950e53a3a67579941d5f index ce130b8..7ecdbc9 100644 --- a/.idea/sonarlint/issuestore/f/d/fda3622ab8d207ddf1c0950e53a3a67579941d5f +++ b/.idea/sonarlint/issuestore/f/d/fda3622ab8d207ddf1c0950e53a3a67579941d5f @@ -1,2 +1,2 @@ -V kotlin:S1135T"2Complete the task associated to this TODO comment.(80 \ No newline at end of file +O kotlin:S1135T"2Complete the task associated to this TODO comment.( \ No newline at end of file diff --git a/.idea/sonarlint/issuestore/index.pb b/.idea/sonarlint/issuestore/index.pb index fa5650f..b98fe07 100644 --- a/.idea/sonarlint/issuestore/index.pb +++ b/.idea/sonarlint/issuestore/index.pb @@ -3,10 +3,6 @@ t Dapp/src/main/java/com/maestrovs/slovo/screens/base/IOnBackPressed.kt,1/c/1c9cff1a32e63ed77d6193056cf4979b4529c852 r Bapp/src/main/java/com/maestrovs/slovo/screens/base/BaseActivity.kt,3/7/37dc6629e926bcd7492bab0a8cfb997b03244836 -A -gradle.properties,2/a/2afbb999f001938c88fa43fc2ef52abf0f8213e4 -@ -local.properties,0/7/0712df971a99ac4d2fccb8e0fb19f377f3374cca 7 gradlew,5/b/5bbfa66edb4db3c7c33c5181f43510990d3307f9 ? @@ -17,12 +13,8 @@ n >app/src/main/java/com/maestrovs/slovo/screens/base/Settings.kt,e/c/ec098a9a003aa1be7844060d5ce7f6feba1ef67b r Bapp/src/main/java/com/maestrovs/slovo/screens/base/BaseFragment.kt,5/6/56c719b76b35720ed4e17758b2027f096a51e1bb -X -(gradle/wrapper/gradle-wrapper.properties,f/b/fbe448ebfc3eb2d4e308f6b8b043666f5b57235e v Fapp/src/main/java/com/maestrovs/slovo/screens/extensions/Extensions.kt,9/d/9d868d8cd4e71681162f1ea717c533945274c904 - -Wapp/src/main/java/com/maestrovs/slovo/components/flip/animation/MtxRotationAnimation.kt,c/4/c4f4fac6782d4beef73b7d4614447a90add5bf9f  Zapp/src/main/java/com/maestrovs/slovo/components/flip/animation/SimpleAnimationListener.kt,9/4/94d0ed67a6510ce659d362c5688cbcdcde78f8a9 v @@ -41,37 +33,57 @@ n >app/src/main/java/com/maestrovs/slovo/components/UIProgress.kt,7/1/71e50c9e0099d7353dd625b24a20091a67efe907 j :app/src/main/java/com/maestrovs/slovo/components/Common.kt,d/5/d5b9e8a4009e697972cce7aeeea05ade43cb8121 -n ->app/src/main/java/com/maestrovs/slovo/screens/StartActivity.kt,9/2/921afc5c4d086bfb0ca3e4cda5e40fb7e68fc3f3 x Happ/src/main/java/com/maestrovs/slovo/components/UIProgressHorizontal.kt,5/0/50be24b64ebe0d7b068a6824d7f69febc4a15c75 -b -2app/src/main/java/com/maestrovs/slovo/data/Game.kt,6/f/6f366a1d96fe2d4dc29f6d372a54662e2d28434c -e -5app/src/main/java/com/maestrovs/slovo/data/UserDao.kt,f/3/f34b2514c5986f1d0fede71f751b5d46d09f45c3 m =app/src/main/java/com/maestrovs/slovo/common/SharedManager.kt,a/4/a4a41a658cd8c1c7f7efcecdf64f8e4a0d6b3af8 -< - build.gradle,f/0/f07866736216be0ee2aba49e392191aeae700a35 f 6app/src/main/java/com/maestrovs/slovo/MyApplication.kt,6/a/6a0da5d4f3b0a46e2ef4cda915a5adc01dded5ca s Capp/src/main/java/com/maestrovs/slovo/screens/base/BaseViewModel.kt,9/d/9d20f8826d7faa1f24453362732da03c97b261e3 -} -Mapp/src/main/java/com/maestrovs/slovo/screens/splash/SplashScreenViewModel.kt,8/5/857831421eecec47c8c097feac5e71bf4fc7e7f9 w Gapp/src/main/java/com/maestrovs/slovo/data/repository/MainRepository.kt,8/b/8b3ce0886f97aab2bb8797b30a3fcf79855f9c9c w Gapp/src/main/java/com/maestrovs/slovo/data/repository/MainRemoteData.kt,d/b/db4ddb821ddd3f3613ed6525478926e256c3c678 t Dapp/src/main/java/com/maestrovs/slovo/data/repository/MainService.kt,7/6/7683614e49abfdff19bcdd57c7cb890743a243f0 -P - app/src/main/AndroidManifest.xml,8/c/8c55c3ccc257e5907959013f99656e4c8ec3903e r Bapp/src/main/java/com/maestrovs/slovo/data/repository/AppModule.kt,8/5/8510de9368421f02ee6c1e645124c8b872bf4dec +m +=app/src/main/java/com/maestrovs/slovo/screens/MainActivity.kt,4/2/421910f0d1a57b0ba935c0e7ca0e7a215b30b9c1 +n +>app/src/main/java/com/maestrovs/slovo/components/UITilesRow.kt,c/1/c1221c5d450cfacb7d68e42f5966e8054b861467 +g +7app/src/main/java/com/maestrovs/slovo/model/KeysList.kt,e/d/ed9dfa06e74428e219fcb30e476b220c9bf35ed5 +b +2app/src/main/java/com/maestrovs/slovo/model/Row.kt,e/7/e714605635946ef671c9a3adf54068a1f3ce56c9 +| +Lapp/src/main/java/com/maestrovs/slovo/screens/splash/SplashScreenFragment.kt,e/e/ee638785e32b24cc2475ea62178f6acb42e359f9 +} +Mapp/src/main/java/com/maestrovs/slovo/screens/splash/SplashScreenViewModel.kt,8/5/857831421eecec47c8c097feac5e71bf4fc7e7f9 +x +Happ/src/main/java/com/maestrovs/slovo/screens/webview/WebViewFragment.kt,f/d/fda3622ab8d207ddf1c0950e53a3a67579941d5f +X +(gradle/wrapper/gradle-wrapper.properties,f/b/fbe448ebfc3eb2d4e308f6b8b043666f5b57235e +A +gradle.properties,2/a/2afbb999f001938c88fa43fc2ef52abf0f8213e4 y Iapp/src/main/java/com/maestrovs/slovo/screens/webview/WebViewViewModel.kt,a/9/a993b50482527f0786b007ea0614bdcf9b8f312d +j +:app/src/main/java/com/maestrovs/slovo/components/UITile.kt,b/e/be5b4657f23f490e2bd0058b9346f354743f1f45 +e +5app/src/main/java/com/maestrovs/slovo/data/UserDao.kt,f/3/f34b2514c5986f1d0fede71f751b5d46d09f45c3 +n +>app/src/main/java/com/maestrovs/slovo/components/UIKeyboard.kt,5/2/52cc36c04c276e86e9454b24a08d270a91129921 + +Wapp/src/main/java/com/maestrovs/slovo/components/flip/animation/MtxRotationAnimation.kt,c/4/c4f4fac6782d4beef73b7d4614447a90add5bf9f +n +>app/src/main/java/com/maestrovs/slovo/screens/MainViewModel.kt,d/0/d0e138071081eb4e494d5bd20fa8513359c2143f x -Happ/src/main/java/com/maestrovs/slovo/screens/webview/WebViewFragment.kt,f/d/fda3622ab8d207ddf1c0950e53a3a67579941d5f -| -Lapp/src/main/java/com/maestrovs/slovo/screens/splash/SplashScreenFragment.kt,e/e/ee638785e32b24cc2475ea62178f6acb42e359f9 \ No newline at end of file +Happ/src/main/java/com/maestrovs/slovo/screens/main/MainScreenFragment.kt,b/b/bbf018821dbc69b242165908c52a0302fa5d6552 +b +2app/src/main/java/com/maestrovs/slovo/data/Game.kt,6/f/6f366a1d96fe2d4dc29f6d372a54662e2d28434c +@ +app/build.gradle,f/4/f4a01d6a4fcb971362ec00a83903fd3902f52164 +< + build.gradle,f/0/f07866736216be0ee2aba49e392191aeae700a35 \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 9274d83..3c36fc4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -15,8 +15,8 @@ android { applicationId "com.maestrovs.slovo" minSdk 23 targetSdk 32 - versionCode 2 - versionName "1.1" + versionCode 3 + versionName "1.3.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/maestrovs/slovo/data/Game.kt b/app/src/main/java/com/maestrovs/slovo/data/Game.kt index 091ea3d..7cf261d 100644 --- a/app/src/main/java/com/maestrovs/slovo/data/Game.kt +++ b/app/src/main/java/com/maestrovs/slovo/data/Game.kt @@ -7,7 +7,9 @@ import androidx.room.PrimaryKey @Entity data class Game( @ColumnInfo(name = "slovo") val slovo: String?, - @ColumnInfo(name = "step") val step: Int? + @ColumnInfo(name = "step") val step: Int?, + @ColumnInfo(name = "num") val num: Int?, + @ColumnInfo(name = "result") val result: Boolean? ){ @PrimaryKey(autoGenerate = true) var id: Int = 0 diff --git a/app/src/main/java/com/maestrovs/slovo/screens/MainViewModel.kt b/app/src/main/java/com/maestrovs/slovo/screens/MainViewModel.kt index e552b3a..590a41b 100644 --- a/app/src/main/java/com/maestrovs/slovo/screens/MainViewModel.kt +++ b/app/src/main/java/com/maestrovs/slovo/screens/MainViewModel.kt @@ -37,6 +37,9 @@ class MainViewModel(application: Application) : BaseViewModel(application) { var slovo: String? = null + var attempt = 0 + var attemptSlovo: String? = null; + //private var savedSlovo: String? = null private var savedWords: HashSet = hashSetOf() @@ -96,30 +99,37 @@ class MainViewModel(application: Application) : BaseViewModel(application) { } } + + if(restoredSlovo != null && !savedSteps.isNullOrEmpty()){ slovo = restoredSlovo!! - callback(Game(restoredSlovo!!, 0), list) - }else { - - BehaviorSubject.create { emitter: ObservableEmitter> -> - val games = db.userDao().getRandomSlovo() - emitter.onNext(games) - }.hide() - .observeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.newThread()) - .subscribe({ - if (it.isEmpty()) { - callback(Game("ФІНІШ", 0),null) - } else { - slovo = it[0].slovo - callback(it[0], null) - } + attemptSlovo = null; attempt = 0; + callback(Game(restoredSlovo!!, 0,0,false), list) + }else if(attemptSlovo != null) { + slovo = attemptSlovo!! + callback(Game(attemptSlovo!!, 0,0,false), list) + }else{ + attemptSlovo = null; attempt = 0; + BehaviorSubject.create { emitter: ObservableEmitter> -> + val games = db.userDao().getRandomSlovo() + emitter.onNext(games) + }.hide() + .observeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.newThread()) + .subscribe({ + if (it.isEmpty()) { + callback(Game("ФІНІШ", 0,0,false),null) + } else { + slovo = it[0].slovo + callback(it[0], null) + } + + }, { + errorMessage.postValue(it.localizedMessage) + }).addTo(disposable) + } - }, { - errorMessage.postValue(it.localizedMessage) - }).addTo(disposable) - } } fun updateSlovoStepInDB(game: Game){ @@ -217,7 +227,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) { var count = 0 dictionary.map { Completable.create { emitter -> - db.userDao().insertAll(Game(it.uppercase(),0)) + db.userDao().insertAll(Game(it.uppercase(),0,0,false)) emitter.onComplete()} .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.newThread()) diff --git a/app/src/main/java/com/maestrovs/slovo/screens/game_end/GameEndFragment.kt b/app/src/main/java/com/maestrovs/slovo/screens/game_end/GameEndFragment.kt new file mode 100644 index 0000000..4a28fed --- /dev/null +++ b/app/src/main/java/com/maestrovs/slovo/screens/game_end/GameEndFragment.kt @@ -0,0 +1,167 @@ +package com.maestrovs.slovo.screens.game_end + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.core.content.ContextCompat +import androidx.lifecycle.ViewModelProvider +import androidx.navigation.fragment.findNavController +import androidx.navigation.fragment.navArgs +import com.maestrovs.slovo.R +import com.maestrovs.slovo.databinding.FragmentGameEndBinding +import com.maestrovs.slovo.screens.base.BaseFragment +import com.maestrovs.slovo.screens.extensions.applyFont +import com.maestrovs.slovo.screens.MainActivity +import com.maestrovs.slovo.screens.MainViewModel +import com.maestrovs.slovo.screens.main.MainScreenFragmentDirections + + +class GameEndFragment : BaseFragment() { + + private val mainScreenViewModel by lazy { + ViewModelProvider(activity as MainActivity).get(MainViewModel::class.java).apply { + lifecycle.addObserver(this) + } + } + + private val gameEndViewModel by lazy { + ViewModelProvider(this).get(GameEndViewModel::class.java).apply { + lifecycle.addObserver(this) + } + } + private var _binding: FragmentGameEndBinding? = null + private val binding get() = _binding!! + lateinit var mainActivity: MainActivity + + private val safeArgs: GameEndFragmentArgs by navArgs() + + var canShowMeaningOfWord = true; + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + gameEndViewModel.navController = findNavController() + _binding = FragmentGameEndBinding.inflate(inflater, container, false) + val root: View = binding.root + applyFont(requireContext(), root, "fonts/Comfortaa-Regular.ttf") + + // binding.title.text = safeArgs.slovo + + canShowMeaningOfWord = safeArgs.isWin + + binding.tvTitle.setTextColor(ContextCompat.getColor(requireContext(), + if(safeArgs.isWin) { + R.color.green + }else{ + R.color.red + } + )) + + binding.tvTitle.text = if(safeArgs.isWin) { + "Вірно!" + }else{ + "Не вгадали" + } + + binding.tvSlovo.visibility = if(safeArgs.isWin) { + View.VISIBLE + }else{ + View.VISIBLE + } + + + binding.tvSlovo.text = if(safeArgs.isWin) { + safeArgs.slovo + }else{ + safeArgs.slovo //"✜ ✜ ✜ ✜ ✜" + } + + binding.btShow.visibility = if(safeArgs.isWin) { + View.GONE + }else{ + View.GONE + } + + binding.btAgain.visibility = if(safeArgs.isWin) { + View.GONE + }else{ + View.GONE + } + + binding.btMeaning.visibility = if(safeArgs.isWin) { + View.VISIBLE + }else{ + //View.GONE + View.VISIBLE + } + + binding.ivResult.setImageDrawable(ContextCompat.getDrawable(requireContext(), + if(safeArgs.isWin){ + R.drawable.ic_orn_green + }else{ + R.drawable.ic_orn_red + } + )) + + binding.btMeaning.setOnClickListener { + safeArgs.slovo.let { + findNavController().navigate(GameEndFragmentDirections.actionGameEndFragmentToWebViewFragment(it)) + } + } + + binding.btNext.setOnClickListener { + findNavController().popBackStack() + } + + + /*mainScreenViewModel.getGamesCount { + Log.d("Game", "Games count = $it") + if (it == null || it == 0) + { + binding.dicText.visibility = View.VISIBLE + mainScreenViewModel.readDictionary { dic -> + var totalCnt = dic.size + binding.dicProgress.max = totalCnt + mainScreenViewModel.writeDictionaryToDB(dic, { progress -> + // Log.d("Game", "Progress = $progress") + binding.dicProgress.progress = progress + }, + { + launchGame(false) + }) + } + } else { + launchGame(true) + } + }*/ + + /// findNavController().navigate(SplashScreenFragmentDirections.actionSplashScreenFragmentToWebViewFragment("слово")) + + return root + } + + private fun launchGame(withDelay: Boolean) { + /* Handler(Looper.getMainLooper()).postDelayed( + { + splashViewModel.onMainScreen() + + }, if (withDelay) { + delay + } else { + 0 + } + )*/ + } + + + override fun onDestroyView() { + super.onDestroyView() + // binding.clMessage.animate().cancel() + _binding = null + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/maestrovs/slovo/screens/game_end/GameEndViewModel.kt b/app/src/main/java/com/maestrovs/slovo/screens/game_end/GameEndViewModel.kt new file mode 100644 index 0000000..723ce40 --- /dev/null +++ b/app/src/main/java/com/maestrovs/slovo/screens/game_end/GameEndViewModel.kt @@ -0,0 +1,40 @@ +package com.maestrovs.slovo.screens.game_end + +import android.app.Application +import com.maestrovs.slovo.screens.base.BaseViewModel + +class GameEndViewModel(application: Application) : BaseViewModel(application) { + + + + + fun onBack() { + // navController.popBackStack(R.id.fragment_main_screen, false) + } + + + + /* fun onMainScreen() { + navController.navigate(SplashScreenFragmentDirections.actionSplashScreenFragmentToFragmentMainScreen()) + + + /// navController.navigate(R.id.schedulersFragment) + + /// navController.navigate(R.id.feedbackFragment) + }*/ + + + /* fun onPhoneVerification() { + navController.navigate(SplashScreenFragmentDirections.actionSplashScreenFragmentToPhoneVerificationFragment()) + + }*/ + + + + + + init { + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/maestrovs/slovo/screens/main/MainScreenFragment.kt b/app/src/main/java/com/maestrovs/slovo/screens/main/MainScreenFragment.kt index 6d642a7..5b21cc4 100644 --- a/app/src/main/java/com/maestrovs/slovo/screens/main/MainScreenFragment.kt +++ b/app/src/main/java/com/maestrovs/slovo/screens/main/MainScreenFragment.kt @@ -1,27 +1,29 @@ package com.maestrovs.slovo.screens.main +import android.graphics.Color import android.os.Bundle import android.os.Handler import android.os.Looper +import android.text.Spannable +import android.text.SpannableString +import android.text.style.ForegroundColorSpan import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.view.animation.AnimationUtils import android.widget.Toast -import androidx.core.content.ContextCompat import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProvider import androidx.navigation.fragment.findNavController -import com.afollestad.materialdialogs.MaterialDialog import com.maestrovs.slovo.R import com.maestrovs.slovo.components.KeyboardProtocol import com.maestrovs.slovo.components.OpenStatus import com.maestrovs.slovo.data.Game import com.maestrovs.slovo.databinding.FragmentMainScreenBinding import com.maestrovs.slovo.model.Key -import com.maestrovs.slovo.model.KeyUI import com.maestrovs.slovo.model.KeyType +import com.maestrovs.slovo.model.KeyUI import com.maestrovs.slovo.model.isMoreWeight import com.maestrovs.slovo.screens.MainActivity import com.maestrovs.slovo.screens.MainViewModel @@ -70,6 +72,14 @@ class MainScreenFragment : BaseFragment(), Observer> { // binding.btMenuShipments onClick mainScreenViewModel.onShipments() binding.gameSmile.visibility = View.GONE + val myString = "#слово" + val spanFlag = Spannable.SPAN_INCLUSIVE_INCLUSIVE + val spannableString = SpannableString(myString) + val foregroundSpan = ForegroundColorSpan(Color.RED) + spannableString.setSpan(foregroundSpan, 0, 1, spanFlag) + + binding.title.text = spannableString + binding.statistic.setOnClickListener { // val games = db!!.userDao().getAll() Log.d("Game","games..") @@ -83,7 +93,6 @@ class MainScreenFragment : BaseFragment(), Observer> { slovo.let { findNavController().navigate(MainScreenFragmentDirections.actionFragmentMainScreenToWebViewFragment(it)) } - } binding.nextBt.setOnClickListener { @@ -144,7 +153,7 @@ class MainScreenFragment : BaseFragment(), Observer> { when(status){ OpenStatus.Win ->{ - mainScreenViewModel.updateSlovoStepInDB(Game(slovo,step+1)) + mainScreenViewModel.updateSlovoStepInDB(Game(slovo,step+1,0,false)) showWin() } OpenStatus.Game -> { @@ -163,7 +172,12 @@ class MainScreenFragment : BaseFragment(), Observer> { binding.keyboard.updateKeys(keyboardKeys) } else { //Fail - mainScreenViewModel.updateSlovoStepInDB(Game(slovo,-1)) + if(step>=0){ + step = -1 //Можна повторну спробу вгадати слово + }else{ + step = -2 //Немає більше спроб вгадати слово + } + mainScreenViewModel.updateSlovoStepInDB(Game(slovo,step,0,false)) showFail() } } @@ -293,10 +307,11 @@ class MainScreenFragment : BaseFragment(), Observer> { mainScreenViewModel.resetSavedGame() Handler(Looper.getMainLooper()).postDelayed({ - binding.nextBt.visibility = View.VISIBLE + /*binding.nextBt.visibility = View.VISIBLE binding.webViewBt.visibility = View.VISIBLE binding.gameSmile.visibility = View.VISIBLE - binding.gameSmile.setImageDrawable(ContextCompat.getDrawable(requireContext(),R.drawable.smile_glad_green)); + binding.gameSmile.setImageDrawable(ContextCompat.getDrawable(requireContext(),R.drawable.smile_glad_green));*/ + findNavController().navigate(MainScreenFragmentDirections.actionFragmentMainScreenToGameEndFragment(slovo, true)) }, ngDelay) @@ -306,10 +321,11 @@ class MainScreenFragment : BaseFragment(), Observer> { mainScreenViewModel.resetSavedGame() Handler(Looper.getMainLooper()).postDelayed({ - binding.nextBt.visibility = View.VISIBLE + /* binding.nextBt.visibility = View.VISIBLE binding.webViewBt.visibility = View.VISIBLE binding.gameSmile.visibility = View.VISIBLE - binding.gameSmile.setImageDrawable(ContextCompat.getDrawable(requireContext(),R.drawable.smile_sad)); + binding.gameSmile.setImageDrawable(ContextCompat.getDrawable(requireContext(),R.drawable.smile_sad));*/ + findNavController().navigate(MainScreenFragmentDirections.actionFragmentMainScreenToGameEndFragment(slovo, false)) }, ngDelay) } diff --git a/app/src/main/java/com/maestrovs/slovo/screens/splash/SplashScreenViewModel.kt b/app/src/main/java/com/maestrovs/slovo/screens/splash/SplashScreenViewModel.kt index 7a38bad..0d46e52 100644 --- a/app/src/main/java/com/maestrovs/slovo/screens/splash/SplashScreenViewModel.kt +++ b/app/src/main/java/com/maestrovs/slovo/screens/splash/SplashScreenViewModel.kt @@ -18,6 +18,7 @@ class SplashScreenViewModel(application: Application) : BaseViewModel(applicatio navController.navigate(SplashScreenFragmentDirections.actionSplashScreenFragmentToFragmentMainScreen()) + // navController.navigate(SplashScreenFragmentDirections.actionSplashScreenFragmentToGameEndFragment("молоко",false)) /// navController.navigate(R.id.schedulersFragment) /// navController.navigate(R.id.feedbackFragment) diff --git a/app/src/main/java/com/maestrovs/slovo/screens/webview/WebViewFragment.kt b/app/src/main/java/com/maestrovs/slovo/screens/webview/WebViewFragment.kt index bca7aab..9c14b40 100644 --- a/app/src/main/java/com/maestrovs/slovo/screens/webview/WebViewFragment.kt +++ b/app/src/main/java/com/maestrovs/slovo/screens/webview/WebViewFragment.kt @@ -56,7 +56,7 @@ class WebViewFragment : BaseFragment() { binding.backButton.setOnClickListener{ - findNavController().popBackStack(R.id.fragment_main_screen, false) + findNavController().popBackStack()//popBackStack(R.id.fragment_main_screen, false) } val slovo = safeArgs.slovo diff --git a/app/src/main/res/drawable/ic_about.xml b/app/src/main/res/drawable/ic_about.xml new file mode 100644 index 0000000..674a814 --- /dev/null +++ b/app/src/main/res/drawable/ic_about.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_about_fill.xml b/app/src/main/res/drawable/ic_about_fill.xml new file mode 100644 index 0000000..4d722a2 --- /dev/null +++ b/app/src/main/res/drawable/ic_about_fill.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_statistic_fill.xml b/app/src/main/res/drawable/ic_statistic_fill.xml new file mode 100644 index 0000000..80e2627 --- /dev/null +++ b/app/src/main/res/drawable/ic_statistic_fill.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/img_hidding_pass.png b/app/src/main/res/drawable/img_hidding_pass.png new file mode 100644 index 0000000000000000000000000000000000000000..0ca610f36357d45dcfe7903dbf463723899d9436 GIT binary patch literal 8594 zcmZ{KXFyX;6Yfc<0#ZbZ7zl_8N)r$aNE47M0!nWx0Y!SiP$WQT3JQd(R6%-IK%_~N z5|Ap=Yp6jwgce$E_}=&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iG2+<;!4U-*Ni2w!Rfgbw#GY%(S$EDLP1DWK^0jZV8|J%sgHc{muO8XXO1i$gWv$ zvss3U|BQn!zb&KE%R4b_;v0z6Q$)iB!H6CjEX+^1mc#YIdjPDlMK+cTSlK{P(XfsU zX2i{>c+~j2SJ%*mD)J@E85xw(bt{ysH6q&+9GR`c+zPmc&$jj71!2E2^O6rw`p-F4 zBmNQe^MzUiFf|1HZz>vYMtfG`6qIDh_*d|kSydc>WLA~#JZuyfp**W|$6cb<|3^^z ziZ+82h}54jc`blT@C(0Q3IHJavv&d51N*6>jPU6_mF*-GtG7A2c4$NH7l>Nqugj`NLR_DgaM)hIUTz9q}?T(}2yW-oW z%n;un1}D;)6%0xwbZ-? zer7D#HGB?R<^#f(v4l#Vo-IKcXnpo*){5L8Hfe6Mk26UqjAf*Z)Fe0XXY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_main_screen.xml b/app/src/main/res/layout/fragment_main_screen.xml index aba8f5d..e8b0aa9 100644 --- a/app/src/main/res/layout/fragment_main_screen.xml +++ b/app/src/main/res/layout/fragment_main_screen.xml @@ -24,13 +24,14 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:layout_marginTop="10dp" - android:text="Slovo" + android:text="#слово" + android:textStyle="italic" android:textColor="@color/black" - android:textSize="33sp" + android:textSize="30sp" /> + + + android:orientation="vertical" + app:layout_constraintBottom_toTopOf="@+id/keyboard" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/title"> + android:layout_height="wrap_content" /> + android:layout_height="wrap_content" /> + android:layout_height="wrap_content" /> + android:layout_height="wrap_content" /> + android:layout_height="wrap_content" /> + android:layout_height="wrap_content" /> + android:visibility="gone" /> @@ -131,6 +147,7 @@ android:layout_marginStart="16dp" android:layout_marginTop="8dp" android:text="Значення слова" + android:visibility="gone" /> diff --git a/app/src/main/res/navigation/mobile_navigation.xml b/app/src/main/res/navigation/mobile_navigation.xml index 53769ed..ce5394f 100644 --- a/app/src/main/res/navigation/mobile_navigation.xml +++ b/app/src/main/res/navigation/mobile_navigation.xml @@ -25,6 +25,9 @@ + @@ -37,6 +40,9 @@ + + + + + + + \ No newline at end of file