Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
likorn
/
quick_max
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9c95e259
authored
Sep 26, 2019
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the package name
parent
1eceba7e
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
77 additions
and
40 deletions
.idea/dictionaries/paktalin.xml
app/build.gradle
app/src/main/AndroidManifest.xml
app/src/main/java/com/example/quickmax/AnswerCardView.kt → app/src/main/java/com/paktalin/quickmax/AnswerCardView.kt
app/src/main/java/com/example/quickmax/MainActivity.kt → app/src/main/java/com/paktalin/quickmax/MainActivity.kt
app/src/main/java/com/example/quickmax/TaskActivity.kt → app/src/main/java/com/paktalin/quickmax/TaskActivity.kt
app/src/main/java/com/example/quickmax/ViewUtils.kt → app/src/main/java/com/paktalin/quickmax/ViewUtils.kt
app/src/main/java/com/example/quickmax/answers/Answer.kt → app/src/main/java/com/paktalin/quickmax/answers/Answer.kt
app/src/main/java/com/example/quickmax/answers/AnswerSet.kt → app/src/main/java/com/paktalin/quickmax/answers/AnswerSet.kt
app/src/main/java/com/example/quickmax/answers/Calculator.kt → app/src/main/java/com/paktalin/quickmax/answers/Calculator.kt
app/src/main/res/layout/activity_task.xml
app/src/test/java/com/example/quickmax/AnswerSetTest.kt → app/src/test/java/com/paktalin/quickmax/AnswerSetTest.kt
app/src/test/java/com/example/quickmax/CalculatorTest.kt → app/src/test/java/com/paktalin/quickmax/CalculatorTest.kt
.idea/dictionaries/paktalin.xml
0 → 100644
View file @
9c95e259
<component
name=
"ProjectDictionaryState"
>
<dictionary
name=
"paktalin"
>
<words>
<w>
paktalin
</w>
<w>
quickmax
</w>
</words>
</dictionary>
</component>
\ No newline at end of file
app/build.gradle
View file @
9c95e259
...
@@ -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
...
...
app/src/main/AndroidManifest.xml
View file @
9c95e259
<?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"
/>
...
...
app/src/main/java/com/
example
/quickmax/AnswerCardView.kt
→
app/src/main/java/com/
paktalin
/quickmax/AnswerCardView.kt
View file @
9c95e259
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
()
{
...
...
app/src/main/java/com/
example
/quickmax/MainActivity.kt
→
app/src/main/java/com/
paktalin
/quickmax/MainActivity.kt
View file @
9c95e259
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
}
}
...
...
app/src/main/java/com/
example
/quickmax/TaskActivity.kt
→
app/src/main/java/com/
paktalin
/quickmax/TaskActivity.kt
View file @
9c95e259
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
()
...
...
app/src/main/java/com/
example
/quickmax/ViewUtils.kt
→
app/src/main/java/com/
paktalin
/quickmax/ViewUtils.kt
View file @
9c95e259
package
com.
example
.quickmax
package
com.
paktalin
.quickmax
import
android.content.Context
import
android.content.Context
import
android.view.View
import
android.view.View
...
...
app/src/main/java/com/
example
/quickmax/answers/Answer.kt
→
app/src/main/java/com/
paktalin
/quickmax/answers/Answer.kt
View file @
9c95e259
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
...
...
app/src/main/java/com/
example
/quickmax/answers/AnswerSet.kt
→
app/src/main/java/com/
paktalin
/quickmax/answers/AnswerSet.kt
View file @
9c95e259
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
...
...
app/src/main/java/com/
example
/quickmax/answers/Calculator.kt
→
app/src/main/java/com/
paktalin
/quickmax/answers/Calculator.kt
View file @
9c95e259
package
com.
example
.quickmax.answers
package
com.
paktalin
.quickmax.answers
import
kotlin.math.pow
import
kotlin.math.pow
...
...
app/src/main/res/layout/activity_task.xml
View file @
9c95e259
...
@@ -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
...
...
app/src/test/java/com/
example
/quickmax/AnswerSetTest.kt
→
app/src/test/java/com/
paktalin
/quickmax/AnswerSetTest.kt
View file @
9c95e259
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.*
...
...
app/src/test/java/com/
example
/quickmax/CalculatorTest.kt
→
app/src/test/java/com/
paktalin
/quickmax/CalculatorTest.kt
View file @
9c95e259
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.*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment