Commit 9c95e259 by likorn

Changed the package name

parent 1eceba7e
<component name="ProjectDictionaryState">
<dictionary name="paktalin">
<words>
<w>paktalin</w>
<w>quickmax</w>
</words>
</dictionary>
</component>
\ No newline at end of file
...@@ -8,7 +8,7 @@ android { ...@@ -8,7 +8,7 @@ android {
compileSdkVersion 29 compileSdkVersion 29
buildToolsVersion "29.0.2" buildToolsVersion "29.0.2"
defaultConfig { defaultConfig {
applicationId "com.example.quickmax" applicationId "com.paktalin.quickmax"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 29 targetSdkVersion 29
versionCode 1 versionCode 1
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.quickmax"> package="com.paktalin.quickmax">
<application <application
android:allowBackup="true" android:allowBackup="true"
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar"> android:theme="@style/Theme.MaterialComponents.Light.NoActionBar">
<activity android:name=".TaskActivity" <activity android:name="com.paktalin.quickmax.TaskActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
</activity> </activity>
<activity android:name=".MainActivity" <activity android:name="com.paktalin.quickmax.MainActivity"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
package com.example.quickmax package com.paktalin.quickmax
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
...@@ -21,17 +21,26 @@ class AnswerCardView : MaterialCardView { ...@@ -21,17 +21,26 @@ class AnswerCardView : MaterialCardView {
isEnabled = true isEnabled = true
isChecked = false isChecked = false
setCardBackgroundColor(Color.WHITE) setCardBackgroundColor(Color.WHITE)
getTextView(this).setTextColor(color(context, R.color.transparent_black)) getTextView(this).setTextColor(
color(
context,
R.color.transparent_black
)
)
} }
fun markCorrect(context: Context) { fun markCorrect(context: Context) {
checkedIcon = context.resources.getDrawable(R.drawable.ic_check, null) checkedIcon = context.resources.getDrawable(R.drawable.ic_check, null)
foregroundTintList = ContextCompat.getColorStateList(context, R.color.colorAccent) foregroundTintList = ContextCompat.getColorStateList(context,
R.color.colorAccent
)
} }
fun markWrong(context: Context) { fun markWrong(context: Context) {
checkedIcon = context.resources.getDrawable(R.drawable.ic_cancel, null) checkedIcon = context.resources.getDrawable(R.drawable.ic_cancel, null)
foregroundTintList = ContextCompat.getColorStateList(context, R.color.red) foregroundTintList = ContextCompat.getColorStateList(context,
R.color.red
)
} }
fun disable() { fun disable() {
......
package com.example.quickmax package com.paktalin.quickmax
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
...@@ -64,7 +64,9 @@ class MainActivity : AppCompatActivity() { ...@@ -64,7 +64,9 @@ class MainActivity : AppCompatActivity() {
private fun retrieveSharedPrefs() { private fun retrieveSharedPrefs() {
val prefs = getSharedPreferences("my_prefs", Context.MODE_PRIVATE) val prefs = getSharedPreferences("my_prefs", Context.MODE_PRIVATE)
secToSolve = prefs.getInt("sec_to_solve", 4) secToSolve = prefs.getInt("sec_to_solve", 4)
checkedCard = findViewById(prefs.getInt("checked_num_id", R.id.card_3_digits)) checkedCard = findViewById(prefs.getInt("checked_num_id",
R.id.card_3_digits
))
numDigits = numDigitsFromCard(checkedCard) numDigits = numDigitsFromCard(checkedCard)
checkedCard.isChecked = true checkedCard.isChecked = true
} }
......
package com.example.quickmax package com.paktalin.quickmax
import android.animation.ArgbEvaluator import android.animation.ArgbEvaluator
import android.animation.ValueAnimator import android.animation.ValueAnimator
...@@ -11,8 +11,8 @@ import android.util.TypedValue ...@@ -11,8 +11,8 @@ import android.util.TypedValue
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.example.quickmax.answers.Answer import com.paktalin.quickmax.answers.Answer
import com.example.quickmax.answers.AnswerSet import com.paktalin.quickmax.answers.AnswerSet
import kotlinx.android.synthetic.main.activity_task.* import kotlinx.android.synthetic.main.activity_task.*
class TaskActivity : AppCompatActivity() { class TaskActivity : AppCompatActivity() {
...@@ -33,7 +33,10 @@ class TaskActivity : AppCompatActivity() { ...@@ -33,7 +33,10 @@ class TaskActivity : AppCompatActivity() {
} }
private fun startNewRound() { private fun startNewRound() {
answerSet = AnswerSet(numDigits, listOf(card_left_top, card_right_top, card_left_bottom, card_right_bottom)) answerSet = AnswerSet(
numDigits,
listOf(card_left_top, card_right_top, card_left_bottom, card_right_bottom)
)
setUpCards() setUpCards()
timer.start() timer.start()
startProgressBarAnimation() startProgressBarAnimation()
...@@ -72,12 +75,21 @@ class TaskActivity : AppCompatActivity() { ...@@ -72,12 +75,21 @@ class TaskActivity : AppCompatActivity() {
if (answer.correct) { if (answer.correct) {
answer.card.markCorrect(this@TaskActivity) answer.card.markCorrect(this@TaskActivity)
tv_response.text = resources.getString(R.string.response_correct) tv_response.text = resources.getString(R.string.response_correct)
btn_next.backgroundTintList = ContextCompat.getColorStateList(this, R.color.colorAccent) btn_next.backgroundTintList = ContextCompat.getColorStateList(this,
btn_next.setTextColor(color(this, R.color.transparent_dark_black)) R.color.colorAccent
)
btn_next.setTextColor(
color(
this,
R.color.transparent_dark_black
)
)
} else { } else {
answer.card.markWrong(this@TaskActivity) answer.card.markWrong(this@TaskActivity)
tv_response.text = resources.getString(R.string.response_wrong) tv_response.text = resources.getString(R.string.response_wrong)
btn_next.backgroundTintList = ContextCompat.getColorStateList(this, R.color.colorPrimary) btn_next.backgroundTintList = ContextCompat.getColorStateList(this,
R.color.colorPrimary
)
btn_next.setTextColor(Color.WHITE) btn_next.setTextColor(Color.WHITE)
} }
} }
...@@ -88,7 +100,8 @@ class TaskActivity : AppCompatActivity() { ...@@ -88,7 +100,8 @@ class TaskActivity : AppCompatActivity() {
private fun startProgressBarAnimation() { private fun startProgressBarAnimation() {
val colorFrom = Color.TRANSPARENT val colorFrom = Color.TRANSPARENT
val colorTo = color(this, R.color.transparent_red) val colorTo =
color(this, R.color.transparent_red)
colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo) colorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), colorFrom, colorTo)
colorAnimation.duration = millisToSolve colorAnimation.duration = millisToSolve
colorAnimation.addUpdateListener { animator -> colorAnimation.addUpdateListener { animator ->
...@@ -107,7 +120,11 @@ class TaskActivity : AppCompatActivity() { ...@@ -107,7 +120,11 @@ class TaskActivity : AppCompatActivity() {
override fun onFinish() { override fun onFinish() {
tv_response.setTextSize(TypedValue.COMPLEX_UNIT_SP, resources.getDimension(R.dimen.response_text_size)) tv_response.setTextSize(TypedValue.COMPLEX_UNIT_SP, resources.getDimension(R.dimen.response_text_size))
tv_response.text = resources.getString(R.string.time_is_over) tv_response.text = resources.getString(R.string.time_is_over)
btn_next.background.setColorFilter(color(this@TaskActivity, R.color.colorPrimary), PorterDuff.Mode.MULTIPLY) btn_next.background.setColorFilter(
color(
this@TaskActivity,
R.color.colorPrimary
), PorterDuff.Mode.MULTIPLY)
btn_next.setTextColor(Color.WHITE) btn_next.setTextColor(Color.WHITE)
btn_next.visibility = View.VISIBLE btn_next.visibility = View.VISIBLE
disableCards() disableCards()
......
package com.example.quickmax package com.paktalin.quickmax
import android.content.Context import android.content.Context
import android.view.View import android.view.View
......
package com.example.quickmax.answers package com.paktalin.quickmax.answers
import com.example.quickmax.AnswerCardView import com.paktalin.quickmax.AnswerCardView
class Answer(val card: AnswerCardView, val value: Int) { class Answer(val card: AnswerCardView, val value: Int) {
var correct: Boolean = false var correct: Boolean = false
......
package com.example.quickmax.answers package com.paktalin.quickmax.answers
import com.example.quickmax.AnswerCardView import com.paktalin.quickmax.AnswerCardView
class AnswerSet(numDigits: Int, cards: List<AnswerCardView>): Iterable<Answer> { class AnswerSet(numDigits: Int, cards: List<AnswerCardView>): Iterable<Answer> {
private val numAnswers = 4 private val numAnswers = 4
......
package com.example.quickmax.answers package com.paktalin.quickmax.answers
import kotlin.math.pow import kotlin.math.pow
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#DADADA" android:background="#DADADA"
tools:context=".TaskActivity"> tools:context="com.paktalin.quickmax.TaskActivity">
<LinearLayout <LinearLayout
android:id="@+id/layout_gradient" android:id="@+id/layout_gradient"
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
app:layout_constraintVertical_bias="0.5" app:layout_constraintVertical_bias="0.5"
app:layout_constraintVertical_chainStyle="packed"> app:layout_constraintVertical_chainStyle="packed">
<com.example.quickmax.AnswerCardView <com.paktalin.quickmax.AnswerCardView
android:id="@+id/card_left_top" android:id="@+id/card_left_top"
style="@style/MyCard" style="@style/MyCard"
app:cardBackgroundColor="#F44336" app:cardBackgroundColor="#F44336"
...@@ -103,9 +103,9 @@ ...@@ -103,9 +103,9 @@
<TextView style="@style/AnswerCardText" /> <TextView style="@style/AnswerCardText" />
</com.example.quickmax.AnswerCardView> </com.paktalin.quickmax.AnswerCardView>
<com.example.quickmax.AnswerCardView <com.paktalin.quickmax.AnswerCardView
android:id="@+id/card_right_top" android:id="@+id/card_right_top"
style="@style/MyCard" style="@style/MyCard"
app:layout_constraintBottom_toTopOf="@id/card_right_bottom" app:layout_constraintBottom_toTopOf="@id/card_right_bottom"
...@@ -116,9 +116,9 @@ ...@@ -116,9 +116,9 @@
<TextView style="@style/AnswerCardText" /> <TextView style="@style/AnswerCardText" />
</com.example.quickmax.AnswerCardView> </com.paktalin.quickmax.AnswerCardView>
<com.example.quickmax.AnswerCardView <com.paktalin.quickmax.AnswerCardView
android:id="@+id/card_left_bottom" android:id="@+id/card_left_bottom"
style="@style/MyCard" style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
...@@ -129,9 +129,9 @@ ...@@ -129,9 +129,9 @@
<TextView style="@style/AnswerCardText" /> <TextView style="@style/AnswerCardText" />
</com.example.quickmax.AnswerCardView> </com.paktalin.quickmax.AnswerCardView>
<com.example.quickmax.AnswerCardView <com.paktalin.quickmax.AnswerCardView
android:id="@+id/card_right_bottom" android:id="@+id/card_right_bottom"
style="@style/MyCard" style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
...@@ -142,7 +142,7 @@ ...@@ -142,7 +142,7 @@
<TextView style="@style/AnswerCardText" /> <TextView style="@style/AnswerCardText" />
</com.example.quickmax.AnswerCardView> </com.paktalin.quickmax.AnswerCardView>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
......
package com.example.quickmax package com.paktalin.quickmax
import com.example.quickmax.answers.AnswerSet import com.paktalin.quickmax.answers.AnswerSet
import com.example.quickmax.answers.findSecondMax import com.paktalin.quickmax.answers.findSecondMax
import org.junit.Test import org.junit.Test
import org.junit.Assert.* import org.junit.Assert.*
......
package com.example.quickmax package com.paktalin.quickmax
import com.example.quickmax.answers.findSecondMax import com.paktalin.quickmax.answers.findSecondMax
import com.example.quickmax.answers.generateRandom import com.paktalin.quickmax.answers.generateRandom
import org.junit.Test import org.junit.Test
import org.junit.Assert.* import org.junit.Assert.*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment