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 {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.quickmax"
applicationId "com.paktalin.quickmax"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.quickmax">
package="com.paktalin.quickmax">
<application
android:allowBackup="true"
......@@ -9,10 +9,10 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MaterialComponents.Light.NoActionBar">
<activity android:name=".TaskActivity"
<activity android:name="com.paktalin.quickmax.TaskActivity"
android:screenOrientation="portrait">
</activity>
<activity android:name=".MainActivity"
<activity android:name="com.paktalin.quickmax.MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
package com.example.quickmax
package com.paktalin.quickmax
import android.content.Context
import android.graphics.Color
......@@ -21,17 +21,26 @@ class AnswerCardView : MaterialCardView {
isEnabled = true
isChecked = false
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) {
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) {
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() {
......
package com.example.quickmax
package com.paktalin.quickmax
import android.content.Context
import android.content.Intent
......@@ -64,7 +64,9 @@ class MainActivity : AppCompatActivity() {
private fun retrieveSharedPrefs() {
val prefs = getSharedPreferences("my_prefs", Context.MODE_PRIVATE)
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)
checkedCard.isChecked = true
}
......
package com.example.quickmax
package com.paktalin.quickmax
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
......@@ -11,8 +11,8 @@ import android.util.TypedValue
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.example.quickmax.answers.Answer
import com.example.quickmax.answers.AnswerSet
import com.paktalin.quickmax.answers.Answer
import com.paktalin.quickmax.answers.AnswerSet
import kotlinx.android.synthetic.main.activity_task.*
class TaskActivity : AppCompatActivity() {
......@@ -33,7 +33,10 @@ class TaskActivity : AppCompatActivity() {
}
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()
timer.start()
startProgressBarAnimation()
......@@ -72,12 +75,21 @@ class TaskActivity : AppCompatActivity() {
if (answer.correct) {
answer.card.markCorrect(this@TaskActivity)
tv_response.text = resources.getString(R.string.response_correct)
btn_next.backgroundTintList = ContextCompat.getColorStateList(this, R.color.colorAccent)
btn_next.setTextColor(color(this, R.color.transparent_dark_black))
btn_next.backgroundTintList = ContextCompat.getColorStateList(this,
R.color.colorAccent
)
btn_next.setTextColor(
color(
this,
R.color.transparent_dark_black
)
)
} else {
answer.card.markWrong(this@TaskActivity)
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)
}
}
......@@ -88,7 +100,8 @@ class TaskActivity : AppCompatActivity() {
private fun startProgressBarAnimation() {
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.duration = millisToSolve
colorAnimation.addUpdateListener { animator ->
......@@ -107,7 +120,11 @@ class TaskActivity : AppCompatActivity() {
override fun onFinish() {
tv_response.setTextSize(TypedValue.COMPLEX_UNIT_SP, resources.getDimension(R.dimen.response_text_size))
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.visibility = View.VISIBLE
disableCards()
......
package com.example.quickmax
package com.paktalin.quickmax
import android.content.Context
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) {
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> {
private val numAnswers = 4
......
package com.example.quickmax.answers
package com.paktalin.quickmax.answers
import kotlin.math.pow
......
......@@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DADADA"
tools:context=".TaskActivity">
tools:context="com.paktalin.quickmax.TaskActivity">
<LinearLayout
android:id="@+id/layout_gradient"
......@@ -90,7 +90,7 @@
app:layout_constraintVertical_bias="0.5"
app:layout_constraintVertical_chainStyle="packed">
<com.example.quickmax.AnswerCardView
<com.paktalin.quickmax.AnswerCardView
android:id="@+id/card_left_top"
style="@style/MyCard"
app:cardBackgroundColor="#F44336"
......@@ -103,9 +103,9 @@
<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"
style="@style/MyCard"
app:layout_constraintBottom_toTopOf="@id/card_right_bottom"
......@@ -116,9 +116,9 @@
<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"
style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent"
......@@ -129,9 +129,9 @@
<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"
style="@style/MyCard"
app:layout_constraintBottom_toBottomOf="parent"
......@@ -142,7 +142,7 @@
<TextView style="@style/AnswerCardText" />
</com.example.quickmax.AnswerCardView>
</com.paktalin.quickmax.AnswerCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.button.MaterialButton
......
package com.example.quickmax
package com.paktalin.quickmax
import com.example.quickmax.answers.AnswerSet
import com.example.quickmax.answers.findSecondMax
import com.paktalin.quickmax.answers.AnswerSet
import com.paktalin.quickmax.answers.findSecondMax
import org.junit.Test
import org.junit.Assert.*
......
package com.example.quickmax
package com.paktalin.quickmax
import com.example.quickmax.answers.findSecondMax
import com.example.quickmax.answers.generateRandom
import com.paktalin.quickmax.answers.findSecondMax
import com.paktalin.quickmax.answers.generateRandom
import org.junit.Test
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